diff --git a/frontend/src/utils/IchimokuCloudPlugin.ts b/frontend/src/utils/IchimokuCloudPlugin.ts index 09d26bb..3c96890 100644 --- a/frontend/src/utils/IchimokuCloudPlugin.ts +++ b/frontend/src/utils/IchimokuCloudPlugin.ts @@ -70,30 +70,31 @@ class CloudRenderer implements IPrimitivePaneRenderer { console.log('[IchimokuCloud] draw: skipped, data.length=', this._data.length); return; } - console.log('[IchimokuCloud] draw called. data.length:', this._data.length, 'bullish:', this._bullishVisible, 'bearish:', this._bearishVisible); const timeScale = this._chart.timeScale(); // eslint-disable-next-line @typescript-eslint/no-explicit-any target.useBitmapCoordinateSpace(({ context: ctx, horizontalPixelRatio: hpr, verticalPixelRatio: vpr }: any) => { + let drawn = 0, skippedTime = 0, skippedPrice = 0; for (let i = 0; i < this._data.length - 1; i++) { const a = this._data[i]; const b = this._data[i + 1]; const x1 = timeScale.timeToCoordinate(a.time as Time); const x2 = timeScale.timeToCoordinate(b.time as Time); - if (x1 == null || x2 == null) continue; + if (x1 == null || x2 == null) { skippedTime++; continue; } const aAy = this._series.priceToCoordinate(a.spanA); const aBy = this._series.priceToCoordinate(a.spanB); const bAy = this._series.priceToCoordinate(b.spanA); const bBy = this._series.priceToCoordinate(b.spanB); - if (aAy == null || aBy == null || bAy == null || bBy == null) continue; + if (aAy == null || aBy == null || bAy == null || bBy == null) { skippedPrice++; continue; } // 한국 관례: SpanA > SpanB → 양운(빨강), SpanA <= SpanB → 음운(청록) const bullish = (a.spanA + b.spanA) > (a.spanB + b.spanB); if (bullish && !this._bullishVisible) continue; if (!bullish && !this._bearishVisible) continue; + drawn++; ctx.save(); ctx.beginPath(); ctx.moveTo(x1 * hpr, aAy * vpr); @@ -105,6 +106,11 @@ class CloudRenderer implements IPrimitivePaneRenderer { ctx.fill(); ctx.restore(); } + if (skippedTime > 0 || skippedPrice > 0 || drawn === 0) { + console.warn('[IchimokuCloud] draw result: drawn=', drawn, 'skippedTime=', skippedTime, 'skippedPrice=', skippedPrice, + 'sample time0=', this._data[0]?.time, 'x1_0=', timeScale.timeToCoordinate(this._data[0]?.time as Time), + 'spanA0=', this._data[0]?.spanA, 'priceCoord=', this._series.priceToCoordinate(this._data[0]?.spanA)); + } }); } }