push the uni-demo project
This commit is contained in:
46
uni-demo/node_modules/echarts/lib/chart/bar.js
generated
vendored
Normal file
46
uni-demo/node_modules/echarts/lib/chart/bar.js
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
|
||||
/*
|
||||
* 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 { use } from '../extension.js';
|
||||
import { install } from './bar/install.js';
|
||||
use(install);
|
||||
127
uni-demo/node_modules/echarts/lib/chart/bar/BarSeries.js
generated
vendored
Normal file
127
uni-demo/node_modules/echarts/lib/chart/bar/BarSeries.js
generated
vendored
Normal file
@@ -0,0 +1,127 @@
|
||||
|
||||
/*
|
||||
* 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 BaseBarSeriesModel from './BaseBarSeries.js';
|
||||
import createSeriesData from '../helper/createSeriesData.js';
|
||||
import { inheritDefaultOption } from '../../util/component.js';
|
||||
|
||||
var BarSeriesModel =
|
||||
/** @class */
|
||||
function (_super) {
|
||||
__extends(BarSeriesModel, _super);
|
||||
|
||||
function BarSeriesModel() {
|
||||
var _this = _super !== null && _super.apply(this, arguments) || this;
|
||||
|
||||
_this.type = BarSeriesModel.type;
|
||||
return _this;
|
||||
}
|
||||
|
||||
BarSeriesModel.prototype.getInitialData = function () {
|
||||
return createSeriesData(null, this, {
|
||||
useEncodeDefaulter: true,
|
||||
createInvertedIndices: !!this.get('realtimeSort', true) || null
|
||||
});
|
||||
};
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
|
||||
|
||||
BarSeriesModel.prototype.getProgressive = function () {
|
||||
// Do not support progressive in normal mode.
|
||||
return this.get('large') ? this.get('progressive') : false;
|
||||
};
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
|
||||
|
||||
BarSeriesModel.prototype.getProgressiveThreshold = function () {
|
||||
// Do not support progressive in normal mode.
|
||||
var progressiveThreshold = this.get('progressiveThreshold');
|
||||
var largeThreshold = this.get('largeThreshold');
|
||||
|
||||
if (largeThreshold > progressiveThreshold) {
|
||||
progressiveThreshold = largeThreshold;
|
||||
}
|
||||
|
||||
return progressiveThreshold;
|
||||
};
|
||||
|
||||
BarSeriesModel.prototype.brushSelector = function (dataIndex, data, selectors) {
|
||||
return selectors.rect(data.getItemLayout(dataIndex));
|
||||
};
|
||||
|
||||
BarSeriesModel.type = 'series.bar';
|
||||
BarSeriesModel.dependencies = ['grid', 'polar'];
|
||||
BarSeriesModel.defaultOption = inheritDefaultOption(BaseBarSeriesModel.defaultOption, {
|
||||
// If clipped
|
||||
// Only available on cartesian2d
|
||||
clip: true,
|
||||
roundCap: false,
|
||||
showBackground: false,
|
||||
backgroundStyle: {
|
||||
color: 'rgba(180, 180, 180, 0.2)',
|
||||
borderColor: null,
|
||||
borderWidth: 0,
|
||||
borderType: 'solid',
|
||||
borderRadius: 0,
|
||||
shadowBlur: 0,
|
||||
shadowColor: null,
|
||||
shadowOffsetX: 0,
|
||||
shadowOffsetY: 0,
|
||||
opacity: 1
|
||||
},
|
||||
select: {
|
||||
itemStyle: {
|
||||
borderColor: '#212121'
|
||||
}
|
||||
},
|
||||
realtimeSort: false
|
||||
});
|
||||
return BarSeriesModel;
|
||||
}(BaseBarSeriesModel);
|
||||
|
||||
export default BarSeriesModel;
|
||||
1032
uni-demo/node_modules/echarts/lib/chart/bar/BarView.js
generated
vendored
Normal file
1032
uni-demo/node_modules/echarts/lib/chart/bar/BarView.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
105
uni-demo/node_modules/echarts/lib/chart/bar/BaseBarSeries.js
generated
vendored
Normal file
105
uni-demo/node_modules/echarts/lib/chart/bar/BaseBarSeries.js
generated
vendored
Normal file
@@ -0,0 +1,105 @@
|
||||
|
||||
/*
|
||||
* 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 SeriesModel from '../../model/Series.js';
|
||||
import createSeriesData from '../helper/createSeriesData.js';
|
||||
|
||||
var BaseBarSeriesModel =
|
||||
/** @class */
|
||||
function (_super) {
|
||||
__extends(BaseBarSeriesModel, _super);
|
||||
|
||||
function BaseBarSeriesModel() {
|
||||
var _this = _super !== null && _super.apply(this, arguments) || this;
|
||||
|
||||
_this.type = BaseBarSeriesModel.type;
|
||||
return _this;
|
||||
}
|
||||
|
||||
BaseBarSeriesModel.prototype.getInitialData = function (option, ecModel) {
|
||||
return createSeriesData(null, this, {
|
||||
useEncodeDefaulter: true
|
||||
});
|
||||
};
|
||||
|
||||
BaseBarSeriesModel.prototype.getMarkerPosition = function (value) {
|
||||
var coordSys = this.coordinateSystem;
|
||||
|
||||
if (coordSys && coordSys.clampData) {
|
||||
// PENDING if clamp ?
|
||||
var pt = coordSys.dataToPoint(coordSys.clampData(value));
|
||||
var data = this.getData();
|
||||
var offset = data.getLayout('offset');
|
||||
var size = data.getLayout('size');
|
||||
var offsetIndex = coordSys.getBaseAxis().isHorizontal() ? 0 : 1;
|
||||
pt[offsetIndex] += offset + size / 2;
|
||||
return pt;
|
||||
}
|
||||
|
||||
return [NaN, NaN];
|
||||
};
|
||||
|
||||
BaseBarSeriesModel.type = 'series.__base_bar__';
|
||||
BaseBarSeriesModel.defaultOption = {
|
||||
// zlevel: 0,
|
||||
z: 2,
|
||||
coordinateSystem: 'cartesian2d',
|
||||
legendHoverLink: true,
|
||||
// stack: null
|
||||
// Cartesian coordinate system
|
||||
// xAxisIndex: 0,
|
||||
// yAxisIndex: 0,
|
||||
barMinHeight: 0,
|
||||
barMinAngle: 0,
|
||||
// cursor: null,
|
||||
large: false,
|
||||
largeThreshold: 400,
|
||||
progressive: 3e3,
|
||||
progressiveChunkMode: 'mod'
|
||||
};
|
||||
return BaseBarSeriesModel;
|
||||
}(SeriesModel);
|
||||
|
||||
SeriesModel.registerClass(BaseBarSeriesModel);
|
||||
export default BaseBarSeriesModel;
|
||||
100
uni-demo/node_modules/echarts/lib/chart/bar/PictorialBarSeries.js
generated
vendored
Normal file
100
uni-demo/node_modules/echarts/lib/chart/bar/PictorialBarSeries.js
generated
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* AUTO-GENERATED FILE. DO NOT MODIFY.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { __extends } from "tslib";
|
||||
import BaseBarSeriesModel from './BaseBarSeries.js';
|
||||
import { inheritDefaultOption } from '../../util/component.js';
|
||||
|
||||
var PictorialBarSeriesModel =
|
||||
/** @class */
|
||||
function (_super) {
|
||||
__extends(PictorialBarSeriesModel, _super);
|
||||
|
||||
function PictorialBarSeriesModel() {
|
||||
var _this = _super !== null && _super.apply(this, arguments) || this;
|
||||
|
||||
_this.type = PictorialBarSeriesModel.type;
|
||||
_this.hasSymbolVisual = true;
|
||||
_this.defaultSymbol = 'roundRect';
|
||||
return _this;
|
||||
}
|
||||
|
||||
PictorialBarSeriesModel.prototype.getInitialData = function (option) {
|
||||
// Disable stack.
|
||||
option.stack = null;
|
||||
return _super.prototype.getInitialData.apply(this, arguments);
|
||||
};
|
||||
|
||||
PictorialBarSeriesModel.type = 'series.pictorialBar';
|
||||
PictorialBarSeriesModel.dependencies = ['grid'];
|
||||
PictorialBarSeriesModel.defaultOption = inheritDefaultOption(BaseBarSeriesModel.defaultOption, {
|
||||
symbol: 'circle',
|
||||
symbolSize: null,
|
||||
symbolRotate: null,
|
||||
symbolPosition: null,
|
||||
symbolOffset: null,
|
||||
symbolMargin: null,
|
||||
symbolRepeat: false,
|
||||
symbolRepeatDirection: 'end',
|
||||
symbolClip: false,
|
||||
symbolBoundingData: null,
|
||||
symbolPatternSize: 400,
|
||||
barGap: '-100%',
|
||||
// z can be set in data item, which is z2 actually.
|
||||
// Disable progressive
|
||||
progressive: 0,
|
||||
emphasis: {
|
||||
// By default pictorialBar do not hover scale. Hover scale is not suitable
|
||||
// for the case that both has foreground and background.
|
||||
scale: false
|
||||
},
|
||||
select: {
|
||||
itemStyle: {
|
||||
borderColor: '#212121'
|
||||
}
|
||||
}
|
||||
});
|
||||
return PictorialBarSeriesModel;
|
||||
}(BaseBarSeriesModel);
|
||||
|
||||
export default PictorialBarSeriesModel;
|
||||
690
uni-demo/node_modules/echarts/lib/chart/bar/PictorialBarView.js
generated
vendored
Normal file
690
uni-demo/node_modules/echarts/lib/chart/bar/PictorialBarView.js
generated
vendored
Normal file
@@ -0,0 +1,690 @@
|
||||
|
||||
/*
|
||||
* 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';
|
||||
import * as graphic from '../../util/graphic.js';
|
||||
import { toggleHoverEmphasis } from '../../util/states.js';
|
||||
import { createSymbol, normalizeSymbolOffset } from '../../util/symbol.js';
|
||||
import { parsePercent, isNumeric } from '../../util/number.js';
|
||||
import ChartView from '../../view/Chart.js';
|
||||
import { getDefaultLabel } from '../helper/labelHelper.js';
|
||||
import { setLabelStyle, getLabelStatesModels } from '../../label/labelStyle.js';
|
||||
import ZRImage from 'zrender/lib/graphic/Image.js';
|
||||
import { getECData } from '../../util/innerStore.js';
|
||||
var BAR_BORDER_WIDTH_QUERY = ['itemStyle', 'borderWidth']; // index: +isHorizontal
|
||||
|
||||
var LAYOUT_ATTRS = [{
|
||||
xy: 'x',
|
||||
wh: 'width',
|
||||
index: 0,
|
||||
posDesc: ['left', 'right']
|
||||
}, {
|
||||
xy: 'y',
|
||||
wh: 'height',
|
||||
index: 1,
|
||||
posDesc: ['top', 'bottom']
|
||||
}];
|
||||
var pathForLineWidth = new graphic.Circle();
|
||||
|
||||
var PictorialBarView =
|
||||
/** @class */
|
||||
function (_super) {
|
||||
__extends(PictorialBarView, _super);
|
||||
|
||||
function PictorialBarView() {
|
||||
var _this = _super !== null && _super.apply(this, arguments) || this;
|
||||
|
||||
_this.type = PictorialBarView.type;
|
||||
return _this;
|
||||
}
|
||||
|
||||
PictorialBarView.prototype.render = function (seriesModel, ecModel, api) {
|
||||
var group = this.group;
|
||||
var data = seriesModel.getData();
|
||||
var oldData = this._data;
|
||||
var cartesian = seriesModel.coordinateSystem;
|
||||
var baseAxis = cartesian.getBaseAxis();
|
||||
var isHorizontal = baseAxis.isHorizontal();
|
||||
var coordSysRect = cartesian.master.getRect();
|
||||
var opt = {
|
||||
ecSize: {
|
||||
width: api.getWidth(),
|
||||
height: api.getHeight()
|
||||
},
|
||||
seriesModel: seriesModel,
|
||||
coordSys: cartesian,
|
||||
coordSysExtent: [[coordSysRect.x, coordSysRect.x + coordSysRect.width], [coordSysRect.y, coordSysRect.y + coordSysRect.height]],
|
||||
isHorizontal: isHorizontal,
|
||||
valueDim: LAYOUT_ATTRS[+isHorizontal],
|
||||
categoryDim: LAYOUT_ATTRS[1 - +isHorizontal]
|
||||
};
|
||||
data.diff(oldData).add(function (dataIndex) {
|
||||
if (!data.hasValue(dataIndex)) {
|
||||
return;
|
||||
}
|
||||
|
||||
var itemModel = getItemModel(data, dataIndex);
|
||||
var symbolMeta = getSymbolMeta(data, dataIndex, itemModel, opt);
|
||||
var bar = createBar(data, opt, symbolMeta);
|
||||
data.setItemGraphicEl(dataIndex, bar);
|
||||
group.add(bar);
|
||||
updateCommon(bar, opt, symbolMeta);
|
||||
}).update(function (newIndex, oldIndex) {
|
||||
var bar = oldData.getItemGraphicEl(oldIndex);
|
||||
|
||||
if (!data.hasValue(newIndex)) {
|
||||
group.remove(bar);
|
||||
return;
|
||||
}
|
||||
|
||||
var itemModel = getItemModel(data, newIndex);
|
||||
var symbolMeta = getSymbolMeta(data, newIndex, itemModel, opt);
|
||||
var pictorialShapeStr = getShapeStr(data, symbolMeta);
|
||||
|
||||
if (bar && pictorialShapeStr !== bar.__pictorialShapeStr) {
|
||||
group.remove(bar);
|
||||
data.setItemGraphicEl(newIndex, null);
|
||||
bar = null;
|
||||
}
|
||||
|
||||
if (bar) {
|
||||
updateBar(bar, opt, symbolMeta);
|
||||
} else {
|
||||
bar = createBar(data, opt, symbolMeta, true);
|
||||
}
|
||||
|
||||
data.setItemGraphicEl(newIndex, bar);
|
||||
bar.__pictorialSymbolMeta = symbolMeta; // Add back
|
||||
|
||||
group.add(bar);
|
||||
updateCommon(bar, opt, symbolMeta);
|
||||
}).remove(function (dataIndex) {
|
||||
var bar = oldData.getItemGraphicEl(dataIndex);
|
||||
bar && removeBar(oldData, dataIndex, bar.__pictorialSymbolMeta.animationModel, bar);
|
||||
}).execute();
|
||||
this._data = data;
|
||||
return this.group;
|
||||
};
|
||||
|
||||
PictorialBarView.prototype.remove = function (ecModel, api) {
|
||||
var group = this.group;
|
||||
var data = this._data;
|
||||
|
||||
if (ecModel.get('animation')) {
|
||||
if (data) {
|
||||
data.eachItemGraphicEl(function (bar) {
|
||||
removeBar(data, getECData(bar).dataIndex, ecModel, bar);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
group.removeAll();
|
||||
}
|
||||
};
|
||||
|
||||
PictorialBarView.type = 'pictorialBar';
|
||||
return PictorialBarView;
|
||||
}(ChartView); // Set or calculate default value about symbol, and calculate layout info.
|
||||
|
||||
|
||||
function getSymbolMeta(data, dataIndex, itemModel, opt) {
|
||||
var layout = data.getItemLayout(dataIndex);
|
||||
var symbolRepeat = itemModel.get('symbolRepeat');
|
||||
var symbolClip = itemModel.get('symbolClip');
|
||||
var symbolPosition = itemModel.get('symbolPosition') || 'start';
|
||||
var symbolRotate = itemModel.get('symbolRotate');
|
||||
var rotation = (symbolRotate || 0) * Math.PI / 180 || 0;
|
||||
var symbolPatternSize = itemModel.get('symbolPatternSize') || 2;
|
||||
var isAnimationEnabled = itemModel.isAnimationEnabled();
|
||||
var symbolMeta = {
|
||||
dataIndex: dataIndex,
|
||||
layout: layout,
|
||||
itemModel: itemModel,
|
||||
symbolType: data.getItemVisual(dataIndex, 'symbol') || 'circle',
|
||||
style: data.getItemVisual(dataIndex, 'style'),
|
||||
symbolClip: symbolClip,
|
||||
symbolRepeat: symbolRepeat,
|
||||
symbolRepeatDirection: itemModel.get('symbolRepeatDirection'),
|
||||
symbolPatternSize: symbolPatternSize,
|
||||
rotation: rotation,
|
||||
animationModel: isAnimationEnabled ? itemModel : null,
|
||||
hoverScale: isAnimationEnabled && itemModel.get(['emphasis', 'scale']),
|
||||
z2: itemModel.getShallow('z', true) || 0
|
||||
};
|
||||
prepareBarLength(itemModel, symbolRepeat, layout, opt, symbolMeta);
|
||||
prepareSymbolSize(data, dataIndex, layout, symbolRepeat, symbolClip, symbolMeta.boundingLength, symbolMeta.pxSign, symbolPatternSize, opt, symbolMeta);
|
||||
prepareLineWidth(itemModel, symbolMeta.symbolScale, rotation, opt, symbolMeta);
|
||||
var symbolSize = symbolMeta.symbolSize;
|
||||
var symbolOffset = normalizeSymbolOffset(itemModel.get('symbolOffset'), symbolSize);
|
||||
prepareLayoutInfo(itemModel, symbolSize, layout, symbolRepeat, symbolClip, symbolOffset, symbolPosition, symbolMeta.valueLineWidth, symbolMeta.boundingLength, symbolMeta.repeatCutLength, opt, symbolMeta);
|
||||
return symbolMeta;
|
||||
} // bar length can be negative.
|
||||
|
||||
|
||||
function prepareBarLength(itemModel, symbolRepeat, layout, opt, outputSymbolMeta) {
|
||||
var valueDim = opt.valueDim;
|
||||
var symbolBoundingData = itemModel.get('symbolBoundingData');
|
||||
var valueAxis = opt.coordSys.getOtherAxis(opt.coordSys.getBaseAxis());
|
||||
var zeroPx = valueAxis.toGlobalCoord(valueAxis.dataToCoord(0));
|
||||
var pxSignIdx = 1 - +(layout[valueDim.wh] <= 0);
|
||||
var boundingLength;
|
||||
|
||||
if (zrUtil.isArray(symbolBoundingData)) {
|
||||
var symbolBoundingExtent = [convertToCoordOnAxis(valueAxis, symbolBoundingData[0]) - zeroPx, convertToCoordOnAxis(valueAxis, symbolBoundingData[1]) - zeroPx];
|
||||
symbolBoundingExtent[1] < symbolBoundingExtent[0] && symbolBoundingExtent.reverse();
|
||||
boundingLength = symbolBoundingExtent[pxSignIdx];
|
||||
} else if (symbolBoundingData != null) {
|
||||
boundingLength = convertToCoordOnAxis(valueAxis, symbolBoundingData) - zeroPx;
|
||||
} else if (symbolRepeat) {
|
||||
boundingLength = opt.coordSysExtent[valueDim.index][pxSignIdx] - zeroPx;
|
||||
} else {
|
||||
boundingLength = layout[valueDim.wh];
|
||||
}
|
||||
|
||||
outputSymbolMeta.boundingLength = boundingLength;
|
||||
|
||||
if (symbolRepeat) {
|
||||
outputSymbolMeta.repeatCutLength = layout[valueDim.wh];
|
||||
} // if 'pxSign' means sign of pixel, it can't be zero, or symbolScale will be zero
|
||||
// and when borderWidth be settled, the actual linewidth will be NaN
|
||||
|
||||
|
||||
outputSymbolMeta.pxSign = boundingLength > 0 ? 1 : -1;
|
||||
}
|
||||
|
||||
function convertToCoordOnAxis(axis, value) {
|
||||
return axis.toGlobalCoord(axis.dataToCoord(axis.scale.parse(value)));
|
||||
} // Support ['100%', '100%']
|
||||
|
||||
|
||||
function prepareSymbolSize(data, dataIndex, layout, symbolRepeat, symbolClip, boundingLength, pxSign, symbolPatternSize, opt, outputSymbolMeta) {
|
||||
var valueDim = opt.valueDim;
|
||||
var categoryDim = opt.categoryDim;
|
||||
var categorySize = Math.abs(layout[categoryDim.wh]);
|
||||
var symbolSize = data.getItemVisual(dataIndex, 'symbolSize');
|
||||
var parsedSymbolSize;
|
||||
|
||||
if (zrUtil.isArray(symbolSize)) {
|
||||
parsedSymbolSize = symbolSize.slice();
|
||||
} else {
|
||||
if (symbolSize == null) {
|
||||
// will parse to number below
|
||||
parsedSymbolSize = ['100%', '100%'];
|
||||
} else {
|
||||
parsedSymbolSize = [symbolSize, symbolSize];
|
||||
}
|
||||
} // Note: percentage symbolSize (like '100%') do not consider lineWidth, because it is
|
||||
// to complicated to calculate real percent value if considering scaled lineWidth.
|
||||
// So the actual size will bigger than layout size if lineWidth is bigger than zero,
|
||||
// which can be tolerated in pictorial chart.
|
||||
|
||||
|
||||
parsedSymbolSize[categoryDim.index] = parsePercent(parsedSymbolSize[categoryDim.index], categorySize);
|
||||
parsedSymbolSize[valueDim.index] = parsePercent(parsedSymbolSize[valueDim.index], symbolRepeat ? categorySize : Math.abs(boundingLength));
|
||||
outputSymbolMeta.symbolSize = parsedSymbolSize; // If x or y is less than zero, show reversed shape.
|
||||
|
||||
var symbolScale = outputSymbolMeta.symbolScale = [parsedSymbolSize[0] / symbolPatternSize, parsedSymbolSize[1] / symbolPatternSize]; // Follow convention, 'right' and 'top' is the normal scale.
|
||||
|
||||
symbolScale[valueDim.index] *= (opt.isHorizontal ? -1 : 1) * pxSign;
|
||||
}
|
||||
|
||||
function prepareLineWidth(itemModel, symbolScale, rotation, opt, outputSymbolMeta) {
|
||||
// In symbols are drawn with scale, so do not need to care about the case that width
|
||||
// or height are too small. But symbol use strokeNoScale, where acture lineWidth should
|
||||
// be calculated.
|
||||
var valueLineWidth = itemModel.get(BAR_BORDER_WIDTH_QUERY) || 0;
|
||||
|
||||
if (valueLineWidth) {
|
||||
pathForLineWidth.attr({
|
||||
scaleX: symbolScale[0],
|
||||
scaleY: symbolScale[1],
|
||||
rotation: rotation
|
||||
});
|
||||
pathForLineWidth.updateTransform();
|
||||
valueLineWidth /= pathForLineWidth.getLineScale();
|
||||
valueLineWidth *= symbolScale[opt.valueDim.index];
|
||||
}
|
||||
|
||||
outputSymbolMeta.valueLineWidth = valueLineWidth || 0;
|
||||
}
|
||||
|
||||
function prepareLayoutInfo(itemModel, symbolSize, layout, symbolRepeat, symbolClip, symbolOffset, symbolPosition, valueLineWidth, boundingLength, repeatCutLength, opt, outputSymbolMeta) {
|
||||
var categoryDim = opt.categoryDim;
|
||||
var valueDim = opt.valueDim;
|
||||
var pxSign = outputSymbolMeta.pxSign;
|
||||
var unitLength = Math.max(symbolSize[valueDim.index] + valueLineWidth, 0);
|
||||
var pathLen = unitLength; // Note: rotation will not effect the layout of symbols, because user may
|
||||
// want symbols to rotate on its center, which should not be translated
|
||||
// when rotating.
|
||||
|
||||
if (symbolRepeat) {
|
||||
var absBoundingLength = Math.abs(boundingLength);
|
||||
var symbolMargin = zrUtil.retrieve(itemModel.get('symbolMargin'), '15%') + '';
|
||||
var hasEndGap = false;
|
||||
|
||||
if (symbolMargin.lastIndexOf('!') === symbolMargin.length - 1) {
|
||||
hasEndGap = true;
|
||||
symbolMargin = symbolMargin.slice(0, symbolMargin.length - 1);
|
||||
}
|
||||
|
||||
var symbolMarginNumeric = parsePercent(symbolMargin, symbolSize[valueDim.index]);
|
||||
var uLenWithMargin = Math.max(unitLength + symbolMarginNumeric * 2, 0); // When symbol margin is less than 0, margin at both ends will be subtracted
|
||||
// to ensure that all of the symbols will not be overflow the given area.
|
||||
|
||||
var endFix = hasEndGap ? 0 : symbolMarginNumeric * 2; // Both final repeatTimes and final symbolMarginNumeric area calculated based on
|
||||
// boundingLength.
|
||||
|
||||
var repeatSpecified = isNumeric(symbolRepeat);
|
||||
var repeatTimes = repeatSpecified ? symbolRepeat : toIntTimes((absBoundingLength + endFix) / uLenWithMargin); // Adjust calculate margin, to ensure each symbol is displayed
|
||||
// entirely in the given layout area.
|
||||
|
||||
var mDiff = absBoundingLength - repeatTimes * unitLength;
|
||||
symbolMarginNumeric = mDiff / 2 / (hasEndGap ? repeatTimes : Math.max(repeatTimes - 1, 1));
|
||||
uLenWithMargin = unitLength + symbolMarginNumeric * 2;
|
||||
endFix = hasEndGap ? 0 : symbolMarginNumeric * 2; // Update repeatTimes when not all symbol will be shown.
|
||||
|
||||
if (!repeatSpecified && symbolRepeat !== 'fixed') {
|
||||
repeatTimes = repeatCutLength ? toIntTimes((Math.abs(repeatCutLength) + endFix) / uLenWithMargin) : 0;
|
||||
}
|
||||
|
||||
pathLen = repeatTimes * uLenWithMargin - endFix;
|
||||
outputSymbolMeta.repeatTimes = repeatTimes;
|
||||
outputSymbolMeta.symbolMargin = symbolMarginNumeric;
|
||||
}
|
||||
|
||||
var sizeFix = pxSign * (pathLen / 2);
|
||||
var pathPosition = outputSymbolMeta.pathPosition = [];
|
||||
pathPosition[categoryDim.index] = layout[categoryDim.wh] / 2;
|
||||
pathPosition[valueDim.index] = symbolPosition === 'start' ? sizeFix : symbolPosition === 'end' ? boundingLength - sizeFix : boundingLength / 2; // 'center'
|
||||
|
||||
if (symbolOffset) {
|
||||
pathPosition[0] += symbolOffset[0];
|
||||
pathPosition[1] += symbolOffset[1];
|
||||
}
|
||||
|
||||
var bundlePosition = outputSymbolMeta.bundlePosition = [];
|
||||
bundlePosition[categoryDim.index] = layout[categoryDim.xy];
|
||||
bundlePosition[valueDim.index] = layout[valueDim.xy];
|
||||
var barRectShape = outputSymbolMeta.barRectShape = zrUtil.extend({}, layout);
|
||||
barRectShape[valueDim.wh] = pxSign * Math.max(Math.abs(layout[valueDim.wh]), Math.abs(pathPosition[valueDim.index] + sizeFix));
|
||||
barRectShape[categoryDim.wh] = layout[categoryDim.wh];
|
||||
var clipShape = outputSymbolMeta.clipShape = {}; // Consider that symbol may be overflow layout rect.
|
||||
|
||||
clipShape[categoryDim.xy] = -layout[categoryDim.xy];
|
||||
clipShape[categoryDim.wh] = opt.ecSize[categoryDim.wh];
|
||||
clipShape[valueDim.xy] = 0;
|
||||
clipShape[valueDim.wh] = layout[valueDim.wh];
|
||||
}
|
||||
|
||||
function createPath(symbolMeta) {
|
||||
var symbolPatternSize = symbolMeta.symbolPatternSize;
|
||||
var path = createSymbol( // Consider texture img, make a big size.
|
||||
symbolMeta.symbolType, -symbolPatternSize / 2, -symbolPatternSize / 2, symbolPatternSize, symbolPatternSize);
|
||||
path.attr({
|
||||
culling: true
|
||||
});
|
||||
path.type !== 'image' && path.setStyle({
|
||||
strokeNoScale: true
|
||||
});
|
||||
return path;
|
||||
}
|
||||
|
||||
function createOrUpdateRepeatSymbols(bar, opt, symbolMeta, isUpdate) {
|
||||
var bundle = bar.__pictorialBundle;
|
||||
var symbolSize = symbolMeta.symbolSize;
|
||||
var valueLineWidth = symbolMeta.valueLineWidth;
|
||||
var pathPosition = symbolMeta.pathPosition;
|
||||
var valueDim = opt.valueDim;
|
||||
var repeatTimes = symbolMeta.repeatTimes || 0;
|
||||
var index = 0;
|
||||
var unit = symbolSize[opt.valueDim.index] + valueLineWidth + symbolMeta.symbolMargin * 2;
|
||||
eachPath(bar, function (path) {
|
||||
path.__pictorialAnimationIndex = index;
|
||||
path.__pictorialRepeatTimes = repeatTimes;
|
||||
|
||||
if (index < repeatTimes) {
|
||||
updateAttr(path, null, makeTarget(index), symbolMeta, isUpdate);
|
||||
} else {
|
||||
updateAttr(path, null, {
|
||||
scaleX: 0,
|
||||
scaleY: 0
|
||||
}, symbolMeta, isUpdate, function () {
|
||||
bundle.remove(path);
|
||||
});
|
||||
} // updateHoverAnimation(path, symbolMeta);
|
||||
|
||||
|
||||
index++;
|
||||
});
|
||||
|
||||
for (; index < repeatTimes; index++) {
|
||||
var path = createPath(symbolMeta);
|
||||
path.__pictorialAnimationIndex = index;
|
||||
path.__pictorialRepeatTimes = repeatTimes;
|
||||
bundle.add(path);
|
||||
var target = makeTarget(index);
|
||||
updateAttr(path, {
|
||||
x: target.x,
|
||||
y: target.y,
|
||||
scaleX: 0,
|
||||
scaleY: 0
|
||||
}, {
|
||||
scaleX: target.scaleX,
|
||||
scaleY: target.scaleY,
|
||||
rotation: target.rotation
|
||||
}, symbolMeta, isUpdate);
|
||||
}
|
||||
|
||||
function makeTarget(index) {
|
||||
var position = pathPosition.slice(); // (start && pxSign > 0) || (end && pxSign < 0): i = repeatTimes - index
|
||||
// Otherwise: i = index;
|
||||
|
||||
var pxSign = symbolMeta.pxSign;
|
||||
var i = index;
|
||||
|
||||
if (symbolMeta.symbolRepeatDirection === 'start' ? pxSign > 0 : pxSign < 0) {
|
||||
i = repeatTimes - 1 - index;
|
||||
}
|
||||
|
||||
position[valueDim.index] = unit * (i - repeatTimes / 2 + 0.5) + pathPosition[valueDim.index];
|
||||
return {
|
||||
x: position[0],
|
||||
y: position[1],
|
||||
scaleX: symbolMeta.symbolScale[0],
|
||||
scaleY: symbolMeta.symbolScale[1],
|
||||
rotation: symbolMeta.rotation
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
function createOrUpdateSingleSymbol(bar, opt, symbolMeta, isUpdate) {
|
||||
var bundle = bar.__pictorialBundle;
|
||||
var mainPath = bar.__pictorialMainPath;
|
||||
|
||||
if (!mainPath) {
|
||||
mainPath = bar.__pictorialMainPath = createPath(symbolMeta);
|
||||
bundle.add(mainPath);
|
||||
updateAttr(mainPath, {
|
||||
x: symbolMeta.pathPosition[0],
|
||||
y: symbolMeta.pathPosition[1],
|
||||
scaleX: 0,
|
||||
scaleY: 0,
|
||||
rotation: symbolMeta.rotation
|
||||
}, {
|
||||
scaleX: symbolMeta.symbolScale[0],
|
||||
scaleY: symbolMeta.symbolScale[1]
|
||||
}, symbolMeta, isUpdate);
|
||||
} else {
|
||||
updateAttr(mainPath, null, {
|
||||
x: symbolMeta.pathPosition[0],
|
||||
y: symbolMeta.pathPosition[1],
|
||||
scaleX: symbolMeta.symbolScale[0],
|
||||
scaleY: symbolMeta.symbolScale[1],
|
||||
rotation: symbolMeta.rotation
|
||||
}, symbolMeta, isUpdate);
|
||||
}
|
||||
} // bar rect is used for label.
|
||||
|
||||
|
||||
function createOrUpdateBarRect(bar, symbolMeta, isUpdate) {
|
||||
var rectShape = zrUtil.extend({}, symbolMeta.barRectShape);
|
||||
var barRect = bar.__pictorialBarRect;
|
||||
|
||||
if (!barRect) {
|
||||
barRect = bar.__pictorialBarRect = new graphic.Rect({
|
||||
z2: 2,
|
||||
shape: rectShape,
|
||||
silent: true,
|
||||
style: {
|
||||
stroke: 'transparent',
|
||||
fill: 'transparent',
|
||||
lineWidth: 0
|
||||
}
|
||||
});
|
||||
barRect.disableMorphing = true;
|
||||
bar.add(barRect);
|
||||
} else {
|
||||
updateAttr(barRect, null, {
|
||||
shape: rectShape
|
||||
}, symbolMeta, isUpdate);
|
||||
}
|
||||
}
|
||||
|
||||
function createOrUpdateClip(bar, opt, symbolMeta, isUpdate) {
|
||||
// If not clip, symbol will be remove and rebuilt.
|
||||
if (symbolMeta.symbolClip) {
|
||||
var clipPath = bar.__pictorialClipPath;
|
||||
var clipShape = zrUtil.extend({}, symbolMeta.clipShape);
|
||||
var valueDim = opt.valueDim;
|
||||
var animationModel = symbolMeta.animationModel;
|
||||
var dataIndex = symbolMeta.dataIndex;
|
||||
|
||||
if (clipPath) {
|
||||
graphic.updateProps(clipPath, {
|
||||
shape: clipShape
|
||||
}, animationModel, dataIndex);
|
||||
} else {
|
||||
clipShape[valueDim.wh] = 0;
|
||||
clipPath = new graphic.Rect({
|
||||
shape: clipShape
|
||||
});
|
||||
|
||||
bar.__pictorialBundle.setClipPath(clipPath);
|
||||
|
||||
bar.__pictorialClipPath = clipPath;
|
||||
var target = {};
|
||||
target[valueDim.wh] = symbolMeta.clipShape[valueDim.wh];
|
||||
graphic[isUpdate ? 'updateProps' : 'initProps'](clipPath, {
|
||||
shape: target
|
||||
}, animationModel, dataIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getItemModel(data, dataIndex) {
|
||||
var itemModel = data.getItemModel(dataIndex);
|
||||
itemModel.getAnimationDelayParams = getAnimationDelayParams;
|
||||
itemModel.isAnimationEnabled = isAnimationEnabled;
|
||||
return itemModel;
|
||||
}
|
||||
|
||||
function getAnimationDelayParams(path) {
|
||||
// The order is the same as the z-order, see `symbolRepeatDiretion`.
|
||||
return {
|
||||
index: path.__pictorialAnimationIndex,
|
||||
count: path.__pictorialRepeatTimes
|
||||
};
|
||||
}
|
||||
|
||||
function isAnimationEnabled() {
|
||||
// `animation` prop can be set on itemModel in pictorial bar chart.
|
||||
return this.parentModel.isAnimationEnabled() && !!this.getShallow('animation');
|
||||
}
|
||||
|
||||
function createBar(data, opt, symbolMeta, isUpdate) {
|
||||
// bar is the main element for each data.
|
||||
var bar = new graphic.Group(); // bundle is used for location and clip.
|
||||
|
||||
var bundle = new graphic.Group();
|
||||
bar.add(bundle);
|
||||
bar.__pictorialBundle = bundle;
|
||||
bundle.x = symbolMeta.bundlePosition[0];
|
||||
bundle.y = symbolMeta.bundlePosition[1];
|
||||
|
||||
if (symbolMeta.symbolRepeat) {
|
||||
createOrUpdateRepeatSymbols(bar, opt, symbolMeta);
|
||||
} else {
|
||||
createOrUpdateSingleSymbol(bar, opt, symbolMeta);
|
||||
}
|
||||
|
||||
createOrUpdateBarRect(bar, symbolMeta, isUpdate);
|
||||
createOrUpdateClip(bar, opt, symbolMeta, isUpdate);
|
||||
bar.__pictorialShapeStr = getShapeStr(data, symbolMeta);
|
||||
bar.__pictorialSymbolMeta = symbolMeta;
|
||||
return bar;
|
||||
}
|
||||
|
||||
function updateBar(bar, opt, symbolMeta) {
|
||||
var animationModel = symbolMeta.animationModel;
|
||||
var dataIndex = symbolMeta.dataIndex;
|
||||
var bundle = bar.__pictorialBundle;
|
||||
graphic.updateProps(bundle, {
|
||||
x: symbolMeta.bundlePosition[0],
|
||||
y: symbolMeta.bundlePosition[1]
|
||||
}, animationModel, dataIndex);
|
||||
|
||||
if (symbolMeta.symbolRepeat) {
|
||||
createOrUpdateRepeatSymbols(bar, opt, symbolMeta, true);
|
||||
} else {
|
||||
createOrUpdateSingleSymbol(bar, opt, symbolMeta, true);
|
||||
}
|
||||
|
||||
createOrUpdateBarRect(bar, symbolMeta, true);
|
||||
createOrUpdateClip(bar, opt, symbolMeta, true);
|
||||
}
|
||||
|
||||
function removeBar(data, dataIndex, animationModel, bar) {
|
||||
// Not show text when animating
|
||||
var labelRect = bar.__pictorialBarRect;
|
||||
labelRect && labelRect.removeTextContent();
|
||||
var paths = [];
|
||||
eachPath(bar, function (path) {
|
||||
paths.push(path);
|
||||
});
|
||||
bar.__pictorialMainPath && paths.push(bar.__pictorialMainPath); // I do not find proper remove animation for clip yet.
|
||||
|
||||
bar.__pictorialClipPath && (animationModel = null);
|
||||
zrUtil.each(paths, function (path) {
|
||||
graphic.removeElement(path, {
|
||||
scaleX: 0,
|
||||
scaleY: 0
|
||||
}, animationModel, dataIndex, function () {
|
||||
bar.parent && bar.parent.remove(bar);
|
||||
});
|
||||
});
|
||||
data.setItemGraphicEl(dataIndex, null);
|
||||
}
|
||||
|
||||
function getShapeStr(data, symbolMeta) {
|
||||
return [data.getItemVisual(symbolMeta.dataIndex, 'symbol') || 'none', !!symbolMeta.symbolRepeat, !!symbolMeta.symbolClip].join(':');
|
||||
}
|
||||
|
||||
function eachPath(bar, cb, context) {
|
||||
// Do not use Group#eachChild, because it do not support remove.
|
||||
zrUtil.each(bar.__pictorialBundle.children(), function (el) {
|
||||
el !== bar.__pictorialBarRect && cb.call(context, el);
|
||||
});
|
||||
}
|
||||
|
||||
function updateAttr(el, immediateAttrs, animationAttrs, symbolMeta, isUpdate, cb) {
|
||||
immediateAttrs && el.attr(immediateAttrs); // when symbolCip used, only clip path has init animation, otherwise it would be weird effect.
|
||||
|
||||
if (symbolMeta.symbolClip && !isUpdate) {
|
||||
animationAttrs && el.attr(animationAttrs);
|
||||
} else {
|
||||
animationAttrs && graphic[isUpdate ? 'updateProps' : 'initProps'](el, animationAttrs, symbolMeta.animationModel, symbolMeta.dataIndex, cb);
|
||||
}
|
||||
}
|
||||
|
||||
function updateCommon(bar, opt, symbolMeta) {
|
||||
var dataIndex = symbolMeta.dataIndex;
|
||||
var itemModel = symbolMeta.itemModel; // Color must be excluded.
|
||||
// Because symbol provide setColor individually to set fill and stroke
|
||||
|
||||
var emphasisModel = itemModel.getModel('emphasis');
|
||||
var emphasisStyle = emphasisModel.getModel('itemStyle').getItemStyle();
|
||||
var blurStyle = itemModel.getModel(['blur', 'itemStyle']).getItemStyle();
|
||||
var selectStyle = itemModel.getModel(['select', 'itemStyle']).getItemStyle();
|
||||
var cursorStyle = itemModel.getShallow('cursor');
|
||||
var focus = emphasisModel.get('focus');
|
||||
var blurScope = emphasisModel.get('blurScope');
|
||||
var hoverScale = emphasisModel.get('scale');
|
||||
eachPath(bar, function (path) {
|
||||
if (path instanceof ZRImage) {
|
||||
var pathStyle = path.style;
|
||||
path.useStyle(zrUtil.extend({
|
||||
// TODO other properties like dx, dy ?
|
||||
image: pathStyle.image,
|
||||
x: pathStyle.x,
|
||||
y: pathStyle.y,
|
||||
width: pathStyle.width,
|
||||
height: pathStyle.height
|
||||
}, symbolMeta.style));
|
||||
} else {
|
||||
path.useStyle(symbolMeta.style);
|
||||
}
|
||||
|
||||
var emphasisState = path.ensureState('emphasis');
|
||||
emphasisState.style = emphasisStyle;
|
||||
|
||||
if (hoverScale) {
|
||||
// NOTE: Must after scale is set after updateAttr
|
||||
emphasisState.scaleX = path.scaleX * 1.1;
|
||||
emphasisState.scaleY = path.scaleY * 1.1;
|
||||
}
|
||||
|
||||
path.ensureState('blur').style = blurStyle;
|
||||
path.ensureState('select').style = selectStyle;
|
||||
cursorStyle && (path.cursor = cursorStyle);
|
||||
path.z2 = symbolMeta.z2;
|
||||
});
|
||||
var barPositionOutside = opt.valueDim.posDesc[+(symbolMeta.boundingLength > 0)];
|
||||
var barRect = bar.__pictorialBarRect;
|
||||
setLabelStyle(barRect, getLabelStatesModels(itemModel), {
|
||||
labelFetcher: opt.seriesModel,
|
||||
labelDataIndex: dataIndex,
|
||||
defaultText: getDefaultLabel(opt.seriesModel.getData(), dataIndex),
|
||||
inheritColor: symbolMeta.style.fill,
|
||||
defaultOpacity: symbolMeta.style.opacity,
|
||||
defaultOutsidePosition: barPositionOutside
|
||||
});
|
||||
toggleHoverEmphasis(bar, focus, blurScope, emphasisModel.get('disabled'));
|
||||
}
|
||||
|
||||
function toIntTimes(times) {
|
||||
var roundedTimes = Math.round(times); // Escapse accurate error
|
||||
|
||||
return Math.abs(times - roundedTimes) < 1e-4 ? roundedTimes : Math.ceil(times);
|
||||
}
|
||||
|
||||
export default PictorialBarView;
|
||||
82
uni-demo/node_modules/echarts/lib/chart/bar/install.js
generated
vendored
Normal file
82
uni-demo/node_modules/echarts/lib/chart/bar/install.js
generated
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
|
||||
/*
|
||||
* 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 { layout, createProgressiveLayout } from '../../layout/barGrid.js';
|
||||
import dataSample from '../../processor/dataSample.js';
|
||||
import BarSeries from './BarSeries.js';
|
||||
import BarView from './BarView.js';
|
||||
export function install(registers) {
|
||||
registers.registerChartView(BarView);
|
||||
registers.registerSeriesModel(BarSeries);
|
||||
registers.registerLayout(registers.PRIORITY.VISUAL.LAYOUT, zrUtil.curry(layout, 'bar')); // Do layout after other overall layout, which can preapre some informations.
|
||||
|
||||
registers.registerLayout(registers.PRIORITY.VISUAL.PROGRESSIVE_LAYOUT, createProgressiveLayout('bar')); // Down sample after filter
|
||||
|
||||
registers.registerProcessor(registers.PRIORITY.PROCESSOR.STATISTIC, dataSample('bar'));
|
||||
/**
|
||||
* @payload
|
||||
* @property {string} [componentType=series]
|
||||
* @property {number} [dx]
|
||||
* @property {number} [dy]
|
||||
* @property {number} [zoom]
|
||||
* @property {number} [originX]
|
||||
* @property {number} [originY]
|
||||
*/
|
||||
|
||||
registers.registerAction({
|
||||
type: 'changeAxisOrder',
|
||||
event: 'changeAxisOrder',
|
||||
update: 'update'
|
||||
}, function (payload, ecModel) {
|
||||
var componentType = payload.componentType || 'series';
|
||||
ecModel.eachComponent({
|
||||
mainType: componentType,
|
||||
query: payload
|
||||
}, function (componentModel) {
|
||||
if (payload.sortInfo) {
|
||||
componentModel.axis.setCategorySortInfo(payload.sortInfo);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
54
uni-demo/node_modules/echarts/lib/chart/bar/installPictorialBar.js
generated
vendored
Normal file
54
uni-demo/node_modules/echarts/lib/chart/bar/installPictorialBar.js
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
|
||||
/*
|
||||
* 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 PictorialBarView from './PictorialBarView.js';
|
||||
import PictorialBarSeriesModel from './PictorialBarSeries.js';
|
||||
import { createProgressiveLayout, layout } from '../../layout/barGrid.js';
|
||||
import { curry } from 'zrender/lib/core/util.js';
|
||||
export function install(registers) {
|
||||
registers.registerChartView(PictorialBarView);
|
||||
registers.registerSeriesModel(PictorialBarSeriesModel);
|
||||
registers.registerLayout(registers.PRIORITY.VISUAL.LAYOUT, curry(layout, 'pictorialBar')); // Do layout after other overall layout, which can preapre some informations.
|
||||
|
||||
registers.registerLayout(registers.PRIORITY.VISUAL.PROGRESSIVE_LAYOUT, createProgressiveLayout('pictorialBar'));
|
||||
}
|
||||
46
uni-demo/node_modules/echarts/lib/chart/boxplot.js
generated
vendored
Normal file
46
uni-demo/node_modules/echarts/lib/chart/boxplot.js
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
|
||||
/*
|
||||
* 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 { use } from '../extension.js';
|
||||
import { install } from './boxplot/install.js';
|
||||
use(install);
|
||||
116
uni-demo/node_modules/echarts/lib/chart/boxplot/BoxplotSeries.js
generated
vendored
Normal file
116
uni-demo/node_modules/echarts/lib/chart/boxplot/BoxplotSeries.js
generated
vendored
Normal file
@@ -0,0 +1,116 @@
|
||||
|
||||
/*
|
||||
* 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 SeriesModel from '../../model/Series.js';
|
||||
import { WhiskerBoxCommonMixin } from '../helper/whiskerBoxCommon.js';
|
||||
import { mixin } from 'zrender/lib/core/util.js';
|
||||
|
||||
var BoxplotSeriesModel =
|
||||
/** @class */
|
||||
function (_super) {
|
||||
__extends(BoxplotSeriesModel, _super);
|
||||
|
||||
function BoxplotSeriesModel() {
|
||||
var _this = _super !== null && _super.apply(this, arguments) || this;
|
||||
|
||||
_this.type = BoxplotSeriesModel.type; // TODO
|
||||
// box width represents group size, so dimension should have 'size'.
|
||||
|
||||
/**
|
||||
* @see <https://en.wikipedia.org/wiki/Box_plot>
|
||||
* The meanings of 'min' and 'max' depend on user,
|
||||
* and echarts do not need to know it.
|
||||
* @readOnly
|
||||
*/
|
||||
|
||||
_this.defaultValueDimensions = [{
|
||||
name: 'min',
|
||||
defaultTooltip: true
|
||||
}, {
|
||||
name: 'Q1',
|
||||
defaultTooltip: true
|
||||
}, {
|
||||
name: 'median',
|
||||
defaultTooltip: true
|
||||
}, {
|
||||
name: 'Q3',
|
||||
defaultTooltip: true
|
||||
}, {
|
||||
name: 'max',
|
||||
defaultTooltip: true
|
||||
}];
|
||||
_this.visualDrawType = 'stroke';
|
||||
return _this;
|
||||
}
|
||||
|
||||
BoxplotSeriesModel.type = 'series.boxplot';
|
||||
BoxplotSeriesModel.dependencies = ['xAxis', 'yAxis', 'grid'];
|
||||
BoxplotSeriesModel.defaultOption = {
|
||||
// zlevel: 0,
|
||||
z: 2,
|
||||
coordinateSystem: 'cartesian2d',
|
||||
legendHoverLink: true,
|
||||
layout: null,
|
||||
boxWidth: [7, 50],
|
||||
itemStyle: {
|
||||
color: '#fff',
|
||||
borderWidth: 1
|
||||
},
|
||||
emphasis: {
|
||||
scale: true,
|
||||
itemStyle: {
|
||||
borderWidth: 2,
|
||||
shadowBlur: 5,
|
||||
shadowOffsetX: 1,
|
||||
shadowOffsetY: 1,
|
||||
shadowColor: 'rgba(0,0,0,0.2)'
|
||||
}
|
||||
},
|
||||
animationDuration: 800
|
||||
};
|
||||
return BoxplotSeriesModel;
|
||||
}(SeriesModel);
|
||||
|
||||
mixin(BoxplotSeriesModel, WhiskerBoxCommonMixin, true);
|
||||
export default BoxplotSeriesModel;
|
||||
203
uni-demo/node_modules/echarts/lib/chart/boxplot/BoxplotView.js
generated
vendored
Normal file
203
uni-demo/node_modules/echarts/lib/chart/boxplot/BoxplotView.js
generated
vendored
Normal file
@@ -0,0 +1,203 @@
|
||||
|
||||
/*
|
||||
* 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';
|
||||
import ChartView from '../../view/Chart.js';
|
||||
import * as graphic from '../../util/graphic.js';
|
||||
import { setStatesStylesFromModel, toggleHoverEmphasis } from '../../util/states.js';
|
||||
import Path from 'zrender/lib/graphic/Path.js';
|
||||
import { saveOldStyle } from '../../animation/basicTrasition.js';
|
||||
|
||||
var BoxplotView =
|
||||
/** @class */
|
||||
function (_super) {
|
||||
__extends(BoxplotView, _super);
|
||||
|
||||
function BoxplotView() {
|
||||
var _this = _super !== null && _super.apply(this, arguments) || this;
|
||||
|
||||
_this.type = BoxplotView.type;
|
||||
return _this;
|
||||
}
|
||||
|
||||
BoxplotView.prototype.render = function (seriesModel, ecModel, api) {
|
||||
var data = seriesModel.getData();
|
||||
var group = this.group;
|
||||
var oldData = this._data; // There is no old data only when first rendering or switching from
|
||||
// stream mode to normal mode, where previous elements should be removed.
|
||||
|
||||
if (!this._data) {
|
||||
group.removeAll();
|
||||
}
|
||||
|
||||
var constDim = seriesModel.get('layout') === 'horizontal' ? 1 : 0;
|
||||
data.diff(oldData).add(function (newIdx) {
|
||||
if (data.hasValue(newIdx)) {
|
||||
var itemLayout = data.getItemLayout(newIdx);
|
||||
var symbolEl = createNormalBox(itemLayout, data, newIdx, constDim, true);
|
||||
data.setItemGraphicEl(newIdx, symbolEl);
|
||||
group.add(symbolEl);
|
||||
}
|
||||
}).update(function (newIdx, oldIdx) {
|
||||
var symbolEl = oldData.getItemGraphicEl(oldIdx); // Empty data
|
||||
|
||||
if (!data.hasValue(newIdx)) {
|
||||
group.remove(symbolEl);
|
||||
return;
|
||||
}
|
||||
|
||||
var itemLayout = data.getItemLayout(newIdx);
|
||||
|
||||
if (!symbolEl) {
|
||||
symbolEl = createNormalBox(itemLayout, data, newIdx, constDim);
|
||||
} else {
|
||||
saveOldStyle(symbolEl);
|
||||
updateNormalBoxData(itemLayout, symbolEl, data, newIdx);
|
||||
}
|
||||
|
||||
group.add(symbolEl);
|
||||
data.setItemGraphicEl(newIdx, symbolEl);
|
||||
}).remove(function (oldIdx) {
|
||||
var el = oldData.getItemGraphicEl(oldIdx);
|
||||
el && group.remove(el);
|
||||
}).execute();
|
||||
this._data = data;
|
||||
};
|
||||
|
||||
BoxplotView.prototype.remove = function (ecModel) {
|
||||
var group = this.group;
|
||||
var data = this._data;
|
||||
this._data = null;
|
||||
data && data.eachItemGraphicEl(function (el) {
|
||||
el && group.remove(el);
|
||||
});
|
||||
};
|
||||
|
||||
BoxplotView.type = 'boxplot';
|
||||
return BoxplotView;
|
||||
}(ChartView);
|
||||
|
||||
var BoxPathShape =
|
||||
/** @class */
|
||||
function () {
|
||||
function BoxPathShape() {}
|
||||
|
||||
return BoxPathShape;
|
||||
}();
|
||||
|
||||
var BoxPath =
|
||||
/** @class */
|
||||
function (_super) {
|
||||
__extends(BoxPath, _super);
|
||||
|
||||
function BoxPath(opts) {
|
||||
var _this = _super.call(this, opts) || this;
|
||||
|
||||
_this.type = 'boxplotBoxPath';
|
||||
return _this;
|
||||
}
|
||||
|
||||
BoxPath.prototype.getDefaultShape = function () {
|
||||
return new BoxPathShape();
|
||||
};
|
||||
|
||||
BoxPath.prototype.buildPath = function (ctx, shape) {
|
||||
var ends = shape.points;
|
||||
var i = 0;
|
||||
ctx.moveTo(ends[i][0], ends[i][1]);
|
||||
i++;
|
||||
|
||||
for (; i < 4; i++) {
|
||||
ctx.lineTo(ends[i][0], ends[i][1]);
|
||||
}
|
||||
|
||||
ctx.closePath();
|
||||
|
||||
for (; i < ends.length; i++) {
|
||||
ctx.moveTo(ends[i][0], ends[i][1]);
|
||||
i++;
|
||||
ctx.lineTo(ends[i][0], ends[i][1]);
|
||||
}
|
||||
};
|
||||
|
||||
return BoxPath;
|
||||
}(Path);
|
||||
|
||||
function createNormalBox(itemLayout, data, dataIndex, constDim, isInit) {
|
||||
var ends = itemLayout.ends;
|
||||
var el = new BoxPath({
|
||||
shape: {
|
||||
points: isInit ? transInit(ends, constDim, itemLayout) : ends
|
||||
}
|
||||
});
|
||||
updateNormalBoxData(itemLayout, el, data, dataIndex, isInit);
|
||||
return el;
|
||||
}
|
||||
|
||||
function updateNormalBoxData(itemLayout, el, data, dataIndex, isInit) {
|
||||
var seriesModel = data.hostModel;
|
||||
var updateMethod = graphic[isInit ? 'initProps' : 'updateProps'];
|
||||
updateMethod(el, {
|
||||
shape: {
|
||||
points: itemLayout.ends
|
||||
}
|
||||
}, seriesModel, dataIndex);
|
||||
el.useStyle(data.getItemVisual(dataIndex, 'style'));
|
||||
el.style.strokeNoScale = true;
|
||||
el.z2 = 100;
|
||||
var itemModel = data.getItemModel(dataIndex);
|
||||
var emphasisModel = itemModel.getModel('emphasis');
|
||||
setStatesStylesFromModel(el, itemModel);
|
||||
toggleHoverEmphasis(el, emphasisModel.get('focus'), emphasisModel.get('blurScope'), emphasisModel.get('disabled'));
|
||||
}
|
||||
|
||||
function transInit(points, dim, itemLayout) {
|
||||
return zrUtil.map(points, function (point) {
|
||||
point = point.slice();
|
||||
point[dim] = itemLayout.initBaseline;
|
||||
return point;
|
||||
});
|
||||
}
|
||||
|
||||
export default BoxplotView;
|
||||
201
uni-demo/node_modules/echarts/lib/chart/boxplot/boxplotLayout.js
generated
vendored
Normal file
201
uni-demo/node_modules/echarts/lib/chart/boxplot/boxplotLayout.js
generated
vendored
Normal file
@@ -0,0 +1,201 @@
|
||||
|
||||
/*
|
||||
* 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 { parsePercent } from '../../util/number.js';
|
||||
var each = zrUtil.each;
|
||||
export default function boxplotLayout(ecModel) {
|
||||
var groupResult = groupSeriesByAxis(ecModel);
|
||||
each(groupResult, function (groupItem) {
|
||||
var seriesModels = groupItem.seriesModels;
|
||||
|
||||
if (!seriesModels.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
calculateBase(groupItem);
|
||||
each(seriesModels, function (seriesModel, idx) {
|
||||
layoutSingleSeries(seriesModel, groupItem.boxOffsetList[idx], groupItem.boxWidthList[idx]);
|
||||
});
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Group series by axis.
|
||||
*/
|
||||
|
||||
function groupSeriesByAxis(ecModel) {
|
||||
var result = [];
|
||||
var axisList = [];
|
||||
ecModel.eachSeriesByType('boxplot', function (seriesModel) {
|
||||
var baseAxis = seriesModel.getBaseAxis();
|
||||
var idx = zrUtil.indexOf(axisList, baseAxis);
|
||||
|
||||
if (idx < 0) {
|
||||
idx = axisList.length;
|
||||
axisList[idx] = baseAxis;
|
||||
result[idx] = {
|
||||
axis: baseAxis,
|
||||
seriesModels: []
|
||||
};
|
||||
}
|
||||
|
||||
result[idx].seriesModels.push(seriesModel);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Calculate offset and box width for each series.
|
||||
*/
|
||||
|
||||
|
||||
function calculateBase(groupItem) {
|
||||
var baseAxis = groupItem.axis;
|
||||
var seriesModels = groupItem.seriesModels;
|
||||
var seriesCount = seriesModels.length;
|
||||
var boxWidthList = groupItem.boxWidthList = [];
|
||||
var boxOffsetList = groupItem.boxOffsetList = [];
|
||||
var boundList = [];
|
||||
var bandWidth;
|
||||
|
||||
if (baseAxis.type === 'category') {
|
||||
bandWidth = baseAxis.getBandWidth();
|
||||
} else {
|
||||
var maxDataCount_1 = 0;
|
||||
each(seriesModels, function (seriesModel) {
|
||||
maxDataCount_1 = Math.max(maxDataCount_1, seriesModel.getData().count());
|
||||
});
|
||||
var extent = baseAxis.getExtent();
|
||||
bandWidth = Math.abs(extent[1] - extent[0]) / maxDataCount_1;
|
||||
}
|
||||
|
||||
each(seriesModels, function (seriesModel) {
|
||||
var boxWidthBound = seriesModel.get('boxWidth');
|
||||
|
||||
if (!zrUtil.isArray(boxWidthBound)) {
|
||||
boxWidthBound = [boxWidthBound, boxWidthBound];
|
||||
}
|
||||
|
||||
boundList.push([parsePercent(boxWidthBound[0], bandWidth) || 0, parsePercent(boxWidthBound[1], bandWidth) || 0]);
|
||||
});
|
||||
var availableWidth = bandWidth * 0.8 - 2;
|
||||
var boxGap = availableWidth / seriesCount * 0.3;
|
||||
var boxWidth = (availableWidth - boxGap * (seriesCount - 1)) / seriesCount;
|
||||
var base = boxWidth / 2 - availableWidth / 2;
|
||||
each(seriesModels, function (seriesModel, idx) {
|
||||
boxOffsetList.push(base);
|
||||
base += boxGap + boxWidth;
|
||||
boxWidthList.push(Math.min(Math.max(boxWidth, boundList[idx][0]), boundList[idx][1]));
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Calculate points location for each series.
|
||||
*/
|
||||
|
||||
|
||||
function layoutSingleSeries(seriesModel, offset, boxWidth) {
|
||||
var coordSys = seriesModel.coordinateSystem;
|
||||
var data = seriesModel.getData();
|
||||
var halfWidth = boxWidth / 2;
|
||||
var cDimIdx = seriesModel.get('layout') === 'horizontal' ? 0 : 1;
|
||||
var vDimIdx = 1 - cDimIdx;
|
||||
var coordDims = ['x', 'y'];
|
||||
var cDim = data.mapDimension(coordDims[cDimIdx]);
|
||||
var vDims = data.mapDimensionsAll(coordDims[vDimIdx]);
|
||||
|
||||
if (cDim == null || vDims.length < 5) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (var dataIndex = 0; dataIndex < data.count(); dataIndex++) {
|
||||
var axisDimVal = data.get(cDim, dataIndex);
|
||||
var median = getPoint(axisDimVal, vDims[2], dataIndex);
|
||||
var end1 = getPoint(axisDimVal, vDims[0], dataIndex);
|
||||
var end2 = getPoint(axisDimVal, vDims[1], dataIndex);
|
||||
var end4 = getPoint(axisDimVal, vDims[3], dataIndex);
|
||||
var end5 = getPoint(axisDimVal, vDims[4], dataIndex);
|
||||
var ends = [];
|
||||
addBodyEnd(ends, end2, false);
|
||||
addBodyEnd(ends, end4, true);
|
||||
ends.push(end1, end2, end5, end4);
|
||||
layEndLine(ends, end1);
|
||||
layEndLine(ends, end5);
|
||||
layEndLine(ends, median);
|
||||
data.setItemLayout(dataIndex, {
|
||||
initBaseline: median[vDimIdx],
|
||||
ends: ends
|
||||
});
|
||||
}
|
||||
|
||||
function getPoint(axisDimVal, dim, dataIndex) {
|
||||
var val = data.get(dim, dataIndex);
|
||||
var p = [];
|
||||
p[cDimIdx] = axisDimVal;
|
||||
p[vDimIdx] = val;
|
||||
var point;
|
||||
|
||||
if (isNaN(axisDimVal) || isNaN(val)) {
|
||||
point = [NaN, NaN];
|
||||
} else {
|
||||
point = coordSys.dataToPoint(p);
|
||||
point[cDimIdx] += offset;
|
||||
}
|
||||
|
||||
return point;
|
||||
}
|
||||
|
||||
function addBodyEnd(ends, point, start) {
|
||||
var point1 = point.slice();
|
||||
var point2 = point.slice();
|
||||
point1[cDimIdx] += halfWidth;
|
||||
point2[cDimIdx] -= halfWidth;
|
||||
start ? ends.push(point1, point2) : ends.push(point2, point1);
|
||||
}
|
||||
|
||||
function layEndLine(ends, endCenter) {
|
||||
var from = endCenter.slice();
|
||||
var to = endCenter.slice();
|
||||
from[cDimIdx] -= halfWidth;
|
||||
to[cDimIdx] += halfWidth;
|
||||
ends.push(from, to);
|
||||
}
|
||||
}
|
||||
70
uni-demo/node_modules/echarts/lib/chart/boxplot/boxplotTransform.js
generated
vendored
Normal file
70
uni-demo/node_modules/echarts/lib/chart/boxplot/boxplotTransform.js
generated
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
|
||||
/*
|
||||
* 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 prepareBoxplotData from './prepareBoxplotData.js';
|
||||
import { throwError, makePrintable } from '../../util/log.js';
|
||||
import { SOURCE_FORMAT_ARRAY_ROWS } from '../../util/types.js';
|
||||
export var boxplotTransform = {
|
||||
type: 'echarts:boxplot',
|
||||
transform: function transform(params) {
|
||||
var upstream = params.upstream;
|
||||
|
||||
if (upstream.sourceFormat !== SOURCE_FORMAT_ARRAY_ROWS) {
|
||||
var errMsg = '';
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
errMsg = makePrintable('source data is not applicable for this boxplot transform. Expect number[][].');
|
||||
}
|
||||
|
||||
throwError(errMsg);
|
||||
}
|
||||
|
||||
var result = prepareBoxplotData(upstream.getRawData(), params.config);
|
||||
return [{
|
||||
dimensions: ['ItemName', 'Low', 'Q1', 'Q2', 'Q3', 'High'],
|
||||
data: result.boxData
|
||||
}, {
|
||||
data: result.outliers
|
||||
}];
|
||||
}
|
||||
};
|
||||
44
uni-demo/node_modules/echarts/lib/chart/boxplot/boxplotVisual.js
generated
vendored
Normal file
44
uni-demo/node_modules/echarts/lib/chart/boxplot/boxplotVisual.js
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* AUTO-GENERATED FILE. DO NOT MODIFY.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
export default function boxplotVisual(ecModel, api) {}
|
||||
55
uni-demo/node_modules/echarts/lib/chart/boxplot/install.js
generated
vendored
Normal file
55
uni-demo/node_modules/echarts/lib/chart/boxplot/install.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 BoxplotSeriesModel from './BoxplotSeries.js';
|
||||
import BoxplotView from './BoxplotView.js';
|
||||
import boxplotVisual from './boxplotVisual.js';
|
||||
import boxplotLayout from './boxplotLayout.js';
|
||||
import { boxplotTransform } from './boxplotTransform.js';
|
||||
export function install(registers) {
|
||||
registers.registerSeriesModel(BoxplotSeriesModel);
|
||||
registers.registerChartView(BoxplotView);
|
||||
registers.registerVisual(boxplotVisual);
|
||||
registers.registerLayout(boxplotLayout);
|
||||
registers.registerTransform(boxplotTransform);
|
||||
}
|
||||
101
uni-demo/node_modules/echarts/lib/chart/boxplot/prepareBoxplotData.js
generated
vendored
Normal file
101
uni-demo/node_modules/echarts/lib/chart/boxplot/prepareBoxplotData.js
generated
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
|
||||
/*
|
||||
* 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 { quantile, asc } from '../../util/number.js';
|
||||
import { isFunction, isString } from 'zrender/lib/core/util.js';
|
||||
/**
|
||||
* See:
|
||||
* <https://en.wikipedia.org/wiki/Box_plot#cite_note-frigge_hoaglin_iglewicz-2>
|
||||
* <http://stat.ethz.ch/R-manual/R-devel/library/grDevices/html/boxplot.stats.html>
|
||||
*
|
||||
* Helper method for preparing data.
|
||||
*
|
||||
* @param rawData like
|
||||
* [
|
||||
* [12,232,443], (raw data set for the first box)
|
||||
* [3843,5545,1232], (raw data set for the second box)
|
||||
* ...
|
||||
* ]
|
||||
* @param opt.boundIQR=1.5 Data less than min bound is outlier.
|
||||
* default 1.5, means Q1 - 1.5 * (Q3 - Q1).
|
||||
* If 'none'/0 passed, min bound will not be used.
|
||||
*/
|
||||
|
||||
export default function prepareBoxplotData(rawData, opt) {
|
||||
opt = opt || {};
|
||||
var boxData = [];
|
||||
var outliers = [];
|
||||
var boundIQR = opt.boundIQR;
|
||||
var useExtreme = boundIQR === 'none' || boundIQR === 0;
|
||||
|
||||
for (var i = 0; i < rawData.length; i++) {
|
||||
var ascList = asc(rawData[i].slice());
|
||||
var Q1 = quantile(ascList, 0.25);
|
||||
var Q2 = quantile(ascList, 0.5);
|
||||
var Q3 = quantile(ascList, 0.75);
|
||||
var min = ascList[0];
|
||||
var max = ascList[ascList.length - 1];
|
||||
var bound = (boundIQR == null ? 1.5 : boundIQR) * (Q3 - Q1);
|
||||
var low = useExtreme ? min : Math.max(min, Q1 - bound);
|
||||
var high = useExtreme ? max : Math.min(max, Q3 + bound);
|
||||
var itemNameFormatter = opt.itemNameFormatter;
|
||||
var itemName = isFunction(itemNameFormatter) ? itemNameFormatter({
|
||||
value: i
|
||||
}) : isString(itemNameFormatter) ? itemNameFormatter.replace('{value}', i + '') : i + '';
|
||||
boxData.push([itemName, low, Q1, Q2, Q3, high]);
|
||||
|
||||
for (var j = 0; j < ascList.length; j++) {
|
||||
var dataItem = ascList[j];
|
||||
|
||||
if (dataItem < low || dataItem > high) {
|
||||
var outlier = [itemName, dataItem];
|
||||
outliers.push(outlier);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
boxData: boxData,
|
||||
outliers: outliers
|
||||
};
|
||||
}
|
||||
46
uni-demo/node_modules/echarts/lib/chart/candlestick.js
generated
vendored
Normal file
46
uni-demo/node_modules/echarts/lib/chart/candlestick.js
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
|
||||
/*
|
||||
* 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 { use } from '../extension.js';
|
||||
import { install } from './candlestick/install.js';
|
||||
use(install);
|
||||
129
uni-demo/node_modules/echarts/lib/chart/candlestick/CandlestickSeries.js
generated
vendored
Normal file
129
uni-demo/node_modules/echarts/lib/chart/candlestick/CandlestickSeries.js
generated
vendored
Normal file
@@ -0,0 +1,129 @@
|
||||
|
||||
/*
|
||||
* 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 SeriesModel from '../../model/Series.js';
|
||||
import { WhiskerBoxCommonMixin } from '../helper/whiskerBoxCommon.js';
|
||||
import { mixin } from 'zrender/lib/core/util.js';
|
||||
|
||||
var CandlestickSeriesModel =
|
||||
/** @class */
|
||||
function (_super) {
|
||||
__extends(CandlestickSeriesModel, _super);
|
||||
|
||||
function CandlestickSeriesModel() {
|
||||
var _this = _super !== null && _super.apply(this, arguments) || this;
|
||||
|
||||
_this.type = CandlestickSeriesModel.type;
|
||||
_this.defaultValueDimensions = [{
|
||||
name: 'open',
|
||||
defaultTooltip: true
|
||||
}, {
|
||||
name: 'close',
|
||||
defaultTooltip: true
|
||||
}, {
|
||||
name: 'lowest',
|
||||
defaultTooltip: true
|
||||
}, {
|
||||
name: 'highest',
|
||||
defaultTooltip: true
|
||||
}];
|
||||
return _this;
|
||||
}
|
||||
/**
|
||||
* Get dimension for shadow in dataZoom
|
||||
* @return dimension name
|
||||
*/
|
||||
|
||||
|
||||
CandlestickSeriesModel.prototype.getShadowDim = function () {
|
||||
return 'open';
|
||||
};
|
||||
|
||||
CandlestickSeriesModel.prototype.brushSelector = function (dataIndex, data, selectors) {
|
||||
var itemLayout = data.getItemLayout(dataIndex);
|
||||
return itemLayout && selectors.rect(itemLayout.brushRect);
|
||||
};
|
||||
|
||||
CandlestickSeriesModel.type = 'series.candlestick';
|
||||
CandlestickSeriesModel.dependencies = ['xAxis', 'yAxis', 'grid'];
|
||||
CandlestickSeriesModel.defaultOption = {
|
||||
// zlevel: 0,
|
||||
z: 2,
|
||||
coordinateSystem: 'cartesian2d',
|
||||
legendHoverLink: true,
|
||||
// xAxisIndex: 0,
|
||||
// yAxisIndex: 0,
|
||||
layout: null,
|
||||
clip: true,
|
||||
itemStyle: {
|
||||
color: '#eb5454',
|
||||
color0: '#47b262',
|
||||
borderColor: '#eb5454',
|
||||
borderColor0: '#47b262',
|
||||
// borderColor: '#d24040',
|
||||
// borderColor0: '#398f4f',
|
||||
borderWidth: 1
|
||||
},
|
||||
emphasis: {
|
||||
scale: true,
|
||||
itemStyle: {
|
||||
borderWidth: 2
|
||||
}
|
||||
},
|
||||
barMaxWidth: null,
|
||||
barMinWidth: null,
|
||||
barWidth: null,
|
||||
large: true,
|
||||
largeThreshold: 600,
|
||||
progressive: 3e3,
|
||||
progressiveThreshold: 1e4,
|
||||
progressiveChunkMode: 'mod',
|
||||
animationEasing: 'linear',
|
||||
animationDuration: 300
|
||||
};
|
||||
return CandlestickSeriesModel;
|
||||
}(SeriesModel);
|
||||
|
||||
mixin(CandlestickSeriesModel, WhiskerBoxCommonMixin, true);
|
||||
export default CandlestickSeriesModel;
|
||||
386
uni-demo/node_modules/echarts/lib/chart/candlestick/CandlestickView.js
generated
vendored
Normal file
386
uni-demo/node_modules/echarts/lib/chart/candlestick/CandlestickView.js
generated
vendored
Normal file
@@ -0,0 +1,386 @@
|
||||
|
||||
/*
|
||||
* 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';
|
||||
import ChartView from '../../view/Chart.js';
|
||||
import * as graphic from '../../util/graphic.js';
|
||||
import { setStatesStylesFromModel } from '../../util/states.js';
|
||||
import Path from 'zrender/lib/graphic/Path.js';
|
||||
import { createClipPath } from '../helper/createClipPathFromCoordSys.js';
|
||||
import { saveOldStyle } from '../../animation/basicTrasition.js';
|
||||
var SKIP_PROPS = ['color', 'borderColor'];
|
||||
|
||||
var CandlestickView =
|
||||
/** @class */
|
||||
function (_super) {
|
||||
__extends(CandlestickView, _super);
|
||||
|
||||
function CandlestickView() {
|
||||
var _this = _super !== null && _super.apply(this, arguments) || this;
|
||||
|
||||
_this.type = CandlestickView.type;
|
||||
return _this;
|
||||
}
|
||||
|
||||
CandlestickView.prototype.render = function (seriesModel, ecModel, api) {
|
||||
// If there is clipPath created in large mode. Remove it.
|
||||
this.group.removeClipPath(); // Clear previously rendered progressive elements.
|
||||
|
||||
this._progressiveEls = null;
|
||||
|
||||
this._updateDrawMode(seriesModel);
|
||||
|
||||
this._isLargeDraw ? this._renderLarge(seriesModel) : this._renderNormal(seriesModel);
|
||||
};
|
||||
|
||||
CandlestickView.prototype.incrementalPrepareRender = function (seriesModel, ecModel, api) {
|
||||
this._clear();
|
||||
|
||||
this._updateDrawMode(seriesModel);
|
||||
};
|
||||
|
||||
CandlestickView.prototype.incrementalRender = function (params, seriesModel, ecModel, api) {
|
||||
this._progressiveEls = [];
|
||||
this._isLargeDraw ? this._incrementalRenderLarge(params, seriesModel) : this._incrementalRenderNormal(params, seriesModel);
|
||||
};
|
||||
|
||||
CandlestickView.prototype.eachRendered = function (cb) {
|
||||
graphic.traverseElements(this._progressiveEls || this.group, cb);
|
||||
};
|
||||
|
||||
CandlestickView.prototype._updateDrawMode = function (seriesModel) {
|
||||
var isLargeDraw = seriesModel.pipelineContext.large;
|
||||
|
||||
if (this._isLargeDraw == null || isLargeDraw !== this._isLargeDraw) {
|
||||
this._isLargeDraw = isLargeDraw;
|
||||
|
||||
this._clear();
|
||||
}
|
||||
};
|
||||
|
||||
CandlestickView.prototype._renderNormal = function (seriesModel) {
|
||||
var data = seriesModel.getData();
|
||||
var oldData = this._data;
|
||||
var group = this.group;
|
||||
var isSimpleBox = data.getLayout('isSimpleBox');
|
||||
var needsClip = seriesModel.get('clip', true);
|
||||
var coord = seriesModel.coordinateSystem;
|
||||
var clipArea = coord.getArea && coord.getArea(); // There is no old data only when first rendering or switching from
|
||||
// stream mode to normal mode, where previous elements should be removed.
|
||||
|
||||
if (!this._data) {
|
||||
group.removeAll();
|
||||
}
|
||||
|
||||
data.diff(oldData).add(function (newIdx) {
|
||||
if (data.hasValue(newIdx)) {
|
||||
var itemLayout = data.getItemLayout(newIdx);
|
||||
|
||||
if (needsClip && isNormalBoxClipped(clipArea, itemLayout)) {
|
||||
return;
|
||||
}
|
||||
|
||||
var el = createNormalBox(itemLayout, newIdx, true);
|
||||
graphic.initProps(el, {
|
||||
shape: {
|
||||
points: itemLayout.ends
|
||||
}
|
||||
}, seriesModel, newIdx);
|
||||
setBoxCommon(el, data, newIdx, isSimpleBox);
|
||||
group.add(el);
|
||||
data.setItemGraphicEl(newIdx, el);
|
||||
}
|
||||
}).update(function (newIdx, oldIdx) {
|
||||
var el = oldData.getItemGraphicEl(oldIdx); // Empty data
|
||||
|
||||
if (!data.hasValue(newIdx)) {
|
||||
group.remove(el);
|
||||
return;
|
||||
}
|
||||
|
||||
var itemLayout = data.getItemLayout(newIdx);
|
||||
|
||||
if (needsClip && isNormalBoxClipped(clipArea, itemLayout)) {
|
||||
group.remove(el);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!el) {
|
||||
el = createNormalBox(itemLayout, newIdx);
|
||||
} else {
|
||||
graphic.updateProps(el, {
|
||||
shape: {
|
||||
points: itemLayout.ends
|
||||
}
|
||||
}, seriesModel, newIdx);
|
||||
saveOldStyle(el);
|
||||
}
|
||||
|
||||
setBoxCommon(el, data, newIdx, isSimpleBox);
|
||||
group.add(el);
|
||||
data.setItemGraphicEl(newIdx, el);
|
||||
}).remove(function (oldIdx) {
|
||||
var el = oldData.getItemGraphicEl(oldIdx);
|
||||
el && group.remove(el);
|
||||
}).execute();
|
||||
this._data = data;
|
||||
};
|
||||
|
||||
CandlestickView.prototype._renderLarge = function (seriesModel) {
|
||||
this._clear();
|
||||
|
||||
createLarge(seriesModel, this.group);
|
||||
var clipPath = seriesModel.get('clip', true) ? createClipPath(seriesModel.coordinateSystem, false, seriesModel) : null;
|
||||
|
||||
if (clipPath) {
|
||||
this.group.setClipPath(clipPath);
|
||||
} else {
|
||||
this.group.removeClipPath();
|
||||
}
|
||||
};
|
||||
|
||||
CandlestickView.prototype._incrementalRenderNormal = function (params, seriesModel) {
|
||||
var data = seriesModel.getData();
|
||||
var isSimpleBox = data.getLayout('isSimpleBox');
|
||||
var dataIndex;
|
||||
|
||||
while ((dataIndex = params.next()) != null) {
|
||||
var itemLayout = data.getItemLayout(dataIndex);
|
||||
var el = createNormalBox(itemLayout, dataIndex);
|
||||
setBoxCommon(el, data, dataIndex, isSimpleBox);
|
||||
el.incremental = true;
|
||||
this.group.add(el);
|
||||
|
||||
this._progressiveEls.push(el);
|
||||
}
|
||||
};
|
||||
|
||||
CandlestickView.prototype._incrementalRenderLarge = function (params, seriesModel) {
|
||||
createLarge(seriesModel, this.group, this._progressiveEls, true);
|
||||
};
|
||||
|
||||
CandlestickView.prototype.remove = function (ecModel) {
|
||||
this._clear();
|
||||
};
|
||||
|
||||
CandlestickView.prototype._clear = function () {
|
||||
this.group.removeAll();
|
||||
this._data = null;
|
||||
};
|
||||
|
||||
CandlestickView.type = 'candlestick';
|
||||
return CandlestickView;
|
||||
}(ChartView);
|
||||
|
||||
var NormalBoxPathShape =
|
||||
/** @class */
|
||||
function () {
|
||||
function NormalBoxPathShape() {}
|
||||
|
||||
return NormalBoxPathShape;
|
||||
}();
|
||||
|
||||
var NormalBoxPath =
|
||||
/** @class */
|
||||
function (_super) {
|
||||
__extends(NormalBoxPath, _super);
|
||||
|
||||
function NormalBoxPath(opts) {
|
||||
var _this = _super.call(this, opts) || this;
|
||||
|
||||
_this.type = 'normalCandlestickBox';
|
||||
return _this;
|
||||
}
|
||||
|
||||
NormalBoxPath.prototype.getDefaultShape = function () {
|
||||
return new NormalBoxPathShape();
|
||||
};
|
||||
|
||||
NormalBoxPath.prototype.buildPath = function (ctx, shape) {
|
||||
var ends = shape.points;
|
||||
|
||||
if (this.__simpleBox) {
|
||||
ctx.moveTo(ends[4][0], ends[4][1]);
|
||||
ctx.lineTo(ends[6][0], ends[6][1]);
|
||||
} else {
|
||||
ctx.moveTo(ends[0][0], ends[0][1]);
|
||||
ctx.lineTo(ends[1][0], ends[1][1]);
|
||||
ctx.lineTo(ends[2][0], ends[2][1]);
|
||||
ctx.lineTo(ends[3][0], ends[3][1]);
|
||||
ctx.closePath();
|
||||
ctx.moveTo(ends[4][0], ends[4][1]);
|
||||
ctx.lineTo(ends[5][0], ends[5][1]);
|
||||
ctx.moveTo(ends[6][0], ends[6][1]);
|
||||
ctx.lineTo(ends[7][0], ends[7][1]);
|
||||
}
|
||||
};
|
||||
|
||||
return NormalBoxPath;
|
||||
}(Path);
|
||||
|
||||
function createNormalBox(itemLayout, dataIndex, isInit) {
|
||||
var ends = itemLayout.ends;
|
||||
return new NormalBoxPath({
|
||||
shape: {
|
||||
points: isInit ? transInit(ends, itemLayout) : ends
|
||||
},
|
||||
z2: 100
|
||||
});
|
||||
}
|
||||
|
||||
function isNormalBoxClipped(clipArea, itemLayout) {
|
||||
var clipped = true;
|
||||
|
||||
for (var i = 0; i < itemLayout.ends.length; i++) {
|
||||
// If any point are in the region.
|
||||
if (clipArea.contain(itemLayout.ends[i][0], itemLayout.ends[i][1])) {
|
||||
clipped = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return clipped;
|
||||
}
|
||||
|
||||
function setBoxCommon(el, data, dataIndex, isSimpleBox) {
|
||||
var itemModel = data.getItemModel(dataIndex);
|
||||
el.useStyle(data.getItemVisual(dataIndex, 'style'));
|
||||
el.style.strokeNoScale = true;
|
||||
el.__simpleBox = isSimpleBox;
|
||||
setStatesStylesFromModel(el, itemModel);
|
||||
}
|
||||
|
||||
function transInit(points, itemLayout) {
|
||||
return zrUtil.map(points, function (point) {
|
||||
point = point.slice();
|
||||
point[1] = itemLayout.initBaseline;
|
||||
return point;
|
||||
});
|
||||
}
|
||||
|
||||
var LargeBoxPathShape =
|
||||
/** @class */
|
||||
function () {
|
||||
function LargeBoxPathShape() {}
|
||||
|
||||
return LargeBoxPathShape;
|
||||
}();
|
||||
|
||||
var LargeBoxPath =
|
||||
/** @class */
|
||||
function (_super) {
|
||||
__extends(LargeBoxPath, _super);
|
||||
|
||||
function LargeBoxPath(opts) {
|
||||
var _this = _super.call(this, opts) || this;
|
||||
|
||||
_this.type = 'largeCandlestickBox';
|
||||
return _this;
|
||||
}
|
||||
|
||||
LargeBoxPath.prototype.getDefaultShape = function () {
|
||||
return new LargeBoxPathShape();
|
||||
};
|
||||
|
||||
LargeBoxPath.prototype.buildPath = function (ctx, shape) {
|
||||
// Drawing lines is more efficient than drawing
|
||||
// a whole line or drawing rects.
|
||||
var points = shape.points;
|
||||
|
||||
for (var i = 0; i < points.length;) {
|
||||
if (this.__sign === points[i++]) {
|
||||
var x = points[i++];
|
||||
ctx.moveTo(x, points[i++]);
|
||||
ctx.lineTo(x, points[i++]);
|
||||
} else {
|
||||
i += 3;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return LargeBoxPath;
|
||||
}(Path);
|
||||
|
||||
function createLarge(seriesModel, group, progressiveEls, incremental) {
|
||||
var data = seriesModel.getData();
|
||||
var largePoints = data.getLayout('largePoints');
|
||||
var elP = new LargeBoxPath({
|
||||
shape: {
|
||||
points: largePoints
|
||||
},
|
||||
__sign: 1
|
||||
});
|
||||
group.add(elP);
|
||||
var elN = new LargeBoxPath({
|
||||
shape: {
|
||||
points: largePoints
|
||||
},
|
||||
__sign: -1
|
||||
});
|
||||
group.add(elN);
|
||||
setLargeStyle(1, elP, seriesModel, data);
|
||||
setLargeStyle(-1, elN, seriesModel, data);
|
||||
|
||||
if (incremental) {
|
||||
elP.incremental = true;
|
||||
elN.incremental = true;
|
||||
}
|
||||
|
||||
if (progressiveEls) {
|
||||
progressiveEls.push(elP, elN);
|
||||
}
|
||||
}
|
||||
|
||||
function setLargeStyle(sign, el, seriesModel, data) {
|
||||
// TODO put in visual?
|
||||
var borderColor = seriesModel.get(['itemStyle', sign > 0 ? 'borderColor' : 'borderColor0']) || seriesModel.get(['itemStyle', sign > 0 ? 'color' : 'color0']); // Color must be excluded.
|
||||
// Because symbol provide setColor individually to set fill and stroke
|
||||
|
||||
var itemStyle = seriesModel.getModel('itemStyle').getItemStyle(SKIP_PROPS);
|
||||
el.useStyle(itemStyle);
|
||||
el.style.fill = null;
|
||||
el.style.stroke = borderColor;
|
||||
}
|
||||
|
||||
export default CandlestickView;
|
||||
207
uni-demo/node_modules/echarts/lib/chart/candlestick/candlestickLayout.js
generated
vendored
Normal file
207
uni-demo/node_modules/echarts/lib/chart/candlestick/candlestickLayout.js
generated
vendored
Normal file
@@ -0,0 +1,207 @@
|
||||
|
||||
/*
|
||||
* 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 { subPixelOptimize } from '../../util/graphic.js';
|
||||
import createRenderPlanner from '../helper/createRenderPlanner.js';
|
||||
import { parsePercent } from '../../util/number.js';
|
||||
import { map, retrieve2 } from 'zrender/lib/core/util.js';
|
||||
import { createFloat32Array } from '../../util/vendor.js';
|
||||
var candlestickLayout = {
|
||||
seriesType: 'candlestick',
|
||||
plan: createRenderPlanner(),
|
||||
reset: function (seriesModel) {
|
||||
var coordSys = seriesModel.coordinateSystem;
|
||||
var data = seriesModel.getData();
|
||||
var candleWidth = calculateCandleWidth(seriesModel, data);
|
||||
var cDimIdx = 0;
|
||||
var vDimIdx = 1;
|
||||
var coordDims = ['x', 'y'];
|
||||
var cDimI = data.getDimensionIndex(data.mapDimension(coordDims[cDimIdx]));
|
||||
var vDimsI = map(data.mapDimensionsAll(coordDims[vDimIdx]), data.getDimensionIndex, data);
|
||||
var openDimI = vDimsI[0];
|
||||
var closeDimI = vDimsI[1];
|
||||
var lowestDimI = vDimsI[2];
|
||||
var highestDimI = vDimsI[3];
|
||||
data.setLayout({
|
||||
candleWidth: candleWidth,
|
||||
// The value is experimented visually.
|
||||
isSimpleBox: candleWidth <= 1.3
|
||||
});
|
||||
|
||||
if (cDimI < 0 || vDimsI.length < 4) {
|
||||
return;
|
||||
}
|
||||
|
||||
return {
|
||||
progress: seriesModel.pipelineContext.large ? largeProgress : normalProgress
|
||||
};
|
||||
|
||||
function normalProgress(params, data) {
|
||||
var dataIndex;
|
||||
var store = data.getStore();
|
||||
|
||||
while ((dataIndex = params.next()) != null) {
|
||||
var axisDimVal = store.get(cDimI, dataIndex);
|
||||
var openVal = store.get(openDimI, dataIndex);
|
||||
var closeVal = store.get(closeDimI, dataIndex);
|
||||
var lowestVal = store.get(lowestDimI, dataIndex);
|
||||
var highestVal = store.get(highestDimI, dataIndex);
|
||||
var ocLow = Math.min(openVal, closeVal);
|
||||
var ocHigh = Math.max(openVal, closeVal);
|
||||
var ocLowPoint = getPoint(ocLow, axisDimVal);
|
||||
var ocHighPoint = getPoint(ocHigh, axisDimVal);
|
||||
var lowestPoint = getPoint(lowestVal, axisDimVal);
|
||||
var highestPoint = getPoint(highestVal, axisDimVal);
|
||||
var ends = [];
|
||||
addBodyEnd(ends, ocHighPoint, 0);
|
||||
addBodyEnd(ends, ocLowPoint, 1);
|
||||
ends.push(subPixelOptimizePoint(highestPoint), subPixelOptimizePoint(ocHighPoint), subPixelOptimizePoint(lowestPoint), subPixelOptimizePoint(ocLowPoint));
|
||||
data.setItemLayout(dataIndex, {
|
||||
sign: getSign(store, dataIndex, openVal, closeVal, closeDimI),
|
||||
initBaseline: openVal > closeVal ? ocHighPoint[vDimIdx] : ocLowPoint[vDimIdx],
|
||||
ends: ends,
|
||||
brushRect: makeBrushRect(lowestVal, highestVal, axisDimVal)
|
||||
});
|
||||
}
|
||||
|
||||
function getPoint(val, axisDimVal) {
|
||||
var p = [];
|
||||
p[cDimIdx] = axisDimVal;
|
||||
p[vDimIdx] = val;
|
||||
return isNaN(axisDimVal) || isNaN(val) ? [NaN, NaN] : coordSys.dataToPoint(p);
|
||||
}
|
||||
|
||||
function addBodyEnd(ends, point, start) {
|
||||
var point1 = point.slice();
|
||||
var point2 = point.slice();
|
||||
point1[cDimIdx] = subPixelOptimize(point1[cDimIdx] + candleWidth / 2, 1, false);
|
||||
point2[cDimIdx] = subPixelOptimize(point2[cDimIdx] - candleWidth / 2, 1, true);
|
||||
start ? ends.push(point1, point2) : ends.push(point2, point1);
|
||||
}
|
||||
|
||||
function makeBrushRect(lowestVal, highestVal, axisDimVal) {
|
||||
var pmin = getPoint(lowestVal, axisDimVal);
|
||||
var pmax = getPoint(highestVal, axisDimVal);
|
||||
pmin[cDimIdx] -= candleWidth / 2;
|
||||
pmax[cDimIdx] -= candleWidth / 2;
|
||||
return {
|
||||
x: pmin[0],
|
||||
y: pmin[1],
|
||||
width: vDimIdx ? candleWidth : pmax[0] - pmin[0],
|
||||
height: vDimIdx ? pmax[1] - pmin[1] : candleWidth
|
||||
};
|
||||
}
|
||||
|
||||
function subPixelOptimizePoint(point) {
|
||||
point[cDimIdx] = subPixelOptimize(point[cDimIdx], 1);
|
||||
return point;
|
||||
}
|
||||
}
|
||||
|
||||
function largeProgress(params, data) {
|
||||
// Structure: [sign, x, yhigh, ylow, sign, x, yhigh, ylow, ...]
|
||||
var points = createFloat32Array(params.count * 4);
|
||||
var offset = 0;
|
||||
var point;
|
||||
var tmpIn = [];
|
||||
var tmpOut = [];
|
||||
var dataIndex;
|
||||
var store = data.getStore();
|
||||
|
||||
while ((dataIndex = params.next()) != null) {
|
||||
var axisDimVal = store.get(cDimI, dataIndex);
|
||||
var openVal = store.get(openDimI, dataIndex);
|
||||
var closeVal = store.get(closeDimI, dataIndex);
|
||||
var lowestVal = store.get(lowestDimI, dataIndex);
|
||||
var highestVal = store.get(highestDimI, dataIndex);
|
||||
|
||||
if (isNaN(axisDimVal) || isNaN(lowestVal) || isNaN(highestVal)) {
|
||||
points[offset++] = NaN;
|
||||
offset += 3;
|
||||
continue;
|
||||
}
|
||||
|
||||
points[offset++] = getSign(store, dataIndex, openVal, closeVal, closeDimI);
|
||||
tmpIn[cDimIdx] = axisDimVal;
|
||||
tmpIn[vDimIdx] = lowestVal;
|
||||
point = coordSys.dataToPoint(tmpIn, null, tmpOut);
|
||||
points[offset++] = point ? point[0] : NaN;
|
||||
points[offset++] = point ? point[1] : NaN;
|
||||
tmpIn[vDimIdx] = highestVal;
|
||||
point = coordSys.dataToPoint(tmpIn, null, tmpOut);
|
||||
points[offset++] = point ? point[1] : NaN;
|
||||
}
|
||||
|
||||
data.setLayout('largePoints', points);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function getSign(store, dataIndex, openVal, closeVal, closeDimI) {
|
||||
var sign;
|
||||
|
||||
if (openVal > closeVal) {
|
||||
sign = -1;
|
||||
} else if (openVal < closeVal) {
|
||||
sign = 1;
|
||||
} else {
|
||||
sign = dataIndex > 0 // If close === open, compare with close of last record
|
||||
? store.get(closeDimI, dataIndex - 1) <= closeVal ? 1 : -1 : // No record of previous, set to be positive
|
||||
1;
|
||||
}
|
||||
|
||||
return sign;
|
||||
}
|
||||
|
||||
function calculateCandleWidth(seriesModel, data) {
|
||||
var baseAxis = seriesModel.getBaseAxis();
|
||||
var extent;
|
||||
var bandWidth = baseAxis.type === 'category' ? baseAxis.getBandWidth() : (extent = baseAxis.getExtent(), Math.abs(extent[1] - extent[0]) / data.count());
|
||||
var barMaxWidth = parsePercent(retrieve2(seriesModel.get('barMaxWidth'), bandWidth), bandWidth);
|
||||
var barMinWidth = parsePercent(retrieve2(seriesModel.get('barMinWidth'), 1), bandWidth);
|
||||
var barWidth = seriesModel.get('barWidth');
|
||||
return barWidth != null ? parsePercent(barWidth, bandWidth) // Put max outer to ensure bar visible in spite of overlap.
|
||||
: Math.max(Math.min(bandWidth / 2, barMaxWidth), barMinWidth);
|
||||
}
|
||||
|
||||
export default candlestickLayout;
|
||||
87
uni-demo/node_modules/echarts/lib/chart/candlestick/candlestickVisual.js
generated
vendored
Normal file
87
uni-demo/node_modules/echarts/lib/chart/candlestick/candlestickVisual.js
generated
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
|
||||
/*
|
||||
* 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 createRenderPlanner from '../helper/createRenderPlanner.js';
|
||||
import { extend } from 'zrender/lib/core/util.js';
|
||||
var positiveBorderColorQuery = ['itemStyle', 'borderColor'];
|
||||
var negativeBorderColorQuery = ['itemStyle', 'borderColor0'];
|
||||
var positiveColorQuery = ['itemStyle', 'color'];
|
||||
var negativeColorQuery = ['itemStyle', 'color0'];
|
||||
var candlestickVisual = {
|
||||
seriesType: 'candlestick',
|
||||
plan: createRenderPlanner(),
|
||||
// For legend.
|
||||
performRawSeries: true,
|
||||
reset: function (seriesModel, ecModel) {
|
||||
function getColor(sign, model) {
|
||||
return model.get(sign > 0 ? positiveColorQuery : negativeColorQuery);
|
||||
}
|
||||
|
||||
function getBorderColor(sign, model) {
|
||||
return model.get(sign > 0 ? positiveBorderColorQuery : negativeBorderColorQuery);
|
||||
} // Only visible series has each data be visual encoded
|
||||
|
||||
|
||||
if (ecModel.isSeriesFiltered(seriesModel)) {
|
||||
return;
|
||||
}
|
||||
|
||||
var isLargeRender = seriesModel.pipelineContext.large;
|
||||
return !isLargeRender && {
|
||||
progress: function (params, data) {
|
||||
var dataIndex;
|
||||
|
||||
while ((dataIndex = params.next()) != null) {
|
||||
var itemModel = data.getItemModel(dataIndex);
|
||||
var sign = data.getItemLayout(dataIndex).sign;
|
||||
var style = itemModel.getItemStyle();
|
||||
style.fill = getColor(sign, itemModel);
|
||||
style.stroke = getBorderColor(sign, itemModel) || style.fill;
|
||||
var existsStyle = data.ensureUniqueItemVisual(dataIndex, 'style');
|
||||
extend(existsStyle, style);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
export default candlestickVisual;
|
||||
55
uni-demo/node_modules/echarts/lib/chart/candlestick/install.js
generated
vendored
Normal file
55
uni-demo/node_modules/echarts/lib/chart/candlestick/install.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 CandlestickView from './CandlestickView.js';
|
||||
import CandlestickSeriesModel from './CandlestickSeries.js';
|
||||
import preprocessor from './preprocessor.js';
|
||||
import candlestickVisual from './candlestickVisual.js';
|
||||
import candlestickLayout from './candlestickLayout.js';
|
||||
export function install(registers) {
|
||||
registers.registerChartView(CandlestickView);
|
||||
registers.registerSeriesModel(CandlestickSeriesModel);
|
||||
registers.registerPreprocessor(preprocessor);
|
||||
registers.registerVisual(candlestickVisual);
|
||||
registers.registerLayout(candlestickLayout);
|
||||
}
|
||||
56
uni-demo/node_modules/echarts/lib/chart/candlestick/preprocessor.js
generated
vendored
Normal file
56
uni-demo/node_modules/echarts/lib/chart/candlestick/preprocessor.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.
|
||||
*/
|
||||
import * as zrUtil from 'zrender/lib/core/util.js';
|
||||
export default function candlestickPreprocessor(option) {
|
||||
if (!option || !zrUtil.isArray(option.series)) {
|
||||
return;
|
||||
} // Translate 'k' to 'candlestick'.
|
||||
|
||||
|
||||
zrUtil.each(option.series, function (seriesItem) {
|
||||
if (zrUtil.isObject(seriesItem) && seriesItem.type === 'k') {
|
||||
seriesItem.type = 'candlestick';
|
||||
}
|
||||
});
|
||||
}
|
||||
46
uni-demo/node_modules/echarts/lib/chart/custom.js
generated
vendored
Normal file
46
uni-demo/node_modules/echarts/lib/chart/custom.js
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
|
||||
/*
|
||||
* 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 { use } from '../extension.js';
|
||||
import { install } from './custom/install.js';
|
||||
use(install);
|
||||
116
uni-demo/node_modules/echarts/lib/chart/custom/CustomSeries.js
generated
vendored
Normal file
116
uni-demo/node_modules/echarts/lib/chart/custom/CustomSeries.js
generated
vendored
Normal file
@@ -0,0 +1,116 @@
|
||||
|
||||
/*
|
||||
* 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 { makeInner } from '../../util/model.js';
|
||||
import SeriesModel from '../../model/Series.js'; // Also compat with ec4, where
|
||||
// `visual('color') visual('borderColor')` is supported.
|
||||
|
||||
export var STYLE_VISUAL_TYPE = {
|
||||
color: 'fill',
|
||||
borderColor: 'stroke'
|
||||
};
|
||||
export var NON_STYLE_VISUAL_PROPS = {
|
||||
symbol: 1,
|
||||
symbolSize: 1,
|
||||
symbolKeepAspect: 1,
|
||||
legendIcon: 1,
|
||||
visualMeta: 1,
|
||||
liftZ: 1,
|
||||
decal: 1
|
||||
};
|
||||
;
|
||||
export var customInnerStore = makeInner();
|
||||
|
||||
var CustomSeriesModel =
|
||||
/** @class */
|
||||
function (_super) {
|
||||
__extends(CustomSeriesModel, _super);
|
||||
|
||||
function CustomSeriesModel() {
|
||||
var _this = _super !== null && _super.apply(this, arguments) || this;
|
||||
|
||||
_this.type = CustomSeriesModel.type;
|
||||
return _this;
|
||||
}
|
||||
|
||||
CustomSeriesModel.prototype.optionUpdated = function () {
|
||||
this.currentZLevel = this.get('zlevel', true);
|
||||
this.currentZ = this.get('z', true);
|
||||
};
|
||||
|
||||
CustomSeriesModel.prototype.getInitialData = function (option, ecModel) {
|
||||
return createSeriesData(null, this);
|
||||
};
|
||||
|
||||
CustomSeriesModel.prototype.getDataParams = function (dataIndex, dataType, el) {
|
||||
var params = _super.prototype.getDataParams.call(this, dataIndex, dataType);
|
||||
|
||||
el && (params.info = customInnerStore(el).info);
|
||||
return params;
|
||||
};
|
||||
|
||||
CustomSeriesModel.type = 'series.custom';
|
||||
CustomSeriesModel.dependencies = ['grid', 'polar', 'geo', 'singleAxis', 'calendar'];
|
||||
CustomSeriesModel.defaultOption = {
|
||||
coordinateSystem: 'cartesian2d',
|
||||
// zlevel: 0,
|
||||
z: 2,
|
||||
legendHoverLink: true,
|
||||
// Custom series will not clip by default.
|
||||
// Some case will use custom series to draw label
|
||||
// For example https://echarts.apache.org/examples/en/editor.html?c=custom-gantt-flight
|
||||
clip: false // Cartesian coordinate system
|
||||
// xAxisIndex: 0,
|
||||
// yAxisIndex: 0,
|
||||
// Polar coordinate system
|
||||
// polarIndex: 0,
|
||||
// Geo coordinate system
|
||||
// geoIndex: 0,
|
||||
|
||||
};
|
||||
return CustomSeriesModel;
|
||||
}(SeriesModel);
|
||||
|
||||
export default CustomSeriesModel;
|
||||
1035
uni-demo/node_modules/echarts/lib/chart/custom/CustomView.js
generated
vendored
Normal file
1035
uni-demo/node_modules/echarts/lib/chart/custom/CustomView.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
49
uni-demo/node_modules/echarts/lib/chart/custom/install.js
generated
vendored
Normal file
49
uni-demo/node_modules/echarts/lib/chart/custom/install.js
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
|
||||
/*
|
||||
* 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 CustomSeriesModel from './CustomSeries.js';
|
||||
import CustomChartView from './CustomView.js';
|
||||
export function install(registers) {
|
||||
registers.registerChartView(CustomChartView);
|
||||
registers.registerSeriesModel(CustomSeriesModel);
|
||||
}
|
||||
46
uni-demo/node_modules/echarts/lib/chart/effectScatter.js
generated
vendored
Normal file
46
uni-demo/node_modules/echarts/lib/chart/effectScatter.js
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
|
||||
/*
|
||||
* 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 { use } from '../extension.js';
|
||||
import { install } from './effectScatter/install.js';
|
||||
use(install);
|
||||
114
uni-demo/node_modules/echarts/lib/chart/effectScatter/EffectScatterSeries.js
generated
vendored
Normal file
114
uni-demo/node_modules/echarts/lib/chart/effectScatter/EffectScatterSeries.js
generated
vendored
Normal file
@@ -0,0 +1,114 @@
|
||||
|
||||
/*
|
||||
* 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';
|
||||
|
||||
var EffectScatterSeriesModel =
|
||||
/** @class */
|
||||
function (_super) {
|
||||
__extends(EffectScatterSeriesModel, _super);
|
||||
|
||||
function EffectScatterSeriesModel() {
|
||||
var _this = _super !== null && _super.apply(this, arguments) || this;
|
||||
|
||||
_this.type = EffectScatterSeriesModel.type;
|
||||
_this.hasSymbolVisual = true;
|
||||
return _this;
|
||||
}
|
||||
|
||||
EffectScatterSeriesModel.prototype.getInitialData = function (option, ecModel) {
|
||||
return createSeriesData(null, this, {
|
||||
useEncodeDefaulter: true
|
||||
});
|
||||
};
|
||||
|
||||
EffectScatterSeriesModel.prototype.brushSelector = function (dataIndex, data, selectors) {
|
||||
return selectors.point(data.getItemLayout(dataIndex));
|
||||
};
|
||||
|
||||
EffectScatterSeriesModel.type = 'series.effectScatter';
|
||||
EffectScatterSeriesModel.dependencies = ['grid', 'polar'];
|
||||
EffectScatterSeriesModel.defaultOption = {
|
||||
coordinateSystem: 'cartesian2d',
|
||||
// zlevel: 0,
|
||||
z: 2,
|
||||
legendHoverLink: true,
|
||||
effectType: 'ripple',
|
||||
progressive: 0,
|
||||
// When to show the effect, option: 'render'|'emphasis'
|
||||
showEffectOn: 'render',
|
||||
clip: true,
|
||||
// Ripple effect config
|
||||
rippleEffect: {
|
||||
period: 4,
|
||||
// Scale of ripple
|
||||
scale: 2.5,
|
||||
// Brush type can be fill or stroke
|
||||
brushType: 'fill',
|
||||
// Ripple number
|
||||
number: 3
|
||||
},
|
||||
universalTransition: {
|
||||
divideShape: 'clone'
|
||||
},
|
||||
// Cartesian coordinate system
|
||||
// xAxisIndex: 0,
|
||||
// yAxisIndex: 0,
|
||||
// Polar coordinate system
|
||||
// polarIndex: 0,
|
||||
// Geo coordinate system
|
||||
// geoIndex: 0,
|
||||
// symbol: null, // 图形类型
|
||||
symbolSize: 10 // 图形大小,半宽(半径)参数,当图形为方向或菱形则总宽度为symbolSize * 2
|
||||
// symbolRotate: null, // 图形旋转控制
|
||||
// itemStyle: {
|
||||
// opacity: 1
|
||||
// }
|
||||
|
||||
};
|
||||
return EffectScatterSeriesModel;
|
||||
}(SeriesModel);
|
||||
|
||||
export default EffectScatterSeriesModel;
|
||||
115
uni-demo/node_modules/echarts/lib/chart/effectScatter/EffectScatterView.js
generated
vendored
Normal file
115
uni-demo/node_modules/echarts/lib/chart/effectScatter/EffectScatterView.js
generated
vendored
Normal file
@@ -0,0 +1,115 @@
|
||||
|
||||
/*
|
||||
* 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 SymbolDraw from '../helper/SymbolDraw.js';
|
||||
import EffectSymbol from '../helper/EffectSymbol.js';
|
||||
import * as matrix from 'zrender/lib/core/matrix.js';
|
||||
import pointsLayout from '../../layout/points.js';
|
||||
import ChartView from '../../view/Chart.js';
|
||||
|
||||
var EffectScatterView =
|
||||
/** @class */
|
||||
function (_super) {
|
||||
__extends(EffectScatterView, _super);
|
||||
|
||||
function EffectScatterView() {
|
||||
var _this = _super !== null && _super.apply(this, arguments) || this;
|
||||
|
||||
_this.type = EffectScatterView.type;
|
||||
return _this;
|
||||
}
|
||||
|
||||
EffectScatterView.prototype.init = function () {
|
||||
this._symbolDraw = new SymbolDraw(EffectSymbol);
|
||||
};
|
||||
|
||||
EffectScatterView.prototype.render = function (seriesModel, ecModel, api) {
|
||||
var data = seriesModel.getData();
|
||||
var effectSymbolDraw = this._symbolDraw;
|
||||
effectSymbolDraw.updateData(data, {
|
||||
clipShape: this._getClipShape(seriesModel)
|
||||
});
|
||||
this.group.add(effectSymbolDraw.group);
|
||||
};
|
||||
|
||||
EffectScatterView.prototype._getClipShape = function (seriesModel) {
|
||||
var coordSys = seriesModel.coordinateSystem;
|
||||
var clipArea = coordSys && coordSys.getArea && coordSys.getArea();
|
||||
return seriesModel.get('clip', true) ? clipArea : null;
|
||||
};
|
||||
|
||||
EffectScatterView.prototype.updateTransform = function (seriesModel, ecModel, api) {
|
||||
var data = seriesModel.getData();
|
||||
this.group.dirty();
|
||||
var res = pointsLayout('').reset(seriesModel, ecModel, api);
|
||||
|
||||
if (res.progress) {
|
||||
res.progress({
|
||||
start: 0,
|
||||
end: data.count(),
|
||||
count: data.count()
|
||||
}, data);
|
||||
}
|
||||
|
||||
this._symbolDraw.updateLayout();
|
||||
};
|
||||
|
||||
EffectScatterView.prototype._updateGroupTransform = function (seriesModel) {
|
||||
var coordSys = seriesModel.coordinateSystem;
|
||||
|
||||
if (coordSys && coordSys.getRoamTransform) {
|
||||
this.group.transform = matrix.clone(coordSys.getRoamTransform());
|
||||
this.group.decomposeTransform();
|
||||
}
|
||||
};
|
||||
|
||||
EffectScatterView.prototype.remove = function (ecModel, api) {
|
||||
this._symbolDraw && this._symbolDraw.remove(true);
|
||||
};
|
||||
|
||||
EffectScatterView.type = 'effectScatter';
|
||||
return EffectScatterView;
|
||||
}(ChartView);
|
||||
|
||||
export default EffectScatterView;
|
||||
51
uni-demo/node_modules/echarts/lib/chart/effectScatter/install.js
generated
vendored
Normal file
51
uni-demo/node_modules/echarts/lib/chart/effectScatter/install.js
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
|
||||
/*
|
||||
* 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 EffectScatterView from './EffectScatterView.js';
|
||||
import EffectScatterSeriesModel from './EffectScatterSeries.js';
|
||||
import layoutPoints from '../../layout/points.js';
|
||||
export function install(registers) {
|
||||
registers.registerChartView(EffectScatterView);
|
||||
registers.registerSeriesModel(EffectScatterSeriesModel);
|
||||
registers.registerLayout(layoutPoints('effectScatter'));
|
||||
}
|
||||
46
uni-demo/node_modules/echarts/lib/chart/funnel.js
generated
vendored
Normal file
46
uni-demo/node_modules/echarts/lib/chart/funnel.js
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
|
||||
/*
|
||||
* 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 { use } from '../extension.js';
|
||||
import { install } from './funnel/install.js';
|
||||
use(install);
|
||||
158
uni-demo/node_modules/echarts/lib/chart/funnel/FunnelSeries.js
generated
vendored
Normal file
158
uni-demo/node_modules/echarts/lib/chart/funnel/FunnelSeries.js
generated
vendored
Normal file
@@ -0,0 +1,158 @@
|
||||
|
||||
/*
|
||||
* 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';
|
||||
import createSeriesDataSimply from '../helper/createSeriesDataSimply.js';
|
||||
import { defaultEmphasis } from '../../util/model.js';
|
||||
import { makeSeriesEncodeForNameBased } from '../../data/helper/sourceHelper.js';
|
||||
import LegendVisualProvider from '../../visual/LegendVisualProvider.js';
|
||||
import SeriesModel from '../../model/Series.js';
|
||||
|
||||
var FunnelSeriesModel =
|
||||
/** @class */
|
||||
function (_super) {
|
||||
__extends(FunnelSeriesModel, _super);
|
||||
|
||||
function FunnelSeriesModel() {
|
||||
var _this = _super !== null && _super.apply(this, arguments) || this;
|
||||
|
||||
_this.type = FunnelSeriesModel.type;
|
||||
return _this;
|
||||
}
|
||||
|
||||
FunnelSeriesModel.prototype.init = function (option) {
|
||||
_super.prototype.init.apply(this, arguments); // Enable legend selection for each data item
|
||||
// Use a function instead of direct access because data reference may changed
|
||||
|
||||
|
||||
this.legendVisualProvider = new LegendVisualProvider(zrUtil.bind(this.getData, this), zrUtil.bind(this.getRawData, this)); // Extend labelLine emphasis
|
||||
|
||||
this._defaultLabelLine(option);
|
||||
};
|
||||
|
||||
FunnelSeriesModel.prototype.getInitialData = function (option, ecModel) {
|
||||
return createSeriesDataSimply(this, {
|
||||
coordDimensions: ['value'],
|
||||
encodeDefaulter: zrUtil.curry(makeSeriesEncodeForNameBased, this)
|
||||
});
|
||||
};
|
||||
|
||||
FunnelSeriesModel.prototype._defaultLabelLine = function (option) {
|
||||
// Extend labelLine emphasis
|
||||
defaultEmphasis(option, 'labelLine', ['show']);
|
||||
var labelLineNormalOpt = option.labelLine;
|
||||
var labelLineEmphasisOpt = option.emphasis.labelLine; // Not show label line if `label.normal.show = false`
|
||||
|
||||
labelLineNormalOpt.show = labelLineNormalOpt.show && option.label.show;
|
||||
labelLineEmphasisOpt.show = labelLineEmphasisOpt.show && option.emphasis.label.show;
|
||||
}; // Overwrite
|
||||
|
||||
|
||||
FunnelSeriesModel.prototype.getDataParams = function (dataIndex) {
|
||||
var data = this.getData();
|
||||
|
||||
var params = _super.prototype.getDataParams.call(this, dataIndex);
|
||||
|
||||
var valueDim = data.mapDimension('value');
|
||||
var sum = data.getSum(valueDim); // Percent is 0 if sum is 0
|
||||
|
||||
params.percent = !sum ? 0 : +(data.get(valueDim, dataIndex) / sum * 100).toFixed(2);
|
||||
params.$vars.push('percent');
|
||||
return params;
|
||||
};
|
||||
|
||||
FunnelSeriesModel.type = 'series.funnel';
|
||||
FunnelSeriesModel.defaultOption = {
|
||||
// zlevel: 0, // 一级层叠
|
||||
z: 2,
|
||||
legendHoverLink: true,
|
||||
colorBy: 'data',
|
||||
left: 80,
|
||||
top: 60,
|
||||
right: 80,
|
||||
bottom: 60,
|
||||
// width: {totalWidth} - left - right,
|
||||
// height: {totalHeight} - top - bottom,
|
||||
// 默认取数据最小最大值
|
||||
// min: 0,
|
||||
// max: 100,
|
||||
minSize: '0%',
|
||||
maxSize: '100%',
|
||||
sort: 'descending',
|
||||
orient: 'vertical',
|
||||
gap: 0,
|
||||
funnelAlign: 'center',
|
||||
label: {
|
||||
show: true,
|
||||
position: 'outer' // formatter: 标签文本格式器,同Tooltip.formatter,不支持异步回调
|
||||
|
||||
},
|
||||
labelLine: {
|
||||
show: true,
|
||||
length: 20,
|
||||
lineStyle: {
|
||||
// color: 各异,
|
||||
width: 1
|
||||
}
|
||||
},
|
||||
itemStyle: {
|
||||
// color: 各异,
|
||||
borderColor: '#fff',
|
||||
borderWidth: 1
|
||||
},
|
||||
emphasis: {
|
||||
label: {
|
||||
show: true
|
||||
}
|
||||
},
|
||||
select: {
|
||||
itemStyle: {
|
||||
borderColor: '#212121'
|
||||
}
|
||||
}
|
||||
};
|
||||
return FunnelSeriesModel;
|
||||
}(SeriesModel);
|
||||
|
||||
export default FunnelSeriesModel;
|
||||
224
uni-demo/node_modules/echarts/lib/chart/funnel/FunnelView.js
generated
vendored
Normal file
224
uni-demo/node_modules/echarts/lib/chart/funnel/FunnelView.js
generated
vendored
Normal file
@@ -0,0 +1,224 @@
|
||||
|
||||
/*
|
||||
* 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 graphic from '../../util/graphic.js';
|
||||
import { setStatesStylesFromModel, toggleHoverEmphasis } from '../../util/states.js';
|
||||
import ChartView from '../../view/Chart.js';
|
||||
import { setLabelLineStyle, getLabelLineStatesModels } from '../../label/labelGuideHelper.js';
|
||||
import { setLabelStyle, getLabelStatesModels } from '../../label/labelStyle.js';
|
||||
import { saveOldStyle } from '../../animation/basicTrasition.js';
|
||||
var opacityAccessPath = ['itemStyle', 'opacity'];
|
||||
/**
|
||||
* Piece of pie including Sector, Label, LabelLine
|
||||
*/
|
||||
|
||||
var FunnelPiece =
|
||||
/** @class */
|
||||
function (_super) {
|
||||
__extends(FunnelPiece, _super);
|
||||
|
||||
function FunnelPiece(data, idx) {
|
||||
var _this = _super.call(this) || this;
|
||||
|
||||
var polygon = _this;
|
||||
var labelLine = new graphic.Polyline();
|
||||
var text = new graphic.Text();
|
||||
polygon.setTextContent(text);
|
||||
|
||||
_this.setTextGuideLine(labelLine);
|
||||
|
||||
_this.updateData(data, idx, true);
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
FunnelPiece.prototype.updateData = function (data, idx, firstCreate) {
|
||||
var polygon = this;
|
||||
var seriesModel = data.hostModel;
|
||||
var itemModel = data.getItemModel(idx);
|
||||
var layout = data.getItemLayout(idx);
|
||||
var emphasisModel = itemModel.getModel('emphasis');
|
||||
var opacity = itemModel.get(opacityAccessPath);
|
||||
opacity = opacity == null ? 1 : opacity;
|
||||
|
||||
if (!firstCreate) {
|
||||
saveOldStyle(polygon);
|
||||
} // Update common style
|
||||
|
||||
|
||||
polygon.useStyle(data.getItemVisual(idx, 'style'));
|
||||
polygon.style.lineJoin = 'round';
|
||||
|
||||
if (firstCreate) {
|
||||
polygon.setShape({
|
||||
points: layout.points
|
||||
});
|
||||
polygon.style.opacity = 0;
|
||||
graphic.initProps(polygon, {
|
||||
style: {
|
||||
opacity: opacity
|
||||
}
|
||||
}, seriesModel, idx);
|
||||
} else {
|
||||
graphic.updateProps(polygon, {
|
||||
style: {
|
||||
opacity: opacity
|
||||
},
|
||||
shape: {
|
||||
points: layout.points
|
||||
}
|
||||
}, seriesModel, idx);
|
||||
}
|
||||
|
||||
setStatesStylesFromModel(polygon, itemModel);
|
||||
|
||||
this._updateLabel(data, idx);
|
||||
|
||||
toggleHoverEmphasis(this, emphasisModel.get('focus'), emphasisModel.get('blurScope'), emphasisModel.get('disabled'));
|
||||
};
|
||||
|
||||
FunnelPiece.prototype._updateLabel = function (data, idx) {
|
||||
var polygon = this;
|
||||
var labelLine = this.getTextGuideLine();
|
||||
var labelText = polygon.getTextContent();
|
||||
var seriesModel = data.hostModel;
|
||||
var itemModel = data.getItemModel(idx);
|
||||
var layout = data.getItemLayout(idx);
|
||||
var labelLayout = layout.label;
|
||||
var style = data.getItemVisual(idx, 'style');
|
||||
var visualColor = style.fill;
|
||||
setLabelStyle( // position will not be used in setLabelStyle
|
||||
labelText, getLabelStatesModels(itemModel), {
|
||||
labelFetcher: data.hostModel,
|
||||
labelDataIndex: idx,
|
||||
defaultOpacity: style.opacity,
|
||||
defaultText: data.getName(idx)
|
||||
}, {
|
||||
normal: {
|
||||
align: labelLayout.textAlign,
|
||||
verticalAlign: labelLayout.verticalAlign
|
||||
}
|
||||
});
|
||||
polygon.setTextConfig({
|
||||
local: true,
|
||||
inside: !!labelLayout.inside,
|
||||
insideStroke: visualColor,
|
||||
// insideFill: 'auto',
|
||||
outsideFill: visualColor
|
||||
});
|
||||
var linePoints = labelLayout.linePoints;
|
||||
labelLine.setShape({
|
||||
points: linePoints
|
||||
});
|
||||
polygon.textGuideLineConfig = {
|
||||
anchor: linePoints ? new graphic.Point(linePoints[0][0], linePoints[0][1]) : null
|
||||
}; // Make sure update style on labelText after setLabelStyle.
|
||||
// Because setLabelStyle will replace a new style on it.
|
||||
|
||||
graphic.updateProps(labelText, {
|
||||
style: {
|
||||
x: labelLayout.x,
|
||||
y: labelLayout.y
|
||||
}
|
||||
}, seriesModel, idx);
|
||||
labelText.attr({
|
||||
rotation: labelLayout.rotation,
|
||||
originX: labelLayout.x,
|
||||
originY: labelLayout.y,
|
||||
z2: 10
|
||||
});
|
||||
setLabelLineStyle(polygon, getLabelLineStatesModels(itemModel), {
|
||||
// Default use item visual color
|
||||
stroke: visualColor
|
||||
});
|
||||
};
|
||||
|
||||
return FunnelPiece;
|
||||
}(graphic.Polygon);
|
||||
|
||||
var FunnelView =
|
||||
/** @class */
|
||||
function (_super) {
|
||||
__extends(FunnelView, _super);
|
||||
|
||||
function FunnelView() {
|
||||
var _this = _super !== null && _super.apply(this, arguments) || this;
|
||||
|
||||
_this.type = FunnelView.type;
|
||||
_this.ignoreLabelLineUpdate = true;
|
||||
return _this;
|
||||
}
|
||||
|
||||
FunnelView.prototype.render = function (seriesModel, ecModel, api) {
|
||||
var data = seriesModel.getData();
|
||||
var oldData = this._data;
|
||||
var group = this.group;
|
||||
data.diff(oldData).add(function (idx) {
|
||||
var funnelPiece = new FunnelPiece(data, idx);
|
||||
data.setItemGraphicEl(idx, funnelPiece);
|
||||
group.add(funnelPiece);
|
||||
}).update(function (newIdx, oldIdx) {
|
||||
var piece = oldData.getItemGraphicEl(oldIdx);
|
||||
piece.updateData(data, newIdx);
|
||||
group.add(piece);
|
||||
data.setItemGraphicEl(newIdx, piece);
|
||||
}).remove(function (idx) {
|
||||
var piece = oldData.getItemGraphicEl(idx);
|
||||
graphic.removeElementWithFadeOut(piece, seriesModel, idx);
|
||||
}).execute();
|
||||
this._data = data;
|
||||
};
|
||||
|
||||
FunnelView.prototype.remove = function () {
|
||||
this.group.removeAll();
|
||||
this._data = null;
|
||||
};
|
||||
|
||||
FunnelView.prototype.dispose = function () {};
|
||||
|
||||
FunnelView.type = 'funnel';
|
||||
return FunnelView;
|
||||
}(ChartView);
|
||||
|
||||
export default FunnelView;
|
||||
389
uni-demo/node_modules/echarts/lib/chart/funnel/funnelLayout.js
generated
vendored
Normal file
389
uni-demo/node_modules/echarts/lib/chart/funnel/funnelLayout.js
generated
vendored
Normal file
@@ -0,0 +1,389 @@
|
||||
|
||||
/*
|
||||
* 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 layout from '../../util/layout.js';
|
||||
import { parsePercent, linearMap } from '../../util/number.js';
|
||||
import { isFunction } from 'zrender/lib/core/util.js';
|
||||
|
||||
function getViewRect(seriesModel, api) {
|
||||
return layout.getLayoutRect(seriesModel.getBoxLayoutParams(), {
|
||||
width: api.getWidth(),
|
||||
height: api.getHeight()
|
||||
});
|
||||
}
|
||||
|
||||
function getSortedIndices(data, sort) {
|
||||
var valueDim = data.mapDimension('value');
|
||||
var valueArr = data.mapArray(valueDim, function (val) {
|
||||
return val;
|
||||
});
|
||||
var indices = [];
|
||||
var isAscending = sort === 'ascending';
|
||||
|
||||
for (var i = 0, len = data.count(); i < len; i++) {
|
||||
indices[i] = i;
|
||||
} // Add custom sortable function & none sortable opetion by "options.sort"
|
||||
|
||||
|
||||
if (isFunction(sort)) {
|
||||
indices.sort(sort);
|
||||
} else if (sort !== 'none') {
|
||||
indices.sort(function (a, b) {
|
||||
return isAscending ? valueArr[a] - valueArr[b] : valueArr[b] - valueArr[a];
|
||||
});
|
||||
}
|
||||
|
||||
return indices;
|
||||
}
|
||||
|
||||
function labelLayout(data) {
|
||||
var seriesModel = data.hostModel;
|
||||
var orient = seriesModel.get('orient');
|
||||
data.each(function (idx) {
|
||||
var itemModel = data.getItemModel(idx);
|
||||
var labelModel = itemModel.getModel('label');
|
||||
var labelPosition = labelModel.get('position');
|
||||
var labelLineModel = itemModel.getModel('labelLine');
|
||||
var layout = data.getItemLayout(idx);
|
||||
var points = layout.points;
|
||||
var isLabelInside = labelPosition === 'inner' || labelPosition === 'inside' || labelPosition === 'center' || labelPosition === 'insideLeft' || labelPosition === 'insideRight';
|
||||
var textAlign;
|
||||
var textX;
|
||||
var textY;
|
||||
var linePoints;
|
||||
|
||||
if (isLabelInside) {
|
||||
if (labelPosition === 'insideLeft') {
|
||||
textX = (points[0][0] + points[3][0]) / 2 + 5;
|
||||
textY = (points[0][1] + points[3][1]) / 2;
|
||||
textAlign = 'left';
|
||||
} else if (labelPosition === 'insideRight') {
|
||||
textX = (points[1][0] + points[2][0]) / 2 - 5;
|
||||
textY = (points[1][1] + points[2][1]) / 2;
|
||||
textAlign = 'right';
|
||||
} else {
|
||||
textX = (points[0][0] + points[1][0] + points[2][0] + points[3][0]) / 4;
|
||||
textY = (points[0][1] + points[1][1] + points[2][1] + points[3][1]) / 4;
|
||||
textAlign = 'center';
|
||||
}
|
||||
|
||||
linePoints = [[textX, textY], [textX, textY]];
|
||||
} else {
|
||||
var x1 = void 0;
|
||||
var y1 = void 0;
|
||||
var x2 = void 0;
|
||||
var y2 = void 0;
|
||||
var labelLineLen = labelLineModel.get('length');
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (orient === 'vertical' && ['top', 'bottom'].indexOf(labelPosition) > -1) {
|
||||
labelPosition = 'left';
|
||||
console.warn('Position error: Funnel chart on vertical orient dose not support top and bottom.');
|
||||
}
|
||||
|
||||
if (orient === 'horizontal' && ['left', 'right'].indexOf(labelPosition) > -1) {
|
||||
labelPosition = 'bottom';
|
||||
console.warn('Position error: Funnel chart on horizontal orient dose not support left and right.');
|
||||
}
|
||||
}
|
||||
|
||||
if (labelPosition === 'left') {
|
||||
// Left side
|
||||
x1 = (points[3][0] + points[0][0]) / 2;
|
||||
y1 = (points[3][1] + points[0][1]) / 2;
|
||||
x2 = x1 - labelLineLen;
|
||||
textX = x2 - 5;
|
||||
textAlign = 'right';
|
||||
} else if (labelPosition === 'right') {
|
||||
// Right side
|
||||
x1 = (points[1][0] + points[2][0]) / 2;
|
||||
y1 = (points[1][1] + points[2][1]) / 2;
|
||||
x2 = x1 + labelLineLen;
|
||||
textX = x2 + 5;
|
||||
textAlign = 'left';
|
||||
} else if (labelPosition === 'top') {
|
||||
// Top side
|
||||
x1 = (points[3][0] + points[0][0]) / 2;
|
||||
y1 = (points[3][1] + points[0][1]) / 2;
|
||||
y2 = y1 - labelLineLen;
|
||||
textY = y2 - 5;
|
||||
textAlign = 'center';
|
||||
} else if (labelPosition === 'bottom') {
|
||||
// Bottom side
|
||||
x1 = (points[1][0] + points[2][0]) / 2;
|
||||
y1 = (points[1][1] + points[2][1]) / 2;
|
||||
y2 = y1 + labelLineLen;
|
||||
textY = y2 + 5;
|
||||
textAlign = 'center';
|
||||
} else if (labelPosition === 'rightTop') {
|
||||
// RightTop side
|
||||
x1 = orient === 'horizontal' ? points[3][0] : points[1][0];
|
||||
y1 = orient === 'horizontal' ? points[3][1] : points[1][1];
|
||||
|
||||
if (orient === 'horizontal') {
|
||||
y2 = y1 - labelLineLen;
|
||||
textY = y2 - 5;
|
||||
textAlign = 'center';
|
||||
} else {
|
||||
x2 = x1 + labelLineLen;
|
||||
textX = x2 + 5;
|
||||
textAlign = 'top';
|
||||
}
|
||||
} else if (labelPosition === 'rightBottom') {
|
||||
// RightBottom side
|
||||
x1 = points[2][0];
|
||||
y1 = points[2][1];
|
||||
|
||||
if (orient === 'horizontal') {
|
||||
y2 = y1 + labelLineLen;
|
||||
textY = y2 + 5;
|
||||
textAlign = 'center';
|
||||
} else {
|
||||
x2 = x1 + labelLineLen;
|
||||
textX = x2 + 5;
|
||||
textAlign = 'bottom';
|
||||
}
|
||||
} else if (labelPosition === 'leftTop') {
|
||||
// LeftTop side
|
||||
x1 = points[0][0];
|
||||
y1 = orient === 'horizontal' ? points[0][1] : points[1][1];
|
||||
|
||||
if (orient === 'horizontal') {
|
||||
y2 = y1 - labelLineLen;
|
||||
textY = y2 - 5;
|
||||
textAlign = 'center';
|
||||
} else {
|
||||
x2 = x1 - labelLineLen;
|
||||
textX = x2 - 5;
|
||||
textAlign = 'right';
|
||||
}
|
||||
} else if (labelPosition === 'leftBottom') {
|
||||
// LeftBottom side
|
||||
x1 = orient === 'horizontal' ? points[1][0] : points[3][0];
|
||||
y1 = orient === 'horizontal' ? points[1][1] : points[2][1];
|
||||
|
||||
if (orient === 'horizontal') {
|
||||
y2 = y1 + labelLineLen;
|
||||
textY = y2 + 5;
|
||||
textAlign = 'center';
|
||||
} else {
|
||||
x2 = x1 - labelLineLen;
|
||||
textX = x2 - 5;
|
||||
textAlign = 'right';
|
||||
}
|
||||
} else {
|
||||
// Right side or Bottom side
|
||||
x1 = (points[1][0] + points[2][0]) / 2;
|
||||
y1 = (points[1][1] + points[2][1]) / 2;
|
||||
|
||||
if (orient === 'horizontal') {
|
||||
y2 = y1 + labelLineLen;
|
||||
textY = y2 + 5;
|
||||
textAlign = 'center';
|
||||
} else {
|
||||
x2 = x1 + labelLineLen;
|
||||
textX = x2 + 5;
|
||||
textAlign = 'left';
|
||||
}
|
||||
}
|
||||
|
||||
if (orient === 'horizontal') {
|
||||
x2 = x1;
|
||||
textX = x2;
|
||||
} else {
|
||||
y2 = y1;
|
||||
textY = y2;
|
||||
}
|
||||
|
||||
linePoints = [[x1, y1], [x2, y2]];
|
||||
}
|
||||
|
||||
layout.label = {
|
||||
linePoints: linePoints,
|
||||
x: textX,
|
||||
y: textY,
|
||||
verticalAlign: 'middle',
|
||||
textAlign: textAlign,
|
||||
inside: isLabelInside
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
export default function funnelLayout(ecModel, api) {
|
||||
ecModel.eachSeriesByType('funnel', function (seriesModel) {
|
||||
var data = seriesModel.getData();
|
||||
var valueDim = data.mapDimension('value');
|
||||
var sort = seriesModel.get('sort');
|
||||
var viewRect = getViewRect(seriesModel, api);
|
||||
var orient = seriesModel.get('orient');
|
||||
var viewWidth = viewRect.width;
|
||||
var viewHeight = viewRect.height;
|
||||
var indices = getSortedIndices(data, sort);
|
||||
var x = viewRect.x;
|
||||
var y = viewRect.y;
|
||||
var sizeExtent = orient === 'horizontal' ? [parsePercent(seriesModel.get('minSize'), viewHeight), parsePercent(seriesModel.get('maxSize'), viewHeight)] : [parsePercent(seriesModel.get('minSize'), viewWidth), parsePercent(seriesModel.get('maxSize'), viewWidth)];
|
||||
var dataExtent = data.getDataExtent(valueDim);
|
||||
var min = seriesModel.get('min');
|
||||
var max = seriesModel.get('max');
|
||||
|
||||
if (min == null) {
|
||||
min = Math.min(dataExtent[0], 0);
|
||||
}
|
||||
|
||||
if (max == null) {
|
||||
max = dataExtent[1];
|
||||
}
|
||||
|
||||
var funnelAlign = seriesModel.get('funnelAlign');
|
||||
var gap = seriesModel.get('gap');
|
||||
var viewSize = orient === 'horizontal' ? viewWidth : viewHeight;
|
||||
var itemSize = (viewSize - gap * (data.count() - 1)) / data.count();
|
||||
|
||||
var getLinePoints = function (idx, offset) {
|
||||
// End point index is data.count() and we assign it 0
|
||||
if (orient === 'horizontal') {
|
||||
var val_1 = data.get(valueDim, idx) || 0;
|
||||
var itemHeight = linearMap(val_1, [min, max], sizeExtent, true);
|
||||
var y0 = void 0;
|
||||
|
||||
switch (funnelAlign) {
|
||||
case 'top':
|
||||
y0 = y;
|
||||
break;
|
||||
|
||||
case 'center':
|
||||
y0 = y + (viewHeight - itemHeight) / 2;
|
||||
break;
|
||||
|
||||
case 'bottom':
|
||||
y0 = y + (viewHeight - itemHeight);
|
||||
break;
|
||||
}
|
||||
|
||||
return [[offset, y0], [offset, y0 + itemHeight]];
|
||||
}
|
||||
|
||||
var val = data.get(valueDim, idx) || 0;
|
||||
var itemWidth = linearMap(val, [min, max], sizeExtent, true);
|
||||
var x0;
|
||||
|
||||
switch (funnelAlign) {
|
||||
case 'left':
|
||||
x0 = x;
|
||||
break;
|
||||
|
||||
case 'center':
|
||||
x0 = x + (viewWidth - itemWidth) / 2;
|
||||
break;
|
||||
|
||||
case 'right':
|
||||
x0 = x + viewWidth - itemWidth;
|
||||
break;
|
||||
}
|
||||
|
||||
return [[x0, offset], [x0 + itemWidth, offset]];
|
||||
};
|
||||
|
||||
if (sort === 'ascending') {
|
||||
// From bottom to top
|
||||
itemSize = -itemSize;
|
||||
gap = -gap;
|
||||
|
||||
if (orient === 'horizontal') {
|
||||
x += viewWidth;
|
||||
} else {
|
||||
y += viewHeight;
|
||||
}
|
||||
|
||||
indices = indices.reverse();
|
||||
}
|
||||
|
||||
for (var i = 0; i < indices.length; i++) {
|
||||
var idx = indices[i];
|
||||
var nextIdx = indices[i + 1];
|
||||
var itemModel = data.getItemModel(idx);
|
||||
|
||||
if (orient === 'horizontal') {
|
||||
var width = itemModel.get(['itemStyle', 'width']);
|
||||
|
||||
if (width == null) {
|
||||
width = itemSize;
|
||||
} else {
|
||||
width = parsePercent(width, viewWidth);
|
||||
|
||||
if (sort === 'ascending') {
|
||||
width = -width;
|
||||
}
|
||||
}
|
||||
|
||||
var start = getLinePoints(idx, x);
|
||||
var end = getLinePoints(nextIdx, x + width);
|
||||
x += width + gap;
|
||||
data.setItemLayout(idx, {
|
||||
points: start.concat(end.slice().reverse())
|
||||
});
|
||||
} else {
|
||||
var height = itemModel.get(['itemStyle', 'height']);
|
||||
|
||||
if (height == null) {
|
||||
height = itemSize;
|
||||
} else {
|
||||
height = parsePercent(height, viewHeight);
|
||||
|
||||
if (sort === 'ascending') {
|
||||
height = -height;
|
||||
}
|
||||
}
|
||||
|
||||
var start = getLinePoints(idx, y);
|
||||
var end = getLinePoints(nextIdx, y + height);
|
||||
y += height + gap;
|
||||
data.setItemLayout(idx, {
|
||||
points: start.concat(end.slice().reverse())
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
labelLayout(data);
|
||||
});
|
||||
}
|
||||
53
uni-demo/node_modules/echarts/lib/chart/funnel/install.js
generated
vendored
Normal file
53
uni-demo/node_modules/echarts/lib/chart/funnel/install.js
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
|
||||
/*
|
||||
* 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 FunnelView from './FunnelView.js';
|
||||
import FunnelSeriesModel from './FunnelSeries.js';
|
||||
import funnelLayout from './funnelLayout.js';
|
||||
import dataFilter from '../../processor/dataFilter.js';
|
||||
export function install(registers) {
|
||||
registers.registerChartView(FunnelView);
|
||||
registers.registerSeriesModel(FunnelSeriesModel);
|
||||
registers.registerLayout(funnelLayout);
|
||||
registers.registerProcessor(dataFilter('funnel'));
|
||||
}
|
||||
46
uni-demo/node_modules/echarts/lib/chart/gauge.js
generated
vendored
Normal file
46
uni-demo/node_modules/echarts/lib/chart/gauge.js
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
|
||||
/*
|
||||
* 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 { use } from '../extension.js';
|
||||
import { install } from './gauge/install.js';
|
||||
use(install);
|
||||
192
uni-demo/node_modules/echarts/lib/chart/gauge/GaugeSeries.js
generated
vendored
Normal file
192
uni-demo/node_modules/echarts/lib/chart/gauge/GaugeSeries.js
generated
vendored
Normal file
@@ -0,0 +1,192 @@
|
||||
|
||||
/*
|
||||
* 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 createSeriesDataSimply from '../helper/createSeriesDataSimply.js';
|
||||
import SeriesModel from '../../model/Series.js';
|
||||
|
||||
var GaugeSeriesModel =
|
||||
/** @class */
|
||||
function (_super) {
|
||||
__extends(GaugeSeriesModel, _super);
|
||||
|
||||
function GaugeSeriesModel() {
|
||||
var _this = _super !== null && _super.apply(this, arguments) || this;
|
||||
|
||||
_this.type = GaugeSeriesModel.type;
|
||||
_this.visualStyleAccessPath = 'itemStyle';
|
||||
return _this;
|
||||
}
|
||||
|
||||
GaugeSeriesModel.prototype.getInitialData = function (option, ecModel) {
|
||||
return createSeriesDataSimply(this, ['value']);
|
||||
};
|
||||
|
||||
GaugeSeriesModel.type = 'series.gauge';
|
||||
GaugeSeriesModel.defaultOption = {
|
||||
// zlevel: 0,
|
||||
z: 2,
|
||||
colorBy: 'data',
|
||||
// 默认全局居中
|
||||
center: ['50%', '50%'],
|
||||
legendHoverLink: true,
|
||||
radius: '75%',
|
||||
startAngle: 225,
|
||||
endAngle: -45,
|
||||
clockwise: true,
|
||||
// 最小值
|
||||
min: 0,
|
||||
// 最大值
|
||||
max: 100,
|
||||
// 分割段数,默认为10
|
||||
splitNumber: 10,
|
||||
// 坐标轴线
|
||||
axisLine: {
|
||||
// 默认显示,属性show控制显示与否
|
||||
show: true,
|
||||
roundCap: false,
|
||||
lineStyle: {
|
||||
color: [[1, '#E6EBF8']],
|
||||
width: 10
|
||||
}
|
||||
},
|
||||
// 坐标轴线
|
||||
progress: {
|
||||
// 默认显示,属性show控制显示与否
|
||||
show: false,
|
||||
overlap: true,
|
||||
width: 10,
|
||||
roundCap: false,
|
||||
clip: true
|
||||
},
|
||||
// 分隔线
|
||||
splitLine: {
|
||||
// 默认显示,属性show控制显示与否
|
||||
show: true,
|
||||
// 属性length控制线长
|
||||
length: 10,
|
||||
distance: 10,
|
||||
// 属性lineStyle(详见lineStyle)控制线条样式
|
||||
lineStyle: {
|
||||
color: '#63677A',
|
||||
width: 3,
|
||||
type: 'solid'
|
||||
}
|
||||
},
|
||||
// 坐标轴小标记
|
||||
axisTick: {
|
||||
// 属性show控制显示与否,默认不显示
|
||||
show: true,
|
||||
// 每份split细分多少段
|
||||
splitNumber: 5,
|
||||
// 属性length控制线长
|
||||
length: 6,
|
||||
distance: 10,
|
||||
// 属性lineStyle控制线条样式
|
||||
lineStyle: {
|
||||
color: '#63677A',
|
||||
width: 1,
|
||||
type: 'solid'
|
||||
}
|
||||
},
|
||||
axisLabel: {
|
||||
show: true,
|
||||
distance: 15,
|
||||
// formatter: null,
|
||||
color: '#464646',
|
||||
fontSize: 12
|
||||
},
|
||||
pointer: {
|
||||
icon: null,
|
||||
offsetCenter: [0, 0],
|
||||
show: true,
|
||||
showAbove: true,
|
||||
length: '60%',
|
||||
width: 6,
|
||||
keepAspect: false
|
||||
},
|
||||
anchor: {
|
||||
show: false,
|
||||
showAbove: false,
|
||||
size: 6,
|
||||
icon: 'circle',
|
||||
offsetCenter: [0, 0],
|
||||
keepAspect: false,
|
||||
itemStyle: {
|
||||
color: '#fff',
|
||||
borderWidth: 0,
|
||||
borderColor: '#5470c6'
|
||||
}
|
||||
},
|
||||
title: {
|
||||
show: true,
|
||||
// x, y,单位px
|
||||
offsetCenter: [0, '20%'],
|
||||
// 其余属性默认使用全局文本样式,详见TEXTSTYLE
|
||||
color: '#464646',
|
||||
fontSize: 16,
|
||||
valueAnimation: false
|
||||
},
|
||||
detail: {
|
||||
show: true,
|
||||
backgroundColor: 'rgba(0,0,0,0)',
|
||||
borderWidth: 0,
|
||||
borderColor: '#ccc',
|
||||
width: 100,
|
||||
height: null,
|
||||
padding: [5, 10],
|
||||
// x, y,单位px
|
||||
offsetCenter: [0, '40%'],
|
||||
// formatter: null,
|
||||
// 其余属性默认使用全局文本样式,详见TEXTSTYLE
|
||||
color: '#464646',
|
||||
fontSize: 30,
|
||||
fontWeight: 'bold',
|
||||
lineHeight: 30,
|
||||
valueAnimation: false
|
||||
}
|
||||
};
|
||||
return GaugeSeriesModel;
|
||||
}(SeriesModel);
|
||||
|
||||
export default GaugeSeriesModel;
|
||||
580
uni-demo/node_modules/echarts/lib/chart/gauge/GaugeView.js
generated
vendored
Normal file
580
uni-demo/node_modules/echarts/lib/chart/gauge/GaugeView.js
generated
vendored
Normal file
@@ -0,0 +1,580 @@
|
||||
|
||||
/*
|
||||
* 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 PointerPath from './PointerPath.js';
|
||||
import * as graphic from '../../util/graphic.js';
|
||||
import { setStatesStylesFromModel, toggleHoverEmphasis } from '../../util/states.js';
|
||||
import { createTextStyle, setLabelValueAnimation, animateLabelValue } from '../../label/labelStyle.js';
|
||||
import ChartView from '../../view/Chart.js';
|
||||
import { parsePercent, round, linearMap } from '../../util/number.js';
|
||||
import Sausage from '../../util/shape/sausage.js';
|
||||
import { createSymbol } from '../../util/symbol.js';
|
||||
import ZRImage from 'zrender/lib/graphic/Image.js';
|
||||
import { extend, isFunction, isString } from 'zrender/lib/core/util.js';
|
||||
import { setCommonECData } from '../../util/innerStore.js';
|
||||
import { normalizeArcAngles } from 'zrender/lib/core/PathProxy.js';
|
||||
|
||||
function parsePosition(seriesModel, api) {
|
||||
var center = seriesModel.get('center');
|
||||
var width = api.getWidth();
|
||||
var height = api.getHeight();
|
||||
var size = Math.min(width, height);
|
||||
var cx = parsePercent(center[0], api.getWidth());
|
||||
var cy = parsePercent(center[1], api.getHeight());
|
||||
var r = parsePercent(seriesModel.get('radius'), size / 2);
|
||||
return {
|
||||
cx: cx,
|
||||
cy: cy,
|
||||
r: r
|
||||
};
|
||||
}
|
||||
|
||||
function formatLabel(value, labelFormatter) {
|
||||
var label = value == null ? '' : value + '';
|
||||
|
||||
if (labelFormatter) {
|
||||
if (isString(labelFormatter)) {
|
||||
label = labelFormatter.replace('{value}', label);
|
||||
} else if (isFunction(labelFormatter)) {
|
||||
label = labelFormatter(value);
|
||||
}
|
||||
}
|
||||
|
||||
return label;
|
||||
}
|
||||
|
||||
var GaugeView =
|
||||
/** @class */
|
||||
function (_super) {
|
||||
__extends(GaugeView, _super);
|
||||
|
||||
function GaugeView() {
|
||||
var _this = _super !== null && _super.apply(this, arguments) || this;
|
||||
|
||||
_this.type = GaugeView.type;
|
||||
return _this;
|
||||
}
|
||||
|
||||
GaugeView.prototype.render = function (seriesModel, ecModel, api) {
|
||||
this.group.removeAll();
|
||||
var colorList = seriesModel.get(['axisLine', 'lineStyle', 'color']);
|
||||
var posInfo = parsePosition(seriesModel, api);
|
||||
|
||||
this._renderMain(seriesModel, ecModel, api, colorList, posInfo);
|
||||
|
||||
this._data = seriesModel.getData();
|
||||
};
|
||||
|
||||
GaugeView.prototype.dispose = function () {};
|
||||
|
||||
GaugeView.prototype._renderMain = function (seriesModel, ecModel, api, colorList, posInfo) {
|
||||
var group = this.group;
|
||||
var clockwise = seriesModel.get('clockwise');
|
||||
var startAngle = -seriesModel.get('startAngle') / 180 * Math.PI;
|
||||
var endAngle = -seriesModel.get('endAngle') / 180 * Math.PI;
|
||||
var axisLineModel = seriesModel.getModel('axisLine');
|
||||
var roundCap = axisLineModel.get('roundCap');
|
||||
var MainPath = roundCap ? Sausage : graphic.Sector;
|
||||
var showAxis = axisLineModel.get('show');
|
||||
var lineStyleModel = axisLineModel.getModel('lineStyle');
|
||||
var axisLineWidth = lineStyleModel.get('width');
|
||||
var angles = [startAngle, endAngle];
|
||||
normalizeArcAngles(angles, !clockwise);
|
||||
startAngle = angles[0];
|
||||
endAngle = angles[1];
|
||||
var angleRangeSpan = endAngle - startAngle;
|
||||
var prevEndAngle = startAngle;
|
||||
|
||||
for (var i = 0; showAxis && i < colorList.length; i++) {
|
||||
// Clamp
|
||||
var percent = Math.min(Math.max(colorList[i][0], 0), 1);
|
||||
endAngle = startAngle + angleRangeSpan * percent;
|
||||
var sector = new MainPath({
|
||||
shape: {
|
||||
startAngle: prevEndAngle,
|
||||
endAngle: endAngle,
|
||||
cx: posInfo.cx,
|
||||
cy: posInfo.cy,
|
||||
clockwise: clockwise,
|
||||
r0: posInfo.r - axisLineWidth,
|
||||
r: posInfo.r
|
||||
},
|
||||
silent: true
|
||||
});
|
||||
sector.setStyle({
|
||||
fill: colorList[i][1]
|
||||
});
|
||||
sector.setStyle(lineStyleModel.getLineStyle( // Because we use sector to simulate arc
|
||||
// so the properties for stroking are useless
|
||||
['color', 'width']));
|
||||
group.add(sector);
|
||||
prevEndAngle = endAngle;
|
||||
}
|
||||
|
||||
var getColor = function (percent) {
|
||||
// Less than 0
|
||||
if (percent <= 0) {
|
||||
return colorList[0][1];
|
||||
}
|
||||
|
||||
var i;
|
||||
|
||||
for (i = 0; i < colorList.length; i++) {
|
||||
if (colorList[i][0] >= percent && (i === 0 ? 0 : colorList[i - 1][0]) < percent) {
|
||||
return colorList[i][1];
|
||||
}
|
||||
} // More than 1
|
||||
|
||||
|
||||
return colorList[i - 1][1];
|
||||
};
|
||||
|
||||
this._renderTicks(seriesModel, ecModel, api, getColor, posInfo, startAngle, endAngle, clockwise, axisLineWidth);
|
||||
|
||||
this._renderTitleAndDetail(seriesModel, ecModel, api, getColor, posInfo);
|
||||
|
||||
this._renderAnchor(seriesModel, posInfo);
|
||||
|
||||
this._renderPointer(seriesModel, ecModel, api, getColor, posInfo, startAngle, endAngle, clockwise, axisLineWidth);
|
||||
};
|
||||
|
||||
GaugeView.prototype._renderTicks = function (seriesModel, ecModel, api, getColor, posInfo, startAngle, endAngle, clockwise, axisLineWidth) {
|
||||
var group = this.group;
|
||||
var cx = posInfo.cx;
|
||||
var cy = posInfo.cy;
|
||||
var r = posInfo.r;
|
||||
var minVal = +seriesModel.get('min');
|
||||
var maxVal = +seriesModel.get('max');
|
||||
var splitLineModel = seriesModel.getModel('splitLine');
|
||||
var tickModel = seriesModel.getModel('axisTick');
|
||||
var labelModel = seriesModel.getModel('axisLabel');
|
||||
var splitNumber = seriesModel.get('splitNumber');
|
||||
var subSplitNumber = tickModel.get('splitNumber');
|
||||
var splitLineLen = parsePercent(splitLineModel.get('length'), r);
|
||||
var tickLen = parsePercent(tickModel.get('length'), r);
|
||||
var angle = startAngle;
|
||||
var step = (endAngle - startAngle) / splitNumber;
|
||||
var subStep = step / subSplitNumber;
|
||||
var splitLineStyle = splitLineModel.getModel('lineStyle').getLineStyle();
|
||||
var tickLineStyle = tickModel.getModel('lineStyle').getLineStyle();
|
||||
var splitLineDistance = splitLineModel.get('distance');
|
||||
var unitX;
|
||||
var unitY;
|
||||
|
||||
for (var i = 0; i <= splitNumber; i++) {
|
||||
unitX = Math.cos(angle);
|
||||
unitY = Math.sin(angle); // Split line
|
||||
|
||||
if (splitLineModel.get('show')) {
|
||||
var distance = splitLineDistance ? splitLineDistance + axisLineWidth : axisLineWidth;
|
||||
var splitLine = new graphic.Line({
|
||||
shape: {
|
||||
x1: unitX * (r - distance) + cx,
|
||||
y1: unitY * (r - distance) + cy,
|
||||
x2: unitX * (r - splitLineLen - distance) + cx,
|
||||
y2: unitY * (r - splitLineLen - distance) + cy
|
||||
},
|
||||
style: splitLineStyle,
|
||||
silent: true
|
||||
});
|
||||
|
||||
if (splitLineStyle.stroke === 'auto') {
|
||||
splitLine.setStyle({
|
||||
stroke: getColor(i / splitNumber)
|
||||
});
|
||||
}
|
||||
|
||||
group.add(splitLine);
|
||||
} // Label
|
||||
|
||||
|
||||
if (labelModel.get('show')) {
|
||||
var distance = labelModel.get('distance') + splitLineDistance;
|
||||
var label = formatLabel(round(i / splitNumber * (maxVal - minVal) + minVal), labelModel.get('formatter'));
|
||||
var autoColor = getColor(i / splitNumber);
|
||||
group.add(new graphic.Text({
|
||||
style: createTextStyle(labelModel, {
|
||||
text: label,
|
||||
x: unitX * (r - splitLineLen - distance) + cx,
|
||||
y: unitY * (r - splitLineLen - distance) + cy,
|
||||
verticalAlign: unitY < -0.8 ? 'top' : unitY > 0.8 ? 'bottom' : 'middle',
|
||||
align: unitX < -0.4 ? 'left' : unitX > 0.4 ? 'right' : 'center'
|
||||
}, {
|
||||
inheritColor: autoColor
|
||||
}),
|
||||
silent: true
|
||||
}));
|
||||
} // Axis tick
|
||||
|
||||
|
||||
if (tickModel.get('show') && i !== splitNumber) {
|
||||
var distance = tickModel.get('distance');
|
||||
distance = distance ? distance + axisLineWidth : axisLineWidth;
|
||||
|
||||
for (var j = 0; j <= subSplitNumber; j++) {
|
||||
unitX = Math.cos(angle);
|
||||
unitY = Math.sin(angle);
|
||||
var tickLine = new graphic.Line({
|
||||
shape: {
|
||||
x1: unitX * (r - distance) + cx,
|
||||
y1: unitY * (r - distance) + cy,
|
||||
x2: unitX * (r - tickLen - distance) + cx,
|
||||
y2: unitY * (r - tickLen - distance) + cy
|
||||
},
|
||||
silent: true,
|
||||
style: tickLineStyle
|
||||
});
|
||||
|
||||
if (tickLineStyle.stroke === 'auto') {
|
||||
tickLine.setStyle({
|
||||
stroke: getColor((i + j / subSplitNumber) / splitNumber)
|
||||
});
|
||||
}
|
||||
|
||||
group.add(tickLine);
|
||||
angle += subStep;
|
||||
}
|
||||
|
||||
angle -= subStep;
|
||||
} else {
|
||||
angle += step;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
GaugeView.prototype._renderPointer = function (seriesModel, ecModel, api, getColor, posInfo, startAngle, endAngle, clockwise, axisLineWidth) {
|
||||
var group = this.group;
|
||||
var oldData = this._data;
|
||||
var oldProgressData = this._progressEls;
|
||||
var progressList = [];
|
||||
var showPointer = seriesModel.get(['pointer', 'show']);
|
||||
var progressModel = seriesModel.getModel('progress');
|
||||
var showProgress = progressModel.get('show');
|
||||
var data = seriesModel.getData();
|
||||
var valueDim = data.mapDimension('value');
|
||||
var minVal = +seriesModel.get('min');
|
||||
var maxVal = +seriesModel.get('max');
|
||||
var valueExtent = [minVal, maxVal];
|
||||
var angleExtent = [startAngle, endAngle];
|
||||
|
||||
function createPointer(idx, angle) {
|
||||
var itemModel = data.getItemModel(idx);
|
||||
var pointerModel = itemModel.getModel('pointer');
|
||||
var pointerWidth = parsePercent(pointerModel.get('width'), posInfo.r);
|
||||
var pointerLength = parsePercent(pointerModel.get('length'), posInfo.r);
|
||||
var pointerStr = seriesModel.get(['pointer', 'icon']);
|
||||
var pointerOffset = pointerModel.get('offsetCenter');
|
||||
var pointerOffsetX = parsePercent(pointerOffset[0], posInfo.r);
|
||||
var pointerOffsetY = parsePercent(pointerOffset[1], posInfo.r);
|
||||
var pointerKeepAspect = pointerModel.get('keepAspect');
|
||||
var pointer; // not exist icon type will be set 'rect'
|
||||
|
||||
if (pointerStr) {
|
||||
pointer = createSymbol(pointerStr, pointerOffsetX - pointerWidth / 2, pointerOffsetY - pointerLength, pointerWidth, pointerLength, null, pointerKeepAspect);
|
||||
} else {
|
||||
pointer = new PointerPath({
|
||||
shape: {
|
||||
angle: -Math.PI / 2,
|
||||
width: pointerWidth,
|
||||
r: pointerLength,
|
||||
x: pointerOffsetX,
|
||||
y: pointerOffsetY
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
pointer.rotation = -(angle + Math.PI / 2);
|
||||
pointer.x = posInfo.cx;
|
||||
pointer.y = posInfo.cy;
|
||||
return pointer;
|
||||
}
|
||||
|
||||
function createProgress(idx, endAngle) {
|
||||
var roundCap = progressModel.get('roundCap');
|
||||
var ProgressPath = roundCap ? Sausage : graphic.Sector;
|
||||
var isOverlap = progressModel.get('overlap');
|
||||
var progressWidth = isOverlap ? progressModel.get('width') : axisLineWidth / data.count();
|
||||
var r0 = isOverlap ? posInfo.r - progressWidth : posInfo.r - (idx + 1) * progressWidth;
|
||||
var r = isOverlap ? posInfo.r : posInfo.r - idx * progressWidth;
|
||||
var progress = new ProgressPath({
|
||||
shape: {
|
||||
startAngle: startAngle,
|
||||
endAngle: endAngle,
|
||||
cx: posInfo.cx,
|
||||
cy: posInfo.cy,
|
||||
clockwise: clockwise,
|
||||
r0: r0,
|
||||
r: r
|
||||
}
|
||||
});
|
||||
isOverlap && (progress.z2 = maxVal - data.get(valueDim, idx) % maxVal);
|
||||
return progress;
|
||||
}
|
||||
|
||||
if (showProgress || showPointer) {
|
||||
data.diff(oldData).add(function (idx) {
|
||||
var val = data.get(valueDim, idx);
|
||||
|
||||
if (showPointer) {
|
||||
var pointer = createPointer(idx, startAngle); // TODO hide pointer on NaN value?
|
||||
|
||||
graphic.initProps(pointer, {
|
||||
rotation: -((isNaN(+val) ? angleExtent[0] : linearMap(val, valueExtent, angleExtent, true)) + Math.PI / 2)
|
||||
}, seriesModel);
|
||||
group.add(pointer);
|
||||
data.setItemGraphicEl(idx, pointer);
|
||||
}
|
||||
|
||||
if (showProgress) {
|
||||
var progress = createProgress(idx, startAngle);
|
||||
var isClip = progressModel.get('clip');
|
||||
graphic.initProps(progress, {
|
||||
shape: {
|
||||
endAngle: linearMap(val, valueExtent, angleExtent, isClip)
|
||||
}
|
||||
}, seriesModel);
|
||||
group.add(progress); // Add data index and series index for indexing the data by element
|
||||
// Useful in tooltip
|
||||
|
||||
setCommonECData(seriesModel.seriesIndex, data.dataType, idx, progress);
|
||||
progressList[idx] = progress;
|
||||
}
|
||||
}).update(function (newIdx, oldIdx) {
|
||||
var val = data.get(valueDim, newIdx);
|
||||
|
||||
if (showPointer) {
|
||||
var previousPointer = oldData.getItemGraphicEl(oldIdx);
|
||||
var previousRotate = previousPointer ? previousPointer.rotation : startAngle;
|
||||
var pointer = createPointer(newIdx, previousRotate);
|
||||
pointer.rotation = previousRotate;
|
||||
graphic.updateProps(pointer, {
|
||||
rotation: -((isNaN(+val) ? angleExtent[0] : linearMap(val, valueExtent, angleExtent, true)) + Math.PI / 2)
|
||||
}, seriesModel);
|
||||
group.add(pointer);
|
||||
data.setItemGraphicEl(newIdx, pointer);
|
||||
}
|
||||
|
||||
if (showProgress) {
|
||||
var previousProgress = oldProgressData[oldIdx];
|
||||
var previousEndAngle = previousProgress ? previousProgress.shape.endAngle : startAngle;
|
||||
var progress = createProgress(newIdx, previousEndAngle);
|
||||
var isClip = progressModel.get('clip');
|
||||
graphic.updateProps(progress, {
|
||||
shape: {
|
||||
endAngle: linearMap(val, valueExtent, angleExtent, isClip)
|
||||
}
|
||||
}, seriesModel);
|
||||
group.add(progress); // Add data index and series index for indexing the data by element
|
||||
// Useful in tooltip
|
||||
|
||||
setCommonECData(seriesModel.seriesIndex, data.dataType, newIdx, progress);
|
||||
progressList[newIdx] = progress;
|
||||
}
|
||||
}).execute();
|
||||
data.each(function (idx) {
|
||||
var itemModel = data.getItemModel(idx);
|
||||
var emphasisModel = itemModel.getModel('emphasis');
|
||||
var focus = emphasisModel.get('focus');
|
||||
var blurScope = emphasisModel.get('blurScope');
|
||||
var emphasisDisabled = emphasisModel.get('disabled');
|
||||
|
||||
if (showPointer) {
|
||||
var pointer = data.getItemGraphicEl(idx);
|
||||
var symbolStyle = data.getItemVisual(idx, 'style');
|
||||
var visualColor = symbolStyle.fill;
|
||||
|
||||
if (pointer instanceof ZRImage) {
|
||||
var pathStyle = pointer.style;
|
||||
pointer.useStyle(extend({
|
||||
image: pathStyle.image,
|
||||
x: pathStyle.x,
|
||||
y: pathStyle.y,
|
||||
width: pathStyle.width,
|
||||
height: pathStyle.height
|
||||
}, symbolStyle));
|
||||
} else {
|
||||
pointer.useStyle(symbolStyle);
|
||||
pointer.type !== 'pointer' && pointer.setColor(visualColor);
|
||||
}
|
||||
|
||||
pointer.setStyle(itemModel.getModel(['pointer', 'itemStyle']).getItemStyle());
|
||||
|
||||
if (pointer.style.fill === 'auto') {
|
||||
pointer.setStyle('fill', getColor(linearMap(data.get(valueDim, idx), valueExtent, [0, 1], true)));
|
||||
}
|
||||
|
||||
pointer.z2EmphasisLift = 0;
|
||||
setStatesStylesFromModel(pointer, itemModel);
|
||||
toggleHoverEmphasis(pointer, focus, blurScope, emphasisDisabled);
|
||||
}
|
||||
|
||||
if (showProgress) {
|
||||
var progress = progressList[idx];
|
||||
progress.useStyle(data.getItemVisual(idx, 'style'));
|
||||
progress.setStyle(itemModel.getModel(['progress', 'itemStyle']).getItemStyle());
|
||||
progress.z2EmphasisLift = 0;
|
||||
setStatesStylesFromModel(progress, itemModel);
|
||||
toggleHoverEmphasis(progress, focus, blurScope, emphasisDisabled);
|
||||
}
|
||||
});
|
||||
this._progressEls = progressList;
|
||||
}
|
||||
};
|
||||
|
||||
GaugeView.prototype._renderAnchor = function (seriesModel, posInfo) {
|
||||
var anchorModel = seriesModel.getModel('anchor');
|
||||
var showAnchor = anchorModel.get('show');
|
||||
|
||||
if (showAnchor) {
|
||||
var anchorSize = anchorModel.get('size');
|
||||
var anchorType = anchorModel.get('icon');
|
||||
var offsetCenter = anchorModel.get('offsetCenter');
|
||||
var anchorKeepAspect = anchorModel.get('keepAspect');
|
||||
var anchor = createSymbol(anchorType, posInfo.cx - anchorSize / 2 + parsePercent(offsetCenter[0], posInfo.r), posInfo.cy - anchorSize / 2 + parsePercent(offsetCenter[1], posInfo.r), anchorSize, anchorSize, null, anchorKeepAspect);
|
||||
anchor.z2 = anchorModel.get('showAbove') ? 1 : 0;
|
||||
anchor.setStyle(anchorModel.getModel('itemStyle').getItemStyle());
|
||||
this.group.add(anchor);
|
||||
}
|
||||
};
|
||||
|
||||
GaugeView.prototype._renderTitleAndDetail = function (seriesModel, ecModel, api, getColor, posInfo) {
|
||||
var _this = this;
|
||||
|
||||
var data = seriesModel.getData();
|
||||
var valueDim = data.mapDimension('value');
|
||||
var minVal = +seriesModel.get('min');
|
||||
var maxVal = +seriesModel.get('max');
|
||||
var contentGroup = new graphic.Group();
|
||||
var newTitleEls = [];
|
||||
var newDetailEls = [];
|
||||
var hasAnimation = seriesModel.isAnimationEnabled();
|
||||
var showPointerAbove = seriesModel.get(['pointer', 'showAbove']);
|
||||
data.diff(this._data).add(function (idx) {
|
||||
newTitleEls[idx] = new graphic.Text({
|
||||
silent: true
|
||||
});
|
||||
newDetailEls[idx] = new graphic.Text({
|
||||
silent: true
|
||||
});
|
||||
}).update(function (idx, oldIdx) {
|
||||
newTitleEls[idx] = _this._titleEls[oldIdx];
|
||||
newDetailEls[idx] = _this._detailEls[oldIdx];
|
||||
}).execute();
|
||||
data.each(function (idx) {
|
||||
var itemModel = data.getItemModel(idx);
|
||||
var value = data.get(valueDim, idx);
|
||||
var itemGroup = new graphic.Group();
|
||||
var autoColor = getColor(linearMap(value, [minVal, maxVal], [0, 1], true));
|
||||
var itemTitleModel = itemModel.getModel('title');
|
||||
|
||||
if (itemTitleModel.get('show')) {
|
||||
var titleOffsetCenter = itemTitleModel.get('offsetCenter');
|
||||
var titleX = posInfo.cx + parsePercent(titleOffsetCenter[0], posInfo.r);
|
||||
var titleY = posInfo.cy + parsePercent(titleOffsetCenter[1], posInfo.r);
|
||||
var labelEl = newTitleEls[idx];
|
||||
labelEl.attr({
|
||||
z2: showPointerAbove ? 0 : 2,
|
||||
style: createTextStyle(itemTitleModel, {
|
||||
x: titleX,
|
||||
y: titleY,
|
||||
text: data.getName(idx),
|
||||
align: 'center',
|
||||
verticalAlign: 'middle'
|
||||
}, {
|
||||
inheritColor: autoColor
|
||||
})
|
||||
});
|
||||
itemGroup.add(labelEl);
|
||||
}
|
||||
|
||||
var itemDetailModel = itemModel.getModel('detail');
|
||||
|
||||
if (itemDetailModel.get('show')) {
|
||||
var detailOffsetCenter = itemDetailModel.get('offsetCenter');
|
||||
var detailX = posInfo.cx + parsePercent(detailOffsetCenter[0], posInfo.r);
|
||||
var detailY = posInfo.cy + parsePercent(detailOffsetCenter[1], posInfo.r);
|
||||
var width = parsePercent(itemDetailModel.get('width'), posInfo.r);
|
||||
var height = parsePercent(itemDetailModel.get('height'), posInfo.r);
|
||||
var detailColor = seriesModel.get(['progress', 'show']) ? data.getItemVisual(idx, 'style').fill : autoColor;
|
||||
var labelEl = newDetailEls[idx];
|
||||
var formatter_1 = itemDetailModel.get('formatter');
|
||||
labelEl.attr({
|
||||
z2: showPointerAbove ? 0 : 2,
|
||||
style: createTextStyle(itemDetailModel, {
|
||||
x: detailX,
|
||||
y: detailY,
|
||||
text: formatLabel(value, formatter_1),
|
||||
width: isNaN(width) ? null : width,
|
||||
height: isNaN(height) ? null : height,
|
||||
align: 'center',
|
||||
verticalAlign: 'middle'
|
||||
}, {
|
||||
inheritColor: detailColor
|
||||
})
|
||||
});
|
||||
setLabelValueAnimation(labelEl, {
|
||||
normal: itemDetailModel
|
||||
}, value, function (value) {
|
||||
return formatLabel(value, formatter_1);
|
||||
});
|
||||
hasAnimation && animateLabelValue(labelEl, idx, data, seriesModel, {
|
||||
getFormattedLabel: function (labelDataIndex, status, dataType, labelDimIndex, fmt, extendParams) {
|
||||
return formatLabel(extendParams ? extendParams.interpolatedValue : value, formatter_1);
|
||||
}
|
||||
});
|
||||
itemGroup.add(labelEl);
|
||||
}
|
||||
|
||||
contentGroup.add(itemGroup);
|
||||
});
|
||||
this.group.add(contentGroup);
|
||||
this._titleEls = newTitleEls;
|
||||
this._detailEls = newDetailEls;
|
||||
};
|
||||
|
||||
GaugeView.type = 'gauge';
|
||||
return GaugeView;
|
||||
}(ChartView);
|
||||
|
||||
export default GaugeView;
|
||||
96
uni-demo/node_modules/echarts/lib/chart/gauge/PointerPath.js
generated
vendored
Normal file
96
uni-demo/node_modules/echarts/lib/chart/gauge/PointerPath.js
generated
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
|
||||
/*
|
||||
* 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 'zrender/lib/graphic/Path.js';
|
||||
|
||||
var PointerShape =
|
||||
/** @class */
|
||||
function () {
|
||||
function PointerShape() {
|
||||
this.angle = 0;
|
||||
this.width = 10;
|
||||
this.r = 10;
|
||||
this.x = 0;
|
||||
this.y = 0;
|
||||
}
|
||||
|
||||
return PointerShape;
|
||||
}();
|
||||
|
||||
var PointerPath =
|
||||
/** @class */
|
||||
function (_super) {
|
||||
__extends(PointerPath, _super);
|
||||
|
||||
function PointerPath(opts) {
|
||||
var _this = _super.call(this, opts) || this;
|
||||
|
||||
_this.type = 'pointer';
|
||||
return _this;
|
||||
}
|
||||
|
||||
PointerPath.prototype.getDefaultShape = function () {
|
||||
return new PointerShape();
|
||||
};
|
||||
|
||||
PointerPath.prototype.buildPath = function (ctx, shape) {
|
||||
var mathCos = Math.cos;
|
||||
var mathSin = Math.sin;
|
||||
var r = shape.r;
|
||||
var width = shape.width;
|
||||
var angle = shape.angle;
|
||||
var x = shape.x - mathCos(angle) * width * (width >= r / 3 ? 1 : 2);
|
||||
var y = shape.y - mathSin(angle) * width * (width >= r / 3 ? 1 : 2);
|
||||
angle = shape.angle - Math.PI / 2;
|
||||
ctx.moveTo(x, y);
|
||||
ctx.lineTo(shape.x + mathCos(angle) * width, shape.y + mathSin(angle) * width);
|
||||
ctx.lineTo(shape.x + mathCos(shape.angle) * r, shape.y + mathSin(shape.angle) * r);
|
||||
ctx.lineTo(shape.x - mathCos(angle) * width, shape.y - mathSin(angle) * width);
|
||||
ctx.lineTo(x, y);
|
||||
};
|
||||
|
||||
return PointerPath;
|
||||
}(Path);
|
||||
|
||||
export default PointerPath;
|
||||
49
uni-demo/node_modules/echarts/lib/chart/gauge/install.js
generated
vendored
Normal file
49
uni-demo/node_modules/echarts/lib/chart/gauge/install.js
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
|
||||
/*
|
||||
* 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 GaugeView from './GaugeView.js';
|
||||
import GaugeSeriesModel from './GaugeSeries.js';
|
||||
export function install(registers) {
|
||||
registers.registerChartView(GaugeView);
|
||||
registers.registerSeriesModel(GaugeSeriesModel);
|
||||
}
|
||||
46
uni-demo/node_modules/echarts/lib/chart/graph.js
generated
vendored
Normal file
46
uni-demo/node_modules/echarts/lib/chart/graph.js
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
|
||||
/*
|
||||
* 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 { use } from '../extension.js';
|
||||
import { install } from './graph/install.js';
|
||||
use(install);
|
||||
311
uni-demo/node_modules/echarts/lib/chart/graph/GraphSeries.js
generated
vendored
Normal file
311
uni-demo/node_modules/echarts/lib/chart/graph/GraphSeries.js
generated
vendored
Normal file
@@ -0,0 +1,311 @@
|
||||
|
||||
/*
|
||||
* 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 SeriesData from '../../data/SeriesData.js';
|
||||
import * as zrUtil from 'zrender/lib/core/util.js';
|
||||
import { defaultEmphasis } from '../../util/model.js';
|
||||
import Model from '../../model/Model.js';
|
||||
import createGraphFromNodeEdge from '../helper/createGraphFromNodeEdge.js';
|
||||
import LegendVisualProvider from '../../visual/LegendVisualProvider.js';
|
||||
import SeriesModel from '../../model/Series.js';
|
||||
import { createTooltipMarkup } from '../../component/tooltip/tooltipMarkup.js';
|
||||
import { defaultSeriesFormatTooltip } from '../../component/tooltip/seriesFormatTooltip.js';
|
||||
import { initCurvenessList, createEdgeMapForCurveness } from '../helper/multipleGraphEdgeHelper.js';
|
||||
|
||||
var GraphSeriesModel =
|
||||
/** @class */
|
||||
function (_super) {
|
||||
__extends(GraphSeriesModel, _super);
|
||||
|
||||
function GraphSeriesModel() {
|
||||
var _this = _super !== null && _super.apply(this, arguments) || this;
|
||||
|
||||
_this.type = GraphSeriesModel.type;
|
||||
_this.hasSymbolVisual = true;
|
||||
return _this;
|
||||
}
|
||||
|
||||
GraphSeriesModel.prototype.init = function (option) {
|
||||
_super.prototype.init.apply(this, arguments);
|
||||
|
||||
var self = this;
|
||||
|
||||
function getCategoriesData() {
|
||||
return self._categoriesData;
|
||||
} // Provide data for legend select
|
||||
|
||||
|
||||
this.legendVisualProvider = new LegendVisualProvider(getCategoriesData, getCategoriesData);
|
||||
this.fillDataTextStyle(option.edges || option.links);
|
||||
|
||||
this._updateCategoriesData();
|
||||
};
|
||||
|
||||
GraphSeriesModel.prototype.mergeOption = function (option) {
|
||||
_super.prototype.mergeOption.apply(this, arguments);
|
||||
|
||||
this.fillDataTextStyle(option.edges || option.links);
|
||||
|
||||
this._updateCategoriesData();
|
||||
};
|
||||
|
||||
GraphSeriesModel.prototype.mergeDefaultAndTheme = function (option) {
|
||||
_super.prototype.mergeDefaultAndTheme.apply(this, arguments);
|
||||
|
||||
defaultEmphasis(option, 'edgeLabel', ['show']);
|
||||
};
|
||||
|
||||
GraphSeriesModel.prototype.getInitialData = function (option, ecModel) {
|
||||
var edges = option.edges || option.links || [];
|
||||
var nodes = option.data || option.nodes || [];
|
||||
var self = this;
|
||||
|
||||
if (nodes && edges) {
|
||||
// auto curveness
|
||||
initCurvenessList(this);
|
||||
var graph = createGraphFromNodeEdge(nodes, edges, this, true, beforeLink);
|
||||
zrUtil.each(graph.edges, function (edge) {
|
||||
createEdgeMapForCurveness(edge.node1, edge.node2, this, edge.dataIndex);
|
||||
}, this);
|
||||
return graph.data;
|
||||
}
|
||||
|
||||
function beforeLink(nodeData, edgeData) {
|
||||
// Overwrite nodeData.getItemModel to
|
||||
nodeData.wrapMethod('getItemModel', function (model) {
|
||||
var categoriesModels = self._categoriesModels;
|
||||
var categoryIdx = model.getShallow('category');
|
||||
var categoryModel = categoriesModels[categoryIdx];
|
||||
|
||||
if (categoryModel) {
|
||||
categoryModel.parentModel = model.parentModel;
|
||||
model.parentModel = categoryModel;
|
||||
}
|
||||
|
||||
return model;
|
||||
}); // TODO Inherit resolveParentPath by default in Model#getModel?
|
||||
|
||||
var oldGetModel = Model.prototype.getModel;
|
||||
|
||||
function newGetModel(path, parentModel) {
|
||||
var model = oldGetModel.call(this, path, parentModel);
|
||||
model.resolveParentPath = resolveParentPath;
|
||||
return model;
|
||||
}
|
||||
|
||||
edgeData.wrapMethod('getItemModel', function (model) {
|
||||
model.resolveParentPath = resolveParentPath;
|
||||
model.getModel = newGetModel;
|
||||
return model;
|
||||
});
|
||||
|
||||
function resolveParentPath(pathArr) {
|
||||
if (pathArr && (pathArr[0] === 'label' || pathArr[1] === 'label')) {
|
||||
var newPathArr = pathArr.slice();
|
||||
|
||||
if (pathArr[0] === 'label') {
|
||||
newPathArr[0] = 'edgeLabel';
|
||||
} else if (pathArr[1] === 'label') {
|
||||
newPathArr[1] = 'edgeLabel';
|
||||
}
|
||||
|
||||
return newPathArr;
|
||||
}
|
||||
|
||||
return pathArr;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
GraphSeriesModel.prototype.getGraph = function () {
|
||||
return this.getData().graph;
|
||||
};
|
||||
|
||||
GraphSeriesModel.prototype.getEdgeData = function () {
|
||||
return this.getGraph().edgeData;
|
||||
};
|
||||
|
||||
GraphSeriesModel.prototype.getCategoriesData = function () {
|
||||
return this._categoriesData;
|
||||
};
|
||||
|
||||
GraphSeriesModel.prototype.formatTooltip = function (dataIndex, multipleSeries, dataType) {
|
||||
if (dataType === 'edge') {
|
||||
var nodeData = this.getData();
|
||||
var params = this.getDataParams(dataIndex, dataType);
|
||||
var edge = nodeData.graph.getEdgeByIndex(dataIndex);
|
||||
var sourceName = nodeData.getName(edge.node1.dataIndex);
|
||||
var targetName = nodeData.getName(edge.node2.dataIndex);
|
||||
var nameArr = [];
|
||||
sourceName != null && nameArr.push(sourceName);
|
||||
targetName != null && nameArr.push(targetName);
|
||||
return createTooltipMarkup('nameValue', {
|
||||
name: nameArr.join(' > '),
|
||||
value: params.value,
|
||||
noValue: params.value == null
|
||||
});
|
||||
} // dataType === 'node' or empty
|
||||
|
||||
|
||||
var nodeMarkup = defaultSeriesFormatTooltip({
|
||||
series: this,
|
||||
dataIndex: dataIndex,
|
||||
multipleSeries: multipleSeries
|
||||
});
|
||||
return nodeMarkup;
|
||||
};
|
||||
|
||||
GraphSeriesModel.prototype._updateCategoriesData = function () {
|
||||
var categories = zrUtil.map(this.option.categories || [], function (category) {
|
||||
// Data must has value
|
||||
return category.value != null ? category : zrUtil.extend({
|
||||
value: 0
|
||||
}, category);
|
||||
});
|
||||
var categoriesData = new SeriesData(['value'], this);
|
||||
categoriesData.initData(categories);
|
||||
this._categoriesData = categoriesData;
|
||||
this._categoriesModels = categoriesData.mapArray(function (idx) {
|
||||
return categoriesData.getItemModel(idx);
|
||||
});
|
||||
};
|
||||
|
||||
GraphSeriesModel.prototype.setZoom = function (zoom) {
|
||||
this.option.zoom = zoom;
|
||||
};
|
||||
|
||||
GraphSeriesModel.prototype.setCenter = function (center) {
|
||||
this.option.center = center;
|
||||
};
|
||||
|
||||
GraphSeriesModel.prototype.isAnimationEnabled = function () {
|
||||
return _super.prototype.isAnimationEnabled.call(this) // Not enable animation when do force layout
|
||||
&& !(this.get('layout') === 'force' && this.get(['force', 'layoutAnimation']));
|
||||
};
|
||||
|
||||
GraphSeriesModel.type = 'series.graph';
|
||||
GraphSeriesModel.dependencies = ['grid', 'polar', 'geo', 'singleAxis', 'calendar'];
|
||||
GraphSeriesModel.defaultOption = {
|
||||
// zlevel: 0,
|
||||
z: 2,
|
||||
coordinateSystem: 'view',
|
||||
// Default option for all coordinate systems
|
||||
// xAxisIndex: 0,
|
||||
// yAxisIndex: 0,
|
||||
// polarIndex: 0,
|
||||
// geoIndex: 0,
|
||||
legendHoverLink: true,
|
||||
layout: null,
|
||||
// Configuration of circular layout
|
||||
circular: {
|
||||
rotateLabel: false
|
||||
},
|
||||
// Configuration of force directed layout
|
||||
force: {
|
||||
initLayout: null,
|
||||
// Node repulsion. Can be an array to represent range.
|
||||
repulsion: [0, 50],
|
||||
gravity: 0.1,
|
||||
// Initial friction
|
||||
friction: 0.6,
|
||||
// Edge length. Can be an array to represent range.
|
||||
edgeLength: 30,
|
||||
layoutAnimation: true
|
||||
},
|
||||
left: 'center',
|
||||
top: 'center',
|
||||
// right: null,
|
||||
// bottom: null,
|
||||
// width: '80%',
|
||||
// height: '80%',
|
||||
symbol: 'circle',
|
||||
symbolSize: 10,
|
||||
edgeSymbol: ['none', 'none'],
|
||||
edgeSymbolSize: 10,
|
||||
edgeLabel: {
|
||||
position: 'middle',
|
||||
distance: 5
|
||||
},
|
||||
draggable: false,
|
||||
roam: false,
|
||||
// Default on center of graph
|
||||
center: null,
|
||||
zoom: 1,
|
||||
// Symbol size scale ratio in roam
|
||||
nodeScaleRatio: 0.6,
|
||||
// cursor: null,
|
||||
// categories: [],
|
||||
// data: []
|
||||
// Or
|
||||
// nodes: []
|
||||
//
|
||||
// links: []
|
||||
// Or
|
||||
// edges: []
|
||||
label: {
|
||||
show: false,
|
||||
formatter: '{b}'
|
||||
},
|
||||
itemStyle: {},
|
||||
lineStyle: {
|
||||
color: '#aaa',
|
||||
width: 1,
|
||||
opacity: 0.5
|
||||
},
|
||||
emphasis: {
|
||||
scale: true,
|
||||
label: {
|
||||
show: true
|
||||
}
|
||||
},
|
||||
select: {
|
||||
itemStyle: {
|
||||
borderColor: '#212121'
|
||||
}
|
||||
}
|
||||
};
|
||||
return GraphSeriesModel;
|
||||
}(SeriesModel);
|
||||
|
||||
export default GraphSeriesModel;
|
||||
315
uni-demo/node_modules/echarts/lib/chart/graph/GraphView.js
generated
vendored
Normal file
315
uni-demo/node_modules/echarts/lib/chart/graph/GraphView.js
generated
vendored
Normal file
@@ -0,0 +1,315 @@
|
||||
|
||||
/*
|
||||
* 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';
|
||||
import SymbolDraw from '../helper/SymbolDraw.js';
|
||||
import LineDraw from '../helper/LineDraw.js';
|
||||
import RoamController from '../../component/helper/RoamController.js';
|
||||
import * as roamHelper from '../../component/helper/roamHelper.js';
|
||||
import { onIrrelevantElement } from '../../component/helper/cursorHelper.js';
|
||||
import * as graphic from '../../util/graphic.js';
|
||||
import adjustEdge from './adjustEdge.js';
|
||||
import { getNodeGlobalScale } from './graphHelper.js';
|
||||
import ChartView from '../../view/Chart.js';
|
||||
import { getECData } from '../../util/innerStore.js';
|
||||
|
||||
function isViewCoordSys(coordSys) {
|
||||
return coordSys.type === 'view';
|
||||
}
|
||||
|
||||
var GraphView =
|
||||
/** @class */
|
||||
function (_super) {
|
||||
__extends(GraphView, _super);
|
||||
|
||||
function GraphView() {
|
||||
var _this = _super !== null && _super.apply(this, arguments) || this;
|
||||
|
||||
_this.type = GraphView.type;
|
||||
return _this;
|
||||
}
|
||||
|
||||
GraphView.prototype.init = function (ecModel, api) {
|
||||
var symbolDraw = new SymbolDraw();
|
||||
var lineDraw = new LineDraw();
|
||||
var group = this.group;
|
||||
this._controller = new RoamController(api.getZr());
|
||||
this._controllerHost = {
|
||||
target: group
|
||||
};
|
||||
group.add(symbolDraw.group);
|
||||
group.add(lineDraw.group);
|
||||
this._symbolDraw = symbolDraw;
|
||||
this._lineDraw = lineDraw;
|
||||
this._firstRender = true;
|
||||
};
|
||||
|
||||
GraphView.prototype.render = function (seriesModel, ecModel, api) {
|
||||
var _this = this;
|
||||
|
||||
var coordSys = seriesModel.coordinateSystem;
|
||||
this._model = seriesModel;
|
||||
var symbolDraw = this._symbolDraw;
|
||||
var lineDraw = this._lineDraw;
|
||||
var group = this.group;
|
||||
|
||||
if (isViewCoordSys(coordSys)) {
|
||||
var groupNewProp = {
|
||||
x: coordSys.x,
|
||||
y: coordSys.y,
|
||||
scaleX: coordSys.scaleX,
|
||||
scaleY: coordSys.scaleY
|
||||
};
|
||||
|
||||
if (this._firstRender) {
|
||||
group.attr(groupNewProp);
|
||||
} else {
|
||||
graphic.updateProps(group, groupNewProp, seriesModel);
|
||||
}
|
||||
} // Fix edge contact point with node
|
||||
|
||||
|
||||
adjustEdge(seriesModel.getGraph(), getNodeGlobalScale(seriesModel));
|
||||
var data = seriesModel.getData();
|
||||
symbolDraw.updateData(data);
|
||||
var edgeData = seriesModel.getEdgeData(); // TODO: TYPE
|
||||
|
||||
lineDraw.updateData(edgeData);
|
||||
|
||||
this._updateNodeAndLinkScale();
|
||||
|
||||
this._updateController(seriesModel, ecModel, api);
|
||||
|
||||
clearTimeout(this._layoutTimeout);
|
||||
var forceLayout = seriesModel.forceLayout;
|
||||
var layoutAnimation = seriesModel.get(['force', 'layoutAnimation']);
|
||||
|
||||
if (forceLayout) {
|
||||
this._startForceLayoutIteration(forceLayout, layoutAnimation);
|
||||
}
|
||||
|
||||
data.graph.eachNode(function (node) {
|
||||
var idx = node.dataIndex;
|
||||
var el = node.getGraphicEl();
|
||||
var itemModel = node.getModel();
|
||||
|
||||
if (!el) {
|
||||
return;
|
||||
} // Update draggable
|
||||
|
||||
|
||||
el.off('drag').off('dragend');
|
||||
var draggable = itemModel.get('draggable');
|
||||
|
||||
if (draggable) {
|
||||
el.on('drag', function () {
|
||||
if (forceLayout) {
|
||||
forceLayout.warmUp();
|
||||
!_this._layouting && _this._startForceLayoutIteration(forceLayout, layoutAnimation);
|
||||
forceLayout.setFixed(idx); // Write position back to layout
|
||||
|
||||
data.setItemLayout(idx, [el.x, el.y]);
|
||||
}
|
||||
}).on('dragend', function () {
|
||||
if (forceLayout) {
|
||||
forceLayout.setUnfixed(idx);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
el.setDraggable(draggable && !!forceLayout, !!itemModel.get('cursor'));
|
||||
var focus = itemModel.get(['emphasis', 'focus']);
|
||||
|
||||
if (focus === 'adjacency') {
|
||||
getECData(el).focus = node.getAdjacentDataIndices();
|
||||
}
|
||||
});
|
||||
data.graph.eachEdge(function (edge) {
|
||||
var el = edge.getGraphicEl();
|
||||
var focus = edge.getModel().get(['emphasis', 'focus']);
|
||||
|
||||
if (!el) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (focus === 'adjacency') {
|
||||
getECData(el).focus = {
|
||||
edge: [edge.dataIndex],
|
||||
node: [edge.node1.dataIndex, edge.node2.dataIndex]
|
||||
};
|
||||
}
|
||||
});
|
||||
var circularRotateLabel = seriesModel.get('layout') === 'circular' && seriesModel.get(['circular', 'rotateLabel']);
|
||||
var cx = data.getLayout('cx');
|
||||
var cy = data.getLayout('cy');
|
||||
data.eachItemGraphicEl(function (el, idx) {
|
||||
var itemModel = data.getItemModel(idx);
|
||||
var labelRotate = itemModel.get(['label', 'rotate']) || 0;
|
||||
var symbolPath = el.getSymbolPath();
|
||||
|
||||
if (circularRotateLabel) {
|
||||
var pos = data.getItemLayout(idx);
|
||||
var rad = Math.atan2(pos[1] - cy, pos[0] - cx);
|
||||
|
||||
if (rad < 0) {
|
||||
rad = Math.PI * 2 + rad;
|
||||
}
|
||||
|
||||
var isLeft = pos[0] < cx;
|
||||
|
||||
if (isLeft) {
|
||||
rad = rad - Math.PI;
|
||||
}
|
||||
|
||||
var textPosition = isLeft ? 'left' : 'right';
|
||||
symbolPath.setTextConfig({
|
||||
rotation: -rad,
|
||||
position: textPosition,
|
||||
origin: 'center'
|
||||
});
|
||||
var emphasisState = symbolPath.ensureState('emphasis');
|
||||
zrUtil.extend(emphasisState.textConfig || (emphasisState.textConfig = {}), {
|
||||
position: textPosition
|
||||
});
|
||||
} else {
|
||||
symbolPath.setTextConfig({
|
||||
rotation: labelRotate *= Math.PI / 180
|
||||
});
|
||||
}
|
||||
});
|
||||
this._firstRender = false;
|
||||
};
|
||||
|
||||
GraphView.prototype.dispose = function () {
|
||||
this._controller && this._controller.dispose();
|
||||
this._controllerHost = null;
|
||||
};
|
||||
|
||||
GraphView.prototype._startForceLayoutIteration = function (forceLayout, layoutAnimation) {
|
||||
var self = this;
|
||||
|
||||
(function step() {
|
||||
forceLayout.step(function (stopped) {
|
||||
self.updateLayout(self._model);
|
||||
(self._layouting = !stopped) && (layoutAnimation ? self._layoutTimeout = setTimeout(step, 16) : step());
|
||||
});
|
||||
})();
|
||||
};
|
||||
|
||||
GraphView.prototype._updateController = function (seriesModel, ecModel, api) {
|
||||
var _this = this;
|
||||
|
||||
var controller = this._controller;
|
||||
var controllerHost = this._controllerHost;
|
||||
var group = this.group;
|
||||
controller.setPointerChecker(function (e, x, y) {
|
||||
var rect = group.getBoundingRect();
|
||||
rect.applyTransform(group.transform);
|
||||
return rect.contain(x, y) && !onIrrelevantElement(e, api, seriesModel);
|
||||
});
|
||||
|
||||
if (!isViewCoordSys(seriesModel.coordinateSystem)) {
|
||||
controller.disable();
|
||||
return;
|
||||
}
|
||||
|
||||
controller.enable(seriesModel.get('roam'));
|
||||
controllerHost.zoomLimit = seriesModel.get('scaleLimit');
|
||||
controllerHost.zoom = seriesModel.coordinateSystem.getZoom();
|
||||
controller.off('pan').off('zoom').on('pan', function (e) {
|
||||
roamHelper.updateViewOnPan(controllerHost, e.dx, e.dy);
|
||||
api.dispatchAction({
|
||||
seriesId: seriesModel.id,
|
||||
type: 'graphRoam',
|
||||
dx: e.dx,
|
||||
dy: e.dy
|
||||
});
|
||||
}).on('zoom', function (e) {
|
||||
roamHelper.updateViewOnZoom(controllerHost, e.scale, e.originX, e.originY);
|
||||
api.dispatchAction({
|
||||
seriesId: seriesModel.id,
|
||||
type: 'graphRoam',
|
||||
zoom: e.scale,
|
||||
originX: e.originX,
|
||||
originY: e.originY
|
||||
});
|
||||
|
||||
_this._updateNodeAndLinkScale();
|
||||
|
||||
adjustEdge(seriesModel.getGraph(), getNodeGlobalScale(seriesModel));
|
||||
|
||||
_this._lineDraw.updateLayout(); // Only update label layout on zoom
|
||||
|
||||
|
||||
api.updateLabelLayout();
|
||||
});
|
||||
};
|
||||
|
||||
GraphView.prototype._updateNodeAndLinkScale = function () {
|
||||
var seriesModel = this._model;
|
||||
var data = seriesModel.getData();
|
||||
var nodeScale = getNodeGlobalScale(seriesModel);
|
||||
data.eachItemGraphicEl(function (el, idx) {
|
||||
el && el.setSymbolScale(nodeScale);
|
||||
});
|
||||
};
|
||||
|
||||
GraphView.prototype.updateLayout = function (seriesModel) {
|
||||
adjustEdge(seriesModel.getGraph(), getNodeGlobalScale(seriesModel));
|
||||
|
||||
this._symbolDraw.updateLayout();
|
||||
|
||||
this._lineDraw.updateLayout();
|
||||
};
|
||||
|
||||
GraphView.prototype.remove = function (ecModel, api) {
|
||||
this._symbolDraw && this._symbolDraw.remove();
|
||||
this._lineDraw && this._lineDraw.remove();
|
||||
};
|
||||
|
||||
GraphView.type = 'graph';
|
||||
return GraphView;
|
||||
}(ChartView);
|
||||
|
||||
export default GraphView;
|
||||
190
uni-demo/node_modules/echarts/lib/chart/graph/adjustEdge.js
generated
vendored
Normal file
190
uni-demo/node_modules/echarts/lib/chart/graph/adjustEdge.js
generated
vendored
Normal file
@@ -0,0 +1,190 @@
|
||||
|
||||
/*
|
||||
* 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 curveTool from 'zrender/lib/core/curve.js';
|
||||
import * as vec2 from 'zrender/lib/core/vector.js';
|
||||
import { getSymbolSize } from './graphHelper.js';
|
||||
var v1 = [];
|
||||
var v2 = [];
|
||||
var v3 = [];
|
||||
var quadraticAt = curveTool.quadraticAt;
|
||||
var v2DistSquare = vec2.distSquare;
|
||||
var mathAbs = Math.abs;
|
||||
|
||||
function intersectCurveCircle(curvePoints, center, radius) {
|
||||
var p0 = curvePoints[0];
|
||||
var p1 = curvePoints[1];
|
||||
var p2 = curvePoints[2];
|
||||
var d = Infinity;
|
||||
var t;
|
||||
var radiusSquare = radius * radius;
|
||||
var interval = 0.1;
|
||||
|
||||
for (var _t = 0.1; _t <= 0.9; _t += 0.1) {
|
||||
v1[0] = quadraticAt(p0[0], p1[0], p2[0], _t);
|
||||
v1[1] = quadraticAt(p0[1], p1[1], p2[1], _t);
|
||||
var diff = mathAbs(v2DistSquare(v1, center) - radiusSquare);
|
||||
|
||||
if (diff < d) {
|
||||
d = diff;
|
||||
t = _t;
|
||||
}
|
||||
} // Assume the segment is monotone,Find root through Bisection method
|
||||
// At most 32 iteration
|
||||
|
||||
|
||||
for (var i = 0; i < 32; i++) {
|
||||
// let prev = t - interval;
|
||||
var next = t + interval; // v1[0] = quadraticAt(p0[0], p1[0], p2[0], prev);
|
||||
// v1[1] = quadraticAt(p0[1], p1[1], p2[1], prev);
|
||||
|
||||
v2[0] = quadraticAt(p0[0], p1[0], p2[0], t);
|
||||
v2[1] = quadraticAt(p0[1], p1[1], p2[1], t);
|
||||
v3[0] = quadraticAt(p0[0], p1[0], p2[0], next);
|
||||
v3[1] = quadraticAt(p0[1], p1[1], p2[1], next);
|
||||
var diff = v2DistSquare(v2, center) - radiusSquare;
|
||||
|
||||
if (mathAbs(diff) < 1e-2) {
|
||||
break;
|
||||
} // let prevDiff = v2DistSquare(v1, center) - radiusSquare;
|
||||
|
||||
|
||||
var nextDiff = v2DistSquare(v3, center) - radiusSquare;
|
||||
interval /= 2;
|
||||
|
||||
if (diff < 0) {
|
||||
if (nextDiff >= 0) {
|
||||
t = t + interval;
|
||||
} else {
|
||||
t = t - interval;
|
||||
}
|
||||
} else {
|
||||
if (nextDiff >= 0) {
|
||||
t = t - interval;
|
||||
} else {
|
||||
t = t + interval;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return t;
|
||||
} // Adjust edge to avoid
|
||||
|
||||
|
||||
export default function adjustEdge(graph, scale) {
|
||||
var tmp0 = [];
|
||||
var quadraticSubdivide = curveTool.quadraticSubdivide;
|
||||
var pts = [[], [], []];
|
||||
var pts2 = [[], []];
|
||||
var v = [];
|
||||
scale /= 2;
|
||||
graph.eachEdge(function (edge, idx) {
|
||||
var linePoints = edge.getLayout();
|
||||
var fromSymbol = edge.getVisual('fromSymbol');
|
||||
var toSymbol = edge.getVisual('toSymbol');
|
||||
|
||||
if (!linePoints.__original) {
|
||||
linePoints.__original = [vec2.clone(linePoints[0]), vec2.clone(linePoints[1])];
|
||||
|
||||
if (linePoints[2]) {
|
||||
linePoints.__original.push(vec2.clone(linePoints[2]));
|
||||
}
|
||||
}
|
||||
|
||||
var originalPoints = linePoints.__original; // Quadratic curve
|
||||
|
||||
if (linePoints[2] != null) {
|
||||
vec2.copy(pts[0], originalPoints[0]);
|
||||
vec2.copy(pts[1], originalPoints[2]);
|
||||
vec2.copy(pts[2], originalPoints[1]);
|
||||
|
||||
if (fromSymbol && fromSymbol !== 'none') {
|
||||
var symbolSize = getSymbolSize(edge.node1);
|
||||
var t = intersectCurveCircle(pts, originalPoints[0], symbolSize * scale); // Subdivide and get the second
|
||||
|
||||
quadraticSubdivide(pts[0][0], pts[1][0], pts[2][0], t, tmp0);
|
||||
pts[0][0] = tmp0[3];
|
||||
pts[1][0] = tmp0[4];
|
||||
quadraticSubdivide(pts[0][1], pts[1][1], pts[2][1], t, tmp0);
|
||||
pts[0][1] = tmp0[3];
|
||||
pts[1][1] = tmp0[4];
|
||||
}
|
||||
|
||||
if (toSymbol && toSymbol !== 'none') {
|
||||
var symbolSize = getSymbolSize(edge.node2);
|
||||
var t = intersectCurveCircle(pts, originalPoints[1], symbolSize * scale); // Subdivide and get the first
|
||||
|
||||
quadraticSubdivide(pts[0][0], pts[1][0], pts[2][0], t, tmp0);
|
||||
pts[1][0] = tmp0[1];
|
||||
pts[2][0] = tmp0[2];
|
||||
quadraticSubdivide(pts[0][1], pts[1][1], pts[2][1], t, tmp0);
|
||||
pts[1][1] = tmp0[1];
|
||||
pts[2][1] = tmp0[2];
|
||||
} // Copy back to layout
|
||||
|
||||
|
||||
vec2.copy(linePoints[0], pts[0]);
|
||||
vec2.copy(linePoints[1], pts[2]);
|
||||
vec2.copy(linePoints[2], pts[1]);
|
||||
} // Line
|
||||
else {
|
||||
vec2.copy(pts2[0], originalPoints[0]);
|
||||
vec2.copy(pts2[1], originalPoints[1]);
|
||||
vec2.sub(v, pts2[1], pts2[0]);
|
||||
vec2.normalize(v, v);
|
||||
|
||||
if (fromSymbol && fromSymbol !== 'none') {
|
||||
var symbolSize = getSymbolSize(edge.node1);
|
||||
vec2.scaleAndAdd(pts2[0], pts2[0], v, symbolSize * scale);
|
||||
}
|
||||
|
||||
if (toSymbol && toSymbol !== 'none') {
|
||||
var symbolSize = getSymbolSize(edge.node2);
|
||||
vec2.scaleAndAdd(pts2[1], pts2[1], v, -symbolSize * scale);
|
||||
}
|
||||
|
||||
vec2.copy(linePoints[0], pts2[0]);
|
||||
vec2.copy(linePoints[1], pts2[1]);
|
||||
}
|
||||
});
|
||||
}
|
||||
79
uni-demo/node_modules/echarts/lib/chart/graph/categoryFilter.js
generated
vendored
Normal file
79
uni-demo/node_modules/echarts/lib/chart/graph/categoryFilter.js
generated
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
|
||||
/*
|
||||
* 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 { isNumber } from 'zrender/lib/core/util.js';
|
||||
export default function categoryFilter(ecModel) {
|
||||
var legendModels = ecModel.findComponents({
|
||||
mainType: 'legend'
|
||||
});
|
||||
|
||||
if (!legendModels || !legendModels.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
ecModel.eachSeriesByType('graph', function (graphSeries) {
|
||||
var categoriesData = graphSeries.getCategoriesData();
|
||||
var graph = graphSeries.getGraph();
|
||||
var data = graph.data;
|
||||
var categoryNames = categoriesData.mapArray(categoriesData.getName);
|
||||
data.filterSelf(function (idx) {
|
||||
var model = data.getItemModel(idx);
|
||||
var category = model.getShallow('category');
|
||||
|
||||
if (category != null) {
|
||||
if (isNumber(category)) {
|
||||
category = categoryNames[category];
|
||||
} // If in any legend component the status is not selected.
|
||||
|
||||
|
||||
for (var i = 0; i < legendModels.length; i++) {
|
||||
if (!legendModels[i].isSelected(category)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
});
|
||||
}
|
||||
97
uni-demo/node_modules/echarts/lib/chart/graph/categoryVisual.js
generated
vendored
Normal file
97
uni-demo/node_modules/echarts/lib/chart/graph/categoryVisual.js
generated
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
|
||||
/*
|
||||
* 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, isString } from 'zrender/lib/core/util.js';
|
||||
export default function categoryVisual(ecModel) {
|
||||
var paletteScope = {};
|
||||
ecModel.eachSeriesByType('graph', function (seriesModel) {
|
||||
var categoriesData = seriesModel.getCategoriesData();
|
||||
var data = seriesModel.getData();
|
||||
var categoryNameIdxMap = {};
|
||||
categoriesData.each(function (idx) {
|
||||
var name = categoriesData.getName(idx); // Add prefix to avoid conflict with Object.prototype.
|
||||
|
||||
categoryNameIdxMap['ec-' + name] = idx;
|
||||
var itemModel = categoriesData.getItemModel(idx);
|
||||
var style = itemModel.getModel('itemStyle').getItemStyle();
|
||||
|
||||
if (!style.fill) {
|
||||
// Get color from palette.
|
||||
style.fill = seriesModel.getColorFromPalette(name, paletteScope);
|
||||
}
|
||||
|
||||
categoriesData.setItemVisual(idx, 'style', style);
|
||||
var symbolVisualList = ['symbol', 'symbolSize', 'symbolKeepAspect'];
|
||||
|
||||
for (var i = 0; i < symbolVisualList.length; i++) {
|
||||
var symbolVisual = itemModel.getShallow(symbolVisualList[i], true);
|
||||
|
||||
if (symbolVisual != null) {
|
||||
categoriesData.setItemVisual(idx, symbolVisualList[i], symbolVisual);
|
||||
}
|
||||
}
|
||||
}); // Assign category color to visual
|
||||
|
||||
if (categoriesData.count()) {
|
||||
data.each(function (idx) {
|
||||
var model = data.getItemModel(idx);
|
||||
var categoryIdx = model.getShallow('category');
|
||||
|
||||
if (categoryIdx != null) {
|
||||
if (isString(categoryIdx)) {
|
||||
categoryIdx = categoryNameIdxMap['ec-' + categoryIdx];
|
||||
}
|
||||
|
||||
var categoryStyle = categoriesData.getItemVisual(categoryIdx, 'style');
|
||||
var style = data.ensureUniqueItemVisual(idx, 'style');
|
||||
extend(style, categoryStyle);
|
||||
var visualList = ['symbol', 'symbolSize', 'symbolKeepAspect'];
|
||||
|
||||
for (var i = 0; i < visualList.length; i++) {
|
||||
data.setItemVisual(idx, visualList[i], categoriesData.getItemVisual(categoryIdx, visualList[i]));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
51
uni-demo/node_modules/echarts/lib/chart/graph/circularLayout.js
generated
vendored
Normal file
51
uni-demo/node_modules/echarts/lib/chart/graph/circularLayout.js
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
|
||||
/*
|
||||
* 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 { circularLayout } from './circularLayoutHelper.js';
|
||||
export default function graphCircularLayout(ecModel) {
|
||||
ecModel.eachSeriesByType('graph', function (seriesModel) {
|
||||
if (seriesModel.get('layout') === 'circular') {
|
||||
circularLayout(seriesModel, 'symbolSize');
|
||||
}
|
||||
});
|
||||
}
|
||||
150
uni-demo/node_modules/echarts/lib/chart/graph/circularLayoutHelper.js
generated
vendored
Normal file
150
uni-demo/node_modules/echarts/lib/chart/graph/circularLayoutHelper.js
generated
vendored
Normal file
@@ -0,0 +1,150 @@
|
||||
|
||||
/*
|
||||
* 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 vec2 from 'zrender/lib/core/vector.js';
|
||||
import { getSymbolSize, getNodeGlobalScale } from './graphHelper.js';
|
||||
import * as zrUtil from 'zrender/lib/core/util.js';
|
||||
import { getCurvenessForEdge } from '../helper/multipleGraphEdgeHelper.js';
|
||||
var PI = Math.PI;
|
||||
var _symbolRadiansHalf = [];
|
||||
/**
|
||||
* `basedOn` can be:
|
||||
* 'value':
|
||||
* This layout is not accurate and have same bad case. For example,
|
||||
* if the min value is very smaller than the max value, the nodes
|
||||
* with the min value probably overlap even though there is enough
|
||||
* space to layout them. So we only use this approach in the as the
|
||||
* init layout of the force layout.
|
||||
* FIXME
|
||||
* Probably we do not need this method any more but use
|
||||
* `basedOn: 'symbolSize'` in force layout if
|
||||
* delay its init operations to GraphView.
|
||||
* 'symbolSize':
|
||||
* This approach work only if all of the symbol size calculated.
|
||||
* That is, the progressive rendering is not applied to graph.
|
||||
* FIXME
|
||||
* If progressive rendering is applied to graph some day,
|
||||
* probably we have to use `basedOn: 'value'`.
|
||||
*/
|
||||
|
||||
export function circularLayout(seriesModel, basedOn) {
|
||||
var coordSys = seriesModel.coordinateSystem;
|
||||
|
||||
if (coordSys && coordSys.type !== 'view') {
|
||||
return;
|
||||
}
|
||||
|
||||
var rect = coordSys.getBoundingRect();
|
||||
var nodeData = seriesModel.getData();
|
||||
var graph = nodeData.graph;
|
||||
var cx = rect.width / 2 + rect.x;
|
||||
var cy = rect.height / 2 + rect.y;
|
||||
var r = Math.min(rect.width, rect.height) / 2;
|
||||
var count = nodeData.count();
|
||||
nodeData.setLayout({
|
||||
cx: cx,
|
||||
cy: cy
|
||||
});
|
||||
|
||||
if (!count) {
|
||||
return;
|
||||
}
|
||||
|
||||
_layoutNodesBasedOn[basedOn](seriesModel, graph, nodeData, r, cx, cy, count);
|
||||
|
||||
graph.eachEdge(function (edge, index) {
|
||||
var curveness = zrUtil.retrieve3(edge.getModel().get(['lineStyle', 'curveness']), getCurvenessForEdge(edge, seriesModel, index), 0);
|
||||
var p1 = vec2.clone(edge.node1.getLayout());
|
||||
var p2 = vec2.clone(edge.node2.getLayout());
|
||||
var cp1;
|
||||
var x12 = (p1[0] + p2[0]) / 2;
|
||||
var y12 = (p1[1] + p2[1]) / 2;
|
||||
|
||||
if (+curveness) {
|
||||
curveness *= 3;
|
||||
cp1 = [cx * curveness + x12 * (1 - curveness), cy * curveness + y12 * (1 - curveness)];
|
||||
}
|
||||
|
||||
edge.setLayout([p1, p2, cp1]);
|
||||
});
|
||||
}
|
||||
var _layoutNodesBasedOn = {
|
||||
value: function (seriesModel, graph, nodeData, r, cx, cy, count) {
|
||||
var angle = 0;
|
||||
var sum = nodeData.getSum('value');
|
||||
var unitAngle = Math.PI * 2 / (sum || count);
|
||||
graph.eachNode(function (node) {
|
||||
var value = node.getValue('value');
|
||||
var radianHalf = unitAngle * (sum ? value : 1) / 2;
|
||||
angle += radianHalf;
|
||||
node.setLayout([r * Math.cos(angle) + cx, r * Math.sin(angle) + cy]);
|
||||
angle += radianHalf;
|
||||
});
|
||||
},
|
||||
symbolSize: function (seriesModel, graph, nodeData, r, cx, cy, count) {
|
||||
var sumRadian = 0;
|
||||
_symbolRadiansHalf.length = count;
|
||||
var nodeScale = getNodeGlobalScale(seriesModel);
|
||||
graph.eachNode(function (node) {
|
||||
var symbolSize = getSymbolSize(node); // Normally this case will not happen, but we still add
|
||||
// some the defensive code (2px is an arbitrary value).
|
||||
|
||||
isNaN(symbolSize) && (symbolSize = 2);
|
||||
symbolSize < 0 && (symbolSize = 0);
|
||||
symbolSize *= nodeScale;
|
||||
var symbolRadianHalf = Math.asin(symbolSize / 2 / r); // when `symbolSize / 2` is bigger than `r`.
|
||||
|
||||
isNaN(symbolRadianHalf) && (symbolRadianHalf = PI / 2);
|
||||
_symbolRadiansHalf[node.dataIndex] = symbolRadianHalf;
|
||||
sumRadian += symbolRadianHalf * 2;
|
||||
});
|
||||
var halfRemainRadian = (2 * PI - sumRadian) / count / 2;
|
||||
var angle = 0;
|
||||
graph.eachNode(function (node) {
|
||||
var radianHalf = halfRemainRadian + _symbolRadiansHalf[node.dataIndex];
|
||||
angle += radianHalf;
|
||||
node.setLayout([r * Math.cos(angle) + cx, r * Math.sin(angle) + cy]);
|
||||
angle += radianHalf;
|
||||
});
|
||||
}
|
||||
};
|
||||
109
uni-demo/node_modules/echarts/lib/chart/graph/createView.js
generated
vendored
Normal file
109
uni-demo/node_modules/echarts/lib/chart/graph/createView.js
generated
vendored
Normal file
@@ -0,0 +1,109 @@
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
// FIXME Where to create the simple view coordinate system
|
||||
import View from '../../coord/View.js';
|
||||
import { getLayoutRect } from '../../util/layout.js';
|
||||
import * as bbox from 'zrender/lib/core/bbox.js';
|
||||
import { extend } from 'zrender/lib/core/util.js';
|
||||
|
||||
function getViewRect(seriesModel, api, aspect) {
|
||||
var option = extend(seriesModel.getBoxLayoutParams(), {
|
||||
aspect: aspect
|
||||
});
|
||||
return getLayoutRect(option, {
|
||||
width: api.getWidth(),
|
||||
height: api.getHeight()
|
||||
});
|
||||
}
|
||||
|
||||
export default function createViewCoordSys(ecModel, api) {
|
||||
var viewList = [];
|
||||
ecModel.eachSeriesByType('graph', function (seriesModel) {
|
||||
var coordSysType = seriesModel.get('coordinateSystem');
|
||||
|
||||
if (!coordSysType || coordSysType === 'view') {
|
||||
var data_1 = seriesModel.getData();
|
||||
var positions = data_1.mapArray(function (idx) {
|
||||
var itemModel = data_1.getItemModel(idx);
|
||||
return [+itemModel.get('x'), +itemModel.get('y')];
|
||||
});
|
||||
var min = [];
|
||||
var max = [];
|
||||
bbox.fromPoints(positions, min, max); // If width or height is 0
|
||||
|
||||
if (max[0] - min[0] === 0) {
|
||||
max[0] += 1;
|
||||
min[0] -= 1;
|
||||
}
|
||||
|
||||
if (max[1] - min[1] === 0) {
|
||||
max[1] += 1;
|
||||
min[1] -= 1;
|
||||
}
|
||||
|
||||
var aspect = (max[0] - min[0]) / (max[1] - min[1]); // FIXME If get view rect after data processed?
|
||||
|
||||
var viewRect = getViewRect(seriesModel, api, aspect); // Position may be NaN, use view rect instead
|
||||
|
||||
if (isNaN(aspect)) {
|
||||
min = [viewRect.x, viewRect.y];
|
||||
max = [viewRect.x + viewRect.width, viewRect.y + viewRect.height];
|
||||
}
|
||||
|
||||
var bbWidth = max[0] - min[0];
|
||||
var bbHeight = max[1] - min[1];
|
||||
var viewWidth = viewRect.width;
|
||||
var viewHeight = viewRect.height;
|
||||
var viewCoordSys = seriesModel.coordinateSystem = new View();
|
||||
viewCoordSys.zoomLimit = seriesModel.get('scaleLimit');
|
||||
viewCoordSys.setBoundingRect(min[0], min[1], bbWidth, bbHeight);
|
||||
viewCoordSys.setViewRect(viewRect.x, viewRect.y, viewWidth, viewHeight); // Update roam info
|
||||
|
||||
viewCoordSys.setCenter(seriesModel.get('center'), api);
|
||||
viewCoordSys.setZoom(seriesModel.get('zoom'));
|
||||
viewList.push(viewCoordSys);
|
||||
}
|
||||
});
|
||||
return viewList;
|
||||
}
|
||||
99
uni-demo/node_modules/echarts/lib/chart/graph/edgeVisual.js
generated
vendored
Normal file
99
uni-demo/node_modules/echarts/lib/chart/graph/edgeVisual.js
generated
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
|
||||
/*
|
||||
* 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 } from 'zrender/lib/core/util.js';
|
||||
|
||||
function normalize(a) {
|
||||
if (!(a instanceof Array)) {
|
||||
a = [a, a];
|
||||
}
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
export default function graphEdgeVisual(ecModel) {
|
||||
ecModel.eachSeriesByType('graph', function (seriesModel) {
|
||||
var graph = seriesModel.getGraph();
|
||||
var edgeData = seriesModel.getEdgeData();
|
||||
var symbolType = normalize(seriesModel.get('edgeSymbol'));
|
||||
var symbolSize = normalize(seriesModel.get('edgeSymbolSize')); // const colorQuery = ['lineStyle', 'color'] as const;
|
||||
// const opacityQuery = ['lineStyle', 'opacity'] as const;
|
||||
|
||||
edgeData.setVisual('fromSymbol', symbolType && symbolType[0]);
|
||||
edgeData.setVisual('toSymbol', symbolType && symbolType[1]);
|
||||
edgeData.setVisual('fromSymbolSize', symbolSize && symbolSize[0]);
|
||||
edgeData.setVisual('toSymbolSize', symbolSize && symbolSize[1]);
|
||||
edgeData.setVisual('style', seriesModel.getModel('lineStyle').getLineStyle());
|
||||
edgeData.each(function (idx) {
|
||||
var itemModel = edgeData.getItemModel(idx);
|
||||
var edge = graph.getEdgeByIndex(idx);
|
||||
var symbolType = normalize(itemModel.getShallow('symbol', true));
|
||||
var symbolSize = normalize(itemModel.getShallow('symbolSize', true)); // Edge visual must after node visual
|
||||
|
||||
var style = itemModel.getModel('lineStyle').getLineStyle();
|
||||
var existsStyle = edgeData.ensureUniqueItemVisual(idx, 'style');
|
||||
extend(existsStyle, style);
|
||||
|
||||
switch (existsStyle.stroke) {
|
||||
case 'source':
|
||||
{
|
||||
var nodeStyle = edge.node1.getVisual('style');
|
||||
existsStyle.stroke = nodeStyle && nodeStyle.fill;
|
||||
break;
|
||||
}
|
||||
|
||||
case 'target':
|
||||
{
|
||||
var nodeStyle = edge.node2.getVisual('style');
|
||||
existsStyle.stroke = nodeStyle && nodeStyle.fill;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
symbolType[0] && edge.setVisual('fromSymbol', symbolType[0]);
|
||||
symbolType[1] && edge.setVisual('toSymbol', symbolType[1]);
|
||||
symbolSize[0] && edge.setVisual('fromSymbolSize', symbolSize[0]);
|
||||
symbolSize[1] && edge.setVisual('toSymbolSize', symbolSize[1]);
|
||||
});
|
||||
});
|
||||
}
|
||||
207
uni-demo/node_modules/echarts/lib/chart/graph/forceHelper.js
generated
vendored
Normal file
207
uni-demo/node_modules/echarts/lib/chart/graph/forceHelper.js
generated
vendored
Normal file
@@ -0,0 +1,207 @@
|
||||
|
||||
/*
|
||||
* 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 embeded for some of the code in this file:
|
||||
* Some formulas were originally copied from "d3.js" with some
|
||||
* modifications made for this project.
|
||||
* (See more details in the comment of the method "step" 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 vec2 from 'zrender/lib/core/vector.js';
|
||||
var scaleAndAdd = vec2.scaleAndAdd; // function adjacentNode(n, e) {
|
||||
// return e.n1 === n ? e.n2 : e.n1;
|
||||
// }
|
||||
|
||||
export function forceLayout(inNodes, inEdges, opts) {
|
||||
var nodes = inNodes;
|
||||
var edges = inEdges;
|
||||
var rect = opts.rect;
|
||||
var width = rect.width;
|
||||
var height = rect.height;
|
||||
var center = [rect.x + width / 2, rect.y + height / 2]; // let scale = opts.scale || 1;
|
||||
|
||||
var gravity = opts.gravity == null ? 0.1 : opts.gravity; // for (let i = 0; i < edges.length; i++) {
|
||||
// let e = edges[i];
|
||||
// let n1 = e.n1;
|
||||
// let n2 = e.n2;
|
||||
// n1.edges = n1.edges || [];
|
||||
// n2.edges = n2.edges || [];
|
||||
// n1.edges.push(e);
|
||||
// n2.edges.push(e);
|
||||
// }
|
||||
// Init position
|
||||
|
||||
for (var i = 0; i < nodes.length; i++) {
|
||||
var n = nodes[i];
|
||||
|
||||
if (!n.p) {
|
||||
n.p = vec2.create(width * (Math.random() - 0.5) + center[0], height * (Math.random() - 0.5) + center[1]);
|
||||
}
|
||||
|
||||
n.pp = vec2.clone(n.p);
|
||||
n.edges = null;
|
||||
} // Formula in 'Graph Drawing by Force-directed Placement'
|
||||
// let k = scale * Math.sqrt(width * height / nodes.length);
|
||||
// let k2 = k * k;
|
||||
|
||||
|
||||
var initialFriction = opts.friction == null ? 0.6 : opts.friction;
|
||||
var friction = initialFriction;
|
||||
var beforeStepCallback;
|
||||
var afterStepCallback;
|
||||
return {
|
||||
warmUp: function () {
|
||||
friction = initialFriction * 0.8;
|
||||
},
|
||||
setFixed: function (idx) {
|
||||
nodes[idx].fixed = true;
|
||||
},
|
||||
setUnfixed: function (idx) {
|
||||
nodes[idx].fixed = false;
|
||||
},
|
||||
|
||||
/**
|
||||
* Before step hook
|
||||
*/
|
||||
beforeStep: function (cb) {
|
||||
beforeStepCallback = cb;
|
||||
},
|
||||
|
||||
/**
|
||||
* After step hook
|
||||
*/
|
||||
afterStep: function (cb) {
|
||||
afterStepCallback = cb;
|
||||
},
|
||||
|
||||
/**
|
||||
* Some formulas were originally copied from "d3.js"
|
||||
* https://github.com/d3/d3/blob/b516d77fb8566b576088e73410437494717ada26/src/layout/force.js
|
||||
* with some modifications made for this project.
|
||||
* See the license statement at the head of this file.
|
||||
*/
|
||||
step: function (cb) {
|
||||
beforeStepCallback && beforeStepCallback(nodes, edges);
|
||||
var v12 = [];
|
||||
var nLen = nodes.length;
|
||||
|
||||
for (var i = 0; i < edges.length; i++) {
|
||||
var e = edges[i];
|
||||
|
||||
if (e.ignoreForceLayout) {
|
||||
continue;
|
||||
}
|
||||
|
||||
var n1 = e.n1;
|
||||
var n2 = e.n2;
|
||||
vec2.sub(v12, n2.p, n1.p);
|
||||
var d = vec2.len(v12) - e.d;
|
||||
var w = n2.w / (n1.w + n2.w);
|
||||
|
||||
if (isNaN(w)) {
|
||||
w = 0;
|
||||
}
|
||||
|
||||
vec2.normalize(v12, v12);
|
||||
!n1.fixed && scaleAndAdd(n1.p, n1.p, v12, w * d * friction);
|
||||
!n2.fixed && scaleAndAdd(n2.p, n2.p, v12, -(1 - w) * d * friction);
|
||||
} // Gravity
|
||||
|
||||
|
||||
for (var i = 0; i < nLen; i++) {
|
||||
var n = nodes[i];
|
||||
|
||||
if (!n.fixed) {
|
||||
vec2.sub(v12, center, n.p); // let d = vec2.len(v12);
|
||||
// vec2.scale(v12, v12, 1 / d);
|
||||
// let gravityFactor = gravity;
|
||||
|
||||
scaleAndAdd(n.p, n.p, v12, gravity * friction);
|
||||
}
|
||||
} // Repulsive
|
||||
// PENDING
|
||||
|
||||
|
||||
for (var i = 0; i < nLen; i++) {
|
||||
var n1 = nodes[i];
|
||||
|
||||
for (var j = i + 1; j < nLen; j++) {
|
||||
var n2 = nodes[j];
|
||||
vec2.sub(v12, n2.p, n1.p);
|
||||
var d = vec2.len(v12);
|
||||
|
||||
if (d === 0) {
|
||||
// Random repulse
|
||||
vec2.set(v12, Math.random() - 0.5, Math.random() - 0.5);
|
||||
d = 1;
|
||||
}
|
||||
|
||||
var repFact = (n1.rep + n2.rep) / d / d;
|
||||
!n1.fixed && scaleAndAdd(n1.pp, n1.pp, v12, repFact);
|
||||
!n2.fixed && scaleAndAdd(n2.pp, n2.pp, v12, -repFact);
|
||||
}
|
||||
}
|
||||
|
||||
var v = [];
|
||||
|
||||
for (var i = 0; i < nLen; i++) {
|
||||
var n = nodes[i];
|
||||
|
||||
if (!n.fixed) {
|
||||
vec2.sub(v, n.p, n.pp);
|
||||
scaleAndAdd(n.p, n.p, v, friction);
|
||||
vec2.copy(n.pp, n.p);
|
||||
}
|
||||
}
|
||||
|
||||
friction = friction * 0.992;
|
||||
var finished = friction < 0.01;
|
||||
afterStepCallback && afterStepCallback(nodes, edges, finished);
|
||||
cb && cb(finished);
|
||||
}
|
||||
};
|
||||
}
|
||||
172
uni-demo/node_modules/echarts/lib/chart/graph/forceLayout.js
generated
vendored
Normal file
172
uni-demo/node_modules/echarts/lib/chart/graph/forceLayout.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.
|
||||
*/
|
||||
import { forceLayout } from './forceHelper.js';
|
||||
import { simpleLayout } from './simpleLayoutHelper.js';
|
||||
import { circularLayout } from './circularLayoutHelper.js';
|
||||
import { linearMap } from '../../util/number.js';
|
||||
import * as vec2 from 'zrender/lib/core/vector.js';
|
||||
import * as zrUtil from 'zrender/lib/core/util.js';
|
||||
import { getCurvenessForEdge } from '../helper/multipleGraphEdgeHelper.js';
|
||||
export default function graphForceLayout(ecModel) {
|
||||
ecModel.eachSeriesByType('graph', function (graphSeries) {
|
||||
var coordSys = graphSeries.coordinateSystem;
|
||||
|
||||
if (coordSys && coordSys.type !== 'view') {
|
||||
return;
|
||||
}
|
||||
|
||||
if (graphSeries.get('layout') === 'force') {
|
||||
var preservedPoints_1 = graphSeries.preservedPoints || {};
|
||||
var graph_1 = graphSeries.getGraph();
|
||||
var nodeData_1 = graph_1.data;
|
||||
var edgeData = graph_1.edgeData;
|
||||
var forceModel = graphSeries.getModel('force');
|
||||
var initLayout = forceModel.get('initLayout');
|
||||
|
||||
if (graphSeries.preservedPoints) {
|
||||
nodeData_1.each(function (idx) {
|
||||
var id = nodeData_1.getId(idx);
|
||||
nodeData_1.setItemLayout(idx, preservedPoints_1[id] || [NaN, NaN]);
|
||||
});
|
||||
} else if (!initLayout || initLayout === 'none') {
|
||||
simpleLayout(graphSeries);
|
||||
} else if (initLayout === 'circular') {
|
||||
circularLayout(graphSeries, 'value');
|
||||
}
|
||||
|
||||
var nodeDataExtent_1 = nodeData_1.getDataExtent('value');
|
||||
var edgeDataExtent_1 = edgeData.getDataExtent('value'); // let edgeDataExtent = edgeData.getDataExtent('value');
|
||||
|
||||
var repulsion = forceModel.get('repulsion');
|
||||
var edgeLength = forceModel.get('edgeLength');
|
||||
var repulsionArr_1 = zrUtil.isArray(repulsion) ? repulsion : [repulsion, repulsion];
|
||||
var edgeLengthArr_1 = zrUtil.isArray(edgeLength) ? edgeLength : [edgeLength, edgeLength]; // Larger value has smaller length
|
||||
|
||||
edgeLengthArr_1 = [edgeLengthArr_1[1], edgeLengthArr_1[0]];
|
||||
var nodes_1 = nodeData_1.mapArray('value', function (value, idx) {
|
||||
var point = nodeData_1.getItemLayout(idx);
|
||||
var rep = linearMap(value, nodeDataExtent_1, repulsionArr_1);
|
||||
|
||||
if (isNaN(rep)) {
|
||||
rep = (repulsionArr_1[0] + repulsionArr_1[1]) / 2;
|
||||
}
|
||||
|
||||
return {
|
||||
w: rep,
|
||||
rep: rep,
|
||||
fixed: nodeData_1.getItemModel(idx).get('fixed'),
|
||||
p: !point || isNaN(point[0]) || isNaN(point[1]) ? null : point
|
||||
};
|
||||
});
|
||||
var edges = edgeData.mapArray('value', function (value, idx) {
|
||||
var edge = graph_1.getEdgeByIndex(idx);
|
||||
var d = linearMap(value, edgeDataExtent_1, edgeLengthArr_1);
|
||||
|
||||
if (isNaN(d)) {
|
||||
d = (edgeLengthArr_1[0] + edgeLengthArr_1[1]) / 2;
|
||||
}
|
||||
|
||||
var edgeModel = edge.getModel();
|
||||
var curveness = zrUtil.retrieve3(edge.getModel().get(['lineStyle', 'curveness']), -getCurvenessForEdge(edge, graphSeries, idx, true), 0);
|
||||
return {
|
||||
n1: nodes_1[edge.node1.dataIndex],
|
||||
n2: nodes_1[edge.node2.dataIndex],
|
||||
d: d,
|
||||
curveness: curveness,
|
||||
ignoreForceLayout: edgeModel.get('ignoreForceLayout')
|
||||
};
|
||||
}); // let coordSys = graphSeries.coordinateSystem;
|
||||
|
||||
var rect = coordSys.getBoundingRect();
|
||||
var forceInstance = forceLayout(nodes_1, edges, {
|
||||
rect: rect,
|
||||
gravity: forceModel.get('gravity'),
|
||||
friction: forceModel.get('friction')
|
||||
});
|
||||
forceInstance.beforeStep(function (nodes, edges) {
|
||||
for (var i = 0, l = nodes.length; i < l; i++) {
|
||||
if (nodes[i].fixed) {
|
||||
// Write back to layout instance
|
||||
vec2.copy(nodes[i].p, graph_1.getNodeByIndex(i).getLayout());
|
||||
}
|
||||
}
|
||||
});
|
||||
forceInstance.afterStep(function (nodes, edges, stopped) {
|
||||
for (var i = 0, l = nodes.length; i < l; i++) {
|
||||
if (!nodes[i].fixed) {
|
||||
graph_1.getNodeByIndex(i).setLayout(nodes[i].p);
|
||||
}
|
||||
|
||||
preservedPoints_1[nodeData_1.getId(i)] = nodes[i].p;
|
||||
}
|
||||
|
||||
for (var i = 0, l = edges.length; i < l; i++) {
|
||||
var e = edges[i];
|
||||
var edge = graph_1.getEdgeByIndex(i);
|
||||
var p1 = e.n1.p;
|
||||
var p2 = e.n2.p;
|
||||
var points = edge.getLayout();
|
||||
points = points ? points.slice() : [];
|
||||
points[0] = points[0] || [];
|
||||
points[1] = points[1] || [];
|
||||
vec2.copy(points[0], p1);
|
||||
vec2.copy(points[1], p2);
|
||||
|
||||
if (+e.curveness) {
|
||||
points[2] = [(p1[0] + p2[0]) / 2 - (p1[1] - p2[1]) * e.curveness, (p1[1] + p2[1]) / 2 - (p2[0] - p1[0]) * e.curveness];
|
||||
}
|
||||
|
||||
edge.setLayout(points);
|
||||
}
|
||||
});
|
||||
graphSeries.forceLayout = forceInstance;
|
||||
graphSeries.preservedPoints = preservedPoints_1; // Step to get the layout
|
||||
|
||||
forceInstance.step();
|
||||
} else {
|
||||
// Remove prev injected forceLayout instance
|
||||
graphSeries.forceLayout = null;
|
||||
}
|
||||
});
|
||||
}
|
||||
66
uni-demo/node_modules/echarts/lib/chart/graph/graphHelper.js
generated
vendored
Normal file
66
uni-demo/node_modules/echarts/lib/chart/graph/graphHelper.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.
|
||||
*/
|
||||
export function getNodeGlobalScale(seriesModel) {
|
||||
var coordSys = seriesModel.coordinateSystem;
|
||||
|
||||
if (coordSys.type !== 'view') {
|
||||
return 1;
|
||||
}
|
||||
|
||||
var nodeScaleRatio = seriesModel.option.nodeScaleRatio;
|
||||
var groupZoom = coordSys.scaleX; // Scale node when zoom changes
|
||||
|
||||
var roamZoom = coordSys.getZoom();
|
||||
var nodeScale = (roamZoom - 1) * nodeScaleRatio + 1;
|
||||
return nodeScale / groupZoom;
|
||||
}
|
||||
export function getSymbolSize(node) {
|
||||
var symbolSize = node.getVisual('symbolSize');
|
||||
|
||||
if (symbolSize instanceof Array) {
|
||||
symbolSize = (symbolSize[0] + symbolSize[1]) / 2;
|
||||
}
|
||||
|
||||
return +symbolSize;
|
||||
}
|
||||
97
uni-demo/node_modules/echarts/lib/chart/graph/install.js
generated
vendored
Normal file
97
uni-demo/node_modules/echarts/lib/chart/graph/install.js
generated
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
|
||||
/*
|
||||
* 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 categoryFilter from './categoryFilter.js';
|
||||
import categoryVisual from './categoryVisual.js';
|
||||
import edgeVisual from './edgeVisual.js';
|
||||
import simpleLayout from './simpleLayout.js';
|
||||
import circularLayout from './circularLayout.js';
|
||||
import forceLayout from './forceLayout.js';
|
||||
import createView from './createView.js';
|
||||
import View from '../../coord/View.js';
|
||||
import GraphView from './GraphView.js';
|
||||
import GraphSeriesModel from './GraphSeries.js';
|
||||
import { updateCenterAndZoom } from '../../action/roamHelper.js';
|
||||
import { noop } from 'zrender/lib/core/util.js';
|
||||
var actionInfo = {
|
||||
type: 'graphRoam',
|
||||
event: 'graphRoam',
|
||||
update: 'none'
|
||||
};
|
||||
export function install(registers) {
|
||||
registers.registerChartView(GraphView);
|
||||
registers.registerSeriesModel(GraphSeriesModel);
|
||||
registers.registerProcessor(categoryFilter);
|
||||
registers.registerVisual(categoryVisual);
|
||||
registers.registerVisual(edgeVisual);
|
||||
registers.registerLayout(simpleLayout);
|
||||
registers.registerLayout(registers.PRIORITY.VISUAL.POST_CHART_LAYOUT, circularLayout);
|
||||
registers.registerLayout(forceLayout);
|
||||
registers.registerCoordinateSystem('graphView', {
|
||||
dimensions: View.dimensions,
|
||||
create: createView
|
||||
}); // Register legacy focus actions
|
||||
|
||||
registers.registerAction({
|
||||
type: 'focusNodeAdjacency',
|
||||
event: 'focusNodeAdjacency',
|
||||
update: 'series:focusNodeAdjacency'
|
||||
}, noop);
|
||||
registers.registerAction({
|
||||
type: 'unfocusNodeAdjacency',
|
||||
event: 'unfocusNodeAdjacency',
|
||||
update: 'series:unfocusNodeAdjacency'
|
||||
}, noop); // Register roam action.
|
||||
|
||||
registers.registerAction(actionInfo, function (payload, ecModel, api) {
|
||||
ecModel.eachComponent({
|
||||
mainType: 'series',
|
||||
query: payload
|
||||
}, function (seriesModel) {
|
||||
var coordSys = seriesModel.coordinateSystem;
|
||||
var res = updateCenterAndZoom(coordSys, payload, undefined, api);
|
||||
seriesModel.setCenter && seriesModel.setCenter(res.center);
|
||||
seriesModel.setZoom && seriesModel.setZoom(res.zoom);
|
||||
});
|
||||
});
|
||||
}
|
||||
85
uni-demo/node_modules/echarts/lib/chart/graph/simpleLayout.js
generated
vendored
Normal file
85
uni-demo/node_modules/echarts/lib/chart/graph/simpleLayout.js
generated
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
|
||||
/*
|
||||
* 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 } from 'zrender/lib/core/util.js';
|
||||
import { simpleLayout, simpleLayoutEdge } from './simpleLayoutHelper.js';
|
||||
export default function graphSimpleLayout(ecModel, api) {
|
||||
ecModel.eachSeriesByType('graph', function (seriesModel) {
|
||||
var layout = seriesModel.get('layout');
|
||||
var coordSys = seriesModel.coordinateSystem;
|
||||
|
||||
if (coordSys && coordSys.type !== 'view') {
|
||||
var data_1 = seriesModel.getData();
|
||||
var dimensions_1 = [];
|
||||
each(coordSys.dimensions, function (coordDim) {
|
||||
dimensions_1 = dimensions_1.concat(data_1.mapDimensionsAll(coordDim));
|
||||
});
|
||||
|
||||
for (var dataIndex = 0; dataIndex < data_1.count(); dataIndex++) {
|
||||
var value = [];
|
||||
var hasValue = false;
|
||||
|
||||
for (var i = 0; i < dimensions_1.length; i++) {
|
||||
var val = data_1.get(dimensions_1[i], dataIndex);
|
||||
|
||||
if (!isNaN(val)) {
|
||||
hasValue = true;
|
||||
}
|
||||
|
||||
value.push(val);
|
||||
}
|
||||
|
||||
if (hasValue) {
|
||||
data_1.setItemLayout(dataIndex, coordSys.dataToPoint(value));
|
||||
} else {
|
||||
// Also {Array.<number>}, not undefined to avoid if...else... statement
|
||||
data_1.setItemLayout(dataIndex, [NaN, NaN]);
|
||||
}
|
||||
}
|
||||
|
||||
simpleLayoutEdge(data_1.graph, seriesModel);
|
||||
} else if (!layout || layout === 'none') {
|
||||
simpleLayout(seriesModel);
|
||||
}
|
||||
});
|
||||
}
|
||||
74
uni-demo/node_modules/echarts/lib/chart/graph/simpleLayoutHelper.js
generated
vendored
Normal file
74
uni-demo/node_modules/echarts/lib/chart/graph/simpleLayoutHelper.js
generated
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
|
||||
/*
|
||||
* 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 vec2 from 'zrender/lib/core/vector.js';
|
||||
import * as zrUtil from 'zrender/lib/core/util.js';
|
||||
import { getCurvenessForEdge } from '../helper/multipleGraphEdgeHelper.js';
|
||||
export function simpleLayout(seriesModel) {
|
||||
var coordSys = seriesModel.coordinateSystem;
|
||||
|
||||
if (coordSys && coordSys.type !== 'view') {
|
||||
return;
|
||||
}
|
||||
|
||||
var graph = seriesModel.getGraph();
|
||||
graph.eachNode(function (node) {
|
||||
var model = node.getModel();
|
||||
node.setLayout([+model.get('x'), +model.get('y')]);
|
||||
});
|
||||
simpleLayoutEdge(graph, seriesModel);
|
||||
}
|
||||
export function simpleLayoutEdge(graph, seriesModel) {
|
||||
graph.eachEdge(function (edge, index) {
|
||||
var curveness = zrUtil.retrieve3(edge.getModel().get(['lineStyle', 'curveness']), -getCurvenessForEdge(edge, seriesModel, index, true), 0);
|
||||
var p1 = vec2.clone(edge.node1.getLayout());
|
||||
var p2 = vec2.clone(edge.node2.getLayout());
|
||||
var points = [p1, p2];
|
||||
|
||||
if (+curveness) {
|
||||
points.push([(p1[0] + p2[0]) / 2 - (p1[1] - p2[1]) * curveness, (p1[1] + p2[1]) / 2 - (p2[0] - p1[0]) * curveness]);
|
||||
}
|
||||
|
||||
edge.setLayout(points);
|
||||
});
|
||||
}
|
||||
46
uni-demo/node_modules/echarts/lib/chart/heatmap.js
generated
vendored
Normal file
46
uni-demo/node_modules/echarts/lib/chart/heatmap.js
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
|
||||
/*
|
||||
* 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 { use } from '../extension.js';
|
||||
import { install } from './heatmap/install.js';
|
||||
use(install);
|
||||
188
uni-demo/node_modules/echarts/lib/chart/heatmap/HeatmapLayer.js
generated
vendored
Normal file
188
uni-demo/node_modules/echarts/lib/chart/heatmap/HeatmapLayer.js
generated
vendored
Normal file
@@ -0,0 +1,188 @@
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/* global Uint8ClampedArray */
|
||||
import { platformApi } from 'zrender/lib/core/platform.js';
|
||||
var GRADIENT_LEVELS = 256;
|
||||
|
||||
var HeatmapLayer =
|
||||
/** @class */
|
||||
function () {
|
||||
function HeatmapLayer() {
|
||||
this.blurSize = 30;
|
||||
this.pointSize = 20;
|
||||
this.maxOpacity = 1;
|
||||
this.minOpacity = 0;
|
||||
this._gradientPixels = {
|
||||
inRange: null,
|
||||
outOfRange: null
|
||||
};
|
||||
var canvas = platformApi.createCanvas();
|
||||
this.canvas = canvas;
|
||||
}
|
||||
/**
|
||||
* Renders Heatmap and returns the rendered canvas
|
||||
* @param data array of data, each has x, y, value
|
||||
* @param width canvas width
|
||||
* @param height canvas height
|
||||
*/
|
||||
|
||||
|
||||
HeatmapLayer.prototype.update = function (data, width, height, normalize, colorFunc, isInRange) {
|
||||
var brush = this._getBrush();
|
||||
|
||||
var gradientInRange = this._getGradient(colorFunc, 'inRange');
|
||||
|
||||
var gradientOutOfRange = this._getGradient(colorFunc, 'outOfRange');
|
||||
|
||||
var r = this.pointSize + this.blurSize;
|
||||
var canvas = this.canvas;
|
||||
var ctx = canvas.getContext('2d');
|
||||
var len = data.length;
|
||||
canvas.width = width;
|
||||
canvas.height = height;
|
||||
|
||||
for (var i = 0; i < len; ++i) {
|
||||
var p = data[i];
|
||||
var x = p[0];
|
||||
var y = p[1];
|
||||
var value = p[2]; // calculate alpha using value
|
||||
|
||||
var alpha = normalize(value); // draw with the circle brush with alpha
|
||||
|
||||
ctx.globalAlpha = alpha;
|
||||
ctx.drawImage(brush, x - r, y - r);
|
||||
}
|
||||
|
||||
if (!canvas.width || !canvas.height) {
|
||||
// Avoid "Uncaught DOMException: Failed to execute 'getImageData' on
|
||||
// 'CanvasRenderingContext2D': The source height is 0."
|
||||
return canvas;
|
||||
} // colorize the canvas using alpha value and set with gradient
|
||||
|
||||
|
||||
var imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);
|
||||
var pixels = imageData.data;
|
||||
var offset = 0;
|
||||
var pixelLen = pixels.length;
|
||||
var minOpacity = this.minOpacity;
|
||||
var maxOpacity = this.maxOpacity;
|
||||
var diffOpacity = maxOpacity - minOpacity;
|
||||
|
||||
while (offset < pixelLen) {
|
||||
var alpha = pixels[offset + 3] / 256;
|
||||
var gradientOffset = Math.floor(alpha * (GRADIENT_LEVELS - 1)) * 4; // Simple optimize to ignore the empty data
|
||||
|
||||
if (alpha > 0) {
|
||||
var gradient = isInRange(alpha) ? gradientInRange : gradientOutOfRange; // Any alpha > 0 will be mapped to [minOpacity, maxOpacity]
|
||||
|
||||
alpha > 0 && (alpha = alpha * diffOpacity + minOpacity);
|
||||
pixels[offset++] = gradient[gradientOffset];
|
||||
pixels[offset++] = gradient[gradientOffset + 1];
|
||||
pixels[offset++] = gradient[gradientOffset + 2];
|
||||
pixels[offset++] = gradient[gradientOffset + 3] * alpha * 256;
|
||||
} else {
|
||||
offset += 4;
|
||||
}
|
||||
}
|
||||
|
||||
ctx.putImageData(imageData, 0, 0);
|
||||
return canvas;
|
||||
};
|
||||
/**
|
||||
* get canvas of a black circle brush used for canvas to draw later
|
||||
*/
|
||||
|
||||
|
||||
HeatmapLayer.prototype._getBrush = function () {
|
||||
var brushCanvas = this._brushCanvas || (this._brushCanvas = platformApi.createCanvas()); // set brush size
|
||||
|
||||
var r = this.pointSize + this.blurSize;
|
||||
var d = r * 2;
|
||||
brushCanvas.width = d;
|
||||
brushCanvas.height = d;
|
||||
var ctx = brushCanvas.getContext('2d');
|
||||
ctx.clearRect(0, 0, d, d); // in order to render shadow without the distinct circle,
|
||||
// draw the distinct circle in an invisible place,
|
||||
// and use shadowOffset to draw shadow in the center of the canvas
|
||||
|
||||
ctx.shadowOffsetX = d;
|
||||
ctx.shadowBlur = this.blurSize; // draw the shadow in black, and use alpha and shadow blur to generate
|
||||
// color in color map
|
||||
|
||||
ctx.shadowColor = '#000'; // draw circle in the left to the canvas
|
||||
|
||||
ctx.beginPath();
|
||||
ctx.arc(-r, r, this.pointSize, 0, Math.PI * 2, true);
|
||||
ctx.closePath();
|
||||
ctx.fill();
|
||||
return brushCanvas;
|
||||
};
|
||||
/**
|
||||
* get gradient color map
|
||||
* @private
|
||||
*/
|
||||
|
||||
|
||||
HeatmapLayer.prototype._getGradient = function (colorFunc, state) {
|
||||
var gradientPixels = this._gradientPixels;
|
||||
var pixelsSingleState = gradientPixels[state] || (gradientPixels[state] = new Uint8ClampedArray(256 * 4));
|
||||
var color = [0, 0, 0, 0];
|
||||
var off = 0;
|
||||
|
||||
for (var i = 0; i < 256; i++) {
|
||||
colorFunc[state](i / 255, true, color);
|
||||
pixelsSingleState[off++] = color[0];
|
||||
pixelsSingleState[off++] = color[1];
|
||||
pixelsSingleState[off++] = color[2];
|
||||
pixelsSingleState[off++] = color[3];
|
||||
}
|
||||
|
||||
return pixelsSingleState;
|
||||
};
|
||||
|
||||
return HeatmapLayer;
|
||||
}();
|
||||
|
||||
export default HeatmapLayer;
|
||||
99
uni-demo/node_modules/echarts/lib/chart/heatmap/HeatmapSeries.js
generated
vendored
Normal file
99
uni-demo/node_modules/echarts/lib/chart/heatmap/HeatmapSeries.js
generated
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
|
||||
/*
|
||||
* 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 SeriesModel from '../../model/Series.js';
|
||||
import createSeriesData from '../helper/createSeriesData.js';
|
||||
import CoordinateSystem from '../../core/CoordinateSystem.js';
|
||||
|
||||
var HeatmapSeriesModel =
|
||||
/** @class */
|
||||
function (_super) {
|
||||
__extends(HeatmapSeriesModel, _super);
|
||||
|
||||
function HeatmapSeriesModel() {
|
||||
var _this = _super !== null && _super.apply(this, arguments) || this;
|
||||
|
||||
_this.type = HeatmapSeriesModel.type;
|
||||
return _this;
|
||||
}
|
||||
|
||||
HeatmapSeriesModel.prototype.getInitialData = function (option, ecModel) {
|
||||
return createSeriesData(null, this, {
|
||||
generateCoord: 'value'
|
||||
});
|
||||
};
|
||||
|
||||
HeatmapSeriesModel.prototype.preventIncremental = function () {
|
||||
var coordSysCreator = CoordinateSystem.get(this.get('coordinateSystem'));
|
||||
|
||||
if (coordSysCreator && coordSysCreator.dimensions) {
|
||||
return coordSysCreator.dimensions[0] === 'lng' && coordSysCreator.dimensions[1] === 'lat';
|
||||
}
|
||||
};
|
||||
|
||||
HeatmapSeriesModel.type = 'series.heatmap';
|
||||
HeatmapSeriesModel.dependencies = ['grid', 'geo', 'calendar'];
|
||||
HeatmapSeriesModel.defaultOption = {
|
||||
coordinateSystem: 'cartesian2d',
|
||||
// zlevel: 0,
|
||||
z: 2,
|
||||
// Cartesian coordinate system
|
||||
// xAxisIndex: 0,
|
||||
// yAxisIndex: 0,
|
||||
// Geo coordinate system
|
||||
geoIndex: 0,
|
||||
blurSize: 30,
|
||||
pointSize: 20,
|
||||
maxOpacity: 1,
|
||||
minOpacity: 0,
|
||||
select: {
|
||||
itemStyle: {
|
||||
borderColor: '#212121'
|
||||
}
|
||||
}
|
||||
};
|
||||
return HeatmapSeriesModel;
|
||||
}(SeriesModel);
|
||||
|
||||
export default HeatmapSeriesModel;
|
||||
350
uni-demo/node_modules/echarts/lib/chart/heatmap/HeatmapView.js
generated
vendored
Normal file
350
uni-demo/node_modules/echarts/lib/chart/heatmap/HeatmapView.js
generated
vendored
Normal file
@@ -0,0 +1,350 @@
|
||||
|
||||
/*
|
||||
* 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 graphic from '../../util/graphic.js';
|
||||
import { toggleHoverEmphasis } from '../../util/states.js';
|
||||
import HeatmapLayer from './HeatmapLayer.js';
|
||||
import * as zrUtil from 'zrender/lib/core/util.js';
|
||||
import ChartView from '../../view/Chart.js';
|
||||
import { isCoordinateSystemType } from '../../coord/CoordinateSystem.js';
|
||||
import { setLabelStyle, getLabelStatesModels } from '../../label/labelStyle.js';
|
||||
|
||||
function getIsInPiecewiseRange(dataExtent, pieceList, selected) {
|
||||
var dataSpan = dataExtent[1] - dataExtent[0];
|
||||
pieceList = zrUtil.map(pieceList, function (piece) {
|
||||
return {
|
||||
interval: [(piece.interval[0] - dataExtent[0]) / dataSpan, (piece.interval[1] - dataExtent[0]) / dataSpan]
|
||||
};
|
||||
});
|
||||
var len = pieceList.length;
|
||||
var lastIndex = 0;
|
||||
return function (val) {
|
||||
var i; // Try to find in the location of the last found
|
||||
|
||||
for (i = lastIndex; i < len; i++) {
|
||||
var interval = pieceList[i].interval;
|
||||
|
||||
if (interval[0] <= val && val <= interval[1]) {
|
||||
lastIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i === len) {
|
||||
// Not found, back interation
|
||||
for (i = lastIndex - 1; i >= 0; i--) {
|
||||
var interval = pieceList[i].interval;
|
||||
|
||||
if (interval[0] <= val && val <= interval[1]) {
|
||||
lastIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return i >= 0 && i < len && selected[i];
|
||||
};
|
||||
}
|
||||
|
||||
function getIsInContinuousRange(dataExtent, range) {
|
||||
var dataSpan = dataExtent[1] - dataExtent[0];
|
||||
range = [(range[0] - dataExtent[0]) / dataSpan, (range[1] - dataExtent[0]) / dataSpan];
|
||||
return function (val) {
|
||||
return val >= range[0] && val <= range[1];
|
||||
};
|
||||
}
|
||||
|
||||
function isGeoCoordSys(coordSys) {
|
||||
var dimensions = coordSys.dimensions; // Not use coorSys.type === 'geo' because coordSys maybe extended
|
||||
|
||||
return dimensions[0] === 'lng' && dimensions[1] === 'lat';
|
||||
}
|
||||
|
||||
var HeatmapView =
|
||||
/** @class */
|
||||
function (_super) {
|
||||
__extends(HeatmapView, _super);
|
||||
|
||||
function HeatmapView() {
|
||||
var _this = _super !== null && _super.apply(this, arguments) || this;
|
||||
|
||||
_this.type = HeatmapView.type;
|
||||
return _this;
|
||||
}
|
||||
|
||||
HeatmapView.prototype.render = function (seriesModel, ecModel, api) {
|
||||
var visualMapOfThisSeries;
|
||||
ecModel.eachComponent('visualMap', function (visualMap) {
|
||||
visualMap.eachTargetSeries(function (targetSeries) {
|
||||
if (targetSeries === seriesModel) {
|
||||
visualMapOfThisSeries = visualMap;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (!visualMapOfThisSeries) {
|
||||
throw new Error('Heatmap must use with visualMap');
|
||||
}
|
||||
} // Clear previously rendered progressive elements.
|
||||
|
||||
|
||||
this._progressiveEls = null;
|
||||
this.group.removeAll();
|
||||
var coordSys = seriesModel.coordinateSystem;
|
||||
|
||||
if (coordSys.type === 'cartesian2d' || coordSys.type === 'calendar') {
|
||||
this._renderOnCartesianAndCalendar(seriesModel, api, 0, seriesModel.getData().count());
|
||||
} else if (isGeoCoordSys(coordSys)) {
|
||||
this._renderOnGeo(coordSys, seriesModel, visualMapOfThisSeries, api);
|
||||
}
|
||||
};
|
||||
|
||||
HeatmapView.prototype.incrementalPrepareRender = function (seriesModel, ecModel, api) {
|
||||
this.group.removeAll();
|
||||
};
|
||||
|
||||
HeatmapView.prototype.incrementalRender = function (params, seriesModel, ecModel, api) {
|
||||
var coordSys = seriesModel.coordinateSystem;
|
||||
|
||||
if (coordSys) {
|
||||
// geo does not support incremental rendering?
|
||||
if (isGeoCoordSys(coordSys)) {
|
||||
this.render(seriesModel, ecModel, api);
|
||||
} else {
|
||||
this._progressiveEls = [];
|
||||
|
||||
this._renderOnCartesianAndCalendar(seriesModel, api, params.start, params.end, true);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
HeatmapView.prototype.eachRendered = function (cb) {
|
||||
graphic.traverseElements(this._progressiveEls || this.group, cb);
|
||||
};
|
||||
|
||||
HeatmapView.prototype._renderOnCartesianAndCalendar = function (seriesModel, api, start, end, incremental) {
|
||||
var coordSys = seriesModel.coordinateSystem;
|
||||
var isCartesian2d = isCoordinateSystemType(coordSys, 'cartesian2d');
|
||||
var width;
|
||||
var height;
|
||||
var xAxisExtent;
|
||||
var yAxisExtent;
|
||||
|
||||
if (isCartesian2d) {
|
||||
var xAxis = coordSys.getAxis('x');
|
||||
var yAxis = coordSys.getAxis('y');
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (!(xAxis.type === 'category' && yAxis.type === 'category')) {
|
||||
throw new Error('Heatmap on cartesian must have two category axes');
|
||||
}
|
||||
|
||||
if (!(xAxis.onBand && yAxis.onBand)) {
|
||||
throw new Error('Heatmap on cartesian must have two axes with boundaryGap true');
|
||||
}
|
||||
} // add 0.5px to avoid the gaps
|
||||
|
||||
|
||||
width = xAxis.getBandWidth() + .5;
|
||||
height = yAxis.getBandWidth() + .5;
|
||||
xAxisExtent = xAxis.scale.getExtent();
|
||||
yAxisExtent = yAxis.scale.getExtent();
|
||||
}
|
||||
|
||||
var group = this.group;
|
||||
var data = seriesModel.getData();
|
||||
var emphasisStyle = seriesModel.getModel(['emphasis', 'itemStyle']).getItemStyle();
|
||||
var blurStyle = seriesModel.getModel(['blur', 'itemStyle']).getItemStyle();
|
||||
var selectStyle = seriesModel.getModel(['select', 'itemStyle']).getItemStyle();
|
||||
var borderRadius = seriesModel.get(['itemStyle', 'borderRadius']);
|
||||
var labelStatesModels = getLabelStatesModels(seriesModel);
|
||||
var emphasisModel = seriesModel.getModel('emphasis');
|
||||
var focus = emphasisModel.get('focus');
|
||||
var blurScope = emphasisModel.get('blurScope');
|
||||
var emphasisDisabled = emphasisModel.get('disabled');
|
||||
var dataDims = isCartesian2d ? [data.mapDimension('x'), data.mapDimension('y'), data.mapDimension('value')] : [data.mapDimension('time'), data.mapDimension('value')];
|
||||
|
||||
for (var idx = start; idx < end; idx++) {
|
||||
var rect = void 0;
|
||||
var style = data.getItemVisual(idx, 'style');
|
||||
|
||||
if (isCartesian2d) {
|
||||
var dataDimX = data.get(dataDims[0], idx);
|
||||
var dataDimY = data.get(dataDims[1], idx); // Ignore empty data and out of extent data
|
||||
|
||||
if (isNaN(data.get(dataDims[2], idx)) || dataDimX < xAxisExtent[0] || dataDimX > xAxisExtent[1] || dataDimY < yAxisExtent[0] || dataDimY > yAxisExtent[1]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
var point = coordSys.dataToPoint([dataDimX, dataDimY]);
|
||||
rect = new graphic.Rect({
|
||||
shape: {
|
||||
x: point[0] - width / 2,
|
||||
y: point[1] - height / 2,
|
||||
width: width,
|
||||
height: height
|
||||
},
|
||||
style: style
|
||||
});
|
||||
} else {
|
||||
// Ignore empty data
|
||||
if (isNaN(data.get(dataDims[1], idx))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
rect = new graphic.Rect({
|
||||
z2: 1,
|
||||
shape: coordSys.dataToRect([data.get(dataDims[0], idx)]).contentShape,
|
||||
style: style
|
||||
});
|
||||
} // Optimization for large datset
|
||||
|
||||
|
||||
if (data.hasItemOption) {
|
||||
var itemModel = data.getItemModel(idx);
|
||||
var emphasisModel_1 = itemModel.getModel('emphasis');
|
||||
emphasisStyle = emphasisModel_1.getModel('itemStyle').getItemStyle();
|
||||
blurStyle = itemModel.getModel(['blur', 'itemStyle']).getItemStyle();
|
||||
selectStyle = itemModel.getModel(['select', 'itemStyle']).getItemStyle(); // Each item value struct in the data would be firstly
|
||||
// {
|
||||
// itemStyle: { borderRadius: [30, 30] },
|
||||
// value: [2022, 02, 22]
|
||||
// }
|
||||
|
||||
borderRadius = itemModel.get(['itemStyle', 'borderRadius']);
|
||||
focus = emphasisModel_1.get('focus');
|
||||
blurScope = emphasisModel_1.get('blurScope');
|
||||
emphasisDisabled = emphasisModel_1.get('disabled');
|
||||
labelStatesModels = getLabelStatesModels(itemModel);
|
||||
}
|
||||
|
||||
rect.shape.r = borderRadius;
|
||||
var rawValue = seriesModel.getRawValue(idx);
|
||||
var defaultText = '-';
|
||||
|
||||
if (rawValue && rawValue[2] != null) {
|
||||
defaultText = rawValue[2] + '';
|
||||
}
|
||||
|
||||
setLabelStyle(rect, labelStatesModels, {
|
||||
labelFetcher: seriesModel,
|
||||
labelDataIndex: idx,
|
||||
defaultOpacity: style.opacity,
|
||||
defaultText: defaultText
|
||||
});
|
||||
rect.ensureState('emphasis').style = emphasisStyle;
|
||||
rect.ensureState('blur').style = blurStyle;
|
||||
rect.ensureState('select').style = selectStyle;
|
||||
toggleHoverEmphasis(rect, focus, blurScope, emphasisDisabled);
|
||||
rect.incremental = incremental; // PENDING
|
||||
|
||||
if (incremental) {
|
||||
// Rect must use hover layer if it's incremental.
|
||||
rect.states.emphasis.hoverLayer = true;
|
||||
}
|
||||
|
||||
group.add(rect);
|
||||
data.setItemGraphicEl(idx, rect);
|
||||
|
||||
if (this._progressiveEls) {
|
||||
this._progressiveEls.push(rect);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
HeatmapView.prototype._renderOnGeo = function (geo, seriesModel, visualMapModel, api) {
|
||||
var inRangeVisuals = visualMapModel.targetVisuals.inRange;
|
||||
var outOfRangeVisuals = visualMapModel.targetVisuals.outOfRange; // if (!visualMapping) {
|
||||
// throw new Error('Data range must have color visuals');
|
||||
// }
|
||||
|
||||
var data = seriesModel.getData();
|
||||
var hmLayer = this._hmLayer || this._hmLayer || new HeatmapLayer();
|
||||
hmLayer.blurSize = seriesModel.get('blurSize');
|
||||
hmLayer.pointSize = seriesModel.get('pointSize');
|
||||
hmLayer.minOpacity = seriesModel.get('minOpacity');
|
||||
hmLayer.maxOpacity = seriesModel.get('maxOpacity');
|
||||
var rect = geo.getViewRect().clone();
|
||||
var roamTransform = geo.getRoamTransform();
|
||||
rect.applyTransform(roamTransform); // Clamp on viewport
|
||||
|
||||
var x = Math.max(rect.x, 0);
|
||||
var y = Math.max(rect.y, 0);
|
||||
var x2 = Math.min(rect.width + rect.x, api.getWidth());
|
||||
var y2 = Math.min(rect.height + rect.y, api.getHeight());
|
||||
var width = x2 - x;
|
||||
var height = y2 - y;
|
||||
var dims = [data.mapDimension('lng'), data.mapDimension('lat'), data.mapDimension('value')];
|
||||
var points = data.mapArray(dims, function (lng, lat, value) {
|
||||
var pt = geo.dataToPoint([lng, lat]);
|
||||
pt[0] -= x;
|
||||
pt[1] -= y;
|
||||
pt.push(value);
|
||||
return pt;
|
||||
});
|
||||
var dataExtent = visualMapModel.getExtent();
|
||||
var isInRange = visualMapModel.type === 'visualMap.continuous' ? getIsInContinuousRange(dataExtent, visualMapModel.option.range) : getIsInPiecewiseRange(dataExtent, visualMapModel.getPieceList(), visualMapModel.option.selected);
|
||||
hmLayer.update(points, width, height, inRangeVisuals.color.getNormalizer(), {
|
||||
inRange: inRangeVisuals.color.getColorMapper(),
|
||||
outOfRange: outOfRangeVisuals.color.getColorMapper()
|
||||
}, isInRange);
|
||||
var img = new graphic.Image({
|
||||
style: {
|
||||
width: width,
|
||||
height: height,
|
||||
x: x,
|
||||
y: y,
|
||||
image: hmLayer.canvas
|
||||
},
|
||||
silent: true
|
||||
});
|
||||
this.group.add(img);
|
||||
};
|
||||
|
||||
HeatmapView.type = 'heatmap';
|
||||
return HeatmapView;
|
||||
}(ChartView);
|
||||
|
||||
export default HeatmapView;
|
||||
49
uni-demo/node_modules/echarts/lib/chart/heatmap/install.js
generated
vendored
Normal file
49
uni-demo/node_modules/echarts/lib/chart/heatmap/install.js
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
|
||||
/*
|
||||
* 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 HeatmapView from './HeatmapView.js';
|
||||
import HeatmapSeriesModel from './HeatmapSeries.js';
|
||||
export function install(registers) {
|
||||
registers.registerChartView(HeatmapView);
|
||||
registers.registerSeriesModel(HeatmapSeriesModel);
|
||||
}
|
||||
244
uni-demo/node_modules/echarts/lib/chart/helper/EffectLine.js
generated
vendored
Normal file
244
uni-demo/node_modules/echarts/lib/chart/helper/EffectLine.js
generated
vendored
Normal file
@@ -0,0 +1,244 @@
|
||||
|
||||
/*
|
||||
* 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";
|
||||
/**
|
||||
* Provide effect for line
|
||||
*/
|
||||
|
||||
import * as graphic from '../../util/graphic.js';
|
||||
import Line from './Line.js';
|
||||
import * as zrUtil from 'zrender/lib/core/util.js';
|
||||
import { createSymbol } from '../../util/symbol.js';
|
||||
import * as vec2 from 'zrender/lib/core/vector.js';
|
||||
import * as curveUtil from 'zrender/lib/core/curve.js';
|
||||
|
||||
var EffectLine =
|
||||
/** @class */
|
||||
function (_super) {
|
||||
__extends(EffectLine, _super);
|
||||
|
||||
function EffectLine(lineData, idx, seriesScope) {
|
||||
var _this = _super.call(this) || this;
|
||||
|
||||
_this.add(_this.createLine(lineData, idx, seriesScope));
|
||||
|
||||
_this._updateEffectSymbol(lineData, idx);
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
EffectLine.prototype.createLine = function (lineData, idx, seriesScope) {
|
||||
return new Line(lineData, idx, seriesScope);
|
||||
};
|
||||
|
||||
EffectLine.prototype._updateEffectSymbol = function (lineData, idx) {
|
||||
var itemModel = lineData.getItemModel(idx);
|
||||
var effectModel = itemModel.getModel('effect');
|
||||
var size = effectModel.get('symbolSize');
|
||||
var symbolType = effectModel.get('symbol');
|
||||
|
||||
if (!zrUtil.isArray(size)) {
|
||||
size = [size, size];
|
||||
}
|
||||
|
||||
var lineStyle = lineData.getItemVisual(idx, 'style');
|
||||
var color = effectModel.get('color') || lineStyle && lineStyle.stroke;
|
||||
var symbol = this.childAt(1);
|
||||
|
||||
if (this._symbolType !== symbolType) {
|
||||
// Remove previous
|
||||
this.remove(symbol);
|
||||
symbol = createSymbol(symbolType, -0.5, -0.5, 1, 1, color);
|
||||
symbol.z2 = 100;
|
||||
symbol.culling = true;
|
||||
this.add(symbol);
|
||||
} // Symbol may be removed if loop is false
|
||||
|
||||
|
||||
if (!symbol) {
|
||||
return;
|
||||
} // Shadow color is same with color in default
|
||||
|
||||
|
||||
symbol.setStyle('shadowColor', color);
|
||||
symbol.setStyle(effectModel.getItemStyle(['color']));
|
||||
symbol.scaleX = size[0];
|
||||
symbol.scaleY = size[1];
|
||||
symbol.setColor(color);
|
||||
this._symbolType = symbolType;
|
||||
this._symbolScale = size;
|
||||
|
||||
this._updateEffectAnimation(lineData, effectModel, idx);
|
||||
};
|
||||
|
||||
EffectLine.prototype._updateEffectAnimation = function (lineData, effectModel, idx) {
|
||||
var symbol = this.childAt(1);
|
||||
|
||||
if (!symbol) {
|
||||
return;
|
||||
}
|
||||
|
||||
var points = lineData.getItemLayout(idx);
|
||||
var period = effectModel.get('period') * 1000;
|
||||
var loop = effectModel.get('loop');
|
||||
var constantSpeed = effectModel.get('constantSpeed');
|
||||
var delayExpr = zrUtil.retrieve(effectModel.get('delay'), function (idx) {
|
||||
return idx / lineData.count() * period / 3;
|
||||
}); // Ignore when updating
|
||||
|
||||
symbol.ignore = true;
|
||||
|
||||
this._updateAnimationPoints(symbol, points);
|
||||
|
||||
if (constantSpeed > 0) {
|
||||
period = this._getLineLength(symbol) / constantSpeed * 1000;
|
||||
}
|
||||
|
||||
if (period !== this._period || loop !== this._loop) {
|
||||
symbol.stopAnimation();
|
||||
var delayNum = void 0;
|
||||
|
||||
if (zrUtil.isFunction(delayExpr)) {
|
||||
delayNum = delayExpr(idx);
|
||||
} else {
|
||||
delayNum = delayExpr;
|
||||
}
|
||||
|
||||
if (symbol.__t > 0) {
|
||||
delayNum = -period * symbol.__t;
|
||||
}
|
||||
|
||||
this._animateSymbol(symbol, period, delayNum, loop);
|
||||
}
|
||||
|
||||
this._period = period;
|
||||
this._loop = loop;
|
||||
};
|
||||
|
||||
EffectLine.prototype._animateSymbol = function (symbol, period, delayNum, loop) {
|
||||
if (period > 0) {
|
||||
symbol.__t = 0;
|
||||
var self_1 = this;
|
||||
var animator = symbol.animate('', loop).when(period, {
|
||||
__t: 1
|
||||
}).delay(delayNum).during(function () {
|
||||
self_1._updateSymbolPosition(symbol);
|
||||
});
|
||||
|
||||
if (!loop) {
|
||||
animator.done(function () {
|
||||
self_1.remove(symbol);
|
||||
});
|
||||
}
|
||||
|
||||
animator.start();
|
||||
}
|
||||
};
|
||||
|
||||
EffectLine.prototype._getLineLength = function (symbol) {
|
||||
// Not so accurate
|
||||
return vec2.dist(symbol.__p1, symbol.__cp1) + vec2.dist(symbol.__cp1, symbol.__p2);
|
||||
};
|
||||
|
||||
EffectLine.prototype._updateAnimationPoints = function (symbol, points) {
|
||||
symbol.__p1 = points[0];
|
||||
symbol.__p2 = points[1];
|
||||
symbol.__cp1 = points[2] || [(points[0][0] + points[1][0]) / 2, (points[0][1] + points[1][1]) / 2];
|
||||
};
|
||||
|
||||
EffectLine.prototype.updateData = function (lineData, idx, seriesScope) {
|
||||
this.childAt(0).updateData(lineData, idx, seriesScope);
|
||||
|
||||
this._updateEffectSymbol(lineData, idx);
|
||||
};
|
||||
|
||||
EffectLine.prototype._updateSymbolPosition = function (symbol) {
|
||||
var p1 = symbol.__p1;
|
||||
var p2 = symbol.__p2;
|
||||
var cp1 = symbol.__cp1;
|
||||
var t = symbol.__t;
|
||||
var pos = [symbol.x, symbol.y];
|
||||
var lastPos = pos.slice();
|
||||
var quadraticAt = curveUtil.quadraticAt;
|
||||
var quadraticDerivativeAt = curveUtil.quadraticDerivativeAt;
|
||||
pos[0] = quadraticAt(p1[0], cp1[0], p2[0], t);
|
||||
pos[1] = quadraticAt(p1[1], cp1[1], p2[1], t); // Tangent
|
||||
|
||||
var tx = quadraticDerivativeAt(p1[0], cp1[0], p2[0], t);
|
||||
var ty = quadraticDerivativeAt(p1[1], cp1[1], p2[1], t);
|
||||
symbol.rotation = -Math.atan2(ty, tx) - Math.PI / 2; // enable continuity trail for 'line', 'rect', 'roundRect' symbolType
|
||||
|
||||
if (this._symbolType === 'line' || this._symbolType === 'rect' || this._symbolType === 'roundRect') {
|
||||
if (symbol.__lastT !== undefined && symbol.__lastT < symbol.__t) {
|
||||
symbol.scaleY = vec2.dist(lastPos, pos) * 1.05; // make sure the last segment render within endPoint
|
||||
|
||||
if (t === 1) {
|
||||
pos[0] = lastPos[0] + (pos[0] - lastPos[0]) / 2;
|
||||
pos[1] = lastPos[1] + (pos[1] - lastPos[1]) / 2;
|
||||
}
|
||||
} else if (symbol.__lastT === 1) {
|
||||
// After first loop, symbol.__t does NOT start with 0, so connect p1 to pos directly.
|
||||
symbol.scaleY = 2 * vec2.dist(p1, pos);
|
||||
} else {
|
||||
symbol.scaleY = this._symbolScale[1];
|
||||
}
|
||||
}
|
||||
|
||||
symbol.__lastT = symbol.__t;
|
||||
symbol.ignore = false;
|
||||
symbol.x = pos[0];
|
||||
symbol.y = pos[1];
|
||||
};
|
||||
|
||||
EffectLine.prototype.updateLayout = function (lineData, idx) {
|
||||
this.childAt(0).updateLayout(lineData, idx);
|
||||
var effectModel = lineData.getItemModel(idx).getModel('effect');
|
||||
|
||||
this._updateEffectAnimation(lineData, effectModel, idx);
|
||||
};
|
||||
|
||||
return EffectLine;
|
||||
}(graphic.Group);
|
||||
|
||||
export default EffectLine;
|
||||
156
uni-demo/node_modules/echarts/lib/chart/helper/EffectPolyline.js
generated
vendored
Normal file
156
uni-demo/node_modules/echarts/lib/chart/helper/EffectPolyline.js
generated
vendored
Normal file
@@ -0,0 +1,156 @@
|
||||
|
||||
/*
|
||||
* 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 Polyline from './Polyline.js';
|
||||
import EffectLine from './EffectLine.js';
|
||||
import * as vec2 from 'zrender/lib/core/vector.js';
|
||||
|
||||
var EffectPolyline =
|
||||
/** @class */
|
||||
function (_super) {
|
||||
__extends(EffectPolyline, _super);
|
||||
|
||||
function EffectPolyline() {
|
||||
var _this = _super !== null && _super.apply(this, arguments) || this;
|
||||
|
||||
_this._lastFrame = 0;
|
||||
_this._lastFramePercent = 0;
|
||||
return _this;
|
||||
} // Override
|
||||
|
||||
|
||||
EffectPolyline.prototype.createLine = function (lineData, idx, seriesScope) {
|
||||
return new Polyline(lineData, idx, seriesScope);
|
||||
};
|
||||
|
||||
; // Override
|
||||
|
||||
EffectPolyline.prototype._updateAnimationPoints = function (symbol, points) {
|
||||
this._points = points;
|
||||
var accLenArr = [0];
|
||||
var len = 0;
|
||||
|
||||
for (var i = 1; i < points.length; i++) {
|
||||
var p1 = points[i - 1];
|
||||
var p2 = points[i];
|
||||
len += vec2.dist(p1, p2);
|
||||
accLenArr.push(len);
|
||||
}
|
||||
|
||||
if (len === 0) {
|
||||
this._length = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
for (var i = 0; i < accLenArr.length; i++) {
|
||||
accLenArr[i] /= len;
|
||||
}
|
||||
|
||||
this._offsets = accLenArr;
|
||||
this._length = len;
|
||||
};
|
||||
|
||||
; // Override
|
||||
|
||||
EffectPolyline.prototype._getLineLength = function () {
|
||||
return this._length;
|
||||
};
|
||||
|
||||
; // Override
|
||||
|
||||
EffectPolyline.prototype._updateSymbolPosition = function (symbol) {
|
||||
var t = symbol.__t;
|
||||
var points = this._points;
|
||||
var offsets = this._offsets;
|
||||
var len = points.length;
|
||||
|
||||
if (!offsets) {
|
||||
// Has length 0
|
||||
return;
|
||||
}
|
||||
|
||||
var lastFrame = this._lastFrame;
|
||||
var frame;
|
||||
|
||||
if (t < this._lastFramePercent) {
|
||||
// Start from the next frame
|
||||
// PENDING start from lastFrame ?
|
||||
var start = Math.min(lastFrame + 1, len - 1);
|
||||
|
||||
for (frame = start; frame >= 0; frame--) {
|
||||
if (offsets[frame] <= t) {
|
||||
break;
|
||||
}
|
||||
} // PENDING really need to do this ?
|
||||
|
||||
|
||||
frame = Math.min(frame, len - 2);
|
||||
} else {
|
||||
for (frame = lastFrame; frame < len; frame++) {
|
||||
if (offsets[frame] > t) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
frame = Math.min(frame - 1, len - 2);
|
||||
}
|
||||
|
||||
var p = (t - offsets[frame]) / (offsets[frame + 1] - offsets[frame]);
|
||||
var p0 = points[frame];
|
||||
var p1 = points[frame + 1];
|
||||
symbol.x = p0[0] * (1 - p) + p * p1[0];
|
||||
symbol.y = p0[1] * (1 - p) + p * p1[1];
|
||||
var tx = p1[0] - p0[0];
|
||||
var ty = p1[1] - p0[1];
|
||||
symbol.rotation = -Math.atan2(ty, tx) - Math.PI / 2;
|
||||
this._lastFrame = frame;
|
||||
this._lastFramePercent = t;
|
||||
symbol.ignore = false;
|
||||
};
|
||||
|
||||
;
|
||||
return EffectPolyline;
|
||||
}(EffectLine);
|
||||
|
||||
export default EffectPolyline;
|
||||
243
uni-demo/node_modules/echarts/lib/chart/helper/EffectSymbol.js
generated
vendored
Normal file
243
uni-demo/node_modules/echarts/lib/chart/helper/EffectSymbol.js
generated
vendored
Normal file
@@ -0,0 +1,243 @@
|
||||
|
||||
/*
|
||||
* 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 { createSymbol, normalizeSymbolOffset, normalizeSymbolSize } from '../../util/symbol.js';
|
||||
import { Group } from '../../util/graphic.js';
|
||||
import { enterEmphasis, leaveEmphasis, toggleHoverEmphasis } from '../../util/states.js';
|
||||
import SymbolClz from './Symbol.js';
|
||||
|
||||
function updateRipplePath(rippleGroup, effectCfg) {
|
||||
var color = effectCfg.rippleEffectColor || effectCfg.color;
|
||||
rippleGroup.eachChild(function (ripplePath) {
|
||||
ripplePath.attr({
|
||||
z: effectCfg.z,
|
||||
zlevel: effectCfg.zlevel,
|
||||
style: {
|
||||
stroke: effectCfg.brushType === 'stroke' ? color : null,
|
||||
fill: effectCfg.brushType === 'fill' ? color : null
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
var EffectSymbol =
|
||||
/** @class */
|
||||
function (_super) {
|
||||
__extends(EffectSymbol, _super);
|
||||
|
||||
function EffectSymbol(data, idx) {
|
||||
var _this = _super.call(this) || this;
|
||||
|
||||
var symbol = new SymbolClz(data, idx);
|
||||
var rippleGroup = new Group();
|
||||
|
||||
_this.add(symbol);
|
||||
|
||||
_this.add(rippleGroup);
|
||||
|
||||
_this.updateData(data, idx);
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
EffectSymbol.prototype.stopEffectAnimation = function () {
|
||||
this.childAt(1).removeAll();
|
||||
};
|
||||
|
||||
EffectSymbol.prototype.startEffectAnimation = function (effectCfg) {
|
||||
var symbolType = effectCfg.symbolType;
|
||||
var color = effectCfg.color;
|
||||
var rippleNumber = effectCfg.rippleNumber;
|
||||
var rippleGroup = this.childAt(1);
|
||||
|
||||
for (var i = 0; i < rippleNumber; i++) {
|
||||
// If width/height are set too small (e.g., set to 1) on ios10
|
||||
// and macOS Sierra, a circle stroke become a rect, no matter what
|
||||
// the scale is set. So we set width/height as 2. See #4136.
|
||||
var ripplePath = createSymbol(symbolType, -1, -1, 2, 2, color);
|
||||
ripplePath.attr({
|
||||
style: {
|
||||
strokeNoScale: true
|
||||
},
|
||||
z2: 99,
|
||||
silent: true,
|
||||
scaleX: 0.5,
|
||||
scaleY: 0.5
|
||||
});
|
||||
var delay = -i / rippleNumber * effectCfg.period + effectCfg.effectOffset;
|
||||
ripplePath.animate('', true).when(effectCfg.period, {
|
||||
scaleX: effectCfg.rippleScale / 2,
|
||||
scaleY: effectCfg.rippleScale / 2
|
||||
}).delay(delay).start();
|
||||
ripplePath.animateStyle(true).when(effectCfg.period, {
|
||||
opacity: 0
|
||||
}).delay(delay).start();
|
||||
rippleGroup.add(ripplePath);
|
||||
}
|
||||
|
||||
updateRipplePath(rippleGroup, effectCfg);
|
||||
};
|
||||
/**
|
||||
* Update effect symbol
|
||||
*/
|
||||
|
||||
|
||||
EffectSymbol.prototype.updateEffectAnimation = function (effectCfg) {
|
||||
var oldEffectCfg = this._effectCfg;
|
||||
var rippleGroup = this.childAt(1); // Must reinitialize effect if following configuration changed
|
||||
|
||||
var DIFFICULT_PROPS = ['symbolType', 'period', 'rippleScale', 'rippleNumber'];
|
||||
|
||||
for (var i = 0; i < DIFFICULT_PROPS.length; i++) {
|
||||
var propName = DIFFICULT_PROPS[i];
|
||||
|
||||
if (oldEffectCfg[propName] !== effectCfg[propName]) {
|
||||
this.stopEffectAnimation();
|
||||
this.startEffectAnimation(effectCfg);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
updateRipplePath(rippleGroup, effectCfg);
|
||||
};
|
||||
/**
|
||||
* Highlight symbol
|
||||
*/
|
||||
|
||||
|
||||
EffectSymbol.prototype.highlight = function () {
|
||||
enterEmphasis(this);
|
||||
};
|
||||
/**
|
||||
* Downplay symbol
|
||||
*/
|
||||
|
||||
|
||||
EffectSymbol.prototype.downplay = function () {
|
||||
leaveEmphasis(this);
|
||||
};
|
||||
|
||||
EffectSymbol.prototype.getSymbolType = function () {
|
||||
var symbol = this.childAt(0);
|
||||
return symbol && symbol.getSymbolType();
|
||||
};
|
||||
/**
|
||||
* Update symbol properties
|
||||
*/
|
||||
|
||||
|
||||
EffectSymbol.prototype.updateData = function (data, idx) {
|
||||
var _this = this;
|
||||
|
||||
var seriesModel = data.hostModel;
|
||||
this.childAt(0).updateData(data, idx);
|
||||
var rippleGroup = this.childAt(1);
|
||||
var itemModel = data.getItemModel(idx);
|
||||
var symbolType = data.getItemVisual(idx, 'symbol');
|
||||
var symbolSize = normalizeSymbolSize(data.getItemVisual(idx, 'symbolSize'));
|
||||
var symbolStyle = data.getItemVisual(idx, 'style');
|
||||
var color = symbolStyle && symbolStyle.fill;
|
||||
var emphasisModel = itemModel.getModel('emphasis');
|
||||
rippleGroup.setScale(symbolSize);
|
||||
rippleGroup.traverse(function (ripplePath) {
|
||||
ripplePath.setStyle('fill', color);
|
||||
});
|
||||
var symbolOffset = normalizeSymbolOffset(data.getItemVisual(idx, 'symbolOffset'), symbolSize);
|
||||
|
||||
if (symbolOffset) {
|
||||
rippleGroup.x = symbolOffset[0];
|
||||
rippleGroup.y = symbolOffset[1];
|
||||
}
|
||||
|
||||
var symbolRotate = data.getItemVisual(idx, 'symbolRotate');
|
||||
rippleGroup.rotation = (symbolRotate || 0) * Math.PI / 180 || 0;
|
||||
var effectCfg = {};
|
||||
effectCfg.showEffectOn = seriesModel.get('showEffectOn');
|
||||
effectCfg.rippleScale = itemModel.get(['rippleEffect', 'scale']);
|
||||
effectCfg.brushType = itemModel.get(['rippleEffect', 'brushType']);
|
||||
effectCfg.period = itemModel.get(['rippleEffect', 'period']) * 1000;
|
||||
effectCfg.effectOffset = idx / data.count();
|
||||
effectCfg.z = seriesModel.getShallow('z') || 0;
|
||||
effectCfg.zlevel = seriesModel.getShallow('zlevel') || 0;
|
||||
effectCfg.symbolType = symbolType;
|
||||
effectCfg.color = color;
|
||||
effectCfg.rippleEffectColor = itemModel.get(['rippleEffect', 'color']);
|
||||
effectCfg.rippleNumber = itemModel.get(['rippleEffect', 'number']);
|
||||
|
||||
if (effectCfg.showEffectOn === 'render') {
|
||||
this._effectCfg ? this.updateEffectAnimation(effectCfg) : this.startEffectAnimation(effectCfg);
|
||||
this._effectCfg = effectCfg;
|
||||
} else {
|
||||
// Not keep old effect config
|
||||
this._effectCfg = null;
|
||||
this.stopEffectAnimation();
|
||||
|
||||
this.onHoverStateChange = function (toState) {
|
||||
if (toState === 'emphasis') {
|
||||
if (effectCfg.showEffectOn !== 'render') {
|
||||
_this.startEffectAnimation(effectCfg);
|
||||
}
|
||||
} else if (toState === 'normal') {
|
||||
if (effectCfg.showEffectOn !== 'render') {
|
||||
_this.stopEffectAnimation();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
this._effectCfg = effectCfg;
|
||||
toggleHoverEmphasis(this, emphasisModel.get('focus'), emphasisModel.get('blurScope'), emphasisModel.get('disabled'));
|
||||
};
|
||||
|
||||
;
|
||||
|
||||
EffectSymbol.prototype.fadeOut = function (cb) {
|
||||
cb && cb();
|
||||
};
|
||||
|
||||
;
|
||||
return EffectSymbol;
|
||||
}(Group);
|
||||
|
||||
export default EffectSymbol;
|
||||
371
uni-demo/node_modules/echarts/lib/chart/helper/LargeLineDraw.js
generated
vendored
Normal file
371
uni-demo/node_modules/echarts/lib/chart/helper/LargeLineDraw.js
generated
vendored
Normal file
@@ -0,0 +1,371 @@
|
||||
|
||||
/*
|
||||
* 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"; // TODO Batch by color
|
||||
|
||||
import * as graphic from '../../util/graphic.js';
|
||||
import * as lineContain from 'zrender/lib/contain/line.js';
|
||||
import * as quadraticContain from 'zrender/lib/contain/quadratic.js';
|
||||
import { getECData } from '../../util/innerStore.js';
|
||||
|
||||
var LargeLinesPathShape =
|
||||
/** @class */
|
||||
function () {
|
||||
function LargeLinesPathShape() {
|
||||
this.polyline = false;
|
||||
this.curveness = 0;
|
||||
this.segs = [];
|
||||
}
|
||||
|
||||
return LargeLinesPathShape;
|
||||
}();
|
||||
|
||||
var LargeLinesPath =
|
||||
/** @class */
|
||||
function (_super) {
|
||||
__extends(LargeLinesPath, _super);
|
||||
|
||||
function LargeLinesPath(opts) {
|
||||
var _this = _super.call(this, opts) || this;
|
||||
|
||||
_this._off = 0;
|
||||
_this.hoverDataIdx = -1;
|
||||
return _this;
|
||||
}
|
||||
|
||||
LargeLinesPath.prototype.reset = function () {
|
||||
this.notClear = false;
|
||||
this._off = 0;
|
||||
};
|
||||
|
||||
LargeLinesPath.prototype.getDefaultStyle = function () {
|
||||
return {
|
||||
stroke: '#000',
|
||||
fill: null
|
||||
};
|
||||
};
|
||||
|
||||
LargeLinesPath.prototype.getDefaultShape = function () {
|
||||
return new LargeLinesPathShape();
|
||||
};
|
||||
|
||||
LargeLinesPath.prototype.buildPath = function (ctx, shape) {
|
||||
var segs = shape.segs;
|
||||
var curveness = shape.curveness;
|
||||
var i;
|
||||
|
||||
if (shape.polyline) {
|
||||
for (i = this._off; i < segs.length;) {
|
||||
var count = segs[i++];
|
||||
|
||||
if (count > 0) {
|
||||
ctx.moveTo(segs[i++], segs[i++]);
|
||||
|
||||
for (var k = 1; k < count; k++) {
|
||||
ctx.lineTo(segs[i++], segs[i++]);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (i = this._off; i < segs.length;) {
|
||||
var x0 = segs[i++];
|
||||
var y0 = segs[i++];
|
||||
var x1 = segs[i++];
|
||||
var y1 = segs[i++];
|
||||
ctx.moveTo(x0, y0);
|
||||
|
||||
if (curveness > 0) {
|
||||
var x2 = (x0 + x1) / 2 - (y0 - y1) * curveness;
|
||||
var y2 = (y0 + y1) / 2 - (x1 - x0) * curveness;
|
||||
ctx.quadraticCurveTo(x2, y2, x1, y1);
|
||||
} else {
|
||||
ctx.lineTo(x1, y1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.incremental) {
|
||||
this._off = i;
|
||||
this.notClear = true;
|
||||
}
|
||||
};
|
||||
|
||||
LargeLinesPath.prototype.findDataIndex = function (x, y) {
|
||||
var shape = this.shape;
|
||||
var segs = shape.segs;
|
||||
var curveness = shape.curveness;
|
||||
var lineWidth = this.style.lineWidth;
|
||||
|
||||
if (shape.polyline) {
|
||||
var dataIndex = 0;
|
||||
|
||||
for (var i = 0; i < segs.length;) {
|
||||
var count = segs[i++];
|
||||
|
||||
if (count > 0) {
|
||||
var x0 = segs[i++];
|
||||
var y0 = segs[i++];
|
||||
|
||||
for (var k = 1; k < count; k++) {
|
||||
var x1 = segs[i++];
|
||||
var y1 = segs[i++];
|
||||
|
||||
if (lineContain.containStroke(x0, y0, x1, y1, lineWidth, x, y)) {
|
||||
return dataIndex;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dataIndex++;
|
||||
}
|
||||
} else {
|
||||
var dataIndex = 0;
|
||||
|
||||
for (var i = 0; i < segs.length;) {
|
||||
var x0 = segs[i++];
|
||||
var y0 = segs[i++];
|
||||
var x1 = segs[i++];
|
||||
var y1 = segs[i++];
|
||||
|
||||
if (curveness > 0) {
|
||||
var x2 = (x0 + x1) / 2 - (y0 - y1) * curveness;
|
||||
var y2 = (y0 + y1) / 2 - (x1 - x0) * curveness;
|
||||
|
||||
if (quadraticContain.containStroke(x0, y0, x2, y2, x1, y1, lineWidth, x, y)) {
|
||||
return dataIndex;
|
||||
}
|
||||
} else {
|
||||
if (lineContain.containStroke(x0, y0, x1, y1, lineWidth, x, y)) {
|
||||
return dataIndex;
|
||||
}
|
||||
}
|
||||
|
||||
dataIndex++;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
};
|
||||
|
||||
LargeLinesPath.prototype.contain = function (x, y) {
|
||||
var localPos = this.transformCoordToLocal(x, y);
|
||||
var rect = this.getBoundingRect();
|
||||
x = localPos[0];
|
||||
y = localPos[1];
|
||||
|
||||
if (rect.contain(x, y)) {
|
||||
// Cache found data index.
|
||||
var dataIdx = this.hoverDataIdx = this.findDataIndex(x, y);
|
||||
return dataIdx >= 0;
|
||||
}
|
||||
|
||||
this.hoverDataIdx = -1;
|
||||
return false;
|
||||
};
|
||||
|
||||
LargeLinesPath.prototype.getBoundingRect = function () {
|
||||
// Ignore stroke for large symbol draw.
|
||||
var rect = this._rect;
|
||||
|
||||
if (!rect) {
|
||||
var shape = this.shape;
|
||||
var points = shape.segs;
|
||||
var minX = Infinity;
|
||||
var minY = Infinity;
|
||||
var maxX = -Infinity;
|
||||
var maxY = -Infinity;
|
||||
|
||||
for (var i = 0; i < points.length;) {
|
||||
var x = points[i++];
|
||||
var y = points[i++];
|
||||
minX = Math.min(x, minX);
|
||||
maxX = Math.max(x, maxX);
|
||||
minY = Math.min(y, minY);
|
||||
maxY = Math.max(y, maxY);
|
||||
}
|
||||
|
||||
rect = this._rect = new graphic.BoundingRect(minX, minY, maxX, maxY);
|
||||
}
|
||||
|
||||
return rect;
|
||||
};
|
||||
|
||||
return LargeLinesPath;
|
||||
}(graphic.Path);
|
||||
|
||||
var LargeLineDraw =
|
||||
/** @class */
|
||||
function () {
|
||||
function LargeLineDraw() {
|
||||
this.group = new graphic.Group();
|
||||
}
|
||||
/**
|
||||
* Update symbols draw by new data
|
||||
*/
|
||||
|
||||
|
||||
LargeLineDraw.prototype.updateData = function (data) {
|
||||
this._clear();
|
||||
|
||||
var lineEl = this._create();
|
||||
|
||||
lineEl.setShape({
|
||||
segs: data.getLayout('linesPoints')
|
||||
});
|
||||
|
||||
this._setCommon(lineEl, data);
|
||||
};
|
||||
|
||||
;
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
|
||||
LargeLineDraw.prototype.incrementalPrepareUpdate = function (data) {
|
||||
this.group.removeAll();
|
||||
|
||||
this._clear();
|
||||
};
|
||||
|
||||
;
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
|
||||
LargeLineDraw.prototype.incrementalUpdate = function (taskParams, data) {
|
||||
var lastAdded = this._newAdded[0];
|
||||
var linePoints = data.getLayout('linesPoints');
|
||||
var oldSegs = lastAdded && lastAdded.shape.segs; // Merging the exists. Each element has 1e4 points.
|
||||
// Consider the performance balance between too much elements and too much points in one shape(may affect hover optimization)
|
||||
|
||||
if (oldSegs && oldSegs.length < 2e4) {
|
||||
var oldLen = oldSegs.length;
|
||||
var newSegs = new Float32Array(oldLen + linePoints.length); // Concat two array
|
||||
|
||||
newSegs.set(oldSegs);
|
||||
newSegs.set(linePoints, oldLen);
|
||||
lastAdded.setShape({
|
||||
segs: newSegs
|
||||
});
|
||||
} else {
|
||||
// Clear
|
||||
this._newAdded = [];
|
||||
|
||||
var lineEl = this._create();
|
||||
|
||||
lineEl.incremental = true;
|
||||
lineEl.setShape({
|
||||
segs: linePoints
|
||||
});
|
||||
|
||||
this._setCommon(lineEl, data);
|
||||
|
||||
lineEl.__startIndex = taskParams.start;
|
||||
}
|
||||
};
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
|
||||
|
||||
LargeLineDraw.prototype.remove = function () {
|
||||
this._clear();
|
||||
};
|
||||
|
||||
LargeLineDraw.prototype.eachRendered = function (cb) {
|
||||
this._newAdded[0] && cb(this._newAdded[0]);
|
||||
};
|
||||
|
||||
LargeLineDraw.prototype._create = function () {
|
||||
var lineEl = new LargeLinesPath({
|
||||
cursor: 'default'
|
||||
});
|
||||
|
||||
this._newAdded.push(lineEl);
|
||||
|
||||
this.group.add(lineEl);
|
||||
return lineEl;
|
||||
};
|
||||
|
||||
LargeLineDraw.prototype._setCommon = function (lineEl, data, isIncremental) {
|
||||
var hostModel = data.hostModel;
|
||||
lineEl.setShape({
|
||||
polyline: hostModel.get('polyline'),
|
||||
curveness: hostModel.get(['lineStyle', 'curveness'])
|
||||
});
|
||||
lineEl.useStyle(hostModel.getModel('lineStyle').getLineStyle());
|
||||
lineEl.style.strokeNoScale = true;
|
||||
var style = data.getVisual('style');
|
||||
|
||||
if (style && style.stroke) {
|
||||
lineEl.setStyle('stroke', style.stroke);
|
||||
}
|
||||
|
||||
lineEl.setStyle('fill', null);
|
||||
var ecData = getECData(lineEl); // Enable tooltip
|
||||
// PENDING May have performance issue when path is extremely large
|
||||
|
||||
ecData.seriesIndex = hostModel.seriesIndex;
|
||||
lineEl.on('mousemove', function (e) {
|
||||
ecData.dataIndex = null;
|
||||
var dataIndex = lineEl.hoverDataIdx;
|
||||
|
||||
if (dataIndex > 0) {
|
||||
// Provide dataIndex for tooltip
|
||||
ecData.dataIndex = dataIndex + lineEl.__startIndex;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
;
|
||||
|
||||
LargeLineDraw.prototype._clear = function () {
|
||||
this._newAdded = [];
|
||||
this.group.removeAll();
|
||||
};
|
||||
|
||||
;
|
||||
return LargeLineDraw;
|
||||
}();
|
||||
|
||||
export default LargeLineDraw;
|
||||
372
uni-demo/node_modules/echarts/lib/chart/helper/LargeSymbolDraw.js
generated
vendored
Normal file
372
uni-demo/node_modules/echarts/lib/chart/helper/LargeSymbolDraw.js
generated
vendored
Normal file
@@ -0,0 +1,372 @@
|
||||
|
||||
/*
|
||||
* 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";
|
||||
/* global Float32Array */
|
||||
// TODO Batch by color
|
||||
|
||||
import * as graphic from '../../util/graphic.js';
|
||||
import { createSymbol } from '../../util/symbol.js';
|
||||
import { getECData } from '../../util/innerStore.js';
|
||||
var BOOST_SIZE_THRESHOLD = 4;
|
||||
|
||||
var LargeSymbolPathShape =
|
||||
/** @class */
|
||||
function () {
|
||||
function LargeSymbolPathShape() {}
|
||||
|
||||
return LargeSymbolPathShape;
|
||||
}();
|
||||
|
||||
var LargeSymbolPath =
|
||||
/** @class */
|
||||
function (_super) {
|
||||
__extends(LargeSymbolPath, _super);
|
||||
|
||||
function LargeSymbolPath(opts) {
|
||||
var _this = _super.call(this, opts) || this;
|
||||
|
||||
_this._off = 0;
|
||||
_this.hoverDataIdx = -1;
|
||||
return _this;
|
||||
}
|
||||
|
||||
LargeSymbolPath.prototype.getDefaultShape = function () {
|
||||
return new LargeSymbolPathShape();
|
||||
};
|
||||
|
||||
LargeSymbolPath.prototype.reset = function () {
|
||||
this.notClear = false;
|
||||
this._off = 0;
|
||||
};
|
||||
|
||||
LargeSymbolPath.prototype.buildPath = function (path, shape) {
|
||||
var points = shape.points;
|
||||
var size = shape.size;
|
||||
var symbolProxy = this.symbolProxy;
|
||||
var symbolProxyShape = symbolProxy.shape;
|
||||
var ctx = path.getContext ? path.getContext() : path;
|
||||
var canBoost = ctx && size[0] < BOOST_SIZE_THRESHOLD;
|
||||
var softClipShape = this.softClipShape;
|
||||
var i; // Do draw in afterBrush.
|
||||
|
||||
if (canBoost) {
|
||||
this._ctx = ctx;
|
||||
return;
|
||||
}
|
||||
|
||||
this._ctx = null;
|
||||
|
||||
for (i = this._off; i < points.length;) {
|
||||
var x = points[i++];
|
||||
var y = points[i++];
|
||||
|
||||
if (isNaN(x) || isNaN(y)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (softClipShape && !softClipShape.contain(x, y)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
symbolProxyShape.x = x - size[0] / 2;
|
||||
symbolProxyShape.y = y - size[1] / 2;
|
||||
symbolProxyShape.width = size[0];
|
||||
symbolProxyShape.height = size[1];
|
||||
symbolProxy.buildPath(path, symbolProxyShape, true);
|
||||
}
|
||||
|
||||
if (this.incremental) {
|
||||
this._off = i;
|
||||
this.notClear = true;
|
||||
}
|
||||
};
|
||||
|
||||
LargeSymbolPath.prototype.afterBrush = function () {
|
||||
var shape = this.shape;
|
||||
var points = shape.points;
|
||||
var size = shape.size;
|
||||
var ctx = this._ctx;
|
||||
var softClipShape = this.softClipShape;
|
||||
var i;
|
||||
|
||||
if (!ctx) {
|
||||
return;
|
||||
} // PENDING If style or other canvas status changed?
|
||||
|
||||
|
||||
for (i = this._off; i < points.length;) {
|
||||
var x = points[i++];
|
||||
var y = points[i++];
|
||||
|
||||
if (isNaN(x) || isNaN(y)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (softClipShape && !softClipShape.contain(x, y)) {
|
||||
continue;
|
||||
} // fillRect is faster than building a rect path and draw.
|
||||
// And it support light globalCompositeOperation.
|
||||
|
||||
|
||||
ctx.fillRect(x - size[0] / 2, y - size[1] / 2, size[0], size[1]);
|
||||
}
|
||||
|
||||
if (this.incremental) {
|
||||
this._off = i;
|
||||
this.notClear = true;
|
||||
}
|
||||
};
|
||||
|
||||
LargeSymbolPath.prototype.findDataIndex = function (x, y) {
|
||||
// TODO ???
|
||||
// Consider transform
|
||||
var shape = this.shape;
|
||||
var points = shape.points;
|
||||
var size = shape.size;
|
||||
var w = Math.max(size[0], 4);
|
||||
var h = Math.max(size[1], 4); // Not consider transform
|
||||
// Treat each element as a rect
|
||||
// top down traverse
|
||||
|
||||
for (var idx = points.length / 2 - 1; idx >= 0; idx--) {
|
||||
var i = idx * 2;
|
||||
var x0 = points[i] - w / 2;
|
||||
var y0 = points[i + 1] - h / 2;
|
||||
|
||||
if (x >= x0 && y >= y0 && x <= x0 + w && y <= y0 + h) {
|
||||
return idx;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
};
|
||||
|
||||
LargeSymbolPath.prototype.contain = function (x, y) {
|
||||
var localPos = this.transformCoordToLocal(x, y);
|
||||
var rect = this.getBoundingRect();
|
||||
x = localPos[0];
|
||||
y = localPos[1];
|
||||
|
||||
if (rect.contain(x, y)) {
|
||||
// Cache found data index.
|
||||
var dataIdx = this.hoverDataIdx = this.findDataIndex(x, y);
|
||||
return dataIdx >= 0;
|
||||
}
|
||||
|
||||
this.hoverDataIdx = -1;
|
||||
return false;
|
||||
};
|
||||
|
||||
LargeSymbolPath.prototype.getBoundingRect = function () {
|
||||
// Ignore stroke for large symbol draw.
|
||||
var rect = this._rect;
|
||||
|
||||
if (!rect) {
|
||||
var shape = this.shape;
|
||||
var points = shape.points;
|
||||
var size = shape.size;
|
||||
var w = size[0];
|
||||
var h = size[1];
|
||||
var minX = Infinity;
|
||||
var minY = Infinity;
|
||||
var maxX = -Infinity;
|
||||
var maxY = -Infinity;
|
||||
|
||||
for (var i = 0; i < points.length;) {
|
||||
var x = points[i++];
|
||||
var y = points[i++];
|
||||
minX = Math.min(x, minX);
|
||||
maxX = Math.max(x, maxX);
|
||||
minY = Math.min(y, minY);
|
||||
maxY = Math.max(y, maxY);
|
||||
}
|
||||
|
||||
rect = this._rect = new graphic.BoundingRect(minX - w / 2, minY - h / 2, maxX - minX + w, maxY - minY + h);
|
||||
}
|
||||
|
||||
return rect;
|
||||
};
|
||||
|
||||
return LargeSymbolPath;
|
||||
}(graphic.Path);
|
||||
|
||||
var LargeSymbolDraw =
|
||||
/** @class */
|
||||
function () {
|
||||
function LargeSymbolDraw() {
|
||||
this.group = new graphic.Group();
|
||||
}
|
||||
/**
|
||||
* Update symbols draw by new data
|
||||
*/
|
||||
|
||||
|
||||
LargeSymbolDraw.prototype.updateData = function (data, opt) {
|
||||
this._clear();
|
||||
|
||||
var symbolEl = this._create();
|
||||
|
||||
symbolEl.setShape({
|
||||
points: data.getLayout('points')
|
||||
});
|
||||
|
||||
this._setCommon(symbolEl, data, opt);
|
||||
};
|
||||
|
||||
LargeSymbolDraw.prototype.updateLayout = function (data) {
|
||||
var points = data.getLayout('points');
|
||||
this.group.eachChild(function (child) {
|
||||
if (child.startIndex != null) {
|
||||
var len = (child.endIndex - child.startIndex) * 2;
|
||||
var byteOffset = child.startIndex * 4 * 2;
|
||||
points = new Float32Array(points.buffer, byteOffset, len);
|
||||
}
|
||||
|
||||
child.setShape('points', points); // Reset draw cursor.
|
||||
|
||||
child.reset();
|
||||
});
|
||||
};
|
||||
|
||||
LargeSymbolDraw.prototype.incrementalPrepareUpdate = function (data) {
|
||||
this._clear();
|
||||
};
|
||||
|
||||
LargeSymbolDraw.prototype.incrementalUpdate = function (taskParams, data, opt) {
|
||||
var lastAdded = this._newAdded[0];
|
||||
var points = data.getLayout('points');
|
||||
var oldPoints = lastAdded && lastAdded.shape.points; // Merging the exists. Each element has 1e4 points.
|
||||
// Consider the performance balance between too much elements and too much points in one shape(may affect hover optimization)
|
||||
|
||||
if (oldPoints && oldPoints.length < 2e4) {
|
||||
var oldLen = oldPoints.length;
|
||||
var newPoints = new Float32Array(oldLen + points.length); // Concat two array
|
||||
|
||||
newPoints.set(oldPoints);
|
||||
newPoints.set(points, oldLen); // Update endIndex
|
||||
|
||||
lastAdded.endIndex = taskParams.end;
|
||||
lastAdded.setShape({
|
||||
points: newPoints
|
||||
});
|
||||
} else {
|
||||
// Clear
|
||||
this._newAdded = [];
|
||||
|
||||
var symbolEl = this._create();
|
||||
|
||||
symbolEl.startIndex = taskParams.start;
|
||||
symbolEl.endIndex = taskParams.end;
|
||||
symbolEl.incremental = true;
|
||||
symbolEl.setShape({
|
||||
points: points
|
||||
});
|
||||
|
||||
this._setCommon(symbolEl, data, opt);
|
||||
}
|
||||
};
|
||||
|
||||
LargeSymbolDraw.prototype.eachRendered = function (cb) {
|
||||
this._newAdded[0] && cb(this._newAdded[0]);
|
||||
};
|
||||
|
||||
LargeSymbolDraw.prototype._create = function () {
|
||||
var symbolEl = new LargeSymbolPath({
|
||||
cursor: 'default'
|
||||
});
|
||||
this.group.add(symbolEl);
|
||||
|
||||
this._newAdded.push(symbolEl);
|
||||
|
||||
return symbolEl;
|
||||
};
|
||||
|
||||
LargeSymbolDraw.prototype._setCommon = function (symbolEl, data, opt) {
|
||||
var hostModel = data.hostModel;
|
||||
opt = opt || {};
|
||||
var size = data.getVisual('symbolSize');
|
||||
symbolEl.setShape('size', size instanceof Array ? size : [size, size]);
|
||||
symbolEl.softClipShape = opt.clipShape || null; // Create symbolProxy to build path for each data
|
||||
|
||||
symbolEl.symbolProxy = createSymbol(data.getVisual('symbol'), 0, 0, 0, 0); // Use symbolProxy setColor method
|
||||
|
||||
symbolEl.setColor = symbolEl.symbolProxy.setColor;
|
||||
var extrudeShadow = symbolEl.shape.size[0] < BOOST_SIZE_THRESHOLD;
|
||||
symbolEl.useStyle( // Draw shadow when doing fillRect is extremely slow.
|
||||
hostModel.getModel('itemStyle').getItemStyle(extrudeShadow ? ['color', 'shadowBlur', 'shadowColor'] : ['color']));
|
||||
var globalStyle = data.getVisual('style');
|
||||
var visualColor = globalStyle && globalStyle.fill;
|
||||
|
||||
if (visualColor) {
|
||||
symbolEl.setColor(visualColor);
|
||||
}
|
||||
|
||||
var ecData = getECData(symbolEl); // Enable tooltip
|
||||
// PENDING May have performance issue when path is extremely large
|
||||
|
||||
ecData.seriesIndex = hostModel.seriesIndex;
|
||||
symbolEl.on('mousemove', function (e) {
|
||||
ecData.dataIndex = null;
|
||||
var dataIndex = symbolEl.hoverDataIdx;
|
||||
|
||||
if (dataIndex >= 0) {
|
||||
// Provide dataIndex for tooltip
|
||||
ecData.dataIndex = dataIndex + (symbolEl.startIndex || 0);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
LargeSymbolDraw.prototype.remove = function () {
|
||||
this._clear();
|
||||
};
|
||||
|
||||
LargeSymbolDraw.prototype._clear = function () {
|
||||
this._newAdded = [];
|
||||
this.group.removeAll();
|
||||
};
|
||||
|
||||
return LargeSymbolDraw;
|
||||
}();
|
||||
|
||||
export default LargeSymbolDraw;
|
||||
469
uni-demo/node_modules/echarts/lib/chart/helper/Line.js
generated
vendored
Normal file
469
uni-demo/node_modules/echarts/lib/chart/helper/Line.js
generated
vendored
Normal file
@@ -0,0 +1,469 @@
|
||||
|
||||
/*
|
||||
* 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 { isArray, each } from 'zrender/lib/core/util.js';
|
||||
import * as vector from 'zrender/lib/core/vector.js';
|
||||
import * as symbolUtil from '../../util/symbol.js';
|
||||
import ECLinePath from './LinePath.js';
|
||||
import * as graphic from '../../util/graphic.js';
|
||||
import { toggleHoverEmphasis, enterEmphasis, leaveEmphasis, SPECIAL_STATES } from '../../util/states.js';
|
||||
import { getLabelStatesModels, setLabelStyle } from '../../label/labelStyle.js';
|
||||
import { round } from '../../util/number.js';
|
||||
var SYMBOL_CATEGORIES = ['fromSymbol', 'toSymbol'];
|
||||
|
||||
function makeSymbolTypeKey(symbolCategory) {
|
||||
return '_' + symbolCategory + 'Type';
|
||||
}
|
||||
/**
|
||||
* @inner
|
||||
*/
|
||||
|
||||
|
||||
function createSymbol(name, lineData, idx) {
|
||||
var symbolType = lineData.getItemVisual(idx, name);
|
||||
|
||||
if (!symbolType || symbolType === 'none') {
|
||||
return;
|
||||
}
|
||||
|
||||
var symbolSize = lineData.getItemVisual(idx, name + 'Size');
|
||||
var symbolRotate = lineData.getItemVisual(idx, name + 'Rotate');
|
||||
var symbolOffset = lineData.getItemVisual(idx, name + 'Offset');
|
||||
var symbolKeepAspect = lineData.getItemVisual(idx, name + 'KeepAspect');
|
||||
var symbolSizeArr = symbolUtil.normalizeSymbolSize(symbolSize);
|
||||
var symbolOffsetArr = symbolUtil.normalizeSymbolOffset(symbolOffset || 0, symbolSizeArr);
|
||||
var symbolPath = symbolUtil.createSymbol(symbolType, -symbolSizeArr[0] / 2 + symbolOffsetArr[0], -symbolSizeArr[1] / 2 + symbolOffsetArr[1], symbolSizeArr[0], symbolSizeArr[1], null, symbolKeepAspect);
|
||||
symbolPath.__specifiedRotation = symbolRotate == null || isNaN(symbolRotate) ? void 0 : +symbolRotate * Math.PI / 180 || 0;
|
||||
symbolPath.name = name;
|
||||
return symbolPath;
|
||||
}
|
||||
|
||||
function createLine(points) {
|
||||
var line = new ECLinePath({
|
||||
name: 'line',
|
||||
subPixelOptimize: true
|
||||
});
|
||||
setLinePoints(line.shape, points);
|
||||
return line;
|
||||
}
|
||||
|
||||
function setLinePoints(targetShape, points) {
|
||||
targetShape.x1 = points[0][0];
|
||||
targetShape.y1 = points[0][1];
|
||||
targetShape.x2 = points[1][0];
|
||||
targetShape.y2 = points[1][1];
|
||||
targetShape.percent = 1;
|
||||
var cp1 = points[2];
|
||||
|
||||
if (cp1) {
|
||||
targetShape.cpx1 = cp1[0];
|
||||
targetShape.cpy1 = cp1[1];
|
||||
} else {
|
||||
targetShape.cpx1 = NaN;
|
||||
targetShape.cpy1 = NaN;
|
||||
}
|
||||
}
|
||||
|
||||
var Line =
|
||||
/** @class */
|
||||
function (_super) {
|
||||
__extends(Line, _super);
|
||||
|
||||
function Line(lineData, idx, seriesScope) {
|
||||
var _this = _super.call(this) || this;
|
||||
|
||||
_this._createLine(lineData, idx, seriesScope);
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
Line.prototype._createLine = function (lineData, idx, seriesScope) {
|
||||
var seriesModel = lineData.hostModel;
|
||||
var linePoints = lineData.getItemLayout(idx);
|
||||
var line = createLine(linePoints);
|
||||
line.shape.percent = 0;
|
||||
graphic.initProps(line, {
|
||||
shape: {
|
||||
percent: 1
|
||||
}
|
||||
}, seriesModel, idx);
|
||||
this.add(line);
|
||||
each(SYMBOL_CATEGORIES, function (symbolCategory) {
|
||||
var symbol = createSymbol(symbolCategory, lineData, idx); // symbols must added after line to make sure
|
||||
// it will be updated after line#update.
|
||||
// Or symbol position and rotation update in line#beforeUpdate will be one frame slow
|
||||
|
||||
this.add(symbol);
|
||||
this[makeSymbolTypeKey(symbolCategory)] = lineData.getItemVisual(idx, symbolCategory);
|
||||
}, this);
|
||||
|
||||
this._updateCommonStl(lineData, idx, seriesScope);
|
||||
}; // TODO More strict on the List type in parameters?
|
||||
|
||||
|
||||
Line.prototype.updateData = function (lineData, idx, seriesScope) {
|
||||
var seriesModel = lineData.hostModel;
|
||||
var line = this.childOfName('line');
|
||||
var linePoints = lineData.getItemLayout(idx);
|
||||
var target = {
|
||||
shape: {}
|
||||
};
|
||||
setLinePoints(target.shape, linePoints);
|
||||
graphic.updateProps(line, target, seriesModel, idx);
|
||||
each(SYMBOL_CATEGORIES, function (symbolCategory) {
|
||||
var symbolType = lineData.getItemVisual(idx, symbolCategory);
|
||||
var key = makeSymbolTypeKey(symbolCategory); // Symbol changed
|
||||
|
||||
if (this[key] !== symbolType) {
|
||||
this.remove(this.childOfName(symbolCategory));
|
||||
var symbol = createSymbol(symbolCategory, lineData, idx);
|
||||
this.add(symbol);
|
||||
}
|
||||
|
||||
this[key] = symbolType;
|
||||
}, this);
|
||||
|
||||
this._updateCommonStl(lineData, idx, seriesScope);
|
||||
};
|
||||
|
||||
;
|
||||
|
||||
Line.prototype.getLinePath = function () {
|
||||
return this.childAt(0);
|
||||
};
|
||||
|
||||
Line.prototype._updateCommonStl = function (lineData, idx, seriesScope) {
|
||||
var seriesModel = lineData.hostModel;
|
||||
var line = this.childOfName('line');
|
||||
var emphasisLineStyle = seriesScope && seriesScope.emphasisLineStyle;
|
||||
var blurLineStyle = seriesScope && seriesScope.blurLineStyle;
|
||||
var selectLineStyle = seriesScope && seriesScope.selectLineStyle;
|
||||
var labelStatesModels = seriesScope && seriesScope.labelStatesModels;
|
||||
var emphasisDisabled = seriesScope && seriesScope.emphasisDisabled;
|
||||
var focus = seriesScope && seriesScope.focus;
|
||||
var blurScope = seriesScope && seriesScope.blurScope; // Optimization for large dataset
|
||||
|
||||
if (!seriesScope || lineData.hasItemOption) {
|
||||
var itemModel = lineData.getItemModel(idx);
|
||||
var emphasisModel = itemModel.getModel('emphasis');
|
||||
emphasisLineStyle = emphasisModel.getModel('lineStyle').getLineStyle();
|
||||
blurLineStyle = itemModel.getModel(['blur', 'lineStyle']).getLineStyle();
|
||||
selectLineStyle = itemModel.getModel(['select', 'lineStyle']).getLineStyle();
|
||||
emphasisDisabled = emphasisModel.get('disabled');
|
||||
focus = emphasisModel.get('focus');
|
||||
blurScope = emphasisModel.get('blurScope');
|
||||
labelStatesModels = getLabelStatesModels(itemModel);
|
||||
}
|
||||
|
||||
var lineStyle = lineData.getItemVisual(idx, 'style');
|
||||
var visualColor = lineStyle.stroke;
|
||||
line.useStyle(lineStyle);
|
||||
line.style.fill = null;
|
||||
line.style.strokeNoScale = true;
|
||||
line.ensureState('emphasis').style = emphasisLineStyle;
|
||||
line.ensureState('blur').style = blurLineStyle;
|
||||
line.ensureState('select').style = selectLineStyle; // Update symbol
|
||||
|
||||
each(SYMBOL_CATEGORIES, function (symbolCategory) {
|
||||
var symbol = this.childOfName(symbolCategory);
|
||||
|
||||
if (symbol) {
|
||||
// Share opacity and color with line.
|
||||
symbol.setColor(visualColor);
|
||||
symbol.style.opacity = lineStyle.opacity;
|
||||
|
||||
for (var i = 0; i < SPECIAL_STATES.length; i++) {
|
||||
var stateName = SPECIAL_STATES[i];
|
||||
var lineState = line.getState(stateName);
|
||||
|
||||
if (lineState) {
|
||||
var lineStateStyle = lineState.style || {};
|
||||
var state = symbol.ensureState(stateName);
|
||||
var stateStyle = state.style || (state.style = {});
|
||||
|
||||
if (lineStateStyle.stroke != null) {
|
||||
stateStyle[symbol.__isEmptyBrush ? 'stroke' : 'fill'] = lineStateStyle.stroke;
|
||||
}
|
||||
|
||||
if (lineStateStyle.opacity != null) {
|
||||
stateStyle.opacity = lineStateStyle.opacity;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
symbol.markRedraw();
|
||||
}
|
||||
}, this);
|
||||
var rawVal = seriesModel.getRawValue(idx);
|
||||
setLabelStyle(this, labelStatesModels, {
|
||||
labelDataIndex: idx,
|
||||
labelFetcher: {
|
||||
getFormattedLabel: function (dataIndex, stateName) {
|
||||
return seriesModel.getFormattedLabel(dataIndex, stateName, lineData.dataType);
|
||||
}
|
||||
},
|
||||
inheritColor: visualColor || '#000',
|
||||
defaultOpacity: lineStyle.opacity,
|
||||
defaultText: (rawVal == null ? lineData.getName(idx) : isFinite(rawVal) ? round(rawVal) : rawVal) + ''
|
||||
});
|
||||
var label = this.getTextContent(); // Always set `textStyle` even if `normalStyle.text` is null, because default
|
||||
// values have to be set on `normalStyle`.
|
||||
|
||||
if (label) {
|
||||
var labelNormalModel = labelStatesModels.normal;
|
||||
label.__align = label.style.align;
|
||||
label.__verticalAlign = label.style.verticalAlign; // 'start', 'middle', 'end'
|
||||
|
||||
label.__position = labelNormalModel.get('position') || 'middle';
|
||||
var distance = labelNormalModel.get('distance');
|
||||
|
||||
if (!isArray(distance)) {
|
||||
distance = [distance, distance];
|
||||
}
|
||||
|
||||
label.__labelDistance = distance;
|
||||
}
|
||||
|
||||
this.setTextConfig({
|
||||
position: null,
|
||||
local: true,
|
||||
inside: false // Can't be inside for stroke element.
|
||||
|
||||
});
|
||||
toggleHoverEmphasis(this, focus, blurScope, emphasisDisabled);
|
||||
};
|
||||
|
||||
Line.prototype.highlight = function () {
|
||||
enterEmphasis(this);
|
||||
};
|
||||
|
||||
Line.prototype.downplay = function () {
|
||||
leaveEmphasis(this);
|
||||
};
|
||||
|
||||
Line.prototype.updateLayout = function (lineData, idx) {
|
||||
this.setLinePoints(lineData.getItemLayout(idx));
|
||||
};
|
||||
|
||||
Line.prototype.setLinePoints = function (points) {
|
||||
var linePath = this.childOfName('line');
|
||||
setLinePoints(linePath.shape, points);
|
||||
linePath.dirty();
|
||||
};
|
||||
|
||||
Line.prototype.beforeUpdate = function () {
|
||||
var lineGroup = this;
|
||||
var symbolFrom = lineGroup.childOfName('fromSymbol');
|
||||
var symbolTo = lineGroup.childOfName('toSymbol');
|
||||
var label = lineGroup.getTextContent(); // Quick reject
|
||||
|
||||
if (!symbolFrom && !symbolTo && (!label || label.ignore)) {
|
||||
return;
|
||||
}
|
||||
|
||||
var invScale = 1;
|
||||
var parentNode = this.parent;
|
||||
|
||||
while (parentNode) {
|
||||
if (parentNode.scaleX) {
|
||||
invScale /= parentNode.scaleX;
|
||||
}
|
||||
|
||||
parentNode = parentNode.parent;
|
||||
}
|
||||
|
||||
var line = lineGroup.childOfName('line'); // If line not changed
|
||||
// FIXME Parent scale changed
|
||||
|
||||
if (!this.__dirty && !line.__dirty) {
|
||||
return;
|
||||
}
|
||||
|
||||
var percent = line.shape.percent;
|
||||
var fromPos = line.pointAt(0);
|
||||
var toPos = line.pointAt(percent);
|
||||
var d = vector.sub([], toPos, fromPos);
|
||||
vector.normalize(d, d);
|
||||
|
||||
function setSymbolRotation(symbol, percent) {
|
||||
// Fix #12388
|
||||
// when symbol is set to be 'arrow' in markLine,
|
||||
// symbolRotate value will be ignored, and compulsively use tangent angle.
|
||||
// rotate by default if symbol rotation is not specified
|
||||
var specifiedRotation = symbol.__specifiedRotation;
|
||||
|
||||
if (specifiedRotation == null) {
|
||||
var tangent = line.tangentAt(percent);
|
||||
symbol.attr('rotation', (percent === 1 ? -1 : 1) * Math.PI / 2 - Math.atan2(tangent[1], tangent[0]));
|
||||
} else {
|
||||
symbol.attr('rotation', specifiedRotation);
|
||||
}
|
||||
}
|
||||
|
||||
if (symbolFrom) {
|
||||
symbolFrom.setPosition(fromPos);
|
||||
setSymbolRotation(symbolFrom, 0);
|
||||
symbolFrom.scaleX = symbolFrom.scaleY = invScale * percent;
|
||||
symbolFrom.markRedraw();
|
||||
}
|
||||
|
||||
if (symbolTo) {
|
||||
symbolTo.setPosition(toPos);
|
||||
setSymbolRotation(symbolTo, 1);
|
||||
symbolTo.scaleX = symbolTo.scaleY = invScale * percent;
|
||||
symbolTo.markRedraw();
|
||||
}
|
||||
|
||||
if (label && !label.ignore) {
|
||||
label.x = label.y = 0;
|
||||
label.originX = label.originY = 0;
|
||||
var textAlign = void 0;
|
||||
var textVerticalAlign = void 0;
|
||||
var distance = label.__labelDistance;
|
||||
var distanceX = distance[0] * invScale;
|
||||
var distanceY = distance[1] * invScale;
|
||||
var halfPercent = percent / 2;
|
||||
var tangent = line.tangentAt(halfPercent);
|
||||
var n = [tangent[1], -tangent[0]];
|
||||
var cp = line.pointAt(halfPercent);
|
||||
|
||||
if (n[1] > 0) {
|
||||
n[0] = -n[0];
|
||||
n[1] = -n[1];
|
||||
}
|
||||
|
||||
var dir = tangent[0] < 0 ? -1 : 1;
|
||||
|
||||
if (label.__position !== 'start' && label.__position !== 'end') {
|
||||
var rotation = -Math.atan2(tangent[1], tangent[0]);
|
||||
|
||||
if (toPos[0] < fromPos[0]) {
|
||||
rotation = Math.PI + rotation;
|
||||
}
|
||||
|
||||
label.rotation = rotation;
|
||||
}
|
||||
|
||||
var dy = void 0;
|
||||
|
||||
switch (label.__position) {
|
||||
case 'insideStartTop':
|
||||
case 'insideMiddleTop':
|
||||
case 'insideEndTop':
|
||||
case 'middle':
|
||||
dy = -distanceY;
|
||||
textVerticalAlign = 'bottom';
|
||||
break;
|
||||
|
||||
case 'insideStartBottom':
|
||||
case 'insideMiddleBottom':
|
||||
case 'insideEndBottom':
|
||||
dy = distanceY;
|
||||
textVerticalAlign = 'top';
|
||||
break;
|
||||
|
||||
default:
|
||||
dy = 0;
|
||||
textVerticalAlign = 'middle';
|
||||
}
|
||||
|
||||
switch (label.__position) {
|
||||
case 'end':
|
||||
label.x = d[0] * distanceX + toPos[0];
|
||||
label.y = d[1] * distanceY + toPos[1];
|
||||
textAlign = d[0] > 0.8 ? 'left' : d[0] < -0.8 ? 'right' : 'center';
|
||||
textVerticalAlign = d[1] > 0.8 ? 'top' : d[1] < -0.8 ? 'bottom' : 'middle';
|
||||
break;
|
||||
|
||||
case 'start':
|
||||
label.x = -d[0] * distanceX + fromPos[0];
|
||||
label.y = -d[1] * distanceY + fromPos[1];
|
||||
textAlign = d[0] > 0.8 ? 'right' : d[0] < -0.8 ? 'left' : 'center';
|
||||
textVerticalAlign = d[1] > 0.8 ? 'bottom' : d[1] < -0.8 ? 'top' : 'middle';
|
||||
break;
|
||||
|
||||
case 'insideStartTop':
|
||||
case 'insideStart':
|
||||
case 'insideStartBottom':
|
||||
label.x = distanceX * dir + fromPos[0];
|
||||
label.y = fromPos[1] + dy;
|
||||
textAlign = tangent[0] < 0 ? 'right' : 'left';
|
||||
label.originX = -distanceX * dir;
|
||||
label.originY = -dy;
|
||||
break;
|
||||
|
||||
case 'insideMiddleTop':
|
||||
case 'insideMiddle':
|
||||
case 'insideMiddleBottom':
|
||||
case 'middle':
|
||||
label.x = cp[0];
|
||||
label.y = cp[1] + dy;
|
||||
textAlign = 'center';
|
||||
label.originY = -dy;
|
||||
break;
|
||||
|
||||
case 'insideEndTop':
|
||||
case 'insideEnd':
|
||||
case 'insideEndBottom':
|
||||
label.x = -distanceX * dir + toPos[0];
|
||||
label.y = toPos[1] + dy;
|
||||
textAlign = tangent[0] >= 0 ? 'right' : 'left';
|
||||
label.originX = distanceX * dir;
|
||||
label.originY = -dy;
|
||||
break;
|
||||
}
|
||||
|
||||
label.scaleX = label.scaleY = invScale;
|
||||
label.setStyle({
|
||||
// Use the user specified text align and baseline first
|
||||
verticalAlign: label.__verticalAlign || textVerticalAlign,
|
||||
align: label.__align || textAlign
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
return Line;
|
||||
}(graphic.Group);
|
||||
|
||||
export default Line;
|
||||
201
uni-demo/node_modules/echarts/lib/chart/helper/LineDraw.js
generated
vendored
Normal file
201
uni-demo/node_modules/echarts/lib/chart/helper/LineDraw.js
generated
vendored
Normal file
@@ -0,0 +1,201 @@
|
||||
|
||||
/*
|
||||
* 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 graphic from '../../util/graphic.js';
|
||||
import LineGroup from './Line.js';
|
||||
import { getLabelStatesModels } from '../../label/labelStyle.js';
|
||||
|
||||
var LineDraw =
|
||||
/** @class */
|
||||
function () {
|
||||
function LineDraw(LineCtor) {
|
||||
this.group = new graphic.Group();
|
||||
this._LineCtor = LineCtor || LineGroup;
|
||||
}
|
||||
|
||||
LineDraw.prototype.updateData = function (lineData) {
|
||||
var _this = this; // Remove progressive els.
|
||||
|
||||
|
||||
this._progressiveEls = null;
|
||||
var lineDraw = this;
|
||||
var group = lineDraw.group;
|
||||
var oldLineData = lineDraw._lineData;
|
||||
lineDraw._lineData = lineData; // There is no oldLineData only when first rendering or switching from
|
||||
// stream mode to normal mode, where previous elements should be removed.
|
||||
|
||||
if (!oldLineData) {
|
||||
group.removeAll();
|
||||
}
|
||||
|
||||
var seriesScope = makeSeriesScope(lineData);
|
||||
lineData.diff(oldLineData).add(function (idx) {
|
||||
_this._doAdd(lineData, idx, seriesScope);
|
||||
}).update(function (newIdx, oldIdx) {
|
||||
_this._doUpdate(oldLineData, lineData, oldIdx, newIdx, seriesScope);
|
||||
}).remove(function (idx) {
|
||||
group.remove(oldLineData.getItemGraphicEl(idx));
|
||||
}).execute();
|
||||
};
|
||||
|
||||
;
|
||||
|
||||
LineDraw.prototype.updateLayout = function () {
|
||||
var lineData = this._lineData; // Do not support update layout in incremental mode.
|
||||
|
||||
if (!lineData) {
|
||||
return;
|
||||
}
|
||||
|
||||
lineData.eachItemGraphicEl(function (el, idx) {
|
||||
el.updateLayout(lineData, idx);
|
||||
}, this);
|
||||
};
|
||||
|
||||
;
|
||||
|
||||
LineDraw.prototype.incrementalPrepareUpdate = function (lineData) {
|
||||
this._seriesScope = makeSeriesScope(lineData);
|
||||
this._lineData = null;
|
||||
this.group.removeAll();
|
||||
};
|
||||
|
||||
;
|
||||
|
||||
LineDraw.prototype.incrementalUpdate = function (taskParams, lineData) {
|
||||
this._progressiveEls = [];
|
||||
|
||||
function updateIncrementalAndHover(el) {
|
||||
if (!el.isGroup && !isEffectObject(el)) {
|
||||
el.incremental = true;
|
||||
el.ensureState('emphasis').hoverLayer = true;
|
||||
}
|
||||
}
|
||||
|
||||
for (var idx = taskParams.start; idx < taskParams.end; idx++) {
|
||||
var itemLayout = lineData.getItemLayout(idx);
|
||||
|
||||
if (lineNeedsDraw(itemLayout)) {
|
||||
var el = new this._LineCtor(lineData, idx, this._seriesScope);
|
||||
el.traverse(updateIncrementalAndHover);
|
||||
this.group.add(el);
|
||||
lineData.setItemGraphicEl(idx, el);
|
||||
|
||||
this._progressiveEls.push(el);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
;
|
||||
|
||||
LineDraw.prototype.remove = function () {
|
||||
this.group.removeAll();
|
||||
};
|
||||
|
||||
;
|
||||
|
||||
LineDraw.prototype.eachRendered = function (cb) {
|
||||
graphic.traverseElements(this._progressiveEls || this.group, cb);
|
||||
};
|
||||
|
||||
LineDraw.prototype._doAdd = function (lineData, idx, seriesScope) {
|
||||
var itemLayout = lineData.getItemLayout(idx);
|
||||
|
||||
if (!lineNeedsDraw(itemLayout)) {
|
||||
return;
|
||||
}
|
||||
|
||||
var el = new this._LineCtor(lineData, idx, seriesScope);
|
||||
lineData.setItemGraphicEl(idx, el);
|
||||
this.group.add(el);
|
||||
};
|
||||
|
||||
LineDraw.prototype._doUpdate = function (oldLineData, newLineData, oldIdx, newIdx, seriesScope) {
|
||||
var itemEl = oldLineData.getItemGraphicEl(oldIdx);
|
||||
|
||||
if (!lineNeedsDraw(newLineData.getItemLayout(newIdx))) {
|
||||
this.group.remove(itemEl);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!itemEl) {
|
||||
itemEl = new this._LineCtor(newLineData, newIdx, seriesScope);
|
||||
} else {
|
||||
itemEl.updateData(newLineData, newIdx, seriesScope);
|
||||
}
|
||||
|
||||
newLineData.setItemGraphicEl(newIdx, itemEl);
|
||||
this.group.add(itemEl);
|
||||
};
|
||||
|
||||
return LineDraw;
|
||||
}();
|
||||
|
||||
function isEffectObject(el) {
|
||||
return el.animators && el.animators.length > 0;
|
||||
}
|
||||
|
||||
function makeSeriesScope(lineData) {
|
||||
var hostModel = lineData.hostModel;
|
||||
var emphasisModel = hostModel.getModel('emphasis');
|
||||
return {
|
||||
lineStyle: hostModel.getModel('lineStyle').getLineStyle(),
|
||||
emphasisLineStyle: emphasisModel.getModel(['lineStyle']).getLineStyle(),
|
||||
blurLineStyle: hostModel.getModel(['blur', 'lineStyle']).getLineStyle(),
|
||||
selectLineStyle: hostModel.getModel(['select', 'lineStyle']).getLineStyle(),
|
||||
emphasisDisabled: emphasisModel.get('disabled'),
|
||||
blurScope: emphasisModel.get('blurScope'),
|
||||
focus: emphasisModel.get('focus'),
|
||||
labelStatesModels: getLabelStatesModels(hostModel)
|
||||
};
|
||||
}
|
||||
|
||||
function isPointNaN(pt) {
|
||||
return isNaN(pt[0]) || isNaN(pt[1]);
|
||||
}
|
||||
|
||||
function lineNeedsDraw(pts) {
|
||||
return pts && !isPointNaN(pts[0]) && !isPointNaN(pts[1]);
|
||||
}
|
||||
|
||||
export default LineDraw;
|
||||
134
uni-demo/node_modules/echarts/lib/chart/helper/LinePath.js
generated
vendored
Normal file
134
uni-demo/node_modules/echarts/lib/chart/helper/LinePath.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 { __extends } from "tslib";
|
||||
/**
|
||||
* Line path for bezier and straight line draw
|
||||
*/
|
||||
|
||||
import * as graphic from '../../util/graphic.js';
|
||||
import * as vec2 from 'zrender/lib/core/vector.js';
|
||||
var straightLineProto = graphic.Line.prototype;
|
||||
var bezierCurveProto = graphic.BezierCurve.prototype;
|
||||
|
||||
var StraightLineShape =
|
||||
/** @class */
|
||||
function () {
|
||||
function StraightLineShape() {
|
||||
// Start point
|
||||
this.x1 = 0;
|
||||
this.y1 = 0; // End point
|
||||
|
||||
this.x2 = 0;
|
||||
this.y2 = 0;
|
||||
this.percent = 1;
|
||||
}
|
||||
|
||||
return StraightLineShape;
|
||||
}();
|
||||
|
||||
var CurveShape =
|
||||
/** @class */
|
||||
function (_super) {
|
||||
__extends(CurveShape, _super);
|
||||
|
||||
function CurveShape() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
|
||||
return CurveShape;
|
||||
}(StraightLineShape);
|
||||
|
||||
function isStraightLine(shape) {
|
||||
return isNaN(+shape.cpx1) || isNaN(+shape.cpy1);
|
||||
}
|
||||
|
||||
var ECLinePath =
|
||||
/** @class */
|
||||
function (_super) {
|
||||
__extends(ECLinePath, _super);
|
||||
|
||||
function ECLinePath(opts) {
|
||||
var _this = _super.call(this, opts) || this;
|
||||
|
||||
_this.type = 'ec-line';
|
||||
return _this;
|
||||
}
|
||||
|
||||
ECLinePath.prototype.getDefaultStyle = function () {
|
||||
return {
|
||||
stroke: '#000',
|
||||
fill: null
|
||||
};
|
||||
};
|
||||
|
||||
ECLinePath.prototype.getDefaultShape = function () {
|
||||
return new StraightLineShape();
|
||||
};
|
||||
|
||||
ECLinePath.prototype.buildPath = function (ctx, shape) {
|
||||
if (isStraightLine(shape)) {
|
||||
straightLineProto.buildPath.call(this, ctx, shape);
|
||||
} else {
|
||||
bezierCurveProto.buildPath.call(this, ctx, shape);
|
||||
}
|
||||
};
|
||||
|
||||
ECLinePath.prototype.pointAt = function (t) {
|
||||
if (isStraightLine(this.shape)) {
|
||||
return straightLineProto.pointAt.call(this, t);
|
||||
} else {
|
||||
return bezierCurveProto.pointAt.call(this, t);
|
||||
}
|
||||
};
|
||||
|
||||
ECLinePath.prototype.tangentAt = function (t) {
|
||||
var shape = this.shape;
|
||||
var p = isStraightLine(shape) ? [shape.x2 - shape.x1, shape.y2 - shape.y1] : bezierCurveProto.tangentAt.call(this, t);
|
||||
return vec2.normalize(p, p);
|
||||
};
|
||||
|
||||
return ECLinePath;
|
||||
}(graphic.Path);
|
||||
|
||||
export default ECLinePath;
|
||||
126
uni-demo/node_modules/echarts/lib/chart/helper/Polyline.js
generated
vendored
Normal file
126
uni-demo/node_modules/echarts/lib/chart/helper/Polyline.js
generated
vendored
Normal file
@@ -0,0 +1,126 @@
|
||||
|
||||
/*
|
||||
* 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 graphic from '../../util/graphic.js';
|
||||
import { toggleHoverEmphasis } from '../../util/states.js';
|
||||
|
||||
var Polyline =
|
||||
/** @class */
|
||||
function (_super) {
|
||||
__extends(Polyline, _super);
|
||||
|
||||
function Polyline(lineData, idx, seriesScope) {
|
||||
var _this = _super.call(this) || this;
|
||||
|
||||
_this._createPolyline(lineData, idx, seriesScope);
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
Polyline.prototype._createPolyline = function (lineData, idx, seriesScope) {
|
||||
// let seriesModel = lineData.hostModel;
|
||||
var points = lineData.getItemLayout(idx);
|
||||
var line = new graphic.Polyline({
|
||||
shape: {
|
||||
points: points
|
||||
}
|
||||
});
|
||||
this.add(line);
|
||||
|
||||
this._updateCommonStl(lineData, idx, seriesScope);
|
||||
};
|
||||
|
||||
;
|
||||
|
||||
Polyline.prototype.updateData = function (lineData, idx, seriesScope) {
|
||||
var seriesModel = lineData.hostModel;
|
||||
var line = this.childAt(0);
|
||||
var target = {
|
||||
shape: {
|
||||
points: lineData.getItemLayout(idx)
|
||||
}
|
||||
};
|
||||
graphic.updateProps(line, target, seriesModel, idx);
|
||||
|
||||
this._updateCommonStl(lineData, idx, seriesScope);
|
||||
};
|
||||
|
||||
;
|
||||
|
||||
Polyline.prototype._updateCommonStl = function (lineData, idx, seriesScope) {
|
||||
var line = this.childAt(0);
|
||||
var itemModel = lineData.getItemModel(idx);
|
||||
var emphasisLineStyle = seriesScope && seriesScope.emphasisLineStyle;
|
||||
var focus = seriesScope && seriesScope.focus;
|
||||
var blurScope = seriesScope && seriesScope.blurScope;
|
||||
var emphasisDisabled = seriesScope && seriesScope.emphasisDisabled;
|
||||
|
||||
if (!seriesScope || lineData.hasItemOption) {
|
||||
var emphasisModel = itemModel.getModel('emphasis');
|
||||
emphasisLineStyle = emphasisModel.getModel('lineStyle').getLineStyle();
|
||||
emphasisDisabled = emphasisModel.get('disabled');
|
||||
focus = emphasisModel.get('focus');
|
||||
blurScope = emphasisModel.get('blurScope');
|
||||
}
|
||||
|
||||
line.useStyle(lineData.getItemVisual(idx, 'style'));
|
||||
line.style.fill = null;
|
||||
line.style.strokeNoScale = true;
|
||||
var lineEmphasisState = line.ensureState('emphasis');
|
||||
lineEmphasisState.style = emphasisLineStyle;
|
||||
toggleHoverEmphasis(this, focus, blurScope, emphasisDisabled);
|
||||
};
|
||||
|
||||
;
|
||||
|
||||
Polyline.prototype.updateLayout = function (lineData, idx) {
|
||||
var polyline = this.childAt(0);
|
||||
polyline.setShape('points', lineData.getItemLayout(idx));
|
||||
};
|
||||
|
||||
;
|
||||
return Polyline;
|
||||
}(graphic.Group);
|
||||
|
||||
export default Polyline;
|
||||
379
uni-demo/node_modules/echarts/lib/chart/helper/Symbol.js
generated
vendored
Normal file
379
uni-demo/node_modules/echarts/lib/chart/helper/Symbol.js
generated
vendored
Normal file
@@ -0,0 +1,379 @@
|
||||
|
||||
/*
|
||||
* 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 { createSymbol, normalizeSymbolOffset, normalizeSymbolSize } from '../../util/symbol.js';
|
||||
import * as graphic from '../../util/graphic.js';
|
||||
import { getECData } from '../../util/innerStore.js';
|
||||
import { enterEmphasis, leaveEmphasis, toggleHoverEmphasis } from '../../util/states.js';
|
||||
import { getDefaultLabel } from './labelHelper.js';
|
||||
import { extend, isNumber } from 'zrender/lib/core/util.js';
|
||||
import { setLabelStyle, getLabelStatesModels } from '../../label/labelStyle.js';
|
||||
import ZRImage from 'zrender/lib/graphic/Image.js';
|
||||
import { saveOldStyle } from '../../animation/basicTrasition.js';
|
||||
|
||||
var Symbol =
|
||||
/** @class */
|
||||
function (_super) {
|
||||
__extends(Symbol, _super);
|
||||
|
||||
function Symbol(data, idx, seriesScope, opts) {
|
||||
var _this = _super.call(this) || this;
|
||||
|
||||
_this.updateData(data, idx, seriesScope, opts);
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
Symbol.prototype._createSymbol = function (symbolType, data, idx, symbolSize, keepAspect) {
|
||||
// Remove paths created before
|
||||
this.removeAll(); // let symbolPath = createSymbol(
|
||||
// symbolType, -0.5, -0.5, 1, 1, color
|
||||
// );
|
||||
// If width/height are set too small (e.g., set to 1) on ios10
|
||||
// and macOS Sierra, a circle stroke become a rect, no matter what
|
||||
// the scale is set. So we set width/height as 2. See #4150.
|
||||
|
||||
var symbolPath = createSymbol(symbolType, -1, -1, 2, 2, null, keepAspect);
|
||||
symbolPath.attr({
|
||||
z2: 100,
|
||||
culling: true,
|
||||
scaleX: symbolSize[0] / 2,
|
||||
scaleY: symbolSize[1] / 2
|
||||
}); // Rewrite drift method
|
||||
|
||||
symbolPath.drift = driftSymbol;
|
||||
this._symbolType = symbolType;
|
||||
this.add(symbolPath);
|
||||
};
|
||||
/**
|
||||
* Stop animation
|
||||
* @param {boolean} toLastFrame
|
||||
*/
|
||||
|
||||
|
||||
Symbol.prototype.stopSymbolAnimation = function (toLastFrame) {
|
||||
this.childAt(0).stopAnimation(null, toLastFrame);
|
||||
};
|
||||
|
||||
Symbol.prototype.getSymbolType = function () {
|
||||
return this._symbolType;
|
||||
};
|
||||
/**
|
||||
* FIXME:
|
||||
* Caution: This method breaks the encapsulation of this module,
|
||||
* but it indeed brings convenience. So do not use the method
|
||||
* unless you detailedly know all the implements of `Symbol`,
|
||||
* especially animation.
|
||||
*
|
||||
* Get symbol path element.
|
||||
*/
|
||||
|
||||
|
||||
Symbol.prototype.getSymbolPath = function () {
|
||||
return this.childAt(0);
|
||||
};
|
||||
/**
|
||||
* Highlight symbol
|
||||
*/
|
||||
|
||||
|
||||
Symbol.prototype.highlight = function () {
|
||||
enterEmphasis(this.childAt(0));
|
||||
};
|
||||
/**
|
||||
* Downplay symbol
|
||||
*/
|
||||
|
||||
|
||||
Symbol.prototype.downplay = function () {
|
||||
leaveEmphasis(this.childAt(0));
|
||||
};
|
||||
/**
|
||||
* @param {number} zlevel
|
||||
* @param {number} z
|
||||
*/
|
||||
|
||||
|
||||
Symbol.prototype.setZ = function (zlevel, z) {
|
||||
var symbolPath = this.childAt(0);
|
||||
symbolPath.zlevel = zlevel;
|
||||
symbolPath.z = z;
|
||||
};
|
||||
|
||||
Symbol.prototype.setDraggable = function (draggable, hasCursorOption) {
|
||||
var symbolPath = this.childAt(0);
|
||||
symbolPath.draggable = draggable;
|
||||
symbolPath.cursor = !hasCursorOption && draggable ? 'move' : symbolPath.cursor;
|
||||
};
|
||||
/**
|
||||
* Update symbol properties
|
||||
*/
|
||||
|
||||
|
||||
Symbol.prototype.updateData = function (data, idx, seriesScope, opts) {
|
||||
this.silent = false;
|
||||
var symbolType = data.getItemVisual(idx, 'symbol') || 'circle';
|
||||
var seriesModel = data.hostModel;
|
||||
var symbolSize = Symbol.getSymbolSize(data, idx);
|
||||
var isInit = symbolType !== this._symbolType;
|
||||
var disableAnimation = opts && opts.disableAnimation;
|
||||
|
||||
if (isInit) {
|
||||
var keepAspect = data.getItemVisual(idx, 'symbolKeepAspect');
|
||||
|
||||
this._createSymbol(symbolType, data, idx, symbolSize, keepAspect);
|
||||
} else {
|
||||
var symbolPath = this.childAt(0);
|
||||
symbolPath.silent = false;
|
||||
var target = {
|
||||
scaleX: symbolSize[0] / 2,
|
||||
scaleY: symbolSize[1] / 2
|
||||
};
|
||||
disableAnimation ? symbolPath.attr(target) : graphic.updateProps(symbolPath, target, seriesModel, idx);
|
||||
saveOldStyle(symbolPath);
|
||||
}
|
||||
|
||||
this._updateCommon(data, idx, symbolSize, seriesScope, opts);
|
||||
|
||||
if (isInit) {
|
||||
var symbolPath = this.childAt(0);
|
||||
|
||||
if (!disableAnimation) {
|
||||
var target = {
|
||||
scaleX: this._sizeX,
|
||||
scaleY: this._sizeY,
|
||||
style: {
|
||||
// Always fadeIn. Because it has fadeOut animation when symbol is removed..
|
||||
opacity: symbolPath.style.opacity
|
||||
}
|
||||
};
|
||||
symbolPath.scaleX = symbolPath.scaleY = 0;
|
||||
symbolPath.style.opacity = 0;
|
||||
graphic.initProps(symbolPath, target, seriesModel, idx);
|
||||
}
|
||||
}
|
||||
|
||||
if (disableAnimation) {
|
||||
// Must stop leave transition manually if don't call initProps or updateProps.
|
||||
this.childAt(0).stopAnimation('leave');
|
||||
}
|
||||
};
|
||||
|
||||
Symbol.prototype._updateCommon = function (data, idx, symbolSize, seriesScope, opts) {
|
||||
var symbolPath = this.childAt(0);
|
||||
var seriesModel = data.hostModel;
|
||||
var emphasisItemStyle;
|
||||
var blurItemStyle;
|
||||
var selectItemStyle;
|
||||
var focus;
|
||||
var blurScope;
|
||||
var emphasisDisabled;
|
||||
var labelStatesModels;
|
||||
var hoverScale;
|
||||
var cursorStyle;
|
||||
|
||||
if (seriesScope) {
|
||||
emphasisItemStyle = seriesScope.emphasisItemStyle;
|
||||
blurItemStyle = seriesScope.blurItemStyle;
|
||||
selectItemStyle = seriesScope.selectItemStyle;
|
||||
focus = seriesScope.focus;
|
||||
blurScope = seriesScope.blurScope;
|
||||
labelStatesModels = seriesScope.labelStatesModels;
|
||||
hoverScale = seriesScope.hoverScale;
|
||||
cursorStyle = seriesScope.cursorStyle;
|
||||
emphasisDisabled = seriesScope.emphasisDisabled;
|
||||
}
|
||||
|
||||
if (!seriesScope || data.hasItemOption) {
|
||||
var itemModel = seriesScope && seriesScope.itemModel ? seriesScope.itemModel : data.getItemModel(idx);
|
||||
var emphasisModel = itemModel.getModel('emphasis');
|
||||
emphasisItemStyle = emphasisModel.getModel('itemStyle').getItemStyle();
|
||||
selectItemStyle = itemModel.getModel(['select', 'itemStyle']).getItemStyle();
|
||||
blurItemStyle = itemModel.getModel(['blur', 'itemStyle']).getItemStyle();
|
||||
focus = emphasisModel.get('focus');
|
||||
blurScope = emphasisModel.get('blurScope');
|
||||
emphasisDisabled = emphasisModel.get('disabled');
|
||||
labelStatesModels = getLabelStatesModels(itemModel);
|
||||
hoverScale = emphasisModel.getShallow('scale');
|
||||
cursorStyle = itemModel.getShallow('cursor');
|
||||
}
|
||||
|
||||
var symbolRotate = data.getItemVisual(idx, 'symbolRotate');
|
||||
symbolPath.attr('rotation', (symbolRotate || 0) * Math.PI / 180 || 0);
|
||||
var symbolOffset = normalizeSymbolOffset(data.getItemVisual(idx, 'symbolOffset'), symbolSize);
|
||||
|
||||
if (symbolOffset) {
|
||||
symbolPath.x = symbolOffset[0];
|
||||
symbolPath.y = symbolOffset[1];
|
||||
}
|
||||
|
||||
cursorStyle && symbolPath.attr('cursor', cursorStyle);
|
||||
var symbolStyle = data.getItemVisual(idx, 'style');
|
||||
var visualColor = symbolStyle.fill;
|
||||
|
||||
if (symbolPath instanceof ZRImage) {
|
||||
var pathStyle = symbolPath.style;
|
||||
symbolPath.useStyle(extend({
|
||||
// TODO other properties like x, y ?
|
||||
image: pathStyle.image,
|
||||
x: pathStyle.x,
|
||||
y: pathStyle.y,
|
||||
width: pathStyle.width,
|
||||
height: pathStyle.height
|
||||
}, symbolStyle));
|
||||
} else {
|
||||
if (symbolPath.__isEmptyBrush) {
|
||||
// fill and stroke will be swapped if it's empty.
|
||||
// So we cloned a new style to avoid it affecting the original style in visual storage.
|
||||
// TODO Better implementation. No empty logic!
|
||||
symbolPath.useStyle(extend({}, symbolStyle));
|
||||
} else {
|
||||
symbolPath.useStyle(symbolStyle);
|
||||
} // Disable decal because symbol scale will been applied on the decal.
|
||||
|
||||
|
||||
symbolPath.style.decal = null;
|
||||
symbolPath.setColor(visualColor, opts && opts.symbolInnerColor);
|
||||
symbolPath.style.strokeNoScale = true;
|
||||
}
|
||||
|
||||
var liftZ = data.getItemVisual(idx, 'liftZ');
|
||||
var z2Origin = this._z2;
|
||||
|
||||
if (liftZ != null) {
|
||||
if (z2Origin == null) {
|
||||
this._z2 = symbolPath.z2;
|
||||
symbolPath.z2 += liftZ;
|
||||
}
|
||||
} else if (z2Origin != null) {
|
||||
symbolPath.z2 = z2Origin;
|
||||
this._z2 = null;
|
||||
}
|
||||
|
||||
var useNameLabel = opts && opts.useNameLabel;
|
||||
setLabelStyle(symbolPath, labelStatesModels, {
|
||||
labelFetcher: seriesModel,
|
||||
labelDataIndex: idx,
|
||||
defaultText: getLabelDefaultText,
|
||||
inheritColor: visualColor,
|
||||
defaultOpacity: symbolStyle.opacity
|
||||
}); // Do not execute util needed.
|
||||
|
||||
function getLabelDefaultText(idx) {
|
||||
return useNameLabel ? data.getName(idx) : getDefaultLabel(data, idx);
|
||||
}
|
||||
|
||||
this._sizeX = symbolSize[0] / 2;
|
||||
this._sizeY = symbolSize[1] / 2;
|
||||
var emphasisState = symbolPath.ensureState('emphasis');
|
||||
emphasisState.style = emphasisItemStyle;
|
||||
symbolPath.ensureState('select').style = selectItemStyle;
|
||||
symbolPath.ensureState('blur').style = blurItemStyle;
|
||||
|
||||
if (hoverScale) {
|
||||
var scaleRatio = Math.max(isNumber(hoverScale) ? hoverScale : 1.1, 3 / this._sizeY);
|
||||
emphasisState.scaleX = this._sizeX * scaleRatio;
|
||||
emphasisState.scaleY = this._sizeY * scaleRatio;
|
||||
}
|
||||
|
||||
this.setSymbolScale(1);
|
||||
toggleHoverEmphasis(this, focus, blurScope, emphasisDisabled);
|
||||
};
|
||||
|
||||
Symbol.prototype.setSymbolScale = function (scale) {
|
||||
this.scaleX = this.scaleY = scale;
|
||||
};
|
||||
|
||||
Symbol.prototype.fadeOut = function (cb, seriesModel, opt) {
|
||||
var symbolPath = this.childAt(0);
|
||||
var dataIndex = getECData(this).dataIndex;
|
||||
var animationOpt = opt && opt.animation; // Avoid mistaken hover when fading out
|
||||
|
||||
this.silent = symbolPath.silent = true; // Not show text when animating
|
||||
|
||||
if (opt && opt.fadeLabel) {
|
||||
var textContent = symbolPath.getTextContent();
|
||||
|
||||
if (textContent) {
|
||||
graphic.removeElement(textContent, {
|
||||
style: {
|
||||
opacity: 0
|
||||
}
|
||||
}, seriesModel, {
|
||||
dataIndex: dataIndex,
|
||||
removeOpt: animationOpt,
|
||||
cb: function () {
|
||||
symbolPath.removeTextContent();
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
symbolPath.removeTextContent();
|
||||
}
|
||||
|
||||
graphic.removeElement(symbolPath, {
|
||||
style: {
|
||||
opacity: 0
|
||||
},
|
||||
scaleX: 0,
|
||||
scaleY: 0
|
||||
}, seriesModel, {
|
||||
dataIndex: dataIndex,
|
||||
cb: cb,
|
||||
removeOpt: animationOpt
|
||||
});
|
||||
};
|
||||
|
||||
Symbol.getSymbolSize = function (data, idx) {
|
||||
return normalizeSymbolSize(data.getItemVisual(idx, 'symbolSize'));
|
||||
};
|
||||
|
||||
return Symbol;
|
||||
}(graphic.Group);
|
||||
|
||||
function driftSymbol(dx, dy) {
|
||||
this.parent.drift(dx, dy);
|
||||
}
|
||||
|
||||
export default Symbol;
|
||||
249
uni-demo/node_modules/echarts/lib/chart/helper/SymbolDraw.js
generated
vendored
Normal file
249
uni-demo/node_modules/echarts/lib/chart/helper/SymbolDraw.js
generated
vendored
Normal file
@@ -0,0 +1,249 @@
|
||||
|
||||
/*
|
||||
* 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 graphic from '../../util/graphic.js';
|
||||
import SymbolClz from './Symbol.js';
|
||||
import { isObject } from 'zrender/lib/core/util.js';
|
||||
import { getLabelStatesModels } from '../../label/labelStyle.js';
|
||||
|
||||
function symbolNeedsDraw(data, point, idx, opt) {
|
||||
return point && !isNaN(point[0]) && !isNaN(point[1]) && !(opt.isIgnore && opt.isIgnore(idx)) // We do not set clipShape on group, because it will cut part of
|
||||
// the symbol element shape. We use the same clip shape here as
|
||||
// the line clip.
|
||||
&& !(opt.clipShape && !opt.clipShape.contain(point[0], point[1])) && data.getItemVisual(idx, 'symbol') !== 'none';
|
||||
}
|
||||
|
||||
function normalizeUpdateOpt(opt) {
|
||||
if (opt != null && !isObject(opt)) {
|
||||
opt = {
|
||||
isIgnore: opt
|
||||
};
|
||||
}
|
||||
|
||||
return opt || {};
|
||||
}
|
||||
|
||||
function makeSeriesScope(data) {
|
||||
var seriesModel = data.hostModel;
|
||||
var emphasisModel = seriesModel.getModel('emphasis');
|
||||
return {
|
||||
emphasisItemStyle: emphasisModel.getModel('itemStyle').getItemStyle(),
|
||||
blurItemStyle: seriesModel.getModel(['blur', 'itemStyle']).getItemStyle(),
|
||||
selectItemStyle: seriesModel.getModel(['select', 'itemStyle']).getItemStyle(),
|
||||
focus: emphasisModel.get('focus'),
|
||||
blurScope: emphasisModel.get('blurScope'),
|
||||
emphasisDisabled: emphasisModel.get('disabled'),
|
||||
hoverScale: emphasisModel.get('scale'),
|
||||
labelStatesModels: getLabelStatesModels(seriesModel),
|
||||
cursorStyle: seriesModel.get('cursor')
|
||||
};
|
||||
}
|
||||
|
||||
var SymbolDraw =
|
||||
/** @class */
|
||||
function () {
|
||||
function SymbolDraw(SymbolCtor) {
|
||||
this.group = new graphic.Group();
|
||||
this._SymbolCtor = SymbolCtor || SymbolClz;
|
||||
}
|
||||
/**
|
||||
* Update symbols draw by new data
|
||||
*/
|
||||
|
||||
|
||||
SymbolDraw.prototype.updateData = function (data, opt) {
|
||||
// Remove progressive els.
|
||||
this._progressiveEls = null;
|
||||
opt = normalizeUpdateOpt(opt);
|
||||
var group = this.group;
|
||||
var seriesModel = data.hostModel;
|
||||
var oldData = this._data;
|
||||
var SymbolCtor = this._SymbolCtor;
|
||||
var disableAnimation = opt.disableAnimation;
|
||||
var seriesScope = makeSeriesScope(data);
|
||||
var symbolUpdateOpt = {
|
||||
disableAnimation: disableAnimation
|
||||
};
|
||||
|
||||
var getSymbolPoint = opt.getSymbolPoint || function (idx) {
|
||||
return data.getItemLayout(idx);
|
||||
}; // There is no oldLineData only when first rendering or switching from
|
||||
// stream mode to normal mode, where previous elements should be removed.
|
||||
|
||||
|
||||
if (!oldData) {
|
||||
group.removeAll();
|
||||
}
|
||||
|
||||
data.diff(oldData).add(function (newIdx) {
|
||||
var point = getSymbolPoint(newIdx);
|
||||
|
||||
if (symbolNeedsDraw(data, point, newIdx, opt)) {
|
||||
var symbolEl = new SymbolCtor(data, newIdx, seriesScope, symbolUpdateOpt);
|
||||
symbolEl.setPosition(point);
|
||||
data.setItemGraphicEl(newIdx, symbolEl);
|
||||
group.add(symbolEl);
|
||||
}
|
||||
}).update(function (newIdx, oldIdx) {
|
||||
var symbolEl = oldData.getItemGraphicEl(oldIdx);
|
||||
var point = getSymbolPoint(newIdx);
|
||||
|
||||
if (!symbolNeedsDraw(data, point, newIdx, opt)) {
|
||||
group.remove(symbolEl);
|
||||
return;
|
||||
}
|
||||
|
||||
var newSymbolType = data.getItemVisual(newIdx, 'symbol') || 'circle';
|
||||
var oldSymbolType = symbolEl && symbolEl.getSymbolType && symbolEl.getSymbolType();
|
||||
|
||||
if (!symbolEl // Create a new if symbol type changed.
|
||||
|| oldSymbolType && oldSymbolType !== newSymbolType) {
|
||||
group.remove(symbolEl);
|
||||
symbolEl = new SymbolCtor(data, newIdx, seriesScope, symbolUpdateOpt);
|
||||
symbolEl.setPosition(point);
|
||||
} else {
|
||||
symbolEl.updateData(data, newIdx, seriesScope, symbolUpdateOpt);
|
||||
var target = {
|
||||
x: point[0],
|
||||
y: point[1]
|
||||
};
|
||||
disableAnimation ? symbolEl.attr(target) : graphic.updateProps(symbolEl, target, seriesModel);
|
||||
} // Add back
|
||||
|
||||
|
||||
group.add(symbolEl);
|
||||
data.setItemGraphicEl(newIdx, symbolEl);
|
||||
}).remove(function (oldIdx) {
|
||||
var el = oldData.getItemGraphicEl(oldIdx);
|
||||
el && el.fadeOut(function () {
|
||||
group.remove(el);
|
||||
}, seriesModel);
|
||||
}).execute();
|
||||
this._getSymbolPoint = getSymbolPoint;
|
||||
this._data = data;
|
||||
};
|
||||
|
||||
;
|
||||
|
||||
SymbolDraw.prototype.updateLayout = function () {
|
||||
var _this = this;
|
||||
|
||||
var data = this._data;
|
||||
|
||||
if (data) {
|
||||
// Not use animation
|
||||
data.eachItemGraphicEl(function (el, idx) {
|
||||
var point = _this._getSymbolPoint(idx);
|
||||
|
||||
el.setPosition(point);
|
||||
el.markRedraw();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
;
|
||||
|
||||
SymbolDraw.prototype.incrementalPrepareUpdate = function (data) {
|
||||
this._seriesScope = makeSeriesScope(data);
|
||||
this._data = null;
|
||||
this.group.removeAll();
|
||||
};
|
||||
|
||||
;
|
||||
/**
|
||||
* Update symbols draw by new data
|
||||
*/
|
||||
|
||||
SymbolDraw.prototype.incrementalUpdate = function (taskParams, data, opt) {
|
||||
// Clear
|
||||
this._progressiveEls = [];
|
||||
opt = normalizeUpdateOpt(opt);
|
||||
|
||||
function updateIncrementalAndHover(el) {
|
||||
if (!el.isGroup) {
|
||||
el.incremental = true;
|
||||
el.ensureState('emphasis').hoverLayer = true;
|
||||
}
|
||||
}
|
||||
|
||||
for (var idx = taskParams.start; idx < taskParams.end; idx++) {
|
||||
var point = data.getItemLayout(idx);
|
||||
|
||||
if (symbolNeedsDraw(data, point, idx, opt)) {
|
||||
var el = new this._SymbolCtor(data, idx, this._seriesScope);
|
||||
el.traverse(updateIncrementalAndHover);
|
||||
el.setPosition(point);
|
||||
this.group.add(el);
|
||||
data.setItemGraphicEl(idx, el);
|
||||
|
||||
this._progressiveEls.push(el);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
;
|
||||
|
||||
SymbolDraw.prototype.eachRendered = function (cb) {
|
||||
graphic.traverseElements(this._progressiveEls || this.group, cb);
|
||||
};
|
||||
|
||||
SymbolDraw.prototype.remove = function (enableAnimation) {
|
||||
var group = this.group;
|
||||
var data = this._data; // Incremental model do not have this._data.
|
||||
|
||||
if (data && enableAnimation) {
|
||||
data.eachItemGraphicEl(function (el) {
|
||||
el.fadeOut(function () {
|
||||
group.remove(el);
|
||||
}, data.hostModel);
|
||||
});
|
||||
} else {
|
||||
group.removeAll();
|
||||
}
|
||||
};
|
||||
|
||||
;
|
||||
return SymbolDraw;
|
||||
}();
|
||||
|
||||
export default SymbolDraw;
|
||||
156
uni-demo/node_modules/echarts/lib/chart/helper/createClipPathFromCoordSys.js
generated
vendored
Normal file
156
uni-demo/node_modules/echarts/lib/chart/helper/createClipPathFromCoordSys.js
generated
vendored
Normal file
@@ -0,0 +1,156 @@
|
||||
|
||||
/*
|
||||
* 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 graphic from '../../util/graphic.js';
|
||||
import { round } from '../../util/number.js';
|
||||
import { isFunction } from 'zrender/lib/core/util.js';
|
||||
|
||||
function createGridClipPath(cartesian, hasAnimation, seriesModel, done, during) {
|
||||
var rect = cartesian.getArea();
|
||||
var x = rect.x;
|
||||
var y = rect.y;
|
||||
var width = rect.width;
|
||||
var height = rect.height;
|
||||
var lineWidth = seriesModel.get(['lineStyle', 'width']) || 2; // Expand the clip path a bit to avoid the border is clipped and looks thinner
|
||||
|
||||
x -= lineWidth / 2;
|
||||
y -= lineWidth / 2;
|
||||
width += lineWidth;
|
||||
height += lineWidth; // fix: https://github.com/apache/incubator-echarts/issues/11369
|
||||
|
||||
x = Math.floor(x);
|
||||
width = Math.round(width);
|
||||
var clipPath = new graphic.Rect({
|
||||
shape: {
|
||||
x: x,
|
||||
y: y,
|
||||
width: width,
|
||||
height: height
|
||||
}
|
||||
});
|
||||
|
||||
if (hasAnimation) {
|
||||
var baseAxis = cartesian.getBaseAxis();
|
||||
var isHorizontal = baseAxis.isHorizontal();
|
||||
var isAxisInversed = baseAxis.inverse;
|
||||
|
||||
if (isHorizontal) {
|
||||
if (isAxisInversed) {
|
||||
clipPath.shape.x += width;
|
||||
}
|
||||
|
||||
clipPath.shape.width = 0;
|
||||
} else {
|
||||
if (!isAxisInversed) {
|
||||
clipPath.shape.y += height;
|
||||
}
|
||||
|
||||
clipPath.shape.height = 0;
|
||||
}
|
||||
|
||||
var duringCb = isFunction(during) ? function (percent) {
|
||||
during(percent, clipPath);
|
||||
} : null;
|
||||
graphic.initProps(clipPath, {
|
||||
shape: {
|
||||
width: width,
|
||||
height: height,
|
||||
x: x,
|
||||
y: y
|
||||
}
|
||||
}, seriesModel, null, done, duringCb);
|
||||
}
|
||||
|
||||
return clipPath;
|
||||
}
|
||||
|
||||
function createPolarClipPath(polar, hasAnimation, seriesModel) {
|
||||
var sectorArea = polar.getArea(); // Avoid float number rounding error for symbol on the edge of axis extent.
|
||||
|
||||
var r0 = round(sectorArea.r0, 1);
|
||||
var r = round(sectorArea.r, 1);
|
||||
var clipPath = new graphic.Sector({
|
||||
shape: {
|
||||
cx: round(polar.cx, 1),
|
||||
cy: round(polar.cy, 1),
|
||||
r0: r0,
|
||||
r: r,
|
||||
startAngle: sectorArea.startAngle,
|
||||
endAngle: sectorArea.endAngle,
|
||||
clockwise: sectorArea.clockwise
|
||||
}
|
||||
});
|
||||
|
||||
if (hasAnimation) {
|
||||
var isRadial = polar.getBaseAxis().dim === 'angle';
|
||||
|
||||
if (isRadial) {
|
||||
clipPath.shape.endAngle = sectorArea.startAngle;
|
||||
} else {
|
||||
clipPath.shape.r = r0;
|
||||
}
|
||||
|
||||
graphic.initProps(clipPath, {
|
||||
shape: {
|
||||
endAngle: sectorArea.endAngle,
|
||||
r: r
|
||||
}
|
||||
}, seriesModel);
|
||||
}
|
||||
|
||||
return clipPath;
|
||||
}
|
||||
|
||||
function createClipPath(coordSys, hasAnimation, seriesModel, done, during) {
|
||||
if (!coordSys) {
|
||||
return null;
|
||||
} else if (coordSys.type === 'polar') {
|
||||
return createPolarClipPath(coordSys, hasAnimation, seriesModel);
|
||||
} else if (coordSys.type === 'cartesian2d') {
|
||||
return createGridClipPath(coordSys, hasAnimation, seriesModel, done, during);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
export { createGridClipPath, createPolarClipPath, createClipPath };
|
||||
120
uni-demo/node_modules/echarts/lib/chart/helper/createGraphFromNodeEdge.js
generated
vendored
Normal file
120
uni-demo/node_modules/echarts/lib/chart/helper/createGraphFromNodeEdge.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.
|
||||
*/
|
||||
import * as zrUtil from 'zrender/lib/core/util.js';
|
||||
import SeriesData from '../../data/SeriesData.js';
|
||||
import Graph from '../../data/Graph.js';
|
||||
import linkSeriesData from '../../data/helper/linkSeriesData.js';
|
||||
import prepareSeriesDataSchema from '../../data/helper/createDimensions.js';
|
||||
import CoordinateSystem from '../../core/CoordinateSystem.js';
|
||||
import createSeriesData from './createSeriesData.js';
|
||||
import { convertOptionIdName } from '../../util/model.js';
|
||||
export default function createGraphFromNodeEdge(nodes, edges, seriesModel, directed, beforeLink) {
|
||||
// ??? TODO
|
||||
// support dataset?
|
||||
var graph = new Graph(directed);
|
||||
|
||||
for (var i = 0; i < nodes.length; i++) {
|
||||
graph.addNode(zrUtil.retrieve( // Id, name, dataIndex
|
||||
nodes[i].id, nodes[i].name, i), i);
|
||||
}
|
||||
|
||||
var linkNameList = [];
|
||||
var validEdges = [];
|
||||
var linkCount = 0;
|
||||
|
||||
for (var i = 0; i < edges.length; i++) {
|
||||
var link = edges[i];
|
||||
var source = link.source;
|
||||
var target = link.target; // addEdge may fail when source or target not exists
|
||||
|
||||
if (graph.addEdge(source, target, linkCount)) {
|
||||
validEdges.push(link);
|
||||
linkNameList.push(zrUtil.retrieve(convertOptionIdName(link.id, null), source + ' > ' + target));
|
||||
linkCount++;
|
||||
}
|
||||
}
|
||||
|
||||
var coordSys = seriesModel.get('coordinateSystem');
|
||||
var nodeData;
|
||||
|
||||
if (coordSys === 'cartesian2d' || coordSys === 'polar') {
|
||||
nodeData = createSeriesData(nodes, seriesModel);
|
||||
} else {
|
||||
var coordSysCtor = CoordinateSystem.get(coordSys);
|
||||
var coordDimensions = coordSysCtor ? coordSysCtor.dimensions || [] : []; // FIXME: Some geo do not need `value` dimenson, whereas `calendar` needs
|
||||
// `value` dimension, but graph need `value` dimension. It's better to
|
||||
// uniform this behavior.
|
||||
|
||||
if (zrUtil.indexOf(coordDimensions, 'value') < 0) {
|
||||
coordDimensions.concat(['value']);
|
||||
}
|
||||
|
||||
var dimensions = prepareSeriesDataSchema(nodes, {
|
||||
coordDimensions: coordDimensions,
|
||||
encodeDefine: seriesModel.getEncode()
|
||||
}).dimensions;
|
||||
nodeData = new SeriesData(dimensions, seriesModel);
|
||||
nodeData.initData(nodes);
|
||||
}
|
||||
|
||||
var edgeData = new SeriesData(['value'], seriesModel);
|
||||
edgeData.initData(validEdges, linkNameList);
|
||||
beforeLink && beforeLink(nodeData, edgeData);
|
||||
linkSeriesData({
|
||||
mainData: nodeData,
|
||||
struct: graph,
|
||||
structAttr: 'graph',
|
||||
datas: {
|
||||
node: nodeData,
|
||||
edge: edgeData
|
||||
},
|
||||
datasAttr: {
|
||||
node: 'data',
|
||||
edge: 'edgeData'
|
||||
}
|
||||
}); // Update dataIndex of nodes and edges because invalid edge may be removed
|
||||
|
||||
graph.update();
|
||||
return graph;
|
||||
}
|
||||
63
uni-demo/node_modules/echarts/lib/chart/helper/createRenderPlanner.js
generated
vendored
Normal file
63
uni-demo/node_modules/echarts/lib/chart/helper/createRenderPlanner.js
generated
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
|
||||
/*
|
||||
* 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 '../../util/model.js';
|
||||
/**
|
||||
* @return {string} If large mode changed, return string 'reset';
|
||||
*/
|
||||
|
||||
export default function createRenderPlanner() {
|
||||
var inner = makeInner();
|
||||
return function (seriesModel) {
|
||||
var fields = inner(seriesModel);
|
||||
var pipelineContext = seriesModel.pipelineContext;
|
||||
var originalLarge = !!fields.large;
|
||||
var originalProgressive = !!fields.progressiveRender; // FIXME: if the planner works on a filtered series, `pipelineContext` does not
|
||||
// exists. See #11611 . Probably we need to modify this structure, see the comment
|
||||
// on `performRawSeries` in `Schedular.js`.
|
||||
|
||||
var large = fields.large = !!(pipelineContext && pipelineContext.large);
|
||||
var progressive = fields.progressiveRender = !!(pipelineContext && pipelineContext.progressiveRender);
|
||||
return !!(originalLarge !== large || originalProgressive !== progressive) && 'reset';
|
||||
};
|
||||
}
|
||||
183
uni-demo/node_modules/echarts/lib/chart/helper/createSeriesData.js
generated
vendored
Normal file
183
uni-demo/node_modules/echarts/lib/chart/helper/createSeriesData.js
generated
vendored
Normal file
@@ -0,0 +1,183 @@
|
||||
|
||||
/*
|
||||
* 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 SeriesData from '../../data/SeriesData.js';
|
||||
import prepareSeriesDataSchema from '../../data/helper/createDimensions.js';
|
||||
import { getDimensionTypeByAxis } from '../../data/helper/dimensionHelper.js';
|
||||
import { getDataItemValue } from '../../util/model.js';
|
||||
import CoordinateSystem from '../../core/CoordinateSystem.js';
|
||||
import { getCoordSysInfoBySeries } from '../../model/referHelper.js';
|
||||
import { createSourceFromSeriesDataOption } from '../../data/Source.js';
|
||||
import { enableDataStack } from '../../data/helper/dataStackHelper.js';
|
||||
import { makeSeriesEncodeForAxisCoordSys } from '../../data/helper/sourceHelper.js';
|
||||
import { SOURCE_FORMAT_ORIGINAL } from '../../util/types.js';
|
||||
|
||||
function getCoordSysDimDefs(seriesModel, coordSysInfo) {
|
||||
var coordSysName = seriesModel.get('coordinateSystem');
|
||||
var registeredCoordSys = CoordinateSystem.get(coordSysName);
|
||||
var coordSysDimDefs;
|
||||
|
||||
if (coordSysInfo && coordSysInfo.coordSysDims) {
|
||||
coordSysDimDefs = zrUtil.map(coordSysInfo.coordSysDims, function (dim) {
|
||||
var dimInfo = {
|
||||
name: dim
|
||||
};
|
||||
var axisModel = coordSysInfo.axisMap.get(dim);
|
||||
|
||||
if (axisModel) {
|
||||
var axisType = axisModel.get('type');
|
||||
dimInfo.type = getDimensionTypeByAxis(axisType);
|
||||
}
|
||||
|
||||
return dimInfo;
|
||||
});
|
||||
}
|
||||
|
||||
if (!coordSysDimDefs) {
|
||||
// Get dimensions from registered coordinate system
|
||||
coordSysDimDefs = registeredCoordSys && (registeredCoordSys.getDimensionsInfo ? registeredCoordSys.getDimensionsInfo() : registeredCoordSys.dimensions.slice()) || ['x', 'y'];
|
||||
}
|
||||
|
||||
return coordSysDimDefs;
|
||||
}
|
||||
|
||||
function injectOrdinalMeta(dimInfoList, createInvertedIndices, coordSysInfo) {
|
||||
var firstCategoryDimIndex;
|
||||
var hasNameEncode;
|
||||
coordSysInfo && zrUtil.each(dimInfoList, function (dimInfo, dimIndex) {
|
||||
var coordDim = dimInfo.coordDim;
|
||||
var categoryAxisModel = coordSysInfo.categoryAxisMap.get(coordDim);
|
||||
|
||||
if (categoryAxisModel) {
|
||||
if (firstCategoryDimIndex == null) {
|
||||
firstCategoryDimIndex = dimIndex;
|
||||
}
|
||||
|
||||
dimInfo.ordinalMeta = categoryAxisModel.getOrdinalMeta();
|
||||
|
||||
if (createInvertedIndices) {
|
||||
dimInfo.createInvertedIndices = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (dimInfo.otherDims.itemName != null) {
|
||||
hasNameEncode = true;
|
||||
}
|
||||
});
|
||||
|
||||
if (!hasNameEncode && firstCategoryDimIndex != null) {
|
||||
dimInfoList[firstCategoryDimIndex].otherDims.itemName = 0;
|
||||
}
|
||||
|
||||
return firstCategoryDimIndex;
|
||||
}
|
||||
/**
|
||||
* Caution: there are side effects to `sourceManager` in this method.
|
||||
* Should better only be called in `Series['getInitialData']`.
|
||||
*/
|
||||
|
||||
|
||||
function createSeriesData(sourceRaw, seriesModel, opt) {
|
||||
opt = opt || {};
|
||||
var sourceManager = seriesModel.getSourceManager();
|
||||
var source;
|
||||
var isOriginalSource = false;
|
||||
|
||||
if (sourceRaw) {
|
||||
isOriginalSource = true;
|
||||
source = createSourceFromSeriesDataOption(sourceRaw);
|
||||
} else {
|
||||
source = sourceManager.getSource(); // Is series.data. not dataset.
|
||||
|
||||
isOriginalSource = source.sourceFormat === SOURCE_FORMAT_ORIGINAL;
|
||||
}
|
||||
|
||||
var coordSysInfo = getCoordSysInfoBySeries(seriesModel);
|
||||
var coordSysDimDefs = getCoordSysDimDefs(seriesModel, coordSysInfo);
|
||||
var useEncodeDefaulter = opt.useEncodeDefaulter;
|
||||
var encodeDefaulter = zrUtil.isFunction(useEncodeDefaulter) ? useEncodeDefaulter : useEncodeDefaulter ? zrUtil.curry(makeSeriesEncodeForAxisCoordSys, coordSysDimDefs, seriesModel) : null;
|
||||
var createDimensionOptions = {
|
||||
coordDimensions: coordSysDimDefs,
|
||||
generateCoord: opt.generateCoord,
|
||||
encodeDefine: seriesModel.getEncode(),
|
||||
encodeDefaulter: encodeDefaulter,
|
||||
canOmitUnusedDimensions: !isOriginalSource
|
||||
};
|
||||
var schema = prepareSeriesDataSchema(source, createDimensionOptions);
|
||||
var firstCategoryDimIndex = injectOrdinalMeta(schema.dimensions, opt.createInvertedIndices, coordSysInfo);
|
||||
var store = !isOriginalSource ? sourceManager.getSharedDataStore(schema) : null;
|
||||
var stackCalculationInfo = enableDataStack(seriesModel, {
|
||||
schema: schema,
|
||||
store: store
|
||||
});
|
||||
var data = new SeriesData(schema, seriesModel);
|
||||
data.setCalculationInfo(stackCalculationInfo);
|
||||
var dimValueGetter = firstCategoryDimIndex != null && isNeedCompleteOrdinalData(source) ? function (itemOpt, dimName, dataIndex, dimIndex) {
|
||||
// Use dataIndex as ordinal value in categoryAxis
|
||||
return dimIndex === firstCategoryDimIndex ? dataIndex : this.defaultDimValueGetter(itemOpt, dimName, dataIndex, dimIndex);
|
||||
} : null;
|
||||
data.hasItemOption = false;
|
||||
data.initData( // Try to reuse the data store in sourceManager if using dataset.
|
||||
isOriginalSource ? source : store, null, dimValueGetter);
|
||||
return data;
|
||||
}
|
||||
|
||||
function isNeedCompleteOrdinalData(source) {
|
||||
if (source.sourceFormat === SOURCE_FORMAT_ORIGINAL) {
|
||||
var sampleItem = firstDataNotNull(source.data || []);
|
||||
return !zrUtil.isArray(getDataItemValue(sampleItem));
|
||||
}
|
||||
}
|
||||
|
||||
function firstDataNotNull(arr) {
|
||||
var i = 0;
|
||||
|
||||
while (i < arr.length && arr[i] == null) {
|
||||
i++;
|
||||
}
|
||||
|
||||
return arr[i];
|
||||
}
|
||||
|
||||
export default createSeriesData;
|
||||
69
uni-demo/node_modules/echarts/lib/chart/helper/createSeriesDataSimply.js
generated
vendored
Normal file
69
uni-demo/node_modules/echarts/lib/chart/helper/createSeriesDataSimply.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 prepareSeriesDataSchema from '../../data/helper/createDimensions.js';
|
||||
import SeriesData from '../../data/SeriesData.js';
|
||||
import { extend, isArray } from 'zrender/lib/core/util.js';
|
||||
/**
|
||||
* [Usage]:
|
||||
* (1)
|
||||
* createListSimply(seriesModel, ['value']);
|
||||
* (2)
|
||||
* createListSimply(seriesModel, {
|
||||
* coordDimensions: ['value'],
|
||||
* dimensionsCount: 5
|
||||
* });
|
||||
*/
|
||||
|
||||
export default function createSeriesDataSimply(seriesModel, opt, nameList) {
|
||||
opt = isArray(opt) && {
|
||||
coordDimensions: opt
|
||||
} || extend({
|
||||
encodeDefine: seriesModel.getEncode()
|
||||
}, opt);
|
||||
var source = seriesModel.getSource();
|
||||
var dimensions = prepareSeriesDataSchema(source, opt).dimensions;
|
||||
var list = new SeriesData(dimensions, seriesModel);
|
||||
list.initData(source, nameList);
|
||||
return list;
|
||||
}
|
||||
60
uni-demo/node_modules/echarts/lib/chart/helper/enableAriaDecalForTree.js
generated
vendored
Normal file
60
uni-demo/node_modules/echarts/lib/chart/helper/enableAriaDecalForTree.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 { getDecalFromPalette } from '../../model/mixin/palette.js';
|
||||
export default function enableAriaDecalForTree(seriesModel) {
|
||||
var data = seriesModel.getData();
|
||||
var tree = data.tree;
|
||||
var decalPaletteScope = {};
|
||||
tree.eachNode(function (node) {
|
||||
// Use decal of level 1 node
|
||||
var current = node;
|
||||
|
||||
while (current && current.depth > 1) {
|
||||
current = current.parentNode;
|
||||
}
|
||||
|
||||
var decal = getDecalFromPalette(seriesModel.ecModel, current.name || current.dataIndex + '', decalPaletteScope);
|
||||
node.setVisual('decal', decal);
|
||||
});
|
||||
}
|
||||
85
uni-demo/node_modules/echarts/lib/chart/helper/labelHelper.js
generated
vendored
Normal file
85
uni-demo/node_modules/echarts/lib/chart/helper/labelHelper.js
generated
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
|
||||
/*
|
||||
* 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 { retrieveRawValue } from '../../data/helper/dataProvider.js';
|
||||
import { isArray } from 'zrender/lib/core/util.js';
|
||||
/**
|
||||
* @return label string. Not null/undefined
|
||||
*/
|
||||
|
||||
export function getDefaultLabel(data, dataIndex) {
|
||||
var labelDims = data.mapDimensionsAll('defaultedLabel');
|
||||
var len = labelDims.length; // Simple optimization (in lots of cases, label dims length is 1)
|
||||
|
||||
if (len === 1) {
|
||||
var rawVal = retrieveRawValue(data, dataIndex, labelDims[0]);
|
||||
return rawVal != null ? rawVal + '' : null;
|
||||
} else if (len) {
|
||||
var vals = [];
|
||||
|
||||
for (var i = 0; i < labelDims.length; i++) {
|
||||
vals.push(retrieveRawValue(data, dataIndex, labelDims[i]));
|
||||
}
|
||||
|
||||
return vals.join(' ');
|
||||
}
|
||||
}
|
||||
export function getDefaultInterpolatedLabel(data, interpolatedValue) {
|
||||
var labelDims = data.mapDimensionsAll('defaultedLabel');
|
||||
|
||||
if (!isArray(interpolatedValue)) {
|
||||
return interpolatedValue + '';
|
||||
}
|
||||
|
||||
var vals = [];
|
||||
|
||||
for (var i = 0; i < labelDims.length; i++) {
|
||||
var dimIndex = data.getDimensionIndex(labelDims[i]);
|
||||
|
||||
if (dimIndex >= 0) {
|
||||
vals.push(interpolatedValue[dimIndex]);
|
||||
}
|
||||
}
|
||||
|
||||
return vals.join(' ');
|
||||
}
|
||||
257
uni-demo/node_modules/echarts/lib/chart/helper/multipleGraphEdgeHelper.js
generated
vendored
Normal file
257
uni-demo/node_modules/echarts/lib/chart/helper/multipleGraphEdgeHelper.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.
|
||||
*/
|
||||
// @ts-nocheck
|
||||
import * as zrUtil from 'zrender/lib/core/util.js';
|
||||
var KEY_DELIMITER = '-->';
|
||||
/**
|
||||
* params handler
|
||||
* @param {module:echarts/model/SeriesModel} seriesModel
|
||||
* @returns {*}
|
||||
*/
|
||||
|
||||
var getAutoCurvenessParams = function (seriesModel) {
|
||||
return seriesModel.get('autoCurveness') || null;
|
||||
};
|
||||
/**
|
||||
* Generate a list of edge curvatures, 20 is the default
|
||||
* @param {module:echarts/model/SeriesModel} seriesModel
|
||||
* @param {number} appendLength
|
||||
* @return 20 => [0, -0.2, 0.2, -0.4, 0.4, -0.6, 0.6, -0.8, 0.8, -1, 1, -1.2, 1.2, -1.4, 1.4, -1.6, 1.6, -1.8, 1.8, -2]
|
||||
*/
|
||||
|
||||
|
||||
var createCurveness = function (seriesModel, appendLength) {
|
||||
var autoCurvenessParmas = getAutoCurvenessParams(seriesModel);
|
||||
var length = 20;
|
||||
var curvenessList = []; // handler the function set
|
||||
|
||||
if (zrUtil.isNumber(autoCurvenessParmas)) {
|
||||
length = autoCurvenessParmas;
|
||||
} else if (zrUtil.isArray(autoCurvenessParmas)) {
|
||||
seriesModel.__curvenessList = autoCurvenessParmas;
|
||||
return;
|
||||
} // append length
|
||||
|
||||
|
||||
if (appendLength > length) {
|
||||
length = appendLength;
|
||||
} // make sure the length is even
|
||||
|
||||
|
||||
var len = length % 2 ? length + 2 : length + 3;
|
||||
curvenessList = [];
|
||||
|
||||
for (var i = 0; i < len; i++) {
|
||||
curvenessList.push((i % 2 ? i + 1 : i) / 10 * (i % 2 ? -1 : 1));
|
||||
}
|
||||
|
||||
seriesModel.__curvenessList = curvenessList;
|
||||
};
|
||||
/**
|
||||
* Create different cache key data in the positive and negative directions, in order to set the curvature later
|
||||
* @param {number|string|module:echarts/data/Graph.Node} n1
|
||||
* @param {number|string|module:echarts/data/Graph.Node} n2
|
||||
* @param {module:echarts/model/SeriesModel} seriesModel
|
||||
* @returns {string} key
|
||||
*/
|
||||
|
||||
|
||||
var getKeyOfEdges = function (n1, n2, seriesModel) {
|
||||
var source = [n1.id, n1.dataIndex].join('.');
|
||||
var target = [n2.id, n2.dataIndex].join('.');
|
||||
return [seriesModel.uid, source, target].join(KEY_DELIMITER);
|
||||
};
|
||||
/**
|
||||
* get opposite key
|
||||
* @param {string} key
|
||||
* @returns {string}
|
||||
*/
|
||||
|
||||
|
||||
var getOppositeKey = function (key) {
|
||||
var keys = key.split(KEY_DELIMITER);
|
||||
return [keys[0], keys[2], keys[1]].join(KEY_DELIMITER);
|
||||
};
|
||||
/**
|
||||
* get edgeMap with key
|
||||
* @param edge
|
||||
* @param {module:echarts/model/SeriesModel} seriesModel
|
||||
*/
|
||||
|
||||
|
||||
var getEdgeFromMap = function (edge, seriesModel) {
|
||||
var key = getKeyOfEdges(edge.node1, edge.node2, seriesModel);
|
||||
return seriesModel.__edgeMap[key];
|
||||
};
|
||||
/**
|
||||
* calculate all cases total length
|
||||
* @param edge
|
||||
* @param seriesModel
|
||||
* @returns {number}
|
||||
*/
|
||||
|
||||
|
||||
var getTotalLengthBetweenNodes = function (edge, seriesModel) {
|
||||
var len = getEdgeMapLengthWithKey(getKeyOfEdges(edge.node1, edge.node2, seriesModel), seriesModel);
|
||||
var lenV = getEdgeMapLengthWithKey(getKeyOfEdges(edge.node2, edge.node1, seriesModel), seriesModel);
|
||||
return len + lenV;
|
||||
};
|
||||
/**
|
||||
*
|
||||
* @param key
|
||||
*/
|
||||
|
||||
|
||||
var getEdgeMapLengthWithKey = function (key, seriesModel) {
|
||||
var edgeMap = seriesModel.__edgeMap;
|
||||
return edgeMap[key] ? edgeMap[key].length : 0;
|
||||
};
|
||||
/**
|
||||
* Count the number of edges between the same two points, used to obtain the curvature table and the parity of the edge
|
||||
* @see /graph/GraphSeries.js@getInitialData
|
||||
* @param {module:echarts/model/SeriesModel} seriesModel
|
||||
*/
|
||||
|
||||
|
||||
export function initCurvenessList(seriesModel) {
|
||||
if (!getAutoCurvenessParams(seriesModel)) {
|
||||
return;
|
||||
}
|
||||
|
||||
seriesModel.__curvenessList = [];
|
||||
seriesModel.__edgeMap = {}; // calc the array of curveness List
|
||||
|
||||
createCurveness(seriesModel);
|
||||
}
|
||||
/**
|
||||
* set edgeMap with key
|
||||
* @param {number|string|module:echarts/data/Graph.Node} n1
|
||||
* @param {number|string|module:echarts/data/Graph.Node} n2
|
||||
* @param {module:echarts/model/SeriesModel} seriesModel
|
||||
* @param {number} index
|
||||
*/
|
||||
|
||||
export function createEdgeMapForCurveness(n1, n2, seriesModel, index) {
|
||||
if (!getAutoCurvenessParams(seriesModel)) {
|
||||
return;
|
||||
}
|
||||
|
||||
var key = getKeyOfEdges(n1, n2, seriesModel);
|
||||
var edgeMap = seriesModel.__edgeMap;
|
||||
var oppositeEdges = edgeMap[getOppositeKey(key)]; // set direction
|
||||
|
||||
if (edgeMap[key] && !oppositeEdges) {
|
||||
edgeMap[key].isForward = true;
|
||||
} else if (oppositeEdges && edgeMap[key]) {
|
||||
oppositeEdges.isForward = true;
|
||||
edgeMap[key].isForward = false;
|
||||
}
|
||||
|
||||
edgeMap[key] = edgeMap[key] || [];
|
||||
edgeMap[key].push(index);
|
||||
}
|
||||
/**
|
||||
* get curvature for edge
|
||||
* @param edge
|
||||
* @param {module:echarts/model/SeriesModel} seriesModel
|
||||
* @param index
|
||||
*/
|
||||
|
||||
export function getCurvenessForEdge(edge, seriesModel, index, needReverse) {
|
||||
var autoCurvenessParams = getAutoCurvenessParams(seriesModel);
|
||||
var isArrayParam = zrUtil.isArray(autoCurvenessParams);
|
||||
|
||||
if (!autoCurvenessParams) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var edgeArray = getEdgeFromMap(edge, seriesModel);
|
||||
|
||||
if (!edgeArray) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var edgeIndex = -1;
|
||||
|
||||
for (var i = 0; i < edgeArray.length; i++) {
|
||||
if (edgeArray[i] === index) {
|
||||
edgeIndex = i;
|
||||
break;
|
||||
}
|
||||
} // if totalLen is Longer createCurveness
|
||||
|
||||
|
||||
var totalLen = getTotalLengthBetweenNodes(edge, seriesModel);
|
||||
createCurveness(seriesModel, totalLen);
|
||||
edge.lineStyle = edge.lineStyle || {}; // if is opposite edge, must set curvenss to opposite number
|
||||
|
||||
var curKey = getKeyOfEdges(edge.node1, edge.node2, seriesModel);
|
||||
var curvenessList = seriesModel.__curvenessList; // if pass array no need parity
|
||||
|
||||
var parityCorrection = isArrayParam ? 0 : totalLen % 2 ? 0 : 1;
|
||||
|
||||
if (!edgeArray.isForward) {
|
||||
// the opposite edge show outside
|
||||
var oppositeKey = getOppositeKey(curKey);
|
||||
var len = getEdgeMapLengthWithKey(oppositeKey, seriesModel);
|
||||
var resValue = curvenessList[edgeIndex + len + parityCorrection]; // isNeedReverse, simple, force type need reverse the curveness in the junction of the forword and the opposite
|
||||
|
||||
if (needReverse) {
|
||||
// set as array may make the parity handle with the len of opposite
|
||||
if (isArrayParam) {
|
||||
if (autoCurvenessParams && autoCurvenessParams[0] === 0) {
|
||||
return (len + parityCorrection) % 2 ? resValue : -resValue;
|
||||
} else {
|
||||
return ((len % 2 ? 0 : 1) + parityCorrection) % 2 ? resValue : -resValue;
|
||||
}
|
||||
} else {
|
||||
return (len + parityCorrection) % 2 ? resValue : -resValue;
|
||||
}
|
||||
} else {
|
||||
return curvenessList[edgeIndex + len + parityCorrection];
|
||||
}
|
||||
} else {
|
||||
return curvenessList[parityCorrection + edgeIndex];
|
||||
}
|
||||
}
|
||||
65
uni-demo/node_modules/echarts/lib/chart/helper/pieHelper.js
generated
vendored
Normal file
65
uni-demo/node_modules/echarts/lib/chart/helper/pieHelper.js
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
|
||||
/*
|
||||
* 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, map } from 'zrender/lib/core/util.js';
|
||||
import { parsePercent } from 'zrender/lib/contain/text.js';
|
||||
export function getSectorCornerRadius(model, shape, zeroIfNull) {
|
||||
var cornerRadius = model.get('borderRadius');
|
||||
|
||||
if (cornerRadius == null) {
|
||||
return zeroIfNull ? {
|
||||
cornerRadius: 0
|
||||
} : null;
|
||||
}
|
||||
|
||||
if (!isArray(cornerRadius)) {
|
||||
cornerRadius = [cornerRadius, cornerRadius, cornerRadius, cornerRadius];
|
||||
}
|
||||
|
||||
var dr = Math.abs(shape.r || 0 - shape.r0 || 0);
|
||||
return {
|
||||
cornerRadius: map(cornerRadius, function (cr) {
|
||||
return parsePercent(cr, dr);
|
||||
})
|
||||
};
|
||||
}
|
||||
100
uni-demo/node_modules/echarts/lib/chart/helper/treeHelper.js
generated
vendored
Normal file
100
uni-demo/node_modules/echarts/lib/chart/helper/treeHelper.js
generated
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* AUTO-GENERATED FILE. DO NOT MODIFY.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import * as zrUtil from 'zrender/lib/core/util.js';
|
||||
export function retrieveTargetInfo(payload, validPayloadTypes, seriesModel) {
|
||||
if (payload && zrUtil.indexOf(validPayloadTypes, payload.type) >= 0) {
|
||||
var root = seriesModel.getData().tree.root;
|
||||
var targetNode = payload.targetNode;
|
||||
|
||||
if (zrUtil.isString(targetNode)) {
|
||||
targetNode = root.getNodeById(targetNode);
|
||||
}
|
||||
|
||||
if (targetNode && root.contains(targetNode)) {
|
||||
return {
|
||||
node: targetNode
|
||||
};
|
||||
}
|
||||
|
||||
var targetNodeId = payload.targetNodeId;
|
||||
|
||||
if (targetNodeId != null && (targetNode = root.getNodeById(targetNodeId))) {
|
||||
return {
|
||||
node: targetNode
|
||||
};
|
||||
}
|
||||
}
|
||||
} // Not includes the given node at the last item.
|
||||
|
||||
export function getPathToRoot(node) {
|
||||
var path = [];
|
||||
|
||||
while (node) {
|
||||
node = node.parentNode;
|
||||
node && path.push(node);
|
||||
}
|
||||
|
||||
return path.reverse();
|
||||
}
|
||||
export function aboveViewRoot(viewRoot, node) {
|
||||
var viewPath = getPathToRoot(viewRoot);
|
||||
return zrUtil.indexOf(viewPath, node) >= 0;
|
||||
} // From root to the input node (the input node will be included).
|
||||
|
||||
export function wrapTreePathInfo(node, seriesModel) {
|
||||
var treePathInfo = [];
|
||||
|
||||
while (node) {
|
||||
var nodeDataIndex = node.dataIndex;
|
||||
treePathInfo.push({
|
||||
name: node.name,
|
||||
dataIndex: nodeDataIndex,
|
||||
value: seriesModel.getRawValue(nodeDataIndex)
|
||||
});
|
||||
node = node.parentNode;
|
||||
}
|
||||
|
||||
treePathInfo.reverse();
|
||||
return treePathInfo;
|
||||
}
|
||||
151
uni-demo/node_modules/echarts/lib/chart/helper/whiskerBoxCommon.js
generated
vendored
Normal file
151
uni-demo/node_modules/echarts/lib/chart/helper/whiskerBoxCommon.js
generated
vendored
Normal file
@@ -0,0 +1,151 @@
|
||||
|
||||
/*
|
||||
* 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 createSeriesDataSimply from './createSeriesDataSimply.js';
|
||||
import * as zrUtil from 'zrender/lib/core/util.js';
|
||||
import { getDimensionTypeByAxis } from '../../data/helper/dimensionHelper.js';
|
||||
import { makeSeriesEncodeForAxisCoordSys } from '../../data/helper/sourceHelper.js';
|
||||
|
||||
var WhiskerBoxCommonMixin =
|
||||
/** @class */
|
||||
function () {
|
||||
function WhiskerBoxCommonMixin() {}
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
|
||||
|
||||
WhiskerBoxCommonMixin.prototype.getInitialData = function (option, ecModel) {
|
||||
// When both types of xAxis and yAxis are 'value', layout is
|
||||
// needed to be specified by user. Otherwise, layout can be
|
||||
// judged by which axis is category.
|
||||
var ordinalMeta;
|
||||
var xAxisModel = ecModel.getComponent('xAxis', this.get('xAxisIndex'));
|
||||
var yAxisModel = ecModel.getComponent('yAxis', this.get('yAxisIndex'));
|
||||
var xAxisType = xAxisModel.get('type');
|
||||
var yAxisType = yAxisModel.get('type');
|
||||
var addOrdinal; // FIXME
|
||||
// Consider time axis.
|
||||
|
||||
if (xAxisType === 'category') {
|
||||
option.layout = 'horizontal';
|
||||
ordinalMeta = xAxisModel.getOrdinalMeta();
|
||||
addOrdinal = true;
|
||||
} else if (yAxisType === 'category') {
|
||||
option.layout = 'vertical';
|
||||
ordinalMeta = yAxisModel.getOrdinalMeta();
|
||||
addOrdinal = true;
|
||||
} else {
|
||||
option.layout = option.layout || 'horizontal';
|
||||
}
|
||||
|
||||
var coordDims = ['x', 'y'];
|
||||
var baseAxisDimIndex = option.layout === 'horizontal' ? 0 : 1;
|
||||
var baseAxisDim = this._baseAxisDim = coordDims[baseAxisDimIndex];
|
||||
var otherAxisDim = coordDims[1 - baseAxisDimIndex];
|
||||
var axisModels = [xAxisModel, yAxisModel];
|
||||
var baseAxisType = axisModels[baseAxisDimIndex].get('type');
|
||||
var otherAxisType = axisModels[1 - baseAxisDimIndex].get('type');
|
||||
var data = option.data; // Clone a new data for next setOption({}) usage.
|
||||
// Avoid modifying current data will affect further update.
|
||||
|
||||
if (data && addOrdinal) {
|
||||
var newOptionData_1 = [];
|
||||
zrUtil.each(data, function (item, index) {
|
||||
var newItem;
|
||||
|
||||
if (zrUtil.isArray(item)) {
|
||||
newItem = item.slice(); // Modify current using data.
|
||||
|
||||
item.unshift(index);
|
||||
} else if (zrUtil.isArray(item.value)) {
|
||||
newItem = zrUtil.extend({}, item);
|
||||
newItem.value = newItem.value.slice(); // Modify current using data.
|
||||
|
||||
item.value.unshift(index);
|
||||
} else {
|
||||
newItem = item;
|
||||
}
|
||||
|
||||
newOptionData_1.push(newItem);
|
||||
});
|
||||
option.data = newOptionData_1;
|
||||
}
|
||||
|
||||
var defaultValueDimensions = this.defaultValueDimensions;
|
||||
var coordDimensions = [{
|
||||
name: baseAxisDim,
|
||||
type: getDimensionTypeByAxis(baseAxisType),
|
||||
ordinalMeta: ordinalMeta,
|
||||
otherDims: {
|
||||
tooltip: false,
|
||||
itemName: 0
|
||||
},
|
||||
dimsDef: ['base']
|
||||
}, {
|
||||
name: otherAxisDim,
|
||||
type: getDimensionTypeByAxis(otherAxisType),
|
||||
dimsDef: defaultValueDimensions.slice()
|
||||
}];
|
||||
return createSeriesDataSimply(this, {
|
||||
coordDimensions: coordDimensions,
|
||||
dimensionsCount: defaultValueDimensions.length + 1,
|
||||
encodeDefaulter: zrUtil.curry(makeSeriesEncodeForAxisCoordSys, coordDimensions, this)
|
||||
});
|
||||
};
|
||||
/**
|
||||
* If horizontal, base axis is x, otherwise y.
|
||||
* @override
|
||||
*/
|
||||
|
||||
|
||||
WhiskerBoxCommonMixin.prototype.getBaseAxis = function () {
|
||||
var dim = this._baseAxisDim;
|
||||
return this.ecModel.getComponent(dim + 'Axis', this.get(dim + 'AxisIndex')).axis;
|
||||
};
|
||||
|
||||
return WhiskerBoxCommonMixin;
|
||||
}();
|
||||
|
||||
;
|
||||
export { WhiskerBoxCommonMixin };
|
||||
46
uni-demo/node_modules/echarts/lib/chart/line.js
generated
vendored
Normal file
46
uni-demo/node_modules/echarts/lib/chart/line.js
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
|
||||
/*
|
||||
* 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 { use } from '../extension.js';
|
||||
import { install } from './line/install.js';
|
||||
use(install);
|
||||
165
uni-demo/node_modules/echarts/lib/chart/line/LineSeries.js
generated
vendored
Normal file
165
uni-demo/node_modules/echarts/lib/chart/line/LineSeries.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 { __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;
|
||||
1284
uni-demo/node_modules/echarts/lib/chart/line/LineView.js
generated
vendored
Normal file
1284
uni-demo/node_modules/echarts/lib/chart/line/LineView.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
133
uni-demo/node_modules/echarts/lib/chart/line/helper.js
generated
vendored
Normal file
133
uni-demo/node_modules/echarts/lib/chart/line/helper.js
generated
vendored
Normal file
@@ -0,0 +1,133 @@
|
||||
|
||||
/*
|
||||
* 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);
|
||||
}
|
||||
71
uni-demo/node_modules/echarts/lib/chart/line/install.js
generated
vendored
Normal file
71
uni-demo/node_modules/echarts/lib/chart/line/install.js
generated
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
|
||||
/*
|
||||
* 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'));
|
||||
}
|
||||
175
uni-demo/node_modules/echarts/lib/chart/line/lineAnimationDiff.js
generated
vendored
Normal file
175
uni-demo/node_modules/echarts/lib/chart/line/lineAnimationDiff.js
generated
vendored
Normal file
@@ -0,0 +1,175 @@
|
||||
|
||||
/*
|
||||
* 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
|
||||
};
|
||||
}
|
||||
413
uni-demo/node_modules/echarts/lib/chart/line/poly.js
generated
vendored
Normal file
413
uni-demo/node_modules/echarts/lib/chart/line/poly.js
generated
vendored
Normal file
@@ -0,0 +1,413 @@
|
||||
|
||||
/*
|
||||
* 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 };
|
||||
46
uni-demo/node_modules/echarts/lib/chart/lines.js
generated
vendored
Normal file
46
uni-demo/node_modules/echarts/lib/chart/lines.js
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
|
||||
/*
|
||||
* 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 { use } from '../extension.js';
|
||||
import { install } from './lines/install.js';
|
||||
use(install);
|
||||
368
uni-demo/node_modules/echarts/lib/chart/lines/LinesSeries.js
generated
vendored
Normal file
368
uni-demo/node_modules/echarts/lib/chart/lines/LinesSeries.js
generated
vendored
Normal file
@@ -0,0 +1,368 @@
|
||||
|
||||
/*
|
||||
* 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";
|
||||
/* global Uint32Array, Float64Array, Float32Array */
|
||||
|
||||
import SeriesModel from '../../model/Series.js';
|
||||
import SeriesData from '../../data/SeriesData.js';
|
||||
import { concatArray, mergeAll, map, isNumber } from 'zrender/lib/core/util.js';
|
||||
import CoordinateSystem from '../../core/CoordinateSystem.js';
|
||||
import { createTooltipMarkup } from '../../component/tooltip/tooltipMarkup.js';
|
||||
var Uint32Arr = typeof Uint32Array === 'undefined' ? Array : Uint32Array;
|
||||
var Float64Arr = typeof Float64Array === 'undefined' ? Array : Float64Array;
|
||||
|
||||
function compatEc2(seriesOpt) {
|
||||
var data = seriesOpt.data;
|
||||
|
||||
if (data && data[0] && data[0][0] && data[0][0].coord) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
console.warn('Lines data configuration has been changed to' + ' { coords:[[1,2],[2,3]] }');
|
||||
}
|
||||
|
||||
seriesOpt.data = map(data, function (itemOpt) {
|
||||
var coords = [itemOpt[0].coord, itemOpt[1].coord];
|
||||
var target = {
|
||||
coords: coords
|
||||
};
|
||||
|
||||
if (itemOpt[0].name) {
|
||||
target.fromName = itemOpt[0].name;
|
||||
}
|
||||
|
||||
if (itemOpt[1].name) {
|
||||
target.toName = itemOpt[1].name;
|
||||
}
|
||||
|
||||
return mergeAll([target, itemOpt[0], itemOpt[1]]);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
var LinesSeriesModel =
|
||||
/** @class */
|
||||
function (_super) {
|
||||
__extends(LinesSeriesModel, _super);
|
||||
|
||||
function LinesSeriesModel() {
|
||||
var _this = _super !== null && _super.apply(this, arguments) || this;
|
||||
|
||||
_this.type = LinesSeriesModel.type;
|
||||
_this.visualStyleAccessPath = 'lineStyle';
|
||||
_this.visualDrawType = 'stroke';
|
||||
return _this;
|
||||
}
|
||||
|
||||
LinesSeriesModel.prototype.init = function (option) {
|
||||
// The input data may be null/undefined.
|
||||
option.data = option.data || []; // Not using preprocessor because mergeOption may not have series.type
|
||||
|
||||
compatEc2(option);
|
||||
|
||||
var result = this._processFlatCoordsArray(option.data);
|
||||
|
||||
this._flatCoords = result.flatCoords;
|
||||
this._flatCoordsOffset = result.flatCoordsOffset;
|
||||
|
||||
if (result.flatCoords) {
|
||||
option.data = new Float32Array(result.count);
|
||||
}
|
||||
|
||||
_super.prototype.init.apply(this, arguments);
|
||||
};
|
||||
|
||||
LinesSeriesModel.prototype.mergeOption = function (option) {
|
||||
compatEc2(option);
|
||||
|
||||
if (option.data) {
|
||||
// Only update when have option data to merge.
|
||||
var result = this._processFlatCoordsArray(option.data);
|
||||
|
||||
this._flatCoords = result.flatCoords;
|
||||
this._flatCoordsOffset = result.flatCoordsOffset;
|
||||
|
||||
if (result.flatCoords) {
|
||||
option.data = new Float32Array(result.count);
|
||||
}
|
||||
}
|
||||
|
||||
_super.prototype.mergeOption.apply(this, arguments);
|
||||
};
|
||||
|
||||
LinesSeriesModel.prototype.appendData = function (params) {
|
||||
var result = this._processFlatCoordsArray(params.data);
|
||||
|
||||
if (result.flatCoords) {
|
||||
if (!this._flatCoords) {
|
||||
this._flatCoords = result.flatCoords;
|
||||
this._flatCoordsOffset = result.flatCoordsOffset;
|
||||
} else {
|
||||
this._flatCoords = concatArray(this._flatCoords, result.flatCoords);
|
||||
this._flatCoordsOffset = concatArray(this._flatCoordsOffset, result.flatCoordsOffset);
|
||||
}
|
||||
|
||||
params.data = new Float32Array(result.count);
|
||||
}
|
||||
|
||||
this.getRawData().appendData(params.data);
|
||||
};
|
||||
|
||||
LinesSeriesModel.prototype._getCoordsFromItemModel = function (idx) {
|
||||
var itemModel = this.getData().getItemModel(idx);
|
||||
var coords = itemModel.option instanceof Array ? itemModel.option : itemModel.getShallow('coords');
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (!(coords instanceof Array && coords.length > 0 && coords[0] instanceof Array)) {
|
||||
throw new Error('Invalid coords ' + JSON.stringify(coords) + '. Lines must have 2d coords array in data item.');
|
||||
}
|
||||
}
|
||||
|
||||
return coords;
|
||||
};
|
||||
|
||||
LinesSeriesModel.prototype.getLineCoordsCount = function (idx) {
|
||||
if (this._flatCoordsOffset) {
|
||||
return this._flatCoordsOffset[idx * 2 + 1];
|
||||
} else {
|
||||
return this._getCoordsFromItemModel(idx).length;
|
||||
}
|
||||
};
|
||||
|
||||
LinesSeriesModel.prototype.getLineCoords = function (idx, out) {
|
||||
if (this._flatCoordsOffset) {
|
||||
var offset = this._flatCoordsOffset[idx * 2];
|
||||
var len = this._flatCoordsOffset[idx * 2 + 1];
|
||||
|
||||
for (var i = 0; i < len; i++) {
|
||||
out[i] = out[i] || [];
|
||||
out[i][0] = this._flatCoords[offset + i * 2];
|
||||
out[i][1] = this._flatCoords[offset + i * 2 + 1];
|
||||
}
|
||||
|
||||
return len;
|
||||
} else {
|
||||
var coords = this._getCoordsFromItemModel(idx);
|
||||
|
||||
for (var i = 0; i < coords.length; i++) {
|
||||
out[i] = out[i] || [];
|
||||
out[i][0] = coords[i][0];
|
||||
out[i][1] = coords[i][1];
|
||||
}
|
||||
|
||||
return coords.length;
|
||||
}
|
||||
};
|
||||
|
||||
LinesSeriesModel.prototype._processFlatCoordsArray = function (data) {
|
||||
var startOffset = 0;
|
||||
|
||||
if (this._flatCoords) {
|
||||
startOffset = this._flatCoords.length;
|
||||
} // Stored as a typed array. In format
|
||||
// Points Count(2) | x | y | x | y | Points Count(3) | x | y | x | y | x | y |
|
||||
|
||||
|
||||
if (isNumber(data[0])) {
|
||||
var len = data.length; // Store offset and len of each segment
|
||||
|
||||
var coordsOffsetAndLenStorage = new Uint32Arr(len);
|
||||
var coordsStorage = new Float64Arr(len);
|
||||
var coordsCursor = 0;
|
||||
var offsetCursor = 0;
|
||||
var dataCount = 0;
|
||||
|
||||
for (var i = 0; i < len;) {
|
||||
dataCount++;
|
||||
var count = data[i++]; // Offset
|
||||
|
||||
coordsOffsetAndLenStorage[offsetCursor++] = coordsCursor + startOffset; // Len
|
||||
|
||||
coordsOffsetAndLenStorage[offsetCursor++] = count;
|
||||
|
||||
for (var k = 0; k < count; k++) {
|
||||
var x = data[i++];
|
||||
var y = data[i++];
|
||||
coordsStorage[coordsCursor++] = x;
|
||||
coordsStorage[coordsCursor++] = y;
|
||||
|
||||
if (i > len) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
throw new Error('Invalid data format.');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
flatCoordsOffset: new Uint32Array(coordsOffsetAndLenStorage.buffer, 0, offsetCursor),
|
||||
flatCoords: coordsStorage,
|
||||
count: dataCount
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
flatCoordsOffset: null,
|
||||
flatCoords: null,
|
||||
count: data.length
|
||||
};
|
||||
};
|
||||
|
||||
LinesSeriesModel.prototype.getInitialData = function (option, ecModel) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
var CoordSys = CoordinateSystem.get(option.coordinateSystem);
|
||||
|
||||
if (!CoordSys) {
|
||||
throw new Error('Unkown coordinate system ' + option.coordinateSystem);
|
||||
}
|
||||
}
|
||||
|
||||
var lineData = new SeriesData(['value'], this);
|
||||
lineData.hasItemOption = false;
|
||||
lineData.initData(option.data, [], function (dataItem, dimName, dataIndex, dimIndex) {
|
||||
// dataItem is simply coords
|
||||
if (dataItem instanceof Array) {
|
||||
return NaN;
|
||||
} else {
|
||||
lineData.hasItemOption = true;
|
||||
var value = dataItem.value;
|
||||
|
||||
if (value != null) {
|
||||
return value instanceof Array ? value[dimIndex] : value;
|
||||
}
|
||||
}
|
||||
});
|
||||
return lineData;
|
||||
};
|
||||
|
||||
LinesSeriesModel.prototype.formatTooltip = function (dataIndex, multipleSeries, dataType) {
|
||||
var data = this.getData();
|
||||
var itemModel = data.getItemModel(dataIndex);
|
||||
var name = itemModel.get('name');
|
||||
|
||||
if (name) {
|
||||
return name;
|
||||
}
|
||||
|
||||
var fromName = itemModel.get('fromName');
|
||||
var toName = itemModel.get('toName');
|
||||
var nameArr = [];
|
||||
fromName != null && nameArr.push(fromName);
|
||||
toName != null && nameArr.push(toName);
|
||||
return createTooltipMarkup('nameValue', {
|
||||
name: nameArr.join(' > ')
|
||||
});
|
||||
};
|
||||
|
||||
LinesSeriesModel.prototype.preventIncremental = function () {
|
||||
return !!this.get(['effect', 'show']);
|
||||
};
|
||||
|
||||
LinesSeriesModel.prototype.getProgressive = function () {
|
||||
var progressive = this.option.progressive;
|
||||
|
||||
if (progressive == null) {
|
||||
return this.option.large ? 1e4 : this.get('progressive');
|
||||
}
|
||||
|
||||
return progressive;
|
||||
};
|
||||
|
||||
LinesSeriesModel.prototype.getProgressiveThreshold = function () {
|
||||
var progressiveThreshold = this.option.progressiveThreshold;
|
||||
|
||||
if (progressiveThreshold == null) {
|
||||
return this.option.large ? 2e4 : this.get('progressiveThreshold');
|
||||
}
|
||||
|
||||
return progressiveThreshold;
|
||||
};
|
||||
|
||||
LinesSeriesModel.prototype.getZLevelKey = function () {
|
||||
var effectModel = this.getModel('effect');
|
||||
var trailLength = effectModel.get('trailLength');
|
||||
return this.getData().count() > this.getProgressiveThreshold() // Each progressive series has individual key.
|
||||
? this.id : effectModel.get('show') && trailLength > 0 ? trailLength + '' : '';
|
||||
};
|
||||
|
||||
LinesSeriesModel.type = 'series.lines';
|
||||
LinesSeriesModel.dependencies = ['grid', 'polar', 'geo', 'calendar'];
|
||||
LinesSeriesModel.defaultOption = {
|
||||
coordinateSystem: 'geo',
|
||||
// zlevel: 0,
|
||||
z: 2,
|
||||
legendHoverLink: true,
|
||||
// Cartesian coordinate system
|
||||
xAxisIndex: 0,
|
||||
yAxisIndex: 0,
|
||||
symbol: ['none', 'none'],
|
||||
symbolSize: [10, 10],
|
||||
// Geo coordinate system
|
||||
geoIndex: 0,
|
||||
effect: {
|
||||
show: false,
|
||||
period: 4,
|
||||
constantSpeed: 0,
|
||||
symbol: 'circle',
|
||||
symbolSize: 3,
|
||||
loop: true,
|
||||
trailLength: 0.2
|
||||
},
|
||||
large: false,
|
||||
// Available when large is true
|
||||
largeThreshold: 2000,
|
||||
polyline: false,
|
||||
clip: true,
|
||||
label: {
|
||||
show: false,
|
||||
position: 'end' // distance: 5,
|
||||
// formatter: 标签文本格式器,同Tooltip.formatter,不支持异步回调
|
||||
|
||||
},
|
||||
lineStyle: {
|
||||
opacity: 0.5
|
||||
}
|
||||
};
|
||||
return LinesSeriesModel;
|
||||
}(SeriesModel);
|
||||
|
||||
export default LinesSeriesModel;
|
||||
225
uni-demo/node_modules/echarts/lib/chart/lines/LinesView.js
generated
vendored
Normal file
225
uni-demo/node_modules/echarts/lib/chart/lines/LinesView.js
generated
vendored
Normal file
@@ -0,0 +1,225 @@
|
||||
|
||||
/*
|
||||
* 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 LineDraw from '../helper/LineDraw.js';
|
||||
import EffectLine from '../helper/EffectLine.js';
|
||||
import Line from '../helper/Line.js';
|
||||
import Polyline from '../helper/Polyline.js';
|
||||
import EffectPolyline from '../helper/EffectPolyline.js';
|
||||
import LargeLineDraw from '../helper/LargeLineDraw.js';
|
||||
import linesLayout from './linesLayout.js';
|
||||
import { createClipPath } from '../helper/createClipPathFromCoordSys.js';
|
||||
import ChartView from '../../view/Chart.js';
|
||||
|
||||
var LinesView =
|
||||
/** @class */
|
||||
function (_super) {
|
||||
__extends(LinesView, _super);
|
||||
|
||||
function LinesView() {
|
||||
var _this = _super !== null && _super.apply(this, arguments) || this;
|
||||
|
||||
_this.type = LinesView.type;
|
||||
return _this;
|
||||
}
|
||||
|
||||
LinesView.prototype.render = function (seriesModel, ecModel, api) {
|
||||
var data = seriesModel.getData();
|
||||
|
||||
var lineDraw = this._updateLineDraw(data, seriesModel);
|
||||
|
||||
var zlevel = seriesModel.get('zlevel');
|
||||
var trailLength = seriesModel.get(['effect', 'trailLength']);
|
||||
var zr = api.getZr(); // Avoid the drag cause ghost shadow
|
||||
// FIXME Better way ?
|
||||
// SVG doesn't support
|
||||
|
||||
var isSvg = zr.painter.getType() === 'svg';
|
||||
|
||||
if (!isSvg) {
|
||||
zr.painter.getLayer(zlevel).clear(true);
|
||||
} // Config layer with motion blur
|
||||
|
||||
|
||||
if (this._lastZlevel != null && !isSvg) {
|
||||
zr.configLayer(this._lastZlevel, {
|
||||
motionBlur: false
|
||||
});
|
||||
}
|
||||
|
||||
if (this._showEffect(seriesModel) && trailLength > 0) {
|
||||
if (!isSvg) {
|
||||
zr.configLayer(zlevel, {
|
||||
motionBlur: true,
|
||||
lastFrameAlpha: Math.max(Math.min(trailLength / 10 + 0.9, 1), 0)
|
||||
});
|
||||
} else if (process.env.NODE_ENV !== 'production') {
|
||||
console.warn('SVG render mode doesn\'t support lines with trail effect');
|
||||
}
|
||||
}
|
||||
|
||||
lineDraw.updateData(data);
|
||||
var clipPath = seriesModel.get('clip', true) && createClipPath(seriesModel.coordinateSystem, false, seriesModel);
|
||||
|
||||
if (clipPath) {
|
||||
this.group.setClipPath(clipPath);
|
||||
} else {
|
||||
this.group.removeClipPath();
|
||||
}
|
||||
|
||||
this._lastZlevel = zlevel;
|
||||
this._finished = true;
|
||||
};
|
||||
|
||||
LinesView.prototype.incrementalPrepareRender = function (seriesModel, ecModel, api) {
|
||||
var data = seriesModel.getData();
|
||||
|
||||
var lineDraw = this._updateLineDraw(data, seriesModel);
|
||||
|
||||
lineDraw.incrementalPrepareUpdate(data);
|
||||
|
||||
this._clearLayer(api);
|
||||
|
||||
this._finished = false;
|
||||
};
|
||||
|
||||
LinesView.prototype.incrementalRender = function (taskParams, seriesModel, ecModel) {
|
||||
this._lineDraw.incrementalUpdate(taskParams, seriesModel.getData());
|
||||
|
||||
this._finished = taskParams.end === seriesModel.getData().count();
|
||||
};
|
||||
|
||||
LinesView.prototype.eachRendered = function (cb) {
|
||||
this._lineDraw && this._lineDraw.eachRendered(cb);
|
||||
};
|
||||
|
||||
LinesView.prototype.updateTransform = function (seriesModel, ecModel, api) {
|
||||
var data = seriesModel.getData();
|
||||
var pipelineContext = seriesModel.pipelineContext;
|
||||
|
||||
if (!this._finished || pipelineContext.large || pipelineContext.progressiveRender) {
|
||||
// TODO Don't have to do update in large mode. Only do it when there are millions of data.
|
||||
return {
|
||||
update: true
|
||||
};
|
||||
} else {
|
||||
// TODO Use same logic with ScatterView.
|
||||
// Manually update layout
|
||||
var res = linesLayout.reset(seriesModel, ecModel, api);
|
||||
|
||||
if (res.progress) {
|
||||
res.progress({
|
||||
start: 0,
|
||||
end: data.count(),
|
||||
count: data.count()
|
||||
}, data);
|
||||
} // Not in large mode
|
||||
|
||||
|
||||
this._lineDraw.updateLayout();
|
||||
|
||||
this._clearLayer(api);
|
||||
}
|
||||
};
|
||||
|
||||
LinesView.prototype._updateLineDraw = function (data, seriesModel) {
|
||||
var lineDraw = this._lineDraw;
|
||||
|
||||
var hasEffect = this._showEffect(seriesModel);
|
||||
|
||||
var isPolyline = !!seriesModel.get('polyline');
|
||||
var pipelineContext = seriesModel.pipelineContext;
|
||||
var isLargeDraw = pipelineContext.large;
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (hasEffect && isLargeDraw) {
|
||||
console.warn('Large lines not support effect');
|
||||
}
|
||||
}
|
||||
|
||||
if (!lineDraw || hasEffect !== this._hasEffet || isPolyline !== this._isPolyline || isLargeDraw !== this._isLargeDraw) {
|
||||
if (lineDraw) {
|
||||
lineDraw.remove();
|
||||
}
|
||||
|
||||
lineDraw = this._lineDraw = isLargeDraw ? new LargeLineDraw() : new LineDraw(isPolyline ? hasEffect ? EffectPolyline : Polyline : hasEffect ? EffectLine : Line);
|
||||
this._hasEffet = hasEffect;
|
||||
this._isPolyline = isPolyline;
|
||||
this._isLargeDraw = isLargeDraw;
|
||||
}
|
||||
|
||||
this.group.add(lineDraw.group);
|
||||
return lineDraw;
|
||||
};
|
||||
|
||||
LinesView.prototype._showEffect = function (seriesModel) {
|
||||
return !!seriesModel.get(['effect', 'show']);
|
||||
};
|
||||
|
||||
LinesView.prototype._clearLayer = function (api) {
|
||||
// Not use motion when dragging or zooming
|
||||
var zr = api.getZr();
|
||||
var isSvg = zr.painter.getType() === 'svg';
|
||||
|
||||
if (!isSvg && this._lastZlevel != null) {
|
||||
zr.painter.getLayer(this._lastZlevel).clear(true);
|
||||
}
|
||||
};
|
||||
|
||||
LinesView.prototype.remove = function (ecModel, api) {
|
||||
this._lineDraw && this._lineDraw.remove();
|
||||
this._lineDraw = null; // Clear motion when lineDraw is removed
|
||||
|
||||
this._clearLayer(api);
|
||||
};
|
||||
|
||||
LinesView.prototype.dispose = function (ecModel, api) {
|
||||
this.remove(ecModel, api);
|
||||
};
|
||||
|
||||
LinesView.type = 'lines';
|
||||
return LinesView;
|
||||
}(ChartView);
|
||||
|
||||
export default LinesView;
|
||||
53
uni-demo/node_modules/echarts/lib/chart/lines/install.js
generated
vendored
Normal file
53
uni-demo/node_modules/echarts/lib/chart/lines/install.js
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
|
||||
/*
|
||||
* 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 LinesView from './LinesView.js';
|
||||
import LinesSeriesModel from './LinesSeries.js';
|
||||
import linesLayout from './linesLayout.js';
|
||||
import linesVisual from './linesVisual.js';
|
||||
export function install(registers) {
|
||||
registers.registerChartView(LinesView);
|
||||
registers.registerSeriesModel(LinesSeriesModel);
|
||||
registers.registerLayout(linesLayout);
|
||||
registers.registerVisual(linesVisual);
|
||||
}
|
||||
129
uni-demo/node_modules/echarts/lib/chart/lines/linesLayout.js
generated
vendored
Normal file
129
uni-demo/node_modules/echarts/lib/chart/lines/linesLayout.js
generated
vendored
Normal file
@@ -0,0 +1,129 @@
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/* global Float32Array */
|
||||
import createRenderPlanner from '../helper/createRenderPlanner.js';
|
||||
import { error } from '../../util/log.js';
|
||||
var linesLayout = {
|
||||
seriesType: 'lines',
|
||||
plan: createRenderPlanner(),
|
||||
reset: function (seriesModel) {
|
||||
var coordSys = seriesModel.coordinateSystem;
|
||||
|
||||
if (!coordSys) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
error('The lines series must have a coordinate system.');
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
var isPolyline = seriesModel.get('polyline');
|
||||
var isLarge = seriesModel.pipelineContext.large;
|
||||
return {
|
||||
progress: function (params, lineData) {
|
||||
var lineCoords = [];
|
||||
|
||||
if (isLarge) {
|
||||
var points = void 0;
|
||||
var segCount = params.end - params.start;
|
||||
|
||||
if (isPolyline) {
|
||||
var totalCoordsCount = 0;
|
||||
|
||||
for (var i = params.start; i < params.end; i++) {
|
||||
totalCoordsCount += seriesModel.getLineCoordsCount(i);
|
||||
}
|
||||
|
||||
points = new Float32Array(segCount + totalCoordsCount * 2);
|
||||
} else {
|
||||
points = new Float32Array(segCount * 4);
|
||||
}
|
||||
|
||||
var offset = 0;
|
||||
var pt = [];
|
||||
|
||||
for (var i = params.start; i < params.end; i++) {
|
||||
var len = seriesModel.getLineCoords(i, lineCoords);
|
||||
|
||||
if (isPolyline) {
|
||||
points[offset++] = len;
|
||||
}
|
||||
|
||||
for (var k = 0; k < len; k++) {
|
||||
pt = coordSys.dataToPoint(lineCoords[k], false, pt);
|
||||
points[offset++] = pt[0];
|
||||
points[offset++] = pt[1];
|
||||
}
|
||||
}
|
||||
|
||||
lineData.setLayout('linesPoints', points);
|
||||
} else {
|
||||
for (var i = params.start; i < params.end; i++) {
|
||||
var itemModel = lineData.getItemModel(i);
|
||||
var len = seriesModel.getLineCoords(i, lineCoords);
|
||||
var pts = [];
|
||||
|
||||
if (isPolyline) {
|
||||
for (var j = 0; j < len; j++) {
|
||||
pts.push(coordSys.dataToPoint(lineCoords[j]));
|
||||
}
|
||||
} else {
|
||||
pts[0] = coordSys.dataToPoint(lineCoords[0]);
|
||||
pts[1] = coordSys.dataToPoint(lineCoords[1]);
|
||||
var curveness = itemModel.get(['lineStyle', 'curveness']);
|
||||
|
||||
if (+curveness) {
|
||||
pts[2] = [(pts[0][0] + pts[1][0]) / 2 - (pts[0][1] - pts[1][1]) * curveness, (pts[0][1] + pts[1][1]) / 2 - (pts[1][0] - pts[0][0]) * curveness];
|
||||
}
|
||||
}
|
||||
|
||||
lineData.setItemLayout(i, pts);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
export default linesLayout;
|
||||
78
uni-demo/node_modules/echarts/lib/chart/lines/linesVisual.js
generated
vendored
Normal file
78
uni-demo/node_modules/echarts/lib/chart/lines/linesVisual.js
generated
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
|
||||
/*
|
||||
* 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 normalize(a) {
|
||||
if (!(a instanceof Array)) {
|
||||
a = [a, a];
|
||||
}
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
var linesVisual = {
|
||||
seriesType: 'lines',
|
||||
reset: function (seriesModel) {
|
||||
var symbolType = normalize(seriesModel.get('symbol'));
|
||||
var symbolSize = normalize(seriesModel.get('symbolSize'));
|
||||
var data = seriesModel.getData();
|
||||
data.setVisual('fromSymbol', symbolType && symbolType[0]);
|
||||
data.setVisual('toSymbol', symbolType && symbolType[1]);
|
||||
data.setVisual('fromSymbolSize', symbolSize && symbolSize[0]);
|
||||
data.setVisual('toSymbolSize', symbolSize && symbolSize[1]);
|
||||
|
||||
function dataEach(data, idx) {
|
||||
var itemModel = data.getItemModel(idx);
|
||||
var symbolType = normalize(itemModel.getShallow('symbol', true));
|
||||
var symbolSize = normalize(itemModel.getShallow('symbolSize', true));
|
||||
symbolType[0] && data.setItemVisual(idx, 'fromSymbol', symbolType[0]);
|
||||
symbolType[1] && data.setItemVisual(idx, 'toSymbol', symbolType[1]);
|
||||
symbolSize[0] && data.setItemVisual(idx, 'fromSymbolSize', symbolSize[0]);
|
||||
symbolSize[1] && data.setItemVisual(idx, 'toSymbolSize', symbolSize[1]);
|
||||
}
|
||||
|
||||
return {
|
||||
dataEach: data.hasItemOption ? dataEach : null
|
||||
};
|
||||
}
|
||||
};
|
||||
export default linesVisual;
|
||||
46
uni-demo/node_modules/echarts/lib/chart/map.js
generated
vendored
Normal file
46
uni-demo/node_modules/echarts/lib/chart/map.js
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
|
||||
/*
|
||||
* 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 { use } from '../extension.js';
|
||||
import { install } from './map/install.js';
|
||||
use(install);
|
||||
275
uni-demo/node_modules/echarts/lib/chart/map/MapSeries.js
generated
vendored
Normal file
275
uni-demo/node_modules/echarts/lib/chart/map/MapSeries.js
generated
vendored
Normal file
@@ -0,0 +1,275 @@
|
||||
|
||||
/*
|
||||
* 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';
|
||||
import createSeriesDataSimply from '../helper/createSeriesDataSimply.js';
|
||||
import SeriesModel from '../../model/Series.js';
|
||||
import geoSourceManager from '../../coord/geo/geoSourceManager.js';
|
||||
import { makeSeriesEncodeForNameBased } from '../../data/helper/sourceHelper.js';
|
||||
import { createTooltipMarkup } from '../../component/tooltip/tooltipMarkup.js';
|
||||
import { createSymbol } from '../../util/symbol.js';
|
||||
|
||||
var MapSeries =
|
||||
/** @class */
|
||||
function (_super) {
|
||||
__extends(MapSeries, _super);
|
||||
|
||||
function MapSeries() {
|
||||
var _this = _super !== null && _super.apply(this, arguments) || this;
|
||||
|
||||
_this.type = MapSeries.type; // Only first map series of same mapType will drawMap.
|
||||
|
||||
_this.needsDrawMap = false; // Group of all map series with same mapType
|
||||
|
||||
_this.seriesGroup = [];
|
||||
|
||||
_this.getTooltipPosition = function (dataIndex) {
|
||||
if (dataIndex != null) {
|
||||
var name_1 = this.getData().getName(dataIndex);
|
||||
var geo = this.coordinateSystem;
|
||||
var region = geo.getRegion(name_1);
|
||||
return region && geo.dataToPoint(region.getCenter());
|
||||
}
|
||||
};
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
MapSeries.prototype.getInitialData = function (option) {
|
||||
var data = createSeriesDataSimply(this, {
|
||||
coordDimensions: ['value'],
|
||||
encodeDefaulter: zrUtil.curry(makeSeriesEncodeForNameBased, this)
|
||||
});
|
||||
var dataNameMap = zrUtil.createHashMap();
|
||||
var toAppendNames = [];
|
||||
|
||||
for (var i = 0, len = data.count(); i < len; i++) {
|
||||
var name_2 = data.getName(i);
|
||||
dataNameMap.set(name_2, true);
|
||||
}
|
||||
|
||||
var geoSource = geoSourceManager.load(this.getMapType(), this.option.nameMap, this.option.nameProperty);
|
||||
zrUtil.each(geoSource.regions, function (region) {
|
||||
var name = region.name;
|
||||
|
||||
if (!dataNameMap.get(name)) {
|
||||
toAppendNames.push(name);
|
||||
}
|
||||
}); // Complete data with missing regions. The consequent processes (like visual
|
||||
// map and render) can not be performed without a "full data". For example,
|
||||
// find `dataIndex` by name.
|
||||
|
||||
data.appendValues([], toAppendNames);
|
||||
return data;
|
||||
};
|
||||
/**
|
||||
* If no host geo model, return null, which means using a
|
||||
* inner exclusive geo model.
|
||||
*/
|
||||
|
||||
|
||||
MapSeries.prototype.getHostGeoModel = function () {
|
||||
var geoIndex = this.option.geoIndex;
|
||||
return geoIndex != null ? this.ecModel.getComponent('geo', geoIndex) : null;
|
||||
};
|
||||
|
||||
MapSeries.prototype.getMapType = function () {
|
||||
return (this.getHostGeoModel() || this).option.map;
|
||||
}; // _fillOption(option, mapName) {
|
||||
// Shallow clone
|
||||
// option = zrUtil.extend({}, option);
|
||||
// option.data = geoCreator.getFilledRegions(option.data, mapName, option.nameMap);
|
||||
// return option;
|
||||
// }
|
||||
|
||||
|
||||
MapSeries.prototype.getRawValue = function (dataIndex) {
|
||||
// Use value stored in data instead because it is calculated from multiple series
|
||||
// FIXME Provide all value of multiple series ?
|
||||
var data = this.getData();
|
||||
return data.get(data.mapDimension('value'), dataIndex);
|
||||
};
|
||||
/**
|
||||
* Get model of region
|
||||
*/
|
||||
|
||||
|
||||
MapSeries.prototype.getRegionModel = function (regionName) {
|
||||
var data = this.getData();
|
||||
return data.getItemModel(data.indexOfName(regionName));
|
||||
};
|
||||
/**
|
||||
* Map tooltip formatter
|
||||
*/
|
||||
|
||||
|
||||
MapSeries.prototype.formatTooltip = function (dataIndex, multipleSeries, dataType) {
|
||||
// FIXME orignalData and data is a bit confusing
|
||||
var data = this.getData();
|
||||
var value = this.getRawValue(dataIndex);
|
||||
var name = data.getName(dataIndex);
|
||||
var seriesGroup = this.seriesGroup;
|
||||
var seriesNames = [];
|
||||
|
||||
for (var i = 0; i < seriesGroup.length; i++) {
|
||||
var otherIndex = seriesGroup[i].originalData.indexOfName(name);
|
||||
var valueDim = data.mapDimension('value');
|
||||
|
||||
if (!isNaN(seriesGroup[i].originalData.get(valueDim, otherIndex))) {
|
||||
seriesNames.push(seriesGroup[i].name);
|
||||
}
|
||||
}
|
||||
|
||||
return createTooltipMarkup('section', {
|
||||
header: seriesNames.join(', '),
|
||||
noHeader: !seriesNames.length,
|
||||
blocks: [createTooltipMarkup('nameValue', {
|
||||
name: name,
|
||||
value: value
|
||||
})]
|
||||
});
|
||||
};
|
||||
|
||||
MapSeries.prototype.setZoom = function (zoom) {
|
||||
this.option.zoom = zoom;
|
||||
};
|
||||
|
||||
MapSeries.prototype.setCenter = function (center) {
|
||||
this.option.center = center;
|
||||
};
|
||||
|
||||
MapSeries.prototype.getLegendIcon = function (opt) {
|
||||
var iconType = opt.icon || 'roundRect';
|
||||
var icon = createSymbol(iconType, 0, 0, opt.itemWidth, opt.itemHeight, opt.itemStyle.fill);
|
||||
icon.setStyle(opt.itemStyle); // Map do not use itemStyle.borderWidth as border width
|
||||
|
||||
icon.style.stroke = 'none'; // No rotation because no series visual symbol for map
|
||||
|
||||
if (iconType.indexOf('empty') > -1) {
|
||||
icon.style.stroke = icon.style.fill;
|
||||
icon.style.fill = '#fff';
|
||||
icon.style.lineWidth = 2;
|
||||
}
|
||||
|
||||
return icon;
|
||||
};
|
||||
|
||||
MapSeries.type = 'series.map';
|
||||
MapSeries.dependencies = ['geo'];
|
||||
MapSeries.layoutMode = 'box';
|
||||
MapSeries.defaultOption = {
|
||||
// 一级层叠
|
||||
// zlevel: 0,
|
||||
// 二级层叠
|
||||
z: 2,
|
||||
coordinateSystem: 'geo',
|
||||
// map should be explicitly specified since ec3.
|
||||
map: '',
|
||||
// If `geoIndex` is not specified, a exclusive geo will be
|
||||
// created. Otherwise use the specified geo component, and
|
||||
// `map` and `mapType` are ignored.
|
||||
// geoIndex: 0,
|
||||
// 'center' | 'left' | 'right' | 'x%' | {number}
|
||||
left: 'center',
|
||||
// 'center' | 'top' | 'bottom' | 'x%' | {number}
|
||||
top: 'center',
|
||||
// right
|
||||
// bottom
|
||||
// width:
|
||||
// height
|
||||
// Aspect is width / height. Inited to be geoJson bbox aspect
|
||||
// This parameter is used for scale this aspect
|
||||
// Default value:
|
||||
// for geoSVG source: 1,
|
||||
// for geoJSON source: 0.75.
|
||||
aspectScale: null,
|
||||
///// Layout with center and size
|
||||
// If you wan't to put map in a fixed size box with right aspect ratio
|
||||
// This two properties may more conveninet
|
||||
// layoutCenter: [50%, 50%]
|
||||
// layoutSize: 100
|
||||
showLegendSymbol: true,
|
||||
// Define left-top, right-bottom coords to control view
|
||||
// For example, [ [180, 90], [-180, -90] ],
|
||||
// higher priority than center and zoom
|
||||
boundingCoords: null,
|
||||
// Default on center of map
|
||||
center: null,
|
||||
zoom: 1,
|
||||
scaleLimit: null,
|
||||
selectedMode: true,
|
||||
label: {
|
||||
show: false,
|
||||
color: '#000'
|
||||
},
|
||||
// scaleLimit: null,
|
||||
itemStyle: {
|
||||
borderWidth: 0.5,
|
||||
borderColor: '#444',
|
||||
areaColor: '#eee'
|
||||
},
|
||||
emphasis: {
|
||||
label: {
|
||||
show: true,
|
||||
color: 'rgb(100,0,0)'
|
||||
},
|
||||
itemStyle: {
|
||||
areaColor: 'rgba(255,215,0,0.8)'
|
||||
}
|
||||
},
|
||||
select: {
|
||||
label: {
|
||||
show: true,
|
||||
color: 'rgb(100,0,0)'
|
||||
},
|
||||
itemStyle: {
|
||||
color: 'rgba(255,215,0,0.8)'
|
||||
}
|
||||
},
|
||||
nameProperty: 'name'
|
||||
};
|
||||
return MapSeries;
|
||||
}(SeriesModel);
|
||||
|
||||
export default MapSeries;
|
||||
199
uni-demo/node_modules/echarts/lib/chart/map/MapView.js
generated
vendored
Normal file
199
uni-demo/node_modules/echarts/lib/chart/map/MapView.js
generated
vendored
Normal file
@@ -0,0 +1,199 @@
|
||||
|
||||
/*
|
||||
* 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 graphic from '../../util/graphic.js';
|
||||
import MapDraw from '../../component/helper/MapDraw.js';
|
||||
import ChartView from '../../view/Chart.js';
|
||||
import { setLabelStyle, getLabelStatesModels } from '../../label/labelStyle.js';
|
||||
import { setStatesFlag, Z2_EMPHASIS_LIFT } from '../../util/states.js';
|
||||
|
||||
var MapView =
|
||||
/** @class */
|
||||
function (_super) {
|
||||
__extends(MapView, _super);
|
||||
|
||||
function MapView() {
|
||||
var _this = _super !== null && _super.apply(this, arguments) || this;
|
||||
|
||||
_this.type = MapView.type;
|
||||
return _this;
|
||||
}
|
||||
|
||||
MapView.prototype.render = function (mapModel, ecModel, api, payload) {
|
||||
// Not render if it is an toggleSelect action from self
|
||||
if (payload && payload.type === 'mapToggleSelect' && payload.from === this.uid) {
|
||||
return;
|
||||
}
|
||||
|
||||
var group = this.group;
|
||||
group.removeAll();
|
||||
|
||||
if (mapModel.getHostGeoModel()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this._mapDraw && payload && payload.type === 'geoRoam') {
|
||||
this._mapDraw.resetForLabelLayout();
|
||||
} // Not update map if it is an roam action from self
|
||||
|
||||
|
||||
if (!(payload && payload.type === 'geoRoam' && payload.componentType === 'series' && payload.seriesId === mapModel.id)) {
|
||||
if (mapModel.needsDrawMap) {
|
||||
var mapDraw = this._mapDraw || new MapDraw(api);
|
||||
group.add(mapDraw.group);
|
||||
mapDraw.draw(mapModel, ecModel, api, this, payload);
|
||||
this._mapDraw = mapDraw;
|
||||
} else {
|
||||
// Remove drawed map
|
||||
this._mapDraw && this._mapDraw.remove();
|
||||
this._mapDraw = null;
|
||||
}
|
||||
} else {
|
||||
var mapDraw = this._mapDraw;
|
||||
mapDraw && group.add(mapDraw.group);
|
||||
}
|
||||
|
||||
mapModel.get('showLegendSymbol') && ecModel.getComponent('legend') && this._renderSymbols(mapModel, ecModel, api);
|
||||
};
|
||||
|
||||
MapView.prototype.remove = function () {
|
||||
this._mapDraw && this._mapDraw.remove();
|
||||
this._mapDraw = null;
|
||||
this.group.removeAll();
|
||||
};
|
||||
|
||||
MapView.prototype.dispose = function () {
|
||||
this._mapDraw && this._mapDraw.remove();
|
||||
this._mapDraw = null;
|
||||
};
|
||||
|
||||
MapView.prototype._renderSymbols = function (mapModel, ecModel, api) {
|
||||
var originalData = mapModel.originalData;
|
||||
var group = this.group;
|
||||
originalData.each(originalData.mapDimension('value'), function (value, originalDataIndex) {
|
||||
if (isNaN(value)) {
|
||||
return;
|
||||
}
|
||||
|
||||
var layout = originalData.getItemLayout(originalDataIndex);
|
||||
|
||||
if (!layout || !layout.point) {
|
||||
// Not exists in map
|
||||
return;
|
||||
}
|
||||
|
||||
var point = layout.point;
|
||||
var offset = layout.offset;
|
||||
var circle = new graphic.Circle({
|
||||
style: {
|
||||
// Because the special of map draw.
|
||||
// Which needs statistic of multiple series and draw on one map.
|
||||
// And each series also need a symbol with legend color
|
||||
//
|
||||
// Layout and visual are put one the different data
|
||||
// TODO
|
||||
fill: mapModel.getData().getVisual('style').fill
|
||||
},
|
||||
shape: {
|
||||
cx: point[0] + offset * 9,
|
||||
cy: point[1],
|
||||
r: 3
|
||||
},
|
||||
silent: true,
|
||||
// Do not overlap the first series, on which labels are displayed.
|
||||
z2: 8 + (!offset ? Z2_EMPHASIS_LIFT + 1 : 0)
|
||||
}); // Only the series that has the first value on the same region is in charge of rendering the label.
|
||||
// But consider the case:
|
||||
// series: [
|
||||
// {id: 'X', type: 'map', map: 'm', {data: [{name: 'A', value: 11}, {name: 'B', {value: 22}]},
|
||||
// {id: 'Y', type: 'map', map: 'm', {data: [{name: 'A', value: 21}, {name: 'C', {value: 33}]}
|
||||
// ]
|
||||
// The offset `0` of item `A` is at series `X`, but of item `C` is at series `Y`.
|
||||
// For backward compatibility, we follow the rule that render label `A` by the
|
||||
// settings on series `X` but render label `C` by the settings on series `Y`.
|
||||
|
||||
if (!offset) {
|
||||
var fullData = mapModel.mainSeries.getData();
|
||||
var name_1 = originalData.getName(originalDataIndex);
|
||||
var fullIndex_1 = fullData.indexOfName(name_1);
|
||||
var itemModel = originalData.getItemModel(originalDataIndex);
|
||||
var labelModel = itemModel.getModel('label');
|
||||
var regionGroup = fullData.getItemGraphicEl(fullIndex_1); // `getFormattedLabel` needs to use `getData` inside. Here
|
||||
// `mapModel.getData()` is shallow cloned from `mainSeries.getData()`.
|
||||
// FIXME
|
||||
// If this is not the `mainSeries`, the item model (like label formatter)
|
||||
// set on original data item will never get. But it has been working
|
||||
// like that from the begining, and this scenario is rarely encountered.
|
||||
// So it won't be fixed until have to.
|
||||
|
||||
setLabelStyle(circle, getLabelStatesModels(itemModel), {
|
||||
labelFetcher: {
|
||||
getFormattedLabel: function (idx, state) {
|
||||
return mapModel.getFormattedLabel(fullIndex_1, state);
|
||||
}
|
||||
},
|
||||
defaultText: name_1
|
||||
});
|
||||
circle.disableLabelAnimation = true;
|
||||
|
||||
if (!labelModel.get('position')) {
|
||||
circle.setTextConfig({
|
||||
position: 'bottom'
|
||||
});
|
||||
}
|
||||
|
||||
regionGroup.onHoverStateChange = function (toState) {
|
||||
setStatesFlag(circle, toState);
|
||||
};
|
||||
}
|
||||
|
||||
group.add(circle);
|
||||
});
|
||||
};
|
||||
|
||||
MapView.type = 'map';
|
||||
return MapView;
|
||||
}(ChartView);
|
||||
|
||||
export default MapView;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user