事件标记线bug修复

This commit is contained in:
2025-12-25 10:04:26 +08:00
parent 506008a7ae
commit 87b3a28c0e

View File

@@ -202,12 +202,27 @@ const MiniTimelineChart = React.memo(function MiniTimelineChart({ stockCode, eve
return h * 60 + m;
};
const eventMin = parseMinuteTime(eventMinute);
// 盘前时间定义15:00之后上个交易日收盘后或09:30之前
// 盘中时间09:30 - 15:00
const marketOpenMin = 9 * 60 + 30; // 09:30
const marketCloseMin = 15 * 60; // 15:00
// 判断事件是否在盘前上个交易日15:00之后 或 当天09:30之前
const isPreMarket = eventMin >= marketCloseMin || eventMin < marketOpenMin;
let nearestIdx = 0;
if (isPreMarket) {
// 盘前消息:黄线显示在最左侧(开盘位置)
nearestIdx = 0;
} else {
// 盘中消息:找最接近的时间点
for (let i = 1; i < times.length; i++) {
if (Math.abs(parseMinuteTime(times[i]) - eventMin) < Math.abs(parseMinuteTime(times[nearestIdx]) - eventMin)) {
nearestIdx = i;
}
}
}
eventMarkLineData.push({
xAxis: nearestIdx,
lineStyle: { color: '#FFD700', type: 'solid', width: 1.5 },