更新
This commit is contained in:
@ -52,27 +52,26 @@ watch(() => props.data, val => {
|
||||
function startAutoTooltip() {
|
||||
// 详细的条件检查和日志
|
||||
if (!props.autoTooltip) {
|
||||
console.log('自动提示框未启动 - autoTooltip为false');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!props.data) {
|
||||
console.warn('自动提示框未启动 - 缺少数据');
|
||||
// console.warn('自动提示框未启动 - 缺少数据');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!props.data.xDate || props.data.xDate.length === 0) {
|
||||
console.warn('自动提示框未启动 - xDate数据为空');
|
||||
// console.warn('自动提示框未启动 - xDate数据为空');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!props.data.list || props.data.list.length === 0) {
|
||||
console.warn('自动提示框未启动 - list数据为空');
|
||||
// console.warn('自动提示框未启动 - list数据为空');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!myChart.value) {
|
||||
console.warn('自动提示框未启动 - 图表实例不存在');
|
||||
// console.warn('自动提示框未启动 - 图表实例不存在');
|
||||
return;
|
||||
}
|
||||
|
||||
@ -82,26 +81,26 @@ function startAutoTooltip() {
|
||||
const dataLength = props.data.xDate.length;
|
||||
currentTooltipIndex.value = 0;
|
||||
|
||||
console.log(`开始自动提示框循环 - 数据长度: ${dataLength}, 间隔: ${props.tooltipInterval}ms`);
|
||||
console.log('数据预览:', {
|
||||
xDate: props.data.xDate.slice(0, 3),
|
||||
listCount: props.data.list.length,
|
||||
firstSeriesName: props.data.list[0]?.name,
|
||||
firstSeriesValueCount: props.data.list[0]?.value?.length
|
||||
});
|
||||
// console.log(`开始自动提示框循环 - 数据长度: ${dataLength}, 间隔: ${props.tooltipInterval}ms`);
|
||||
// console.log('数据预览:', {
|
||||
// xDate: props.data.xDate.slice(0, 3),
|
||||
// listCount: props.data.list.length,
|
||||
// firstSeriesName: props.data.list[0]?.name,
|
||||
// firstSeriesValueCount: props.data.list[0]?.value?.length
|
||||
// });
|
||||
|
||||
tooltipTimer.value = setInterval(() => {
|
||||
try {
|
||||
// 检查图表实例是否仍然存在
|
||||
if (!myChart.value) {
|
||||
console.error('图表实例丢失,停止自动提示框');
|
||||
// console.error('图表实例丢失,停止自动提示框');
|
||||
stopAutoTooltip();
|
||||
return;
|
||||
}
|
||||
|
||||
// 检查是否暂停
|
||||
if (isPaused.value) {
|
||||
console.log('提示框循环已暂停');
|
||||
// console.log('提示框循环已暂停');
|
||||
return;
|
||||
}
|
||||
|
||||
@ -120,7 +119,7 @@ function startAutoTooltip() {
|
||||
|
||||
// 验证数据有效性
|
||||
if (currentData === undefined) {
|
||||
console.error(`数据索引 ${currentTooltipIndex.value} 超出范围`);
|
||||
// console.error(`数据索引 ${currentTooltipIndex.value} 超出范围`);
|
||||
stopAutoTooltip();
|
||||
return;
|
||||
}
|
||||
@ -132,9 +131,9 @@ function startAutoTooltip() {
|
||||
dataIndex: currentTooltipIndex.value
|
||||
});
|
||||
|
||||
console.log(`✓ 显示提示框 [${currentTooltipIndex.value}/${dataLength-1}] - ${currentData}:`, currentValues);
|
||||
// console.log(`✓ 显示提示框 [${currentTooltipIndex.value}/${dataLength-1}] - ${currentData}:`, currentValues);
|
||||
} catch (error) {
|
||||
console.error('显示提示框时出错:', error);
|
||||
// console.error('显示提示框时出错:', error);
|
||||
// 如果出错,尝试停止循环避免持续错误
|
||||
stopAutoTooltip();
|
||||
}
|
||||
@ -144,12 +143,12 @@ function startAutoTooltip() {
|
||||
// 更新索引,循环展示
|
||||
currentTooltipIndex.value = (currentTooltipIndex.value + 1) % dataLength;
|
||||
} catch (error) {
|
||||
console.error('自动提示框循环出错:', error);
|
||||
// console.error('自动提示框循环出错:', error);
|
||||
stopAutoTooltip();
|
||||
}
|
||||
}, props.tooltipInterval);
|
||||
|
||||
console.log(`✓ 自动提示框已启动 - 间隔: ${props.tooltipInterval}ms, 数据长度: ${dataLength}`);
|
||||
// console.log(`✓ 自动提示框已启动 - 间隔: ${props.tooltipInterval}ms, 数据长度: ${dataLength}`);
|
||||
}
|
||||
|
||||
// 停止自动循环展示提示框
|
||||
@ -157,20 +156,20 @@ function stopAutoTooltip() {
|
||||
if (tooltipTimer.value) {
|
||||
clearInterval(tooltipTimer.value);
|
||||
tooltipTimer.value = null;
|
||||
console.log('自动提示框已停止');
|
||||
// console.log('自动提示框已停止');
|
||||
}
|
||||
}
|
||||
|
||||
// 暂停自动循环
|
||||
function pauseAutoTooltip() {
|
||||
isPaused.value = true;
|
||||
console.log('自动提示框已暂停');
|
||||
// console.log('自动提示框已暂停');
|
||||
}
|
||||
|
||||
// 恢复自动循环
|
||||
function resumeAutoTooltip() {
|
||||
isPaused.value = false;
|
||||
console.log('自动提示框已恢复');
|
||||
// console.log('自动提示框已恢复');
|
||||
}
|
||||
|
||||
// 处理数据
|
||||
|
||||
@ -64,7 +64,10 @@
|
||||
.flowLine {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: relative;
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
pointer-events: none;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.zdy_line_svg {
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<template>
|
||||
<div class="headBox">
|
||||
<FlowLine></FlowLine>
|
||||
<div class="headBoxBg">
|
||||
<!-- 左边 -->
|
||||
<el-popover width="480px" :visible="isShowVisble" :append-to-body="true" trigger="click" popper-class="bszdr-tq-Popover" >
|
||||
@ -84,9 +85,7 @@
|
||||
</div>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="zzzz">
|
||||
<FlowLine></FlowLine>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -282,9 +281,6 @@ onUnmounted(() => {
|
||||
}
|
||||
}
|
||||
|
||||
.zzzz{
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user