실시간 차트 갱신문제 수정

This commit is contained in:
Macbook
2026-05-25 04:09:58 +09:00
parent 67a6aa0dee
commit ac2e6a1dae
4 changed files with 80 additions and 12 deletions
+23
View File
@@ -271,6 +271,29 @@ export class ChartManager {
}
// ─── Data ───────────────────────────────────────────────────────────────
/** 종목·타임프레임 전환 직후 — 이전 시리즈·rawBars 제거 (실시간 틱 혼입·캔들 폭 깨짐 방지) */
clearForSymbolChange(): void {
this.cancelPendingIndicatorUpdates();
this._dataGeneration += 1;
for (const entry of this.indicators.values()) {
if (entry.cloudPlugin) {
for (const s of entry.seriesList) { try { s.detachPrimitive(entry.cloudPlugin); } catch { /* ok */ } }
}
detachBbBandFill(entry);
for (const s of entry.seriesList) { try { this.chart.removeSeries(s); } catch { /* ok */ } }
}
this.indicators.clear();
this.patternMarkers = [];
this._removeExtraSubPanes();
this._disposeMainMarkersPlugin();
if (this.mainSeries) { try { this.chart.removeSeries(this.mainSeries); } catch { /* ok */ } this.mainSeries = null; }
if (this.volumeSeries) { try { this.chart.removeSeries(this.volumeSeries); } catch { /* ok */ } this.volumeSeries = null; }
this.rawBars = [];
}
setData(bars: OHLCVBar[], chartType: ChartType, theme: Theme): void {
// 전체 재로드 전: 진행 중인 지표 갱신 타이머·플래그를 초기화해
// 이전 rawBars 기반의 stale 계산이 새 지표에 적용되는 것을 방지한다.