优化 平移状态下 可以tips

This commit is contained in:
lVAL 2020-10-16 14:47:14 +08:00
parent 58c7914e8b
commit ba3104d9e9

View File

@ -78,7 +78,7 @@ export default {
zr.on('click', this.onClick, this)
this.myChart.on('mousedown', this.onMouseDown);
this.myChart.on('mouseover', this.onMouseOver);
this.myChart.on('mouseout', this.onMouseOver);
this.myChart.on('mouseout', this.onMouseOut);
this.myChart.on('mouseup', this.onMouseUP);
this.myChart.on('datazoom', this.onUpdatePosition);
window.addEventListener('resize', this.onUpdatePosition);
@ -91,7 +91,7 @@ export default {
zr.off('click', this.onClick);
this.myChart.off('mousedown', this.onMouseDown);
this.myChart.off('mouseover', this.onMouseOver);
this.myChart.off('mouseout', this.onMouseOver);
this.myChart.off('mouseout', this.onMouseOut);
this.myChart.off('mouseup', this.onMouseUP);
this.myChart.off('datazoom', this.onUpdatePosition);
window.removeEventListener('resize', this.onUpdatePosition);
@ -122,6 +122,19 @@ export default {
},
onMouseOver(e) {
this.pixelExecCb(e, this.handleSelectLine);
if (this.action == 'Translate') {
setTimeout(() => {
this.onShapeMouseOver(e);
}, 200);
}
},
onMouseOut(e) {
this.pixelExecCb(e, this.handleSelectLine);
if (this.action == 'Translate') {
setTimeout(() => {
this.onShapeMouseOver(e);
}, 200);
}
},
onMouseUP(e) {
switch(this.action) {
@ -136,14 +149,25 @@ export default {
onShapePointDragging(e) {
if (this.selected) {
this.dragging = true;
this.pixelExecCb(e, this.handleDragging);
}
},
onShapeMouseOver() {
if (this.selected) {
this.myChart.dispatchAction({
type: 'showTip',
seriesIndex: this.selected.seriesIndex,
dataIndex: this.selected.dataIndex
});
}
},
onShapeMouseOut() {
if (this.selected) {
this.myChart.dispatchAction({
type: 'showTip',
seriesIndex: this.selected.seriesIndex,
dataIndex: this.selected.dataIndex
});
this.pixelExecCb(e, this.handleDragging);
}
},
setLineLight() {
@ -193,11 +217,11 @@ export default {
cy: 0,
r: 10
},
style: {
fill: 'rgba(0,0,0,0.0)'
},
invisible: true,
draggable: 'horizontal',
ondrag: echarts.util.curry(this.onShapePointDragging),
onmouseover: echarts.util.curry(this.onShapeMouseOver),
onmouseout: echarts.util.curry(this.onShapeMouseOut),
z: 100
}
},
@ -301,6 +325,12 @@ export default {
option.graphic[0].elements = filters;
this.myChart.setOption(option, {notMerge: true});
this.myChart.dispatchAction({
type: 'showTip',
seriesIndex: this.selected.seriesIndex,
dataIndex: this.selected.dataIndex
});
},
handleCreateMark({pointInPixel, yObj, xVal}) {
const myChart = this.myChart;