벡테스팅 수정

This commit is contained in:
Macbook
2026-06-03 02:04:30 +09:00
parent 88fe92d8c3
commit 8de3b77479
14 changed files with 156 additions and 86 deletions
+33 -22
View File
@@ -307,6 +307,8 @@ export class ChartManager {
/** 차트 하단 거래량 pane 표시 */
private _volumeVisible = true;
/** false — 거래량 시리즈·pane 1 미생성 (가상매매 카드 등) */
private _volumePaneEnabled = true;
/** pane 간 구분선 (설정 화면) */
private _paneSeparatorOptions: ChartPaneSeparatorOptions =
@@ -324,10 +326,12 @@ export class ChartManager {
constructor(
container: HTMLElement,
theme: Theme,
options?: { autoSize?: boolean; compactPaneLayout?: boolean },
options?: { autoSize?: boolean; compactPaneLayout?: boolean; volumePaneEnabled?: boolean },
) {
this.container = container;
this._compactPaneLayout = options?.compactPaneLayout ?? false;
this._volumePaneEnabled = options?.volumePaneEnabled ?? true;
if (!this._volumePaneEnabled) this._volumeVisible = false;
const autoSize = options?.autoSize ?? !this._compactPaneLayout;
const t = getTheme(theme);
this.chart = createChart(container, {
@@ -454,28 +458,31 @@ export class ChartManager {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(this.mainSeries as ISeriesApi<any>).setData(mainData);
// Volume sub-pane (pane index 1)
this.volumeSeries = this.chart.addSeries(HistogramSeries, {
priceFormat: { type: 'volume' },
priceScaleId: 'volume',
}, 1);
// 초기 volume pane 크기: resetPaneHeights() 호출 전 임시 설정
// (setHeight 대신 setStretchFactor - LWC 내부 기준 높이와 무관하게 동작)
const panesInit = this.chart.panes();
if (panesInit[0]) panesInit[0].setStretchFactor(0.88);
if (panesInit[1]) panesInit[1].setStretchFactor(0.12);
if (this._volumePaneEnabled) {
// Volume sub-pane (pane index 1)
this.volumeSeries = this.chart.addSeries(HistogramSeries, {
priceFormat: { type: 'volume' },
priceScaleId: 'volume',
}, 1);
this.volumeSeries.setData(bars.map(b => ({
time: b.time as Time,
value: b.volume,
color: b.close >= b.open ? `${t.upColor}88` : `${t.downColor}88`,
})));
// 초기 volume pane 크기: resetPaneHeights() 호출 전 임시 설정
if (panesInit[0]) panesInit[0].setStretchFactor(0.88);
if (panesInit[1]) panesInit[1].setStretchFactor(0.12);
if (!this._volumeVisible) {
try {
this.volumeSeries.applyOptions({ visible: false } as Parameters<ISeriesApi<SeriesType>['applyOptions']>[0]);
} catch { /* ok */ }
this.volumeSeries.setData(bars.map(b => ({
time: b.time as Time,
value: b.volume,
color: b.close >= b.open ? `${t.upColor}88` : `${t.downColor}88`,
})));
if (!this._volumeVisible) {
try {
this.volumeSeries.applyOptions({ visible: false } as Parameters<ISeriesApi<SeriesType>['applyOptions']>[0]);
} catch { /* ok */ }
}
} else if (panesInit[0]) {
panesInit[0].setStretchFactor(1);
}
this._reapplyAllPatternMarkers();
@@ -2621,6 +2628,10 @@ export class ChartManager {
/** 차트 설정: 거래량 pane 표시 on/off */
setVolumeVisible(visible: boolean, availableHeight?: number): void {
if (!this._volumePaneEnabled) {
this._volumeVisible = false;
return;
}
this._volumeVisible = visible;
if (this._candleOnlyLayout) return;
this.applyVolumeVisibility(visible, availableHeight);
@@ -3954,7 +3965,7 @@ export class ChartManager {
}
private _volumeFrac(H: number): number {
if (!this._volumeVisible || this._candleOnlyLayout) return 0;
if (!this._volumePaneEnabled || !this._volumeVisible || this._candleOnlyLayout) return 0;
return Math.min(Math.max(60 / H, 0.04), 0.12);
}
@@ -3970,7 +3981,7 @@ export class ChartManager {
? this._lastLayoutAvailableHeight
: this.container.clientHeight);
const volumeShown = this._volumeVisible && !this._candleOnlyLayout;
const volumeShown = this._volumePaneEnabled && this._volumeVisible && !this._candleOnlyLayout;
const VOL_FRAC = this._volumeFrac(H);
const MIN_IND_PX = this._minIndPx(H);
const ORPHAN_STRETCH = 0.0001;