逐步完成前后端服务器
This commit is contained in:
44
frontend/node_modules/echarts/lib/component/axisPointer/AxisPointer.js
generated
vendored
Normal file
44
frontend/node_modules/echarts/lib/component/axisPointer/AxisPointer.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
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* distributed with this work for additional information
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT 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 {};
|
112
frontend/node_modules/echarts/lib/component/axisPointer/AxisPointerModel.js
generated
vendored
Normal file
112
frontend/node_modules/echarts/lib/component/axisPointer/AxisPointerModel.js
generated
vendored
Normal file
@ -0,0 +1,112 @@
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT 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 ComponentModel from '../../model/Component.js';
|
||||
var AxisPointerModel = /** @class */function (_super) {
|
||||
__extends(AxisPointerModel, _super);
|
||||
function AxisPointerModel() {
|
||||
var _this = _super !== null && _super.apply(this, arguments) || this;
|
||||
_this.type = AxisPointerModel.type;
|
||||
return _this;
|
||||
}
|
||||
AxisPointerModel.type = 'axisPointer';
|
||||
AxisPointerModel.defaultOption = {
|
||||
// 'auto' means that show when triggered by tooltip or handle.
|
||||
show: 'auto',
|
||||
// zlevel: 0,
|
||||
z: 50,
|
||||
type: 'line',
|
||||
// axispointer triggered by tootip determine snap automatically,
|
||||
// see `modelHelper`.
|
||||
snap: false,
|
||||
triggerTooltip: true,
|
||||
triggerEmphasis: true,
|
||||
value: null,
|
||||
status: null,
|
||||
link: [],
|
||||
// Do not set 'auto' here, otherwise global animation: false
|
||||
// will not effect at this axispointer.
|
||||
animation: null,
|
||||
animationDurationUpdate: 200,
|
||||
lineStyle: {
|
||||
color: '#B9BEC9',
|
||||
width: 1,
|
||||
type: 'dashed'
|
||||
},
|
||||
shadowStyle: {
|
||||
color: 'rgba(210,219,238,0.2)'
|
||||
},
|
||||
label: {
|
||||
show: true,
|
||||
formatter: null,
|
||||
precision: 'auto',
|
||||
margin: 3,
|
||||
color: '#fff',
|
||||
padding: [5, 7, 5, 7],
|
||||
backgroundColor: 'auto',
|
||||
borderColor: null,
|
||||
borderWidth: 0,
|
||||
borderRadius: 3
|
||||
},
|
||||
handle: {
|
||||
show: false,
|
||||
// eslint-disable-next-line
|
||||
icon: 'M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4h1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7v-1.2h6.6z M13.3,22H6.7v-1.2h6.6z M13.3,19.6H6.7v-1.2h6.6z',
|
||||
size: 45,
|
||||
// handle margin is from symbol center to axis, which is stable when circular move.
|
||||
margin: 50,
|
||||
// color: '#1b8bbd'
|
||||
// color: '#2f4554'
|
||||
color: '#333',
|
||||
shadowBlur: 3,
|
||||
shadowColor: '#aaa',
|
||||
shadowOffsetX: 0,
|
||||
shadowOffsetY: 2,
|
||||
// For mobile performance
|
||||
throttle: 40
|
||||
}
|
||||
};
|
||||
return AxisPointerModel;
|
||||
}(ComponentModel);
|
||||
export default AxisPointerModel;
|
80
frontend/node_modules/echarts/lib/component/axisPointer/AxisPointerView.js
generated
vendored
Normal file
80
frontend/node_modules/echarts/lib/component/axisPointer/AxisPointerView.js
generated
vendored
Normal file
@ -0,0 +1,80 @@
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT 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 globalListener from './globalListener.js';
|
||||
import ComponentView from '../../view/Component.js';
|
||||
var AxisPointerView = /** @class */function (_super) {
|
||||
__extends(AxisPointerView, _super);
|
||||
function AxisPointerView() {
|
||||
var _this = _super !== null && _super.apply(this, arguments) || this;
|
||||
_this.type = AxisPointerView.type;
|
||||
return _this;
|
||||
}
|
||||
AxisPointerView.prototype.render = function (globalAxisPointerModel, ecModel, api) {
|
||||
var globalTooltipModel = ecModel.getComponent('tooltip');
|
||||
var triggerOn = globalAxisPointerModel.get('triggerOn') || globalTooltipModel && globalTooltipModel.get('triggerOn') || 'mousemove|click';
|
||||
// Register global listener in AxisPointerView to enable
|
||||
// AxisPointerView to be independent to Tooltip.
|
||||
globalListener.register('axisPointer', api, function (currTrigger, e, dispatchAction) {
|
||||
// If 'none', it is not controlled by mouse totally.
|
||||
if (triggerOn !== 'none' && (currTrigger === 'leave' || triggerOn.indexOf(currTrigger) >= 0)) {
|
||||
dispatchAction({
|
||||
type: 'updateAxisPointer',
|
||||
currTrigger: currTrigger,
|
||||
x: e && e.offsetX,
|
||||
y: e && e.offsetY
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
AxisPointerView.prototype.remove = function (ecModel, api) {
|
||||
globalListener.unregister('axisPointer', api);
|
||||
};
|
||||
AxisPointerView.prototype.dispose = function (ecModel, api) {
|
||||
globalListener.unregister('axisPointer', api);
|
||||
};
|
||||
AxisPointerView.type = 'axisPointer';
|
||||
return AxisPointerView;
|
||||
}(ComponentView);
|
||||
export default AxisPointerView;
|
392
frontend/node_modules/echarts/lib/component/axisPointer/BaseAxisPointer.js
generated
vendored
Normal file
392
frontend/node_modules/echarts/lib/component/axisPointer/BaseAxisPointer.js
generated
vendored
Normal file
@ -0,0 +1,392 @@
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* AUTO-GENERATED FILE. DO NOT MODIFY.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import * as zrUtil from 'zrender/lib/core/util.js';
|
||||
import * as graphic from '../../util/graphic.js';
|
||||
import * as axisPointerModelHelper from './modelHelper.js';
|
||||
import * as eventTool from 'zrender/lib/core/event.js';
|
||||
import * as throttleUtil from '../../util/throttle.js';
|
||||
import { makeInner } from '../../util/model.js';
|
||||
var inner = makeInner();
|
||||
var clone = zrUtil.clone;
|
||||
var bind = zrUtil.bind;
|
||||
/**
|
||||
* Base axis pointer class in 2D.
|
||||
*/
|
||||
var BaseAxisPointer = /** @class */function () {
|
||||
function BaseAxisPointer() {
|
||||
this._dragging = false;
|
||||
/**
|
||||
* In px, arbitrary value. Do not set too small,
|
||||
* no animation is ok for most cases.
|
||||
*/
|
||||
this.animationThreshold = 15;
|
||||
}
|
||||
/**
|
||||
* @implement
|
||||
*/
|
||||
BaseAxisPointer.prototype.render = function (axisModel, axisPointerModel, api, forceRender) {
|
||||
var value = axisPointerModel.get('value');
|
||||
var status = axisPointerModel.get('status');
|
||||
// Bind them to `this`, not in closure, otherwise they will not
|
||||
// be replaced when user calling setOption in not merge mode.
|
||||
this._axisModel = axisModel;
|
||||
this._axisPointerModel = axisPointerModel;
|
||||
this._api = api;
|
||||
// Optimize: `render` will be called repeatedly during mouse move.
|
||||
// So it is power consuming if performing `render` each time,
|
||||
// especially on mobile device.
|
||||
if (!forceRender && this._lastValue === value && this._lastStatus === status) {
|
||||
return;
|
||||
}
|
||||
this._lastValue = value;
|
||||
this._lastStatus = status;
|
||||
var group = this._group;
|
||||
var handle = this._handle;
|
||||
if (!status || status === 'hide') {
|
||||
// Do not clear here, for animation better.
|
||||
group && group.hide();
|
||||
handle && handle.hide();
|
||||
return;
|
||||
}
|
||||
group && group.show();
|
||||
handle && handle.show();
|
||||
// Otherwise status is 'show'
|
||||
var elOption = {};
|
||||
this.makeElOption(elOption, value, axisModel, axisPointerModel, api);
|
||||
// Enable change axis pointer type.
|
||||
var graphicKey = elOption.graphicKey;
|
||||
if (graphicKey !== this._lastGraphicKey) {
|
||||
this.clear(api);
|
||||
}
|
||||
this._lastGraphicKey = graphicKey;
|
||||
var moveAnimation = this._moveAnimation = this.determineAnimation(axisModel, axisPointerModel);
|
||||
if (!group) {
|
||||
group = this._group = new graphic.Group();
|
||||
this.createPointerEl(group, elOption, axisModel, axisPointerModel);
|
||||
this.createLabelEl(group, elOption, axisModel, axisPointerModel);
|
||||
api.getZr().add(group);
|
||||
} else {
|
||||
var doUpdateProps = zrUtil.curry(updateProps, axisPointerModel, moveAnimation);
|
||||
this.updatePointerEl(group, elOption, doUpdateProps);
|
||||
this.updateLabelEl(group, elOption, doUpdateProps, axisPointerModel);
|
||||
}
|
||||
updateMandatoryProps(group, axisPointerModel, true);
|
||||
this._renderHandle(value);
|
||||
};
|
||||
/**
|
||||
* @implement
|
||||
*/
|
||||
BaseAxisPointer.prototype.remove = function (api) {
|
||||
this.clear(api);
|
||||
};
|
||||
/**
|
||||
* @implement
|
||||
*/
|
||||
BaseAxisPointer.prototype.dispose = function (api) {
|
||||
this.clear(api);
|
||||
};
|
||||
/**
|
||||
* @protected
|
||||
*/
|
||||
BaseAxisPointer.prototype.determineAnimation = function (axisModel, axisPointerModel) {
|
||||
var animation = axisPointerModel.get('animation');
|
||||
var axis = axisModel.axis;
|
||||
var isCategoryAxis = axis.type === 'category';
|
||||
var useSnap = axisPointerModel.get('snap');
|
||||
// Value axis without snap always do not snap.
|
||||
if (!useSnap && !isCategoryAxis) {
|
||||
return false;
|
||||
}
|
||||
if (animation === 'auto' || animation == null) {
|
||||
var animationThreshold = this.animationThreshold;
|
||||
if (isCategoryAxis && axis.getBandWidth() > animationThreshold) {
|
||||
return true;
|
||||
}
|
||||
// It is important to auto animation when snap used. Consider if there is
|
||||
// a dataZoom, animation will be disabled when too many points exist, while
|
||||
// it will be enabled for better visual effect when little points exist.
|
||||
if (useSnap) {
|
||||
var seriesDataCount = axisPointerModelHelper.getAxisInfo(axisModel).seriesDataCount;
|
||||
var axisExtent = axis.getExtent();
|
||||
// Approximate band width
|
||||
return Math.abs(axisExtent[0] - axisExtent[1]) / seriesDataCount > animationThreshold;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return animation === true;
|
||||
};
|
||||
/**
|
||||
* add {pointer, label, graphicKey} to elOption
|
||||
* @protected
|
||||
*/
|
||||
BaseAxisPointer.prototype.makeElOption = function (elOption, value, axisModel, axisPointerModel, api) {
|
||||
// Should be implemenented by sub-class.
|
||||
};
|
||||
/**
|
||||
* @protected
|
||||
*/
|
||||
BaseAxisPointer.prototype.createPointerEl = function (group, elOption, axisModel, axisPointerModel) {
|
||||
var pointerOption = elOption.pointer;
|
||||
if (pointerOption) {
|
||||
var pointerEl = inner(group).pointerEl = new graphic[pointerOption.type](clone(elOption.pointer));
|
||||
group.add(pointerEl);
|
||||
}
|
||||
};
|
||||
/**
|
||||
* @protected
|
||||
*/
|
||||
BaseAxisPointer.prototype.createLabelEl = function (group, elOption, axisModel, axisPointerModel) {
|
||||
if (elOption.label) {
|
||||
var labelEl = inner(group).labelEl = new graphic.Text(clone(elOption.label));
|
||||
group.add(labelEl);
|
||||
updateLabelShowHide(labelEl, axisPointerModel);
|
||||
}
|
||||
};
|
||||
/**
|
||||
* @protected
|
||||
*/
|
||||
BaseAxisPointer.prototype.updatePointerEl = function (group, elOption, updateProps) {
|
||||
var pointerEl = inner(group).pointerEl;
|
||||
if (pointerEl && elOption.pointer) {
|
||||
pointerEl.setStyle(elOption.pointer.style);
|
||||
updateProps(pointerEl, {
|
||||
shape: elOption.pointer.shape
|
||||
});
|
||||
}
|
||||
};
|
||||
/**
|
||||
* @protected
|
||||
*/
|
||||
BaseAxisPointer.prototype.updateLabelEl = function (group, elOption, updateProps, axisPointerModel) {
|
||||
var labelEl = inner(group).labelEl;
|
||||
if (labelEl) {
|
||||
labelEl.setStyle(elOption.label.style);
|
||||
updateProps(labelEl, {
|
||||
// Consider text length change in vertical axis, animation should
|
||||
// be used on shape, otherwise the effect will be weird.
|
||||
// TODOTODO
|
||||
// shape: elOption.label.shape,
|
||||
x: elOption.label.x,
|
||||
y: elOption.label.y
|
||||
});
|
||||
updateLabelShowHide(labelEl, axisPointerModel);
|
||||
}
|
||||
};
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
BaseAxisPointer.prototype._renderHandle = function (value) {
|
||||
if (this._dragging || !this.updateHandleTransform) {
|
||||
return;
|
||||
}
|
||||
var axisPointerModel = this._axisPointerModel;
|
||||
var zr = this._api.getZr();
|
||||
var handle = this._handle;
|
||||
var handleModel = axisPointerModel.getModel('handle');
|
||||
var status = axisPointerModel.get('status');
|
||||
if (!handleModel.get('show') || !status || status === 'hide') {
|
||||
handle && zr.remove(handle);
|
||||
this._handle = null;
|
||||
return;
|
||||
}
|
||||
var isInit;
|
||||
if (!this._handle) {
|
||||
isInit = true;
|
||||
handle = this._handle = graphic.createIcon(handleModel.get('icon'), {
|
||||
cursor: 'move',
|
||||
draggable: true,
|
||||
onmousemove: function (e) {
|
||||
// For mobile device, prevent screen slider on the button.
|
||||
eventTool.stop(e.event);
|
||||
},
|
||||
onmousedown: bind(this._onHandleDragMove, this, 0, 0),
|
||||
drift: bind(this._onHandleDragMove, this),
|
||||
ondragend: bind(this._onHandleDragEnd, this)
|
||||
});
|
||||
zr.add(handle);
|
||||
}
|
||||
updateMandatoryProps(handle, axisPointerModel, false);
|
||||
// update style
|
||||
handle.setStyle(handleModel.getItemStyle(null, ['color', 'borderColor', 'borderWidth', 'opacity', 'shadowColor', 'shadowBlur', 'shadowOffsetX', 'shadowOffsetY']));
|
||||
// update position
|
||||
var handleSize = handleModel.get('size');
|
||||
if (!zrUtil.isArray(handleSize)) {
|
||||
handleSize = [handleSize, handleSize];
|
||||
}
|
||||
handle.scaleX = handleSize[0] / 2;
|
||||
handle.scaleY = handleSize[1] / 2;
|
||||
throttleUtil.createOrUpdate(this, '_doDispatchAxisPointer', handleModel.get('throttle') || 0, 'fixRate');
|
||||
this._moveHandleToValue(value, isInit);
|
||||
};
|
||||
BaseAxisPointer.prototype._moveHandleToValue = function (value, isInit) {
|
||||
updateProps(this._axisPointerModel, !isInit && this._moveAnimation, this._handle, getHandleTransProps(this.getHandleTransform(value, this._axisModel, this._axisPointerModel)));
|
||||
};
|
||||
BaseAxisPointer.prototype._onHandleDragMove = function (dx, dy) {
|
||||
var handle = this._handle;
|
||||
if (!handle) {
|
||||
return;
|
||||
}
|
||||
this._dragging = true;
|
||||
// Persistent for throttle.
|
||||
var trans = this.updateHandleTransform(getHandleTransProps(handle), [dx, dy], this._axisModel, this._axisPointerModel);
|
||||
this._payloadInfo = trans;
|
||||
handle.stopAnimation();
|
||||
handle.attr(getHandleTransProps(trans));
|
||||
inner(handle).lastProp = null;
|
||||
this._doDispatchAxisPointer();
|
||||
};
|
||||
/**
|
||||
* Throttled method.
|
||||
*/
|
||||
BaseAxisPointer.prototype._doDispatchAxisPointer = function () {
|
||||
var handle = this._handle;
|
||||
if (!handle) {
|
||||
return;
|
||||
}
|
||||
var payloadInfo = this._payloadInfo;
|
||||
var axisModel = this._axisModel;
|
||||
this._api.dispatchAction({
|
||||
type: 'updateAxisPointer',
|
||||
x: payloadInfo.cursorPoint[0],
|
||||
y: payloadInfo.cursorPoint[1],
|
||||
tooltipOption: payloadInfo.tooltipOption,
|
||||
axesInfo: [{
|
||||
axisDim: axisModel.axis.dim,
|
||||
axisIndex: axisModel.componentIndex
|
||||
}]
|
||||
});
|
||||
};
|
||||
BaseAxisPointer.prototype._onHandleDragEnd = function () {
|
||||
this._dragging = false;
|
||||
var handle = this._handle;
|
||||
if (!handle) {
|
||||
return;
|
||||
}
|
||||
var value = this._axisPointerModel.get('value');
|
||||
// Consider snap or categroy axis, handle may be not consistent with
|
||||
// axisPointer. So move handle to align the exact value position when
|
||||
// drag ended.
|
||||
this._moveHandleToValue(value);
|
||||
// For the effect: tooltip will be shown when finger holding on handle
|
||||
// button, and will be hidden after finger left handle button.
|
||||
this._api.dispatchAction({
|
||||
type: 'hideTip'
|
||||
});
|
||||
};
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
BaseAxisPointer.prototype.clear = function (api) {
|
||||
this._lastValue = null;
|
||||
this._lastStatus = null;
|
||||
var zr = api.getZr();
|
||||
var group = this._group;
|
||||
var handle = this._handle;
|
||||
if (zr && group) {
|
||||
this._lastGraphicKey = null;
|
||||
group && zr.remove(group);
|
||||
handle && zr.remove(handle);
|
||||
this._group = null;
|
||||
this._handle = null;
|
||||
this._payloadInfo = null;
|
||||
}
|
||||
throttleUtil.clear(this, '_doDispatchAxisPointer');
|
||||
};
|
||||
/**
|
||||
* @protected
|
||||
*/
|
||||
BaseAxisPointer.prototype.doClear = function () {
|
||||
// Implemented by sub-class if necessary.
|
||||
};
|
||||
BaseAxisPointer.prototype.buildLabel = function (xy, wh, xDimIndex) {
|
||||
xDimIndex = xDimIndex || 0;
|
||||
return {
|
||||
x: xy[xDimIndex],
|
||||
y: xy[1 - xDimIndex],
|
||||
width: wh[xDimIndex],
|
||||
height: wh[1 - xDimIndex]
|
||||
};
|
||||
};
|
||||
return BaseAxisPointer;
|
||||
}();
|
||||
function updateProps(animationModel, moveAnimation, el, props) {
|
||||
// Animation optimize.
|
||||
if (!propsEqual(inner(el).lastProp, props)) {
|
||||
inner(el).lastProp = props;
|
||||
moveAnimation ? graphic.updateProps(el, props, animationModel) : (el.stopAnimation(), el.attr(props));
|
||||
}
|
||||
}
|
||||
function propsEqual(lastProps, newProps) {
|
||||
if (zrUtil.isObject(lastProps) && zrUtil.isObject(newProps)) {
|
||||
var equals_1 = true;
|
||||
zrUtil.each(newProps, function (item, key) {
|
||||
equals_1 = equals_1 && propsEqual(lastProps[key], item);
|
||||
});
|
||||
return !!equals_1;
|
||||
} else {
|
||||
return lastProps === newProps;
|
||||
}
|
||||
}
|
||||
function updateLabelShowHide(labelEl, axisPointerModel) {
|
||||
labelEl[axisPointerModel.get(['label', 'show']) ? 'show' : 'hide']();
|
||||
}
|
||||
function getHandleTransProps(trans) {
|
||||
return {
|
||||
x: trans.x || 0,
|
||||
y: trans.y || 0,
|
||||
rotation: trans.rotation || 0
|
||||
};
|
||||
}
|
||||
function updateMandatoryProps(group, axisPointerModel, silent) {
|
||||
var z = axisPointerModel.get('z');
|
||||
var zlevel = axisPointerModel.get('zlevel');
|
||||
group && group.traverse(function (el) {
|
||||
if (el.type !== 'group') {
|
||||
z != null && (el.z = z);
|
||||
zlevel != null && (el.zlevel = zlevel);
|
||||
el.silent = silent;
|
||||
}
|
||||
});
|
||||
}
|
||||
export default BaseAxisPointer;
|
148
frontend/node_modules/echarts/lib/component/axisPointer/CartesianAxisPointer.js
generated
vendored
Normal file
148
frontend/node_modules/echarts/lib/component/axisPointer/CartesianAxisPointer.js
generated
vendored
Normal file
@ -0,0 +1,148 @@
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT 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 BaseAxisPointer from './BaseAxisPointer.js';
|
||||
import * as viewHelper from './viewHelper.js';
|
||||
import * as cartesianAxisHelper from '../../coord/cartesian/cartesianAxisHelper.js';
|
||||
var CartesianAxisPointer = /** @class */function (_super) {
|
||||
__extends(CartesianAxisPointer, _super);
|
||||
function CartesianAxisPointer() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
CartesianAxisPointer.prototype.makeElOption = function (elOption, value, axisModel, axisPointerModel, api) {
|
||||
var axis = axisModel.axis;
|
||||
var grid = axis.grid;
|
||||
var axisPointerType = axisPointerModel.get('type');
|
||||
var otherExtent = getCartesian(grid, axis).getOtherAxis(axis).getGlobalExtent();
|
||||
var pixelValue = axis.toGlobalCoord(axis.dataToCoord(value, true));
|
||||
if (axisPointerType && axisPointerType !== 'none') {
|
||||
var elStyle = viewHelper.buildElStyle(axisPointerModel);
|
||||
var pointerOption = pointerShapeBuilder[axisPointerType](axis, pixelValue, otherExtent);
|
||||
pointerOption.style = elStyle;
|
||||
elOption.graphicKey = pointerOption.type;
|
||||
elOption.pointer = pointerOption;
|
||||
}
|
||||
var layoutInfo = cartesianAxisHelper.layout(grid.model, axisModel);
|
||||
viewHelper.buildCartesianSingleLabelElOption(
|
||||
// @ts-ignore
|
||||
value, elOption, layoutInfo, axisModel, axisPointerModel, api);
|
||||
};
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
CartesianAxisPointer.prototype.getHandleTransform = function (value, axisModel, axisPointerModel) {
|
||||
var layoutInfo = cartesianAxisHelper.layout(axisModel.axis.grid.model, axisModel, {
|
||||
labelInside: false
|
||||
});
|
||||
// @ts-ignore
|
||||
layoutInfo.labelMargin = axisPointerModel.get(['handle', 'margin']);
|
||||
var pos = viewHelper.getTransformedPosition(axisModel.axis, value, layoutInfo);
|
||||
return {
|
||||
x: pos[0],
|
||||
y: pos[1],
|
||||
rotation: layoutInfo.rotation + (layoutInfo.labelDirection < 0 ? Math.PI : 0)
|
||||
};
|
||||
};
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
CartesianAxisPointer.prototype.updateHandleTransform = function (transform, delta, axisModel, axisPointerModel) {
|
||||
var axis = axisModel.axis;
|
||||
var grid = axis.grid;
|
||||
var axisExtent = axis.getGlobalExtent(true);
|
||||
var otherExtent = getCartesian(grid, axis).getOtherAxis(axis).getGlobalExtent();
|
||||
var dimIndex = axis.dim === 'x' ? 0 : 1;
|
||||
var currPosition = [transform.x, transform.y];
|
||||
currPosition[dimIndex] += delta[dimIndex];
|
||||
currPosition[dimIndex] = Math.min(axisExtent[1], currPosition[dimIndex]);
|
||||
currPosition[dimIndex] = Math.max(axisExtent[0], currPosition[dimIndex]);
|
||||
var cursorOtherValue = (otherExtent[1] + otherExtent[0]) / 2;
|
||||
var cursorPoint = [cursorOtherValue, cursorOtherValue];
|
||||
cursorPoint[dimIndex] = currPosition[dimIndex];
|
||||
// Make tooltip do not overlap axisPointer and in the middle of the grid.
|
||||
var tooltipOptions = [{
|
||||
verticalAlign: 'middle'
|
||||
}, {
|
||||
align: 'center'
|
||||
}];
|
||||
return {
|
||||
x: currPosition[0],
|
||||
y: currPosition[1],
|
||||
rotation: transform.rotation,
|
||||
cursorPoint: cursorPoint,
|
||||
tooltipOption: tooltipOptions[dimIndex]
|
||||
};
|
||||
};
|
||||
return CartesianAxisPointer;
|
||||
}(BaseAxisPointer);
|
||||
function getCartesian(grid, axis) {
|
||||
var opt = {};
|
||||
opt[axis.dim + 'AxisIndex'] = axis.index;
|
||||
return grid.getCartesian(opt);
|
||||
}
|
||||
var pointerShapeBuilder = {
|
||||
line: function (axis, pixelValue, otherExtent) {
|
||||
var targetShape = viewHelper.makeLineShape([pixelValue, otherExtent[0]], [pixelValue, otherExtent[1]], getAxisDimIndex(axis));
|
||||
return {
|
||||
type: 'Line',
|
||||
subPixelOptimize: true,
|
||||
shape: targetShape
|
||||
};
|
||||
},
|
||||
shadow: function (axis, pixelValue, otherExtent) {
|
||||
var bandWidth = Math.max(1, axis.getBandWidth());
|
||||
var span = otherExtent[1] - otherExtent[0];
|
||||
return {
|
||||
type: 'Rect',
|
||||
shape: viewHelper.makeRectShape([pixelValue - bandWidth / 2, otherExtent[0]], [bandWidth, span], getAxisDimIndex(axis))
|
||||
};
|
||||
}
|
||||
};
|
||||
function getAxisDimIndex(axis) {
|
||||
return axis.dim === 'x' ? 0 : 1;
|
||||
}
|
||||
export default CartesianAxisPointer;
|
144
frontend/node_modules/echarts/lib/component/axisPointer/PolarAxisPointer.js
generated
vendored
Normal file
144
frontend/node_modules/echarts/lib/component/axisPointer/PolarAxisPointer.js
generated
vendored
Normal file
@ -0,0 +1,144 @@
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* AUTO-GENERATED FILE. DO NOT MODIFY.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { __extends } from "tslib";
|
||||
import BaseAxisPointer from './BaseAxisPointer.js';
|
||||
import * as graphic from '../../util/graphic.js';
|
||||
import * as viewHelper from './viewHelper.js';
|
||||
import * as matrix from 'zrender/lib/core/matrix.js';
|
||||
import AxisBuilder from '../axis/AxisBuilder.js';
|
||||
var PolarAxisPointer = /** @class */function (_super) {
|
||||
__extends(PolarAxisPointer, _super);
|
||||
function PolarAxisPointer() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
PolarAxisPointer.prototype.makeElOption = function (elOption, value, axisModel, axisPointerModel, api) {
|
||||
var axis = axisModel.axis;
|
||||
if (axis.dim === 'angle') {
|
||||
this.animationThreshold = Math.PI / 18;
|
||||
}
|
||||
var polar = axis.polar;
|
||||
var otherAxis = polar.getOtherAxis(axis);
|
||||
var otherExtent = otherAxis.getExtent();
|
||||
var coordValue = axis.dataToCoord(value);
|
||||
var axisPointerType = axisPointerModel.get('type');
|
||||
if (axisPointerType && axisPointerType !== 'none') {
|
||||
var elStyle = viewHelper.buildElStyle(axisPointerModel);
|
||||
var pointerOption = pointerShapeBuilder[axisPointerType](axis, polar, coordValue, otherExtent);
|
||||
pointerOption.style = elStyle;
|
||||
elOption.graphicKey = pointerOption.type;
|
||||
elOption.pointer = pointerOption;
|
||||
}
|
||||
var labelMargin = axisPointerModel.get(['label', 'margin']);
|
||||
var labelPos = getLabelPosition(value, axisModel, axisPointerModel, polar, labelMargin);
|
||||
viewHelper.buildLabelElOption(elOption, axisModel, axisPointerModel, api, labelPos);
|
||||
};
|
||||
return PolarAxisPointer;
|
||||
}(BaseAxisPointer);
|
||||
;
|
||||
function getLabelPosition(value, axisModel, axisPointerModel, polar, labelMargin) {
|
||||
var axis = axisModel.axis;
|
||||
var coord = axis.dataToCoord(value);
|
||||
var axisAngle = polar.getAngleAxis().getExtent()[0];
|
||||
axisAngle = axisAngle / 180 * Math.PI;
|
||||
var radiusExtent = polar.getRadiusAxis().getExtent();
|
||||
var position;
|
||||
var align;
|
||||
var verticalAlign;
|
||||
if (axis.dim === 'radius') {
|
||||
var transform = matrix.create();
|
||||
matrix.rotate(transform, transform, axisAngle);
|
||||
matrix.translate(transform, transform, [polar.cx, polar.cy]);
|
||||
position = graphic.applyTransform([coord, -labelMargin], transform);
|
||||
var labelRotation = axisModel.getModel('axisLabel').get('rotate') || 0;
|
||||
// @ts-ignore
|
||||
var labelLayout = AxisBuilder.innerTextLayout(axisAngle, labelRotation * Math.PI / 180, -1);
|
||||
align = labelLayout.textAlign;
|
||||
verticalAlign = labelLayout.textVerticalAlign;
|
||||
} else {
|
||||
// angle axis
|
||||
var r = radiusExtent[1];
|
||||
position = polar.coordToPoint([r + labelMargin, coord]);
|
||||
var cx = polar.cx;
|
||||
var cy = polar.cy;
|
||||
align = Math.abs(position[0] - cx) / r < 0.3 ? 'center' : position[0] > cx ? 'left' : 'right';
|
||||
verticalAlign = Math.abs(position[1] - cy) / r < 0.3 ? 'middle' : position[1] > cy ? 'top' : 'bottom';
|
||||
}
|
||||
return {
|
||||
position: position,
|
||||
align: align,
|
||||
verticalAlign: verticalAlign
|
||||
};
|
||||
}
|
||||
var pointerShapeBuilder = {
|
||||
line: function (axis, polar, coordValue, otherExtent) {
|
||||
return axis.dim === 'angle' ? {
|
||||
type: 'Line',
|
||||
shape: viewHelper.makeLineShape(polar.coordToPoint([otherExtent[0], coordValue]), polar.coordToPoint([otherExtent[1], coordValue]))
|
||||
} : {
|
||||
type: 'Circle',
|
||||
shape: {
|
||||
cx: polar.cx,
|
||||
cy: polar.cy,
|
||||
r: coordValue
|
||||
}
|
||||
};
|
||||
},
|
||||
shadow: function (axis, polar, coordValue, otherExtent) {
|
||||
var bandWidth = Math.max(1, axis.getBandWidth());
|
||||
var radian = Math.PI / 180;
|
||||
return axis.dim === 'angle' ? {
|
||||
type: 'Sector',
|
||||
shape: viewHelper.makeSectorShape(polar.cx, polar.cy, otherExtent[0], otherExtent[1],
|
||||
// In ECharts y is negative if angle is positive
|
||||
(-coordValue - bandWidth / 2) * radian, (-coordValue + bandWidth / 2) * radian)
|
||||
} : {
|
||||
type: 'Sector',
|
||||
shape: viewHelper.makeSectorShape(polar.cx, polar.cy, coordValue - bandWidth / 2, coordValue + bandWidth / 2, 0, Math.PI * 2)
|
||||
};
|
||||
}
|
||||
};
|
||||
export default PolarAxisPointer;
|
145
frontend/node_modules/echarts/lib/component/axisPointer/SingleAxisPointer.js
generated
vendored
Normal file
145
frontend/node_modules/echarts/lib/component/axisPointer/SingleAxisPointer.js
generated
vendored
Normal file
@ -0,0 +1,145 @@
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT 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 BaseAxisPointer from './BaseAxisPointer.js';
|
||||
import * as viewHelper from './viewHelper.js';
|
||||
import * as singleAxisHelper from '../../coord/single/singleAxisHelper.js';
|
||||
var XY = ['x', 'y'];
|
||||
var WH = ['width', 'height'];
|
||||
var SingleAxisPointer = /** @class */function (_super) {
|
||||
__extends(SingleAxisPointer, _super);
|
||||
function SingleAxisPointer() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
SingleAxisPointer.prototype.makeElOption = function (elOption, value, axisModel, axisPointerModel, api) {
|
||||
var axis = axisModel.axis;
|
||||
var coordSys = axis.coordinateSystem;
|
||||
var otherExtent = getGlobalExtent(coordSys, 1 - getPointDimIndex(axis));
|
||||
var pixelValue = coordSys.dataToPoint(value)[0];
|
||||
var axisPointerType = axisPointerModel.get('type');
|
||||
if (axisPointerType && axisPointerType !== 'none') {
|
||||
var elStyle = viewHelper.buildElStyle(axisPointerModel);
|
||||
var pointerOption = pointerShapeBuilder[axisPointerType](axis, pixelValue, otherExtent);
|
||||
pointerOption.style = elStyle;
|
||||
elOption.graphicKey = pointerOption.type;
|
||||
elOption.pointer = pointerOption;
|
||||
}
|
||||
var layoutInfo = singleAxisHelper.layout(axisModel);
|
||||
viewHelper.buildCartesianSingleLabelElOption(
|
||||
// @ts-ignore
|
||||
value, elOption, layoutInfo, axisModel, axisPointerModel, api);
|
||||
};
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
SingleAxisPointer.prototype.getHandleTransform = function (value, axisModel, axisPointerModel) {
|
||||
var layoutInfo = singleAxisHelper.layout(axisModel, {
|
||||
labelInside: false
|
||||
});
|
||||
// @ts-ignore
|
||||
layoutInfo.labelMargin = axisPointerModel.get(['handle', 'margin']);
|
||||
var position = viewHelper.getTransformedPosition(axisModel.axis, value, layoutInfo);
|
||||
return {
|
||||
x: position[0],
|
||||
y: position[1],
|
||||
rotation: layoutInfo.rotation + (layoutInfo.labelDirection < 0 ? Math.PI : 0)
|
||||
};
|
||||
};
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
SingleAxisPointer.prototype.updateHandleTransform = function (transform, delta, axisModel, axisPointerModel) {
|
||||
var axis = axisModel.axis;
|
||||
var coordSys = axis.coordinateSystem;
|
||||
var dimIndex = getPointDimIndex(axis);
|
||||
var axisExtent = getGlobalExtent(coordSys, dimIndex);
|
||||
var currPosition = [transform.x, transform.y];
|
||||
currPosition[dimIndex] += delta[dimIndex];
|
||||
currPosition[dimIndex] = Math.min(axisExtent[1], currPosition[dimIndex]);
|
||||
currPosition[dimIndex] = Math.max(axisExtent[0], currPosition[dimIndex]);
|
||||
var otherExtent = getGlobalExtent(coordSys, 1 - dimIndex);
|
||||
var cursorOtherValue = (otherExtent[1] + otherExtent[0]) / 2;
|
||||
var cursorPoint = [cursorOtherValue, cursorOtherValue];
|
||||
cursorPoint[dimIndex] = currPosition[dimIndex];
|
||||
return {
|
||||
x: currPosition[0],
|
||||
y: currPosition[1],
|
||||
rotation: transform.rotation,
|
||||
cursorPoint: cursorPoint,
|
||||
tooltipOption: {
|
||||
verticalAlign: 'middle'
|
||||
}
|
||||
};
|
||||
};
|
||||
return SingleAxisPointer;
|
||||
}(BaseAxisPointer);
|
||||
var pointerShapeBuilder = {
|
||||
line: function (axis, pixelValue, otherExtent) {
|
||||
var targetShape = viewHelper.makeLineShape([pixelValue, otherExtent[0]], [pixelValue, otherExtent[1]], getPointDimIndex(axis));
|
||||
return {
|
||||
type: 'Line',
|
||||
subPixelOptimize: true,
|
||||
shape: targetShape
|
||||
};
|
||||
},
|
||||
shadow: function (axis, pixelValue, otherExtent) {
|
||||
var bandWidth = axis.getBandWidth();
|
||||
var span = otherExtent[1] - otherExtent[0];
|
||||
return {
|
||||
type: 'Rect',
|
||||
shape: viewHelper.makeRectShape([pixelValue - bandWidth / 2, otherExtent[0]], [bandWidth, span], getPointDimIndex(axis))
|
||||
};
|
||||
}
|
||||
};
|
||||
function getPointDimIndex(axis) {
|
||||
return axis.isHorizontal() ? 0 : 1;
|
||||
}
|
||||
function getGlobalExtent(coordSys, dimIndex) {
|
||||
var rect = coordSys.getRect();
|
||||
return [rect[XY[dimIndex]], rect[XY[dimIndex]] + rect[WH[dimIndex]]];
|
||||
}
|
||||
export default SingleAxisPointer;
|
378
frontend/node_modules/echarts/lib/component/axisPointer/axisTrigger.js
generated
vendored
Normal file
378
frontend/node_modules/echarts/lib/component/axisPointer/axisTrigger.js
generated
vendored
Normal file
@ -0,0 +1,378 @@
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT 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';
|
||||
import * as modelHelper from './modelHelper.js';
|
||||
import findPointFromSeries from './findPointFromSeries.js';
|
||||
import { each, curry, bind, extend } from 'zrender/lib/core/util.js';
|
||||
var inner = makeInner();
|
||||
/**
|
||||
* Basic logic: check all axis, if they do not demand show/highlight,
|
||||
* then hide/downplay them.
|
||||
*
|
||||
* @return content of event obj for echarts.connect.
|
||||
*/
|
||||
export default function axisTrigger(payload, ecModel, api) {
|
||||
var currTrigger = payload.currTrigger;
|
||||
var point = [payload.x, payload.y];
|
||||
var finder = payload;
|
||||
var dispatchAction = payload.dispatchAction || bind(api.dispatchAction, api);
|
||||
var coordSysAxesInfo = ecModel.getComponent('axisPointer').coordSysAxesInfo;
|
||||
// Pending
|
||||
// See #6121. But we are not able to reproduce it yet.
|
||||
if (!coordSysAxesInfo) {
|
||||
return;
|
||||
}
|
||||
if (illegalPoint(point)) {
|
||||
// Used in the default behavior of `connection`: use the sample seriesIndex
|
||||
// and dataIndex. And also used in the tooltipView trigger.
|
||||
point = findPointFromSeries({
|
||||
seriesIndex: finder.seriesIndex,
|
||||
// Do not use dataIndexInside from other ec instance.
|
||||
// FIXME: auto detect it?
|
||||
dataIndex: finder.dataIndex
|
||||
}, ecModel).point;
|
||||
}
|
||||
var isIllegalPoint = illegalPoint(point);
|
||||
// Axis and value can be specified when calling dispatchAction({type: 'updateAxisPointer'}).
|
||||
// Notice: In this case, it is difficult to get the `point` (which is necessary to show
|
||||
// tooltip, so if point is not given, we just use the point found by sample seriesIndex
|
||||
// and dataIndex.
|
||||
var inputAxesInfo = finder.axesInfo;
|
||||
var axesInfo = coordSysAxesInfo.axesInfo;
|
||||
var shouldHide = currTrigger === 'leave' || illegalPoint(point);
|
||||
var outputPayload = {};
|
||||
var showValueMap = {};
|
||||
var dataByCoordSys = {
|
||||
list: [],
|
||||
map: {}
|
||||
};
|
||||
var updaters = {
|
||||
showPointer: curry(showPointer, showValueMap),
|
||||
showTooltip: curry(showTooltip, dataByCoordSys)
|
||||
};
|
||||
// Process for triggered axes.
|
||||
each(coordSysAxesInfo.coordSysMap, function (coordSys, coordSysKey) {
|
||||
// If a point given, it must be contained by the coordinate system.
|
||||
var coordSysContainsPoint = isIllegalPoint || coordSys.containPoint(point);
|
||||
each(coordSysAxesInfo.coordSysAxesInfo[coordSysKey], function (axisInfo, key) {
|
||||
var axis = axisInfo.axis;
|
||||
var inputAxisInfo = findInputAxisInfo(inputAxesInfo, axisInfo);
|
||||
// If no inputAxesInfo, no axis is restricted.
|
||||
if (!shouldHide && coordSysContainsPoint && (!inputAxesInfo || inputAxisInfo)) {
|
||||
var val = inputAxisInfo && inputAxisInfo.value;
|
||||
if (val == null && !isIllegalPoint) {
|
||||
val = axis.pointToData(point);
|
||||
}
|
||||
val != null && processOnAxis(axisInfo, val, updaters, false, outputPayload);
|
||||
}
|
||||
});
|
||||
});
|
||||
// Process for linked axes.
|
||||
var linkTriggers = {};
|
||||
each(axesInfo, function (tarAxisInfo, tarKey) {
|
||||
var linkGroup = tarAxisInfo.linkGroup;
|
||||
// If axis has been triggered in the previous stage, it should not be triggered by link.
|
||||
if (linkGroup && !showValueMap[tarKey]) {
|
||||
each(linkGroup.axesInfo, function (srcAxisInfo, srcKey) {
|
||||
var srcValItem = showValueMap[srcKey];
|
||||
// If srcValItem exist, source axis is triggered, so link to target axis.
|
||||
if (srcAxisInfo !== tarAxisInfo && srcValItem) {
|
||||
var val = srcValItem.value;
|
||||
linkGroup.mapper && (val = tarAxisInfo.axis.scale.parse(linkGroup.mapper(val, makeMapperParam(srcAxisInfo), makeMapperParam(tarAxisInfo))));
|
||||
linkTriggers[tarAxisInfo.key] = val;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
each(linkTriggers, function (val, tarKey) {
|
||||
processOnAxis(axesInfo[tarKey], val, updaters, true, outputPayload);
|
||||
});
|
||||
updateModelActually(showValueMap, axesInfo, outputPayload);
|
||||
dispatchTooltipActually(dataByCoordSys, point, payload, dispatchAction);
|
||||
dispatchHighDownActually(axesInfo, dispatchAction, api);
|
||||
return outputPayload;
|
||||
}
|
||||
function processOnAxis(axisInfo, newValue, updaters, noSnap, outputFinder) {
|
||||
var axis = axisInfo.axis;
|
||||
if (axis.scale.isBlank() || !axis.containData(newValue)) {
|
||||
return;
|
||||
}
|
||||
if (!axisInfo.involveSeries) {
|
||||
updaters.showPointer(axisInfo, newValue);
|
||||
return;
|
||||
}
|
||||
// Heavy calculation. So put it after axis.containData checking.
|
||||
var payloadInfo = buildPayloadsBySeries(newValue, axisInfo);
|
||||
var payloadBatch = payloadInfo.payloadBatch;
|
||||
var snapToValue = payloadInfo.snapToValue;
|
||||
// Fill content of event obj for echarts.connect.
|
||||
// By default use the first involved series data as a sample to connect.
|
||||
if (payloadBatch[0] && outputFinder.seriesIndex == null) {
|
||||
extend(outputFinder, payloadBatch[0]);
|
||||
}
|
||||
// If no linkSource input, this process is for collecting link
|
||||
// target, where snap should not be accepted.
|
||||
if (!noSnap && axisInfo.snap) {
|
||||
if (axis.containData(snapToValue) && snapToValue != null) {
|
||||
newValue = snapToValue;
|
||||
}
|
||||
}
|
||||
updaters.showPointer(axisInfo, newValue, payloadBatch);
|
||||
// Tooltip should always be snapToValue, otherwise there will be
|
||||
// incorrect "axis value ~ series value" mapping displayed in tooltip.
|
||||
updaters.showTooltip(axisInfo, payloadInfo, snapToValue);
|
||||
}
|
||||
function buildPayloadsBySeries(value, axisInfo) {
|
||||
var axis = axisInfo.axis;
|
||||
var dim = axis.dim;
|
||||
var snapToValue = value;
|
||||
var payloadBatch = [];
|
||||
var minDist = Number.MAX_VALUE;
|
||||
var minDiff = -1;
|
||||
each(axisInfo.seriesModels, function (series, idx) {
|
||||
var dataDim = series.getData().mapDimensionsAll(dim);
|
||||
var seriesNestestValue;
|
||||
var dataIndices;
|
||||
if (series.getAxisTooltipData) {
|
||||
var result = series.getAxisTooltipData(dataDim, value, axis);
|
||||
dataIndices = result.dataIndices;
|
||||
seriesNestestValue = result.nestestValue;
|
||||
} else {
|
||||
dataIndices = series.getData().indicesOfNearest(dataDim[0], value,
|
||||
// Add a threshold to avoid find the wrong dataIndex
|
||||
// when data length is not same.
|
||||
// false,
|
||||
axis.type === 'category' ? 0.5 : null);
|
||||
if (!dataIndices.length) {
|
||||
return;
|
||||
}
|
||||
seriesNestestValue = series.getData().get(dataDim[0], dataIndices[0]);
|
||||
}
|
||||
if (seriesNestestValue == null || !isFinite(seriesNestestValue)) {
|
||||
return;
|
||||
}
|
||||
var diff = value - seriesNestestValue;
|
||||
var dist = Math.abs(diff);
|
||||
// Consider category case
|
||||
if (dist <= minDist) {
|
||||
if (dist < minDist || diff >= 0 && minDiff < 0) {
|
||||
minDist = dist;
|
||||
minDiff = diff;
|
||||
snapToValue = seriesNestestValue;
|
||||
payloadBatch.length = 0;
|
||||
}
|
||||
each(dataIndices, function (dataIndex) {
|
||||
payloadBatch.push({
|
||||
seriesIndex: series.seriesIndex,
|
||||
dataIndexInside: dataIndex,
|
||||
dataIndex: series.getData().getRawIndex(dataIndex)
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
return {
|
||||
payloadBatch: payloadBatch,
|
||||
snapToValue: snapToValue
|
||||
};
|
||||
}
|
||||
function showPointer(showValueMap, axisInfo, value, payloadBatch) {
|
||||
showValueMap[axisInfo.key] = {
|
||||
value: value,
|
||||
payloadBatch: payloadBatch
|
||||
};
|
||||
}
|
||||
function showTooltip(dataByCoordSys, axisInfo, payloadInfo, value) {
|
||||
var payloadBatch = payloadInfo.payloadBatch;
|
||||
var axis = axisInfo.axis;
|
||||
var axisModel = axis.model;
|
||||
var axisPointerModel = axisInfo.axisPointerModel;
|
||||
// If no data, do not create anything in dataByCoordSys,
|
||||
// whose length will be used to judge whether dispatch action.
|
||||
if (!axisInfo.triggerTooltip || !payloadBatch.length) {
|
||||
return;
|
||||
}
|
||||
var coordSysModel = axisInfo.coordSys.model;
|
||||
var coordSysKey = modelHelper.makeKey(coordSysModel);
|
||||
var coordSysItem = dataByCoordSys.map[coordSysKey];
|
||||
if (!coordSysItem) {
|
||||
coordSysItem = dataByCoordSys.map[coordSysKey] = {
|
||||
coordSysId: coordSysModel.id,
|
||||
coordSysIndex: coordSysModel.componentIndex,
|
||||
coordSysType: coordSysModel.type,
|
||||
coordSysMainType: coordSysModel.mainType,
|
||||
dataByAxis: []
|
||||
};
|
||||
dataByCoordSys.list.push(coordSysItem);
|
||||
}
|
||||
coordSysItem.dataByAxis.push({
|
||||
axisDim: axis.dim,
|
||||
axisIndex: axisModel.componentIndex,
|
||||
axisType: axisModel.type,
|
||||
axisId: axisModel.id,
|
||||
value: value,
|
||||
// Caustion: viewHelper.getValueLabel is actually on "view stage", which
|
||||
// depends that all models have been updated. So it should not be performed
|
||||
// here. Considering axisPointerModel used here is volatile, which is hard
|
||||
// to be retrieve in TooltipView, we prepare parameters here.
|
||||
valueLabelOpt: {
|
||||
precision: axisPointerModel.get(['label', 'precision']),
|
||||
formatter: axisPointerModel.get(['label', 'formatter'])
|
||||
},
|
||||
seriesDataIndices: payloadBatch.slice()
|
||||
});
|
||||
}
|
||||
function updateModelActually(showValueMap, axesInfo, outputPayload) {
|
||||
var outputAxesInfo = outputPayload.axesInfo = [];
|
||||
// Basic logic: If no 'show' required, 'hide' this axisPointer.
|
||||
each(axesInfo, function (axisInfo, key) {
|
||||
var option = axisInfo.axisPointerModel.option;
|
||||
var valItem = showValueMap[key];
|
||||
if (valItem) {
|
||||
!axisInfo.useHandle && (option.status = 'show');
|
||||
option.value = valItem.value;
|
||||
// For label formatter param and highlight.
|
||||
option.seriesDataIndices = (valItem.payloadBatch || []).slice();
|
||||
}
|
||||
// When always show (e.g., handle used), remain
|
||||
// original value and status.
|
||||
else {
|
||||
// If hide, value still need to be set, consider
|
||||
// click legend to toggle axis blank.
|
||||
!axisInfo.useHandle && (option.status = 'hide');
|
||||
}
|
||||
// If status is 'hide', should be no info in payload.
|
||||
option.status === 'show' && outputAxesInfo.push({
|
||||
axisDim: axisInfo.axis.dim,
|
||||
axisIndex: axisInfo.axis.model.componentIndex,
|
||||
value: option.value
|
||||
});
|
||||
});
|
||||
}
|
||||
function dispatchTooltipActually(dataByCoordSys, point, payload, dispatchAction) {
|
||||
// Basic logic: If no showTip required, hideTip will be dispatched.
|
||||
if (illegalPoint(point) || !dataByCoordSys.list.length) {
|
||||
dispatchAction({
|
||||
type: 'hideTip'
|
||||
});
|
||||
return;
|
||||
}
|
||||
// In most case only one axis (or event one series is used). It is
|
||||
// convenient to fetch payload.seriesIndex and payload.dataIndex
|
||||
// directly. So put the first seriesIndex and dataIndex of the first
|
||||
// axis on the payload.
|
||||
var sampleItem = ((dataByCoordSys.list[0].dataByAxis[0] || {}).seriesDataIndices || [])[0] || {};
|
||||
dispatchAction({
|
||||
type: 'showTip',
|
||||
escapeConnect: true,
|
||||
x: point[0],
|
||||
y: point[1],
|
||||
tooltipOption: payload.tooltipOption,
|
||||
position: payload.position,
|
||||
dataIndexInside: sampleItem.dataIndexInside,
|
||||
dataIndex: sampleItem.dataIndex,
|
||||
seriesIndex: sampleItem.seriesIndex,
|
||||
dataByCoordSys: dataByCoordSys.list
|
||||
});
|
||||
}
|
||||
function dispatchHighDownActually(axesInfo, dispatchAction, api) {
|
||||
// FIXME
|
||||
// highlight status modification should be a stage of main process?
|
||||
// (Consider confilct (e.g., legend and axisPointer) and setOption)
|
||||
var zr = api.getZr();
|
||||
var highDownKey = 'axisPointerLastHighlights';
|
||||
var lastHighlights = inner(zr)[highDownKey] || {};
|
||||
var newHighlights = inner(zr)[highDownKey] = {};
|
||||
// Update highlight/downplay status according to axisPointer model.
|
||||
// Build hash map and remove duplicate incidentally.
|
||||
each(axesInfo, function (axisInfo, key) {
|
||||
var option = axisInfo.axisPointerModel.option;
|
||||
option.status === 'show' && axisInfo.triggerEmphasis && each(option.seriesDataIndices, function (batchItem) {
|
||||
var key = batchItem.seriesIndex + ' | ' + batchItem.dataIndex;
|
||||
newHighlights[key] = batchItem;
|
||||
});
|
||||
});
|
||||
// Diff.
|
||||
var toHighlight = [];
|
||||
var toDownplay = [];
|
||||
each(lastHighlights, function (batchItem, key) {
|
||||
!newHighlights[key] && toDownplay.push(batchItem);
|
||||
});
|
||||
each(newHighlights, function (batchItem, key) {
|
||||
!lastHighlights[key] && toHighlight.push(batchItem);
|
||||
});
|
||||
toDownplay.length && api.dispatchAction({
|
||||
type: 'downplay',
|
||||
escapeConnect: true,
|
||||
// Not blur others when highlight in axisPointer.
|
||||
notBlur: true,
|
||||
batch: toDownplay
|
||||
});
|
||||
toHighlight.length && api.dispatchAction({
|
||||
type: 'highlight',
|
||||
escapeConnect: true,
|
||||
// Not blur others when highlight in axisPointer.
|
||||
notBlur: true,
|
||||
batch: toHighlight
|
||||
});
|
||||
}
|
||||
function findInputAxisInfo(inputAxesInfo, axisInfo) {
|
||||
for (var i = 0; i < (inputAxesInfo || []).length; i++) {
|
||||
var inputAxisInfo = inputAxesInfo[i];
|
||||
if (axisInfo.axis.dim === inputAxisInfo.axisDim && axisInfo.axis.model.componentIndex === inputAxisInfo.axisIndex) {
|
||||
return inputAxisInfo;
|
||||
}
|
||||
}
|
||||
}
|
||||
function makeMapperParam(axisInfo) {
|
||||
var axisModel = axisInfo.axis.model;
|
||||
var item = {};
|
||||
var dim = item.axisDim = axisInfo.axis.dim;
|
||||
item.axisIndex = item[dim + 'AxisIndex'] = axisModel.componentIndex;
|
||||
item.axisName = item[dim + 'AxisName'] = axisModel.name;
|
||||
item.axisId = item[dim + 'AxisId'] = axisModel.id;
|
||||
return item;
|
||||
}
|
||||
function illegalPoint(point) {
|
||||
return !point || point[0] == null || isNaN(point[0]) || point[1] == null || isNaN(point[1]);
|
||||
}
|
98
frontend/node_modules/echarts/lib/component/axisPointer/findPointFromSeries.js
generated
vendored
Normal file
98
frontend/node_modules/echarts/lib/component/axisPointer/findPointFromSeries.js
generated
vendored
Normal file
@ -0,0 +1,98 @@
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* AUTO-GENERATED FILE. DO NOT MODIFY.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import * as zrUtil from 'zrender/lib/core/util.js';
|
||||
import * as modelUtil from '../../util/model.js';
|
||||
/**
|
||||
* @param finder contains {seriesIndex, dataIndex, dataIndexInside}
|
||||
* @param ecModel
|
||||
* @return {point: [x, y], el: ...} point Will not be null.
|
||||
*/
|
||||
export default function findPointFromSeries(finder, ecModel) {
|
||||
var point = [];
|
||||
var seriesIndex = finder.seriesIndex;
|
||||
var seriesModel;
|
||||
if (seriesIndex == null || !(seriesModel = ecModel.getSeriesByIndex(seriesIndex))) {
|
||||
return {
|
||||
point: []
|
||||
};
|
||||
}
|
||||
var data = seriesModel.getData();
|
||||
var dataIndex = modelUtil.queryDataIndex(data, finder);
|
||||
if (dataIndex == null || dataIndex < 0 || zrUtil.isArray(dataIndex)) {
|
||||
return {
|
||||
point: []
|
||||
};
|
||||
}
|
||||
var el = data.getItemGraphicEl(dataIndex);
|
||||
var coordSys = seriesModel.coordinateSystem;
|
||||
if (seriesModel.getTooltipPosition) {
|
||||
point = seriesModel.getTooltipPosition(dataIndex) || [];
|
||||
} else if (coordSys && coordSys.dataToPoint) {
|
||||
if (finder.isStacked) {
|
||||
var baseAxis = coordSys.getBaseAxis();
|
||||
var valueAxis = coordSys.getOtherAxis(baseAxis);
|
||||
var valueAxisDim = valueAxis.dim;
|
||||
var baseAxisDim = baseAxis.dim;
|
||||
var baseDataOffset = valueAxisDim === 'x' || valueAxisDim === 'radius' ? 1 : 0;
|
||||
var baseDim = data.mapDimension(baseAxisDim);
|
||||
var stackedData = [];
|
||||
stackedData[baseDataOffset] = data.get(baseDim, dataIndex);
|
||||
stackedData[1 - baseDataOffset] = data.get(data.getCalculationInfo('stackResultDimension'), dataIndex);
|
||||
point = coordSys.dataToPoint(stackedData) || [];
|
||||
} else {
|
||||
point = coordSys.dataToPoint(data.getValues(zrUtil.map(coordSys.dimensions, function (dim) {
|
||||
return data.mapDimension(dim);
|
||||
}), dataIndex)) || [];
|
||||
}
|
||||
} else if (el) {
|
||||
// Use graphic bounding rect
|
||||
var rect = el.getBoundingRect().clone();
|
||||
rect.applyTransform(el.transform);
|
||||
point = [rect.x + rect.width / 2, rect.y + rect.height / 2];
|
||||
}
|
||||
return {
|
||||
point: point,
|
||||
el: el
|
||||
};
|
||||
}
|
138
frontend/node_modules/echarts/lib/component/axisPointer/globalListener.js
generated
vendored
Normal file
138
frontend/node_modules/echarts/lib/component/axisPointer/globalListener.js
generated
vendored
Normal file
@ -0,0 +1,138 @@
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT 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 env from 'zrender/lib/core/env.js';
|
||||
import { makeInner } from '../../util/model.js';
|
||||
var inner = makeInner();
|
||||
var each = zrUtil.each;
|
||||
/**
|
||||
* @param {string} key
|
||||
* @param {module:echarts/ExtensionAPI} api
|
||||
* @param {Function} handler
|
||||
* param: {string} currTrigger
|
||||
* param: {Array.<number>} point
|
||||
*/
|
||||
export function register(key, api, handler) {
|
||||
if (env.node) {
|
||||
return;
|
||||
}
|
||||
var zr = api.getZr();
|
||||
inner(zr).records || (inner(zr).records = {});
|
||||
initGlobalListeners(zr, api);
|
||||
var record = inner(zr).records[key] || (inner(zr).records[key] = {});
|
||||
record.handler = handler;
|
||||
}
|
||||
function initGlobalListeners(zr, api) {
|
||||
if (inner(zr).initialized) {
|
||||
return;
|
||||
}
|
||||
inner(zr).initialized = true;
|
||||
useHandler('click', zrUtil.curry(doEnter, 'click'));
|
||||
useHandler('mousemove', zrUtil.curry(doEnter, 'mousemove'));
|
||||
// useHandler('mouseout', onLeave);
|
||||
useHandler('globalout', onLeave);
|
||||
function useHandler(eventType, cb) {
|
||||
zr.on(eventType, function (e) {
|
||||
var dis = makeDispatchAction(api);
|
||||
each(inner(zr).records, function (record) {
|
||||
record && cb(record, e, dis.dispatchAction);
|
||||
});
|
||||
dispatchTooltipFinally(dis.pendings, api);
|
||||
});
|
||||
}
|
||||
}
|
||||
function dispatchTooltipFinally(pendings, api) {
|
||||
var showLen = pendings.showTip.length;
|
||||
var hideLen = pendings.hideTip.length;
|
||||
var actuallyPayload;
|
||||
if (showLen) {
|
||||
actuallyPayload = pendings.showTip[showLen - 1];
|
||||
} else if (hideLen) {
|
||||
actuallyPayload = pendings.hideTip[hideLen - 1];
|
||||
}
|
||||
if (actuallyPayload) {
|
||||
actuallyPayload.dispatchAction = null;
|
||||
api.dispatchAction(actuallyPayload);
|
||||
}
|
||||
}
|
||||
function onLeave(record, e, dispatchAction) {
|
||||
record.handler('leave', null, dispatchAction);
|
||||
}
|
||||
function doEnter(currTrigger, record, e, dispatchAction) {
|
||||
record.handler(currTrigger, e, dispatchAction);
|
||||
}
|
||||
function makeDispatchAction(api) {
|
||||
var pendings = {
|
||||
showTip: [],
|
||||
hideTip: []
|
||||
};
|
||||
// FIXME
|
||||
// better approach?
|
||||
// 'showTip' and 'hideTip' can be triggered by axisPointer and tooltip,
|
||||
// which may be conflict, (axisPointer call showTip but tooltip call hideTip);
|
||||
// So we have to add "final stage" to merge those dispatched actions.
|
||||
var dispatchAction = function (payload) {
|
||||
var pendingList = pendings[payload.type];
|
||||
if (pendingList) {
|
||||
pendingList.push(payload);
|
||||
} else {
|
||||
payload.dispatchAction = dispatchAction;
|
||||
api.dispatchAction(payload);
|
||||
}
|
||||
};
|
||||
return {
|
||||
dispatchAction: dispatchAction,
|
||||
pendings: pendings
|
||||
};
|
||||
}
|
||||
export function unregister(key, api) {
|
||||
if (env.node) {
|
||||
return;
|
||||
}
|
||||
var zr = api.getZr();
|
||||
var record = (inner(zr).records || {})[key];
|
||||
if (record) {
|
||||
inner(zr).records[key] = null;
|
||||
}
|
||||
}
|
84
frontend/node_modules/echarts/lib/component/axisPointer/install.js
generated
vendored
Normal file
84
frontend/node_modules/echarts/lib/component/axisPointer/install.js
generated
vendored
Normal file
@ -0,0 +1,84 @@
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT 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 AxisView from '../axis/AxisView.js';
|
||||
import CartesianAxisPointer from './CartesianAxisPointer.js';
|
||||
import AxisPointerModel from './AxisPointerModel.js';
|
||||
import AxisPointerView from './AxisPointerView.js';
|
||||
import { isArray } from 'zrender/lib/core/util.js';
|
||||
import { collect } from './modelHelper.js';
|
||||
import axisTrigger from './axisTrigger.js';
|
||||
export function install(registers) {
|
||||
// CartesianAxisPointer is not supposed to be required here. But consider
|
||||
// echarts.simple.js and online build tooltip, which only require gridSimple,
|
||||
// CartesianAxisPointer should be able to required somewhere.
|
||||
AxisView.registerAxisPointerClass('CartesianAxisPointer', CartesianAxisPointer);
|
||||
registers.registerComponentModel(AxisPointerModel);
|
||||
registers.registerComponentView(AxisPointerView);
|
||||
registers.registerPreprocessor(function (option) {
|
||||
// Always has a global axisPointerModel for default setting.
|
||||
if (option) {
|
||||
(!option.axisPointer || option.axisPointer.length === 0) && (option.axisPointer = {});
|
||||
var link = option.axisPointer.link;
|
||||
// Normalize to array to avoid object mergin. But if link
|
||||
// is not set, remain null/undefined, otherwise it will
|
||||
// override existent link setting.
|
||||
if (link && !isArray(link)) {
|
||||
option.axisPointer.link = [link];
|
||||
}
|
||||
}
|
||||
});
|
||||
// This process should proformed after coordinate systems created
|
||||
// and series data processed. So put it on statistic processing stage.
|
||||
registers.registerProcessor(registers.PRIORITY.PROCESSOR.STATISTIC, function (ecModel, api) {
|
||||
// Build axisPointerModel, mergin tooltip.axisPointer model for each axis.
|
||||
// allAxesInfo should be updated when setOption performed.
|
||||
ecModel.getComponent('axisPointer').coordSysAxesInfo = collect(ecModel, api);
|
||||
});
|
||||
// Broadcast to all views.
|
||||
registers.registerAction({
|
||||
type: 'updateAxisPointer',
|
||||
event: 'updateAxisPointer',
|
||||
update: ':updateAxisPointer'
|
||||
}, axisTrigger);
|
||||
}
|
295
frontend/node_modules/echarts/lib/component/axisPointer/modelHelper.js
generated
vendored
Normal file
295
frontend/node_modules/echarts/lib/component/axisPointer/modelHelper.js
generated
vendored
Normal file
@ -0,0 +1,295 @@
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT 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 Model from '../../model/Model.js';
|
||||
import { each, curry, clone, defaults, isArray, indexOf } from 'zrender/lib/core/util.js';
|
||||
// Build axisPointerModel, mergin tooltip.axisPointer model for each axis.
|
||||
// allAxesInfo should be updated when setOption performed.
|
||||
export function collect(ecModel, api) {
|
||||
var result = {
|
||||
/**
|
||||
* key: makeKey(axis.model)
|
||||
* value: {
|
||||
* axis,
|
||||
* coordSys,
|
||||
* axisPointerModel,
|
||||
* triggerTooltip,
|
||||
* triggerEmphasis,
|
||||
* involveSeries,
|
||||
* snap,
|
||||
* seriesModels,
|
||||
* seriesDataCount
|
||||
* }
|
||||
*/
|
||||
axesInfo: {},
|
||||
seriesInvolved: false,
|
||||
/**
|
||||
* key: makeKey(coordSys.model)
|
||||
* value: Object: key makeKey(axis.model), value: axisInfo
|
||||
*/
|
||||
coordSysAxesInfo: {},
|
||||
coordSysMap: {}
|
||||
};
|
||||
collectAxesInfo(result, ecModel, api);
|
||||
// Check seriesInvolved for performance, in case too many series in some chart.
|
||||
result.seriesInvolved && collectSeriesInfo(result, ecModel);
|
||||
return result;
|
||||
}
|
||||
function collectAxesInfo(result, ecModel, api) {
|
||||
var globalTooltipModel = ecModel.getComponent('tooltip');
|
||||
var globalAxisPointerModel = ecModel.getComponent('axisPointer');
|
||||
// links can only be set on global.
|
||||
var linksOption = globalAxisPointerModel.get('link', true) || [];
|
||||
var linkGroups = [];
|
||||
// Collect axes info.
|
||||
each(api.getCoordinateSystems(), function (coordSys) {
|
||||
// Some coordinate system do not support axes, like geo.
|
||||
if (!coordSys.axisPointerEnabled) {
|
||||
return;
|
||||
}
|
||||
var coordSysKey = makeKey(coordSys.model);
|
||||
var axesInfoInCoordSys = result.coordSysAxesInfo[coordSysKey] = {};
|
||||
result.coordSysMap[coordSysKey] = coordSys;
|
||||
// Set tooltip (like 'cross') is a convenient way to show axisPointer
|
||||
// for user. So we enable setting tooltip on coordSys model.
|
||||
var coordSysModel = coordSys.model;
|
||||
var baseTooltipModel = coordSysModel.getModel('tooltip', globalTooltipModel);
|
||||
each(coordSys.getAxes(), curry(saveTooltipAxisInfo, false, null));
|
||||
// If axis tooltip used, choose tooltip axis for each coordSys.
|
||||
// Notice this case: coordSys is `grid` but not `cartesian2D` here.
|
||||
if (coordSys.getTooltipAxes && globalTooltipModel
|
||||
// If tooltip.showContent is set as false, tooltip will not
|
||||
// show but axisPointer will show as normal.
|
||||
&& baseTooltipModel.get('show')) {
|
||||
// Compatible with previous logic. But series.tooltip.trigger: 'axis'
|
||||
// or series.data[n].tooltip.trigger: 'axis' are not support any more.
|
||||
var triggerAxis = baseTooltipModel.get('trigger') === 'axis';
|
||||
var cross = baseTooltipModel.get(['axisPointer', 'type']) === 'cross';
|
||||
var tooltipAxes = coordSys.getTooltipAxes(baseTooltipModel.get(['axisPointer', 'axis']));
|
||||
if (triggerAxis || cross) {
|
||||
each(tooltipAxes.baseAxes, curry(saveTooltipAxisInfo, cross ? 'cross' : true, triggerAxis));
|
||||
}
|
||||
if (cross) {
|
||||
each(tooltipAxes.otherAxes, curry(saveTooltipAxisInfo, 'cross', false));
|
||||
}
|
||||
}
|
||||
// fromTooltip: true | false | 'cross'
|
||||
// triggerTooltip: true | false | null
|
||||
function saveTooltipAxisInfo(fromTooltip, triggerTooltip, axis) {
|
||||
var axisPointerModel = axis.model.getModel('axisPointer', globalAxisPointerModel);
|
||||
var axisPointerShow = axisPointerModel.get('show');
|
||||
if (!axisPointerShow || axisPointerShow === 'auto' && !fromTooltip && !isHandleTrigger(axisPointerModel)) {
|
||||
return;
|
||||
}
|
||||
if (triggerTooltip == null) {
|
||||
triggerTooltip = axisPointerModel.get('triggerTooltip');
|
||||
}
|
||||
axisPointerModel = fromTooltip ? makeAxisPointerModel(axis, baseTooltipModel, globalAxisPointerModel, ecModel, fromTooltip, triggerTooltip) : axisPointerModel;
|
||||
var snap = axisPointerModel.get('snap');
|
||||
var triggerEmphasis = axisPointerModel.get('triggerEmphasis');
|
||||
var axisKey = makeKey(axis.model);
|
||||
var involveSeries = triggerTooltip || snap || axis.type === 'category';
|
||||
// If result.axesInfo[key] exist, override it (tooltip has higher priority).
|
||||
var axisInfo = result.axesInfo[axisKey] = {
|
||||
key: axisKey,
|
||||
axis: axis,
|
||||
coordSys: coordSys,
|
||||
axisPointerModel: axisPointerModel,
|
||||
triggerTooltip: triggerTooltip,
|
||||
triggerEmphasis: triggerEmphasis,
|
||||
involveSeries: involveSeries,
|
||||
snap: snap,
|
||||
useHandle: isHandleTrigger(axisPointerModel),
|
||||
seriesModels: [],
|
||||
linkGroup: null
|
||||
};
|
||||
axesInfoInCoordSys[axisKey] = axisInfo;
|
||||
result.seriesInvolved = result.seriesInvolved || involveSeries;
|
||||
var groupIndex = getLinkGroupIndex(linksOption, axis);
|
||||
if (groupIndex != null) {
|
||||
var linkGroup = linkGroups[groupIndex] || (linkGroups[groupIndex] = {
|
||||
axesInfo: {}
|
||||
});
|
||||
linkGroup.axesInfo[axisKey] = axisInfo;
|
||||
linkGroup.mapper = linksOption[groupIndex].mapper;
|
||||
axisInfo.linkGroup = linkGroup;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
function makeAxisPointerModel(axis, baseTooltipModel, globalAxisPointerModel, ecModel, fromTooltip, triggerTooltip) {
|
||||
var tooltipAxisPointerModel = baseTooltipModel.getModel('axisPointer');
|
||||
var fields = ['type', 'snap', 'lineStyle', 'shadowStyle', 'label', 'animation', 'animationDurationUpdate', 'animationEasingUpdate', 'z'];
|
||||
var volatileOption = {};
|
||||
each(fields, function (field) {
|
||||
volatileOption[field] = clone(tooltipAxisPointerModel.get(field));
|
||||
});
|
||||
// category axis do not auto snap, otherwise some tick that do not
|
||||
// has value can not be hovered. value/time/log axis default snap if
|
||||
// triggered from tooltip and trigger tooltip.
|
||||
volatileOption.snap = axis.type !== 'category' && !!triggerTooltip;
|
||||
// Compatible with previous behavior, tooltip axis does not show label by default.
|
||||
// Only these properties can be overridden from tooltip to axisPointer.
|
||||
if (tooltipAxisPointerModel.get('type') === 'cross') {
|
||||
volatileOption.type = 'line';
|
||||
}
|
||||
var labelOption = volatileOption.label || (volatileOption.label = {});
|
||||
// Follow the convention, do not show label when triggered by tooltip by default.
|
||||
labelOption.show == null && (labelOption.show = false);
|
||||
if (fromTooltip === 'cross') {
|
||||
// When 'cross', both axes show labels.
|
||||
var tooltipAxisPointerLabelShow = tooltipAxisPointerModel.get(['label', 'show']);
|
||||
labelOption.show = tooltipAxisPointerLabelShow != null ? tooltipAxisPointerLabelShow : true;
|
||||
// If triggerTooltip, this is a base axis, which should better not use cross style
|
||||
// (cross style is dashed by default)
|
||||
if (!triggerTooltip) {
|
||||
var crossStyle = volatileOption.lineStyle = tooltipAxisPointerModel.get('crossStyle');
|
||||
crossStyle && defaults(labelOption, crossStyle.textStyle);
|
||||
}
|
||||
}
|
||||
return axis.model.getModel('axisPointer', new Model(volatileOption, globalAxisPointerModel, ecModel));
|
||||
}
|
||||
function collectSeriesInfo(result, ecModel) {
|
||||
// Prepare data for axis trigger
|
||||
ecModel.eachSeries(function (seriesModel) {
|
||||
// Notice this case: this coordSys is `cartesian2D` but not `grid`.
|
||||
var coordSys = seriesModel.coordinateSystem;
|
||||
var seriesTooltipTrigger = seriesModel.get(['tooltip', 'trigger'], true);
|
||||
var seriesTooltipShow = seriesModel.get(['tooltip', 'show'], true);
|
||||
if (!coordSys || seriesTooltipTrigger === 'none' || seriesTooltipTrigger === false || seriesTooltipTrigger === 'item' || seriesTooltipShow === false || seriesModel.get(['axisPointer', 'show'], true) === false) {
|
||||
return;
|
||||
}
|
||||
each(result.coordSysAxesInfo[makeKey(coordSys.model)], function (axisInfo) {
|
||||
var axis = axisInfo.axis;
|
||||
if (coordSys.getAxis(axis.dim) === axis) {
|
||||
axisInfo.seriesModels.push(seriesModel);
|
||||
axisInfo.seriesDataCount == null && (axisInfo.seriesDataCount = 0);
|
||||
axisInfo.seriesDataCount += seriesModel.getData().count();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
/**
|
||||
* For example:
|
||||
* {
|
||||
* axisPointer: {
|
||||
* links: [{
|
||||
* xAxisIndex: [2, 4],
|
||||
* yAxisIndex: 'all'
|
||||
* }, {
|
||||
* xAxisId: ['a5', 'a7'],
|
||||
* xAxisName: 'xxx'
|
||||
* }]
|
||||
* }
|
||||
* }
|
||||
*/
|
||||
function getLinkGroupIndex(linksOption, axis) {
|
||||
var axisModel = axis.model;
|
||||
var dim = axis.dim;
|
||||
for (var i = 0; i < linksOption.length; i++) {
|
||||
var linkOption = linksOption[i] || {};
|
||||
if (checkPropInLink(linkOption[dim + 'AxisId'], axisModel.id) || checkPropInLink(linkOption[dim + 'AxisIndex'], axisModel.componentIndex) || checkPropInLink(linkOption[dim + 'AxisName'], axisModel.name)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
function checkPropInLink(linkPropValue, axisPropValue) {
|
||||
return linkPropValue === 'all' || isArray(linkPropValue) && indexOf(linkPropValue, axisPropValue) >= 0 || linkPropValue === axisPropValue;
|
||||
}
|
||||
export function fixValue(axisModel) {
|
||||
var axisInfo = getAxisInfo(axisModel);
|
||||
if (!axisInfo) {
|
||||
return;
|
||||
}
|
||||
var axisPointerModel = axisInfo.axisPointerModel;
|
||||
var scale = axisInfo.axis.scale;
|
||||
var option = axisPointerModel.option;
|
||||
var status = axisPointerModel.get('status');
|
||||
var value = axisPointerModel.get('value');
|
||||
// Parse init value for category and time axis.
|
||||
if (value != null) {
|
||||
value = scale.parse(value);
|
||||
}
|
||||
var useHandle = isHandleTrigger(axisPointerModel);
|
||||
// If `handle` used, `axisPointer` will always be displayed, so value
|
||||
// and status should be initialized.
|
||||
if (status == null) {
|
||||
option.status = useHandle ? 'show' : 'hide';
|
||||
}
|
||||
var extent = scale.getExtent().slice();
|
||||
extent[0] > extent[1] && extent.reverse();
|
||||
if (
|
||||
// Pick a value on axis when initializing.
|
||||
value == null
|
||||
// If both `handle` and `dataZoom` are used, value may be out of axis extent,
|
||||
// where we should re-pick a value to keep `handle` displaying normally.
|
||||
|| value > extent[1]) {
|
||||
// Make handle displayed on the end of the axis when init, which looks better.
|
||||
value = extent[1];
|
||||
}
|
||||
if (value < extent[0]) {
|
||||
value = extent[0];
|
||||
}
|
||||
option.value = value;
|
||||
if (useHandle) {
|
||||
option.status = axisInfo.axis.scale.isBlank() ? 'hide' : 'show';
|
||||
}
|
||||
}
|
||||
export function getAxisInfo(axisModel) {
|
||||
var coordSysAxesInfo = (axisModel.ecModel.getComponent('axisPointer') || {}).coordSysAxesInfo;
|
||||
return coordSysAxesInfo && coordSysAxesInfo.axesInfo[makeKey(axisModel)];
|
||||
}
|
||||
export function getAxisPointerModel(axisModel) {
|
||||
var axisInfo = getAxisInfo(axisModel);
|
||||
return axisInfo && axisInfo.axisPointerModel;
|
||||
}
|
||||
function isHandleTrigger(axisPointerModel) {
|
||||
return !!axisPointerModel.get(['handle', 'show']);
|
||||
}
|
||||
/**
|
||||
* @param {module:echarts/model/Model} model
|
||||
* @return {string} unique key
|
||||
*/
|
||||
export function makeKey(model) {
|
||||
return model.type + '||' + model.id;
|
||||
}
|
195
frontend/node_modules/echarts/lib/component/axisPointer/viewHelper.js
generated
vendored
Normal file
195
frontend/node_modules/echarts/lib/component/axisPointer/viewHelper.js
generated
vendored
Normal file
@ -0,0 +1,195 @@
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* AUTO-GENERATED FILE. DO NOT MODIFY.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import * as zrUtil from 'zrender/lib/core/util.js';
|
||||
import * as graphic from '../../util/graphic.js';
|
||||
import * as textContain from 'zrender/lib/contain/text.js';
|
||||
import * as formatUtil from '../../util/format.js';
|
||||
import * as matrix from 'zrender/lib/core/matrix.js';
|
||||
import * as axisHelper from '../../coord/axisHelper.js';
|
||||
import AxisBuilder from '../axis/AxisBuilder.js';
|
||||
import { createTextStyle } from '../../label/labelStyle.js';
|
||||
export function buildElStyle(axisPointerModel) {
|
||||
var axisPointerType = axisPointerModel.get('type');
|
||||
var styleModel = axisPointerModel.getModel(axisPointerType + 'Style');
|
||||
var style;
|
||||
if (axisPointerType === 'line') {
|
||||
style = styleModel.getLineStyle();
|
||||
style.fill = null;
|
||||
} else if (axisPointerType === 'shadow') {
|
||||
style = styleModel.getAreaStyle();
|
||||
style.stroke = null;
|
||||
}
|
||||
return style;
|
||||
}
|
||||
/**
|
||||
* @param {Function} labelPos {align, verticalAlign, position}
|
||||
*/
|
||||
export function buildLabelElOption(elOption, axisModel, axisPointerModel, api, labelPos) {
|
||||
var value = axisPointerModel.get('value');
|
||||
var text = getValueLabel(value, axisModel.axis, axisModel.ecModel, axisPointerModel.get('seriesDataIndices'), {
|
||||
precision: axisPointerModel.get(['label', 'precision']),
|
||||
formatter: axisPointerModel.get(['label', 'formatter'])
|
||||
});
|
||||
var labelModel = axisPointerModel.getModel('label');
|
||||
var paddings = formatUtil.normalizeCssArray(labelModel.get('padding') || 0);
|
||||
var font = labelModel.getFont();
|
||||
var textRect = textContain.getBoundingRect(text, font);
|
||||
var position = labelPos.position;
|
||||
var width = textRect.width + paddings[1] + paddings[3];
|
||||
var height = textRect.height + paddings[0] + paddings[2];
|
||||
// Adjust by align.
|
||||
var align = labelPos.align;
|
||||
align === 'right' && (position[0] -= width);
|
||||
align === 'center' && (position[0] -= width / 2);
|
||||
var verticalAlign = labelPos.verticalAlign;
|
||||
verticalAlign === 'bottom' && (position[1] -= height);
|
||||
verticalAlign === 'middle' && (position[1] -= height / 2);
|
||||
// Not overflow ec container
|
||||
confineInContainer(position, width, height, api);
|
||||
var bgColor = labelModel.get('backgroundColor');
|
||||
if (!bgColor || bgColor === 'auto') {
|
||||
bgColor = axisModel.get(['axisLine', 'lineStyle', 'color']);
|
||||
}
|
||||
elOption.label = {
|
||||
// shape: {x: 0, y: 0, width: width, height: height, r: labelModel.get('borderRadius')},
|
||||
x: position[0],
|
||||
y: position[1],
|
||||
style: createTextStyle(labelModel, {
|
||||
text: text,
|
||||
font: font,
|
||||
fill: labelModel.getTextColor(),
|
||||
padding: paddings,
|
||||
backgroundColor: bgColor
|
||||
}),
|
||||
// Label should be over axisPointer.
|
||||
z2: 10
|
||||
};
|
||||
}
|
||||
// Do not overflow ec container
|
||||
function confineInContainer(position, width, height, api) {
|
||||
var viewWidth = api.getWidth();
|
||||
var viewHeight = api.getHeight();
|
||||
position[0] = Math.min(position[0] + width, viewWidth) - width;
|
||||
position[1] = Math.min(position[1] + height, viewHeight) - height;
|
||||
position[0] = Math.max(position[0], 0);
|
||||
position[1] = Math.max(position[1], 0);
|
||||
}
|
||||
export function getValueLabel(value, axis, ecModel, seriesDataIndices, opt) {
|
||||
value = axis.scale.parse(value);
|
||||
var text = axis.scale.getLabel({
|
||||
value: value
|
||||
}, {
|
||||
// If `precision` is set, width can be fixed (like '12.00500'), which
|
||||
// helps to debounce when when moving label.
|
||||
precision: opt.precision
|
||||
});
|
||||
var formatter = opt.formatter;
|
||||
if (formatter) {
|
||||
var params_1 = {
|
||||
value: axisHelper.getAxisRawValue(axis, {
|
||||
value: value
|
||||
}),
|
||||
axisDimension: axis.dim,
|
||||
axisIndex: axis.index,
|
||||
seriesData: []
|
||||
};
|
||||
zrUtil.each(seriesDataIndices, function (idxItem) {
|
||||
var series = ecModel.getSeriesByIndex(idxItem.seriesIndex);
|
||||
var dataIndex = idxItem.dataIndexInside;
|
||||
var dataParams = series && series.getDataParams(dataIndex);
|
||||
dataParams && params_1.seriesData.push(dataParams);
|
||||
});
|
||||
if (zrUtil.isString(formatter)) {
|
||||
text = formatter.replace('{value}', text);
|
||||
} else if (zrUtil.isFunction(formatter)) {
|
||||
text = formatter(params_1);
|
||||
}
|
||||
}
|
||||
return text;
|
||||
}
|
||||
export function getTransformedPosition(axis, value, layoutInfo) {
|
||||
var transform = matrix.create();
|
||||
matrix.rotate(transform, transform, layoutInfo.rotation);
|
||||
matrix.translate(transform, transform, layoutInfo.position);
|
||||
return graphic.applyTransform([axis.dataToCoord(value), (layoutInfo.labelOffset || 0) + (layoutInfo.labelDirection || 1) * (layoutInfo.labelMargin || 0)], transform);
|
||||
}
|
||||
export function buildCartesianSingleLabelElOption(value, elOption, layoutInfo, axisModel, axisPointerModel, api) {
|
||||
// @ts-ignore
|
||||
var textLayout = AxisBuilder.innerTextLayout(layoutInfo.rotation, 0, layoutInfo.labelDirection);
|
||||
layoutInfo.labelMargin = axisPointerModel.get(['label', 'margin']);
|
||||
buildLabelElOption(elOption, axisModel, axisPointerModel, api, {
|
||||
position: getTransformedPosition(axisModel.axis, value, layoutInfo),
|
||||
align: textLayout.textAlign,
|
||||
verticalAlign: textLayout.textVerticalAlign
|
||||
});
|
||||
}
|
||||
export function makeLineShape(p1, p2, xDimIndex) {
|
||||
xDimIndex = xDimIndex || 0;
|
||||
return {
|
||||
x1: p1[xDimIndex],
|
||||
y1: p1[1 - xDimIndex],
|
||||
x2: p2[xDimIndex],
|
||||
y2: p2[1 - xDimIndex]
|
||||
};
|
||||
}
|
||||
export function makeRectShape(xy, wh, xDimIndex) {
|
||||
xDimIndex = xDimIndex || 0;
|
||||
return {
|
||||
x: xy[xDimIndex],
|
||||
y: xy[1 - xDimIndex],
|
||||
width: wh[xDimIndex],
|
||||
height: wh[1 - xDimIndex]
|
||||
};
|
||||
}
|
||||
export function makeSectorShape(cx, cy, r0, r, startAngle, endAngle) {
|
||||
return {
|
||||
cx: cx,
|
||||
cy: cy,
|
||||
r0: r0,
|
||||
r: r,
|
||||
startAngle: startAngle,
|
||||
endAngle: endAngle,
|
||||
clockwise: true
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user