fix(web): 开关缠论元素保留视窗;分周期 Trend 涨跌配色

本地重绘统一冻结视窗;次/次次周期 Trend 上涨下跌使用独立颜色。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
jackyu66git
2026-08-25 23:56:55 +08:00
co-authored by Cursor
parent 90499533fb
commit 97e77847d0
6 changed files with 130 additions and 84 deletions
+10 -5
View File
@@ -12,14 +12,19 @@ function updateChartDisplay() {
_lastKlinePeriod = curPeriod;
// 保存当前的可见范围(周期切换时不保留,避免范围越界)
if (!periodChanged && typeof snapshotPendingChartViewport === 'function') {
snapshotPendingChartViewport();
if (!periodChanged) {
if (typeof reinitTradingViewPreservingViewport === 'function') {
reinitTradingViewPreservingViewport();
} else {
initTradingView($('#symbol').val(), $('#timeframe').val());
}
} else {
window._pendingRestoreView = null;
window._preserveViewBarCount = 0;
initTradingView($('#symbol').val(), $('#timeframe').val());
}
console.log('更新图表显示');
// 重新初始化图表(initTradingView 内部会在最终同步时读取 _pendingRestoreView
initTradingView($('#symbol').val(), $('#timeframe').val());
}
}
// 确保所有时间处理都使用UTC时间,包括表格数据显示