/** * 캔들 pane 하단 시간축 — 거래량·보조지표가 아래에 있을 때 캔들 영역 바로 아래에도 시간 표시. * 크로스헤어 세로선 위치에 해당 날짜·시간 배지를 함께 표시한다. */ import React, { useEffect, useCallback, useRef } from 'react'; import type { MouseEventParams, Time } from 'lightweight-charts'; import type { ChartManager } from '../utils/ChartManager'; import { subscribeChartTimeFormat } from '../utils/chartTimeFormat'; const AXIS_HEIGHT = 22; interface CandlePaneTimeAxisProps { manager: ChartManager; containerEl: HTMLElement; } function applyOverlayLayout( root: HTMLDivElement, pool: HTMLSpanElement[], state: NonNullable>, ): void { root.style.display = 'flex'; root.style.top = `${state.topY}px`; root.style.height = `${state.height ?? AXIS_HEIGHT}px`; root.style.width = `${state.plotWidth}px`; state.labels.forEach((label, i) => { let span = pool[i]; if (!span) { span = document.createElement('span'); span.className = 'candle-pane-time-axis__label'; root.appendChild(span); pool[i] = span; } span.style.display = ''; span.style.left = `${label.x}px`; span.textContent = label.text; }); for (let i = state.labels.length; i < pool.length; i++) { if (pool[i]) pool[i].style.display = 'none'; } } const CandlePaneTimeAxis: React.FC = ({ manager, containerEl }) => { const axisRef = useRef(null); const crosshairRef = useRef(null); const labelPoolRef = useRef([]); const updateCrosshairLabel = useCallback((p: MouseEventParams