逐步完成前后端服务器
This commit is contained in:
136
frontend/node_modules/echarts/lib/component/brush/BrushModel.js
generated
vendored
Normal file
136
frontend/node_modules/echarts/lib/component/brush/BrushModel.js
generated
vendored
Normal file
@ -0,0 +1,136 @@
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT 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 visualSolution from '../../visual/visualSolution.js';
|
||||
import Model from '../../model/Model.js';
|
||||
import ComponentModel from '../../model/Component.js';
|
||||
var DEFAULT_OUT_OF_BRUSH_COLOR = '#ddd';
|
||||
var BrushModel = /** @class */function (_super) {
|
||||
__extends(BrushModel, _super);
|
||||
function BrushModel() {
|
||||
var _this = _super !== null && _super.apply(this, arguments) || this;
|
||||
_this.type = BrushModel.type;
|
||||
/**
|
||||
* @readOnly
|
||||
*/
|
||||
_this.areas = [];
|
||||
/**
|
||||
* Current brush painting area settings.
|
||||
* @readOnly
|
||||
*/
|
||||
_this.brushOption = {};
|
||||
return _this;
|
||||
}
|
||||
BrushModel.prototype.optionUpdated = function (newOption, isInit) {
|
||||
var thisOption = this.option;
|
||||
!isInit && visualSolution.replaceVisualOption(thisOption, newOption, ['inBrush', 'outOfBrush']);
|
||||
var inBrush = thisOption.inBrush = thisOption.inBrush || {};
|
||||
// Always give default visual, consider setOption at the second time.
|
||||
thisOption.outOfBrush = thisOption.outOfBrush || {
|
||||
color: DEFAULT_OUT_OF_BRUSH_COLOR
|
||||
};
|
||||
if (!inBrush.hasOwnProperty('liftZ')) {
|
||||
// Bigger than the highlight z lift, otherwise it will
|
||||
// be effected by the highlight z when brush.
|
||||
inBrush.liftZ = 5;
|
||||
}
|
||||
};
|
||||
/**
|
||||
* If `areas` is null/undefined, range state remain.
|
||||
*/
|
||||
BrushModel.prototype.setAreas = function (areas) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
zrUtil.assert(zrUtil.isArray(areas));
|
||||
zrUtil.each(areas, function (area) {
|
||||
zrUtil.assert(area.brushType, 'Illegal areas');
|
||||
});
|
||||
}
|
||||
// If areas is null/undefined, range state remain.
|
||||
// This helps user to dispatchAction({type: 'brush'}) with no areas
|
||||
// set but just want to get the current brush select info from a `brush` event.
|
||||
if (!areas) {
|
||||
return;
|
||||
}
|
||||
this.areas = zrUtil.map(areas, function (area) {
|
||||
return generateBrushOption(this.option, area);
|
||||
}, this);
|
||||
};
|
||||
/**
|
||||
* Set the current painting brush option.
|
||||
*/
|
||||
BrushModel.prototype.setBrushOption = function (brushOption) {
|
||||
this.brushOption = generateBrushOption(this.option, brushOption);
|
||||
this.brushType = this.brushOption.brushType;
|
||||
};
|
||||
BrushModel.type = 'brush';
|
||||
BrushModel.dependencies = ['geo', 'grid', 'xAxis', 'yAxis', 'parallel', 'series'];
|
||||
BrushModel.defaultOption = {
|
||||
seriesIndex: 'all',
|
||||
brushType: 'rect',
|
||||
brushMode: 'single',
|
||||
transformable: true,
|
||||
brushStyle: {
|
||||
borderWidth: 1,
|
||||
color: 'rgba(210,219,238,0.3)',
|
||||
borderColor: '#D2DBEE'
|
||||
},
|
||||
throttleType: 'fixRate',
|
||||
throttleDelay: 0,
|
||||
removeOnClick: true,
|
||||
z: 10000
|
||||
};
|
||||
return BrushModel;
|
||||
}(ComponentModel);
|
||||
function generateBrushOption(option, brushOption) {
|
||||
return zrUtil.merge({
|
||||
brushType: option.brushType,
|
||||
brushMode: option.brushMode,
|
||||
transformable: option.transformable,
|
||||
brushStyle: new Model(option.brushStyle).getItemStyle(),
|
||||
removeOnClick: option.removeOnClick,
|
||||
z: option.z
|
||||
}, brushOption, true);
|
||||
}
|
||||
export default BrushModel;
|
111
frontend/node_modules/echarts/lib/component/brush/BrushView.js
generated
vendored
Normal file
111
frontend/node_modules/echarts/lib/component/brush/BrushView.js
generated
vendored
Normal file
@ -0,0 +1,111 @@
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT 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 BrushController from '../helper/BrushController.js';
|
||||
import { layoutCovers } from './visualEncoding.js';
|
||||
import ComponentView from '../../view/Component.js';
|
||||
var BrushView = /** @class */function (_super) {
|
||||
__extends(BrushView, _super);
|
||||
function BrushView() {
|
||||
var _this = _super !== null && _super.apply(this, arguments) || this;
|
||||
_this.type = BrushView.type;
|
||||
return _this;
|
||||
}
|
||||
BrushView.prototype.init = function (ecModel, api) {
|
||||
this.ecModel = ecModel;
|
||||
this.api = api;
|
||||
this.model;
|
||||
(this._brushController = new BrushController(api.getZr())).on('brush', zrUtil.bind(this._onBrush, this)).mount();
|
||||
};
|
||||
BrushView.prototype.render = function (brushModel, ecModel, api, payload) {
|
||||
this.model = brushModel;
|
||||
this._updateController(brushModel, ecModel, api, payload);
|
||||
};
|
||||
BrushView.prototype.updateTransform = function (brushModel, ecModel, api, payload) {
|
||||
// PENDING: `updateTransform` is a little tricky, whose layout need
|
||||
// to be calculate mandatorily and other stages will not be performed.
|
||||
// Take care the correctness of the logic. See #11754 .
|
||||
layoutCovers(ecModel);
|
||||
this._updateController(brushModel, ecModel, api, payload);
|
||||
};
|
||||
BrushView.prototype.updateVisual = function (brushModel, ecModel, api, payload) {
|
||||
this.updateTransform(brushModel, ecModel, api, payload);
|
||||
};
|
||||
BrushView.prototype.updateView = function (brushModel, ecModel, api, payload) {
|
||||
this._updateController(brushModel, ecModel, api, payload);
|
||||
};
|
||||
BrushView.prototype._updateController = function (brushModel, ecModel, api, payload) {
|
||||
// Do not update controller when drawing.
|
||||
(!payload || payload.$from !== brushModel.id) && this._brushController.setPanels(brushModel.brushTargetManager.makePanelOpts(api)).enableBrush(brushModel.brushOption).updateCovers(brushModel.areas.slice());
|
||||
};
|
||||
// updateLayout: updateController,
|
||||
// updateVisual: updateController,
|
||||
BrushView.prototype.dispose = function () {
|
||||
this._brushController.dispose();
|
||||
};
|
||||
BrushView.prototype._onBrush = function (eventParam) {
|
||||
var modelId = this.model.id;
|
||||
var areas = this.model.brushTargetManager.setOutputRanges(eventParam.areas, this.ecModel);
|
||||
// Action is not dispatched on drag end, because the drag end
|
||||
// emits the same params with the last drag move event, and
|
||||
// may have some delay when using touch pad, which makes
|
||||
// animation not smooth (when using debounce).
|
||||
(!eventParam.isEnd || eventParam.removeOnClick) && this.api.dispatchAction({
|
||||
type: 'brush',
|
||||
brushId: modelId,
|
||||
areas: zrUtil.clone(areas),
|
||||
$from: modelId
|
||||
});
|
||||
eventParam.isEnd && this.api.dispatchAction({
|
||||
type: 'brushEnd',
|
||||
brushId: modelId,
|
||||
areas: zrUtil.clone(areas),
|
||||
$from: modelId
|
||||
});
|
||||
};
|
||||
BrushView.type = 'brush';
|
||||
return BrushView;
|
||||
}(ComponentView);
|
||||
export default BrushView;
|
101
frontend/node_modules/echarts/lib/component/brush/install.js
generated
vendored
Normal file
101
frontend/node_modules/echarts/lib/component/brush/install.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 brushPreprocessor from './preprocessor.js';
|
||||
import BrushView from './BrushView.js';
|
||||
import BrushModel from './BrushModel.js';
|
||||
import brushVisual from './visualEncoding.js';
|
||||
// TODO
|
||||
import BrushFeature from '../toolbox/feature/Brush.js';
|
||||
import { registerFeature } from '../toolbox/featureManager.js';
|
||||
import { noop } from 'zrender/lib/core/util.js';
|
||||
export function install(registers) {
|
||||
registers.registerComponentView(BrushView);
|
||||
registers.registerComponentModel(BrushModel);
|
||||
registers.registerPreprocessor(brushPreprocessor);
|
||||
registers.registerVisual(registers.PRIORITY.VISUAL.BRUSH, brushVisual);
|
||||
registers.registerAction({
|
||||
type: 'brush',
|
||||
event: 'brush',
|
||||
update: 'updateVisual'
|
||||
}, function (payload, ecModel) {
|
||||
ecModel.eachComponent({
|
||||
mainType: 'brush',
|
||||
query: payload
|
||||
}, function (brushModel) {
|
||||
brushModel.setAreas(payload.areas);
|
||||
});
|
||||
});
|
||||
/**
|
||||
* payload: {
|
||||
* brushComponents: [
|
||||
* {
|
||||
* brushId,
|
||||
* brushIndex,
|
||||
* brushName,
|
||||
* series: [
|
||||
* {
|
||||
* seriesId,
|
||||
* seriesIndex,
|
||||
* seriesName,
|
||||
* rawIndices: [21, 34, ...]
|
||||
* },
|
||||
* ...
|
||||
* ]
|
||||
* },
|
||||
* ...
|
||||
* ]
|
||||
* }
|
||||
*/
|
||||
registers.registerAction({
|
||||
type: 'brushSelect',
|
||||
event: 'brushSelected',
|
||||
update: 'none'
|
||||
}, noop);
|
||||
registers.registerAction({
|
||||
type: 'brushEnd',
|
||||
event: 'brushEnd',
|
||||
update: 'none'
|
||||
}, noop);
|
||||
registerFeature('brush', BrushFeature);
|
||||
}
|
87
frontend/node_modules/echarts/lib/component/brush/preprocessor.js
generated
vendored
Normal file
87
frontend/node_modules/echarts/lib/component/brush/preprocessor.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 * as zrUtil from 'zrender/lib/core/util.js';
|
||||
import { normalizeToArray } from '../../util/model.js';
|
||||
var DEFAULT_TOOLBOX_BTNS = ['rect', 'polygon', 'keep', 'clear'];
|
||||
export default function brushPreprocessor(option, isNew) {
|
||||
var brushComponents = normalizeToArray(option ? option.brush : []);
|
||||
if (!brushComponents.length) {
|
||||
return;
|
||||
}
|
||||
var brushComponentSpecifiedBtns = [];
|
||||
zrUtil.each(brushComponents, function (brushOpt) {
|
||||
var tbs = brushOpt.hasOwnProperty('toolbox') ? brushOpt.toolbox : [];
|
||||
if (tbs instanceof Array) {
|
||||
brushComponentSpecifiedBtns = brushComponentSpecifiedBtns.concat(tbs);
|
||||
}
|
||||
});
|
||||
var toolbox = option && option.toolbox;
|
||||
if (zrUtil.isArray(toolbox)) {
|
||||
toolbox = toolbox[0];
|
||||
}
|
||||
if (!toolbox) {
|
||||
toolbox = {
|
||||
feature: {}
|
||||
};
|
||||
option.toolbox = [toolbox];
|
||||
}
|
||||
var toolboxFeature = toolbox.feature || (toolbox.feature = {});
|
||||
var toolboxBrush = toolboxFeature.brush || (toolboxFeature.brush = {});
|
||||
var brushTypes = toolboxBrush.type || (toolboxBrush.type = []);
|
||||
brushTypes.push.apply(brushTypes, brushComponentSpecifiedBtns);
|
||||
removeDuplicate(brushTypes);
|
||||
if (isNew && !brushTypes.length) {
|
||||
brushTypes.push.apply(brushTypes, DEFAULT_TOOLBOX_BTNS);
|
||||
}
|
||||
}
|
||||
function removeDuplicate(arr) {
|
||||
var map = {};
|
||||
zrUtil.each(arr, function (val) {
|
||||
map[val] = 1;
|
||||
});
|
||||
arr.length = 0;
|
||||
zrUtil.each(map, function (flag, val) {
|
||||
arr.push(val);
|
||||
});
|
||||
}
|
115
frontend/node_modules/echarts/lib/component/brush/selector.js
generated
vendored
Normal file
115
frontend/node_modules/echarts/lib/component/brush/selector.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 * as polygonContain from 'zrender/lib/contain/polygon.js';
|
||||
import BoundingRect from 'zrender/lib/core/BoundingRect.js';
|
||||
import { linePolygonIntersect } from '../../util/graphic.js';
|
||||
export function makeBrushCommonSelectorForSeries(area) {
|
||||
var brushType = area.brushType;
|
||||
// Do not use function binding or curry for performance.
|
||||
var selectors = {
|
||||
point: function (itemLayout) {
|
||||
return selector[brushType].point(itemLayout, selectors, area);
|
||||
},
|
||||
rect: function (itemLayout) {
|
||||
return selector[brushType].rect(itemLayout, selectors, area);
|
||||
}
|
||||
};
|
||||
return selectors;
|
||||
}
|
||||
var selector = {
|
||||
lineX: getLineSelectors(0),
|
||||
lineY: getLineSelectors(1),
|
||||
rect: {
|
||||
point: function (itemLayout, selectors, area) {
|
||||
return itemLayout && area.boundingRect.contain(itemLayout[0], itemLayout[1]);
|
||||
},
|
||||
rect: function (itemLayout, selectors, area) {
|
||||
return itemLayout && area.boundingRect.intersect(itemLayout);
|
||||
}
|
||||
},
|
||||
polygon: {
|
||||
point: function (itemLayout, selectors, area) {
|
||||
return itemLayout && area.boundingRect.contain(itemLayout[0], itemLayout[1]) && polygonContain.contain(area.range, itemLayout[0], itemLayout[1]);
|
||||
},
|
||||
rect: function (itemLayout, selectors, area) {
|
||||
var points = area.range;
|
||||
if (!itemLayout || points.length <= 1) {
|
||||
return false;
|
||||
}
|
||||
var x = itemLayout.x;
|
||||
var y = itemLayout.y;
|
||||
var width = itemLayout.width;
|
||||
var height = itemLayout.height;
|
||||
var p = points[0];
|
||||
if (polygonContain.contain(points, x, y) || polygonContain.contain(points, x + width, y) || polygonContain.contain(points, x, y + height) || polygonContain.contain(points, x + width, y + height) || BoundingRect.create(itemLayout).contain(p[0], p[1]) || linePolygonIntersect(x, y, x + width, y, points) || linePolygonIntersect(x, y, x, y + height, points) || linePolygonIntersect(x + width, y, x + width, y + height, points) || linePolygonIntersect(x, y + height, x + width, y + height, points)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
function getLineSelectors(xyIndex) {
|
||||
var xy = ['x', 'y'];
|
||||
var wh = ['width', 'height'];
|
||||
return {
|
||||
point: function (itemLayout, selectors, area) {
|
||||
if (itemLayout) {
|
||||
var range = area.range;
|
||||
var p = itemLayout[xyIndex];
|
||||
return inLineRange(p, range);
|
||||
}
|
||||
},
|
||||
rect: function (itemLayout, selectors, area) {
|
||||
if (itemLayout) {
|
||||
var range = area.range;
|
||||
var layoutRange = [itemLayout[xy[xyIndex]], itemLayout[xy[xyIndex]] + itemLayout[wh[xyIndex]]];
|
||||
layoutRange[1] < layoutRange[0] && layoutRange.reverse();
|
||||
return inLineRange(layoutRange[0], range) || inLineRange(layoutRange[1], range) || inLineRange(range[0], layoutRange) || inLineRange(range[1], layoutRange);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
function inLineRange(p, range) {
|
||||
return range[0] <= p && p <= range[1];
|
||||
}
|
||||
export default selector;
|
257
frontend/node_modules/echarts/lib/component/brush/visualEncoding.js
generated
vendored
Normal file
257
frontend/node_modules/echarts/lib/component/brush/visualEncoding.js
generated
vendored
Normal file
@ -0,0 +1,257 @@
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* AUTO-GENERATED FILE. DO NOT MODIFY.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import * as zrUtil from 'zrender/lib/core/util.js';
|
||||
import BoundingRect from 'zrender/lib/core/BoundingRect.js';
|
||||
import * as visualSolution from '../../visual/visualSolution.js';
|
||||
import { makeBrushCommonSelectorForSeries } from './selector.js';
|
||||
import * as throttleUtil from '../../util/throttle.js';
|
||||
import BrushTargetManager from '../helper/BrushTargetManager.js';
|
||||
var STATE_LIST = ['inBrush', 'outOfBrush'];
|
||||
var DISPATCH_METHOD = '__ecBrushSelect';
|
||||
var DISPATCH_FLAG = '__ecInBrushSelectEvent';
|
||||
;
|
||||
export function layoutCovers(ecModel) {
|
||||
ecModel.eachComponent({
|
||||
mainType: 'brush'
|
||||
}, function (brushModel) {
|
||||
var brushTargetManager = brushModel.brushTargetManager = new BrushTargetManager(brushModel.option, ecModel);
|
||||
brushTargetManager.setInputRanges(brushModel.areas, ecModel);
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Register the visual encoding if this modules required.
|
||||
*/
|
||||
export default function brushVisual(ecModel, api, payload) {
|
||||
var brushSelected = [];
|
||||
var throttleType;
|
||||
var throttleDelay;
|
||||
ecModel.eachComponent({
|
||||
mainType: 'brush'
|
||||
}, function (brushModel) {
|
||||
payload && payload.type === 'takeGlobalCursor' && brushModel.setBrushOption(payload.key === 'brush' ? payload.brushOption : {
|
||||
brushType: false
|
||||
});
|
||||
});
|
||||
layoutCovers(ecModel);
|
||||
ecModel.eachComponent({
|
||||
mainType: 'brush'
|
||||
}, function (brushModel, brushIndex) {
|
||||
var thisBrushSelected = {
|
||||
brushId: brushModel.id,
|
||||
brushIndex: brushIndex,
|
||||
brushName: brushModel.name,
|
||||
areas: zrUtil.clone(brushModel.areas),
|
||||
selected: []
|
||||
};
|
||||
// Every brush component exists in event params, convenient
|
||||
// for user to find by index.
|
||||
brushSelected.push(thisBrushSelected);
|
||||
var brushOption = brushModel.option;
|
||||
var brushLink = brushOption.brushLink;
|
||||
var linkedSeriesMap = [];
|
||||
var selectedDataIndexForLink = [];
|
||||
var rangeInfoBySeries = [];
|
||||
var hasBrushExists = false;
|
||||
if (!brushIndex) {
|
||||
// Only the first throttle setting works.
|
||||
throttleType = brushOption.throttleType;
|
||||
throttleDelay = brushOption.throttleDelay;
|
||||
}
|
||||
// Add boundingRect and selectors to range.
|
||||
var areas = zrUtil.map(brushModel.areas, function (area) {
|
||||
var builder = boundingRectBuilders[area.brushType];
|
||||
var selectableArea = zrUtil.defaults({
|
||||
boundingRect: builder ? builder(area) : void 0
|
||||
}, area);
|
||||
selectableArea.selectors = makeBrushCommonSelectorForSeries(selectableArea);
|
||||
return selectableArea;
|
||||
});
|
||||
var visualMappings = visualSolution.createVisualMappings(brushModel.option, STATE_LIST, function (mappingOption) {
|
||||
mappingOption.mappingMethod = 'fixed';
|
||||
});
|
||||
zrUtil.isArray(brushLink) && zrUtil.each(brushLink, function (seriesIndex) {
|
||||
linkedSeriesMap[seriesIndex] = 1;
|
||||
});
|
||||
function linkOthers(seriesIndex) {
|
||||
return brushLink === 'all' || !!linkedSeriesMap[seriesIndex];
|
||||
}
|
||||
// If no supported brush or no brush on the series,
|
||||
// all visuals should be in original state.
|
||||
function brushed(rangeInfoList) {
|
||||
return !!rangeInfoList.length;
|
||||
}
|
||||
/**
|
||||
* Logic for each series: (If the logic has to be modified one day, do it carefully!)
|
||||
*
|
||||
* ( brushed ┬ && ┬hasBrushExist ┬ && linkOthers ) => StepA: ┬record, ┬ StepB: ┬visualByRecord.
|
||||
* !brushed┘ ├hasBrushExist ┤ └nothing,┘ ├visualByRecord.
|
||||
* └!hasBrushExist┘ └nothing.
|
||||
* ( !brushed && ┬hasBrushExist ┬ && linkOthers ) => StepA: nothing, StepB: ┬visualByRecord.
|
||||
* └!hasBrushExist┘ └nothing.
|
||||
* ( brushed ┬ && !linkOthers ) => StepA: nothing, StepB: ┬visualByCheck.
|
||||
* !brushed┘ └nothing.
|
||||
* ( !brushed && !linkOthers ) => StepA: nothing, StepB: nothing.
|
||||
*/
|
||||
// Step A
|
||||
ecModel.eachSeries(function (seriesModel, seriesIndex) {
|
||||
var rangeInfoList = rangeInfoBySeries[seriesIndex] = [];
|
||||
seriesModel.subType === 'parallel' ? stepAParallel(seriesModel, seriesIndex) : stepAOthers(seriesModel, seriesIndex, rangeInfoList);
|
||||
});
|
||||
function stepAParallel(seriesModel, seriesIndex) {
|
||||
var coordSys = seriesModel.coordinateSystem;
|
||||
hasBrushExists = hasBrushExists || coordSys.hasAxisBrushed();
|
||||
linkOthers(seriesIndex) && coordSys.eachActiveState(seriesModel.getData(), function (activeState, dataIndex) {
|
||||
activeState === 'active' && (selectedDataIndexForLink[dataIndex] = 1);
|
||||
});
|
||||
}
|
||||
function stepAOthers(seriesModel, seriesIndex, rangeInfoList) {
|
||||
if (!seriesModel.brushSelector || brushModelNotControll(brushModel, seriesIndex)) {
|
||||
return;
|
||||
}
|
||||
zrUtil.each(areas, function (area) {
|
||||
if (brushModel.brushTargetManager.controlSeries(area, seriesModel, ecModel)) {
|
||||
rangeInfoList.push(area);
|
||||
}
|
||||
hasBrushExists = hasBrushExists || brushed(rangeInfoList);
|
||||
});
|
||||
if (linkOthers(seriesIndex) && brushed(rangeInfoList)) {
|
||||
var data_1 = seriesModel.getData();
|
||||
data_1.each(function (dataIndex) {
|
||||
if (checkInRange(seriesModel, rangeInfoList, data_1, dataIndex)) {
|
||||
selectedDataIndexForLink[dataIndex] = 1;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
// Step B
|
||||
ecModel.eachSeries(function (seriesModel, seriesIndex) {
|
||||
var seriesBrushSelected = {
|
||||
seriesId: seriesModel.id,
|
||||
seriesIndex: seriesIndex,
|
||||
seriesName: seriesModel.name,
|
||||
dataIndex: []
|
||||
};
|
||||
// Every series exists in event params, convenient
|
||||
// for user to find series by seriesIndex.
|
||||
thisBrushSelected.selected.push(seriesBrushSelected);
|
||||
var rangeInfoList = rangeInfoBySeries[seriesIndex];
|
||||
var data = seriesModel.getData();
|
||||
var getValueState = linkOthers(seriesIndex) ? function (dataIndex) {
|
||||
return selectedDataIndexForLink[dataIndex] ? (seriesBrushSelected.dataIndex.push(data.getRawIndex(dataIndex)), 'inBrush') : 'outOfBrush';
|
||||
} : function (dataIndex) {
|
||||
return checkInRange(seriesModel, rangeInfoList, data, dataIndex) ? (seriesBrushSelected.dataIndex.push(data.getRawIndex(dataIndex)), 'inBrush') : 'outOfBrush';
|
||||
};
|
||||
// If no supported brush or no brush, all visuals are in original state.
|
||||
(linkOthers(seriesIndex) ? hasBrushExists : brushed(rangeInfoList)) && visualSolution.applyVisual(STATE_LIST, visualMappings, data, getValueState);
|
||||
});
|
||||
});
|
||||
dispatchAction(api, throttleType, throttleDelay, brushSelected, payload);
|
||||
}
|
||||
;
|
||||
function dispatchAction(api, throttleType, throttleDelay, brushSelected, payload) {
|
||||
// This event will not be triggered when `setOpion`, otherwise dead lock may
|
||||
// triggered when do `setOption` in event listener, which we do not find
|
||||
// satisfactory way to solve yet. Some considered resolutions:
|
||||
// (a) Diff with prevoius selected data ant only trigger event when changed.
|
||||
// But store previous data and diff precisely (i.e., not only by dataIndex, but
|
||||
// also detect value changes in selected data) might bring complexity or fragility.
|
||||
// (b) Use spectial param like `silent` to suppress event triggering.
|
||||
// But such kind of volatile param may be weird in `setOption`.
|
||||
if (!payload) {
|
||||
return;
|
||||
}
|
||||
var zr = api.getZr();
|
||||
if (zr[DISPATCH_FLAG]) {
|
||||
return;
|
||||
}
|
||||
if (!zr[DISPATCH_METHOD]) {
|
||||
zr[DISPATCH_METHOD] = doDispatch;
|
||||
}
|
||||
var fn = throttleUtil.createOrUpdate(zr, DISPATCH_METHOD, throttleDelay, throttleType);
|
||||
fn(api, brushSelected);
|
||||
}
|
||||
function doDispatch(api, brushSelected) {
|
||||
if (!api.isDisposed()) {
|
||||
var zr = api.getZr();
|
||||
zr[DISPATCH_FLAG] = true;
|
||||
api.dispatchAction({
|
||||
type: 'brushSelect',
|
||||
batch: brushSelected
|
||||
});
|
||||
zr[DISPATCH_FLAG] = false;
|
||||
}
|
||||
}
|
||||
function checkInRange(seriesModel, rangeInfoList, data, dataIndex) {
|
||||
for (var i = 0, len = rangeInfoList.length; i < len; i++) {
|
||||
var area = rangeInfoList[i];
|
||||
if (seriesModel.brushSelector(dataIndex, data, area.selectors, area)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
function brushModelNotControll(brushModel, seriesIndex) {
|
||||
var seriesIndices = brushModel.option.seriesIndex;
|
||||
return seriesIndices != null && seriesIndices !== 'all' && (zrUtil.isArray(seriesIndices) ? zrUtil.indexOf(seriesIndices, seriesIndex) < 0 : seriesIndex !== seriesIndices);
|
||||
}
|
||||
var boundingRectBuilders = {
|
||||
rect: function (area) {
|
||||
return getBoundingRectFromMinMax(area.range);
|
||||
},
|
||||
polygon: function (area) {
|
||||
var minMax;
|
||||
var range = area.range;
|
||||
for (var i = 0, len = range.length; i < len; i++) {
|
||||
minMax = minMax || [[Infinity, -Infinity], [Infinity, -Infinity]];
|
||||
var rg = range[i];
|
||||
rg[0] < minMax[0][0] && (minMax[0][0] = rg[0]);
|
||||
rg[0] > minMax[0][1] && (minMax[0][1] = rg[0]);
|
||||
rg[1] < minMax[1][0] && (minMax[1][0] = rg[1]);
|
||||
rg[1] > minMax[1][1] && (minMax[1][1] = rg[1]);
|
||||
}
|
||||
return minMax && getBoundingRectFromMinMax(minMax);
|
||||
}
|
||||
};
|
||||
function getBoundingRectFromMinMax(minMax) {
|
||||
return new BoundingRect(minMax[0][0], minMax[1][0], minMax[0][1] - minMax[0][0], minMax[1][1] - minMax[1][0]);
|
||||
}
|
Reference in New Issue
Block a user