최종수정
This commit is contained in:
@@ -225,17 +225,6 @@ function sortDualLinePlotDefs(plotDefs: PlotDef[]): PlotDef[] {
|
||||
);
|
||||
}
|
||||
|
||||
/** 이중 plot 지표 시리즈 추가 순서 — OBV는 plot1→plot0 순으로 본선이 위에 그려지게 */
|
||||
function sortPlotDefsForSeriesAdd(type: string, plotDefs: PlotDef[]): PlotDef[] {
|
||||
const sorted = sortDualLinePlotDefs(plotDefs);
|
||||
return type === 'OBV' ? [...sorted].reverse() : sorted;
|
||||
}
|
||||
|
||||
/** OBV 본선(plot0) — DB plotVisibility·투명색으로 숨김 방지 */
|
||||
function isDualLinePlotForcedVisible(type: string, plotId: string): boolean {
|
||||
return type === 'OBV' && plotId === 'plot0';
|
||||
}
|
||||
|
||||
export class ChartManager {
|
||||
private chart: IChartApi;
|
||||
private container: HTMLElement;
|
||||
@@ -772,13 +761,13 @@ export class ChartManager {
|
||||
indicatorHidden: boolean,
|
||||
def: ReturnType<typeof getIndicatorDef>,
|
||||
): void {
|
||||
const plotDefs = sortPlotDefsForSeriesAdd(config.type, config.plots ?? def?.plots ?? []);
|
||||
const plotDefs = sortDualLinePlotDefs(config.plots ?? def?.plots ?? []);
|
||||
const existingIds = new Set(seriesMeta.map(m => m.plotId));
|
||||
const indicatorPriceFormat = priceFormatForIndicatorPane(pane);
|
||||
|
||||
for (const plotDef of plotDefs) {
|
||||
if (existingIds.has(plotDef.id)) continue;
|
||||
if (config.plotVisibility?.[plotDef.id] === false && !isDualLinePlotForcedVisible(config.type, plotDef.id)) continue;
|
||||
if (config.plotVisibility?.[plotDef.id] === false) continue;
|
||||
if (plotDef.type === 'histogram') continue;
|
||||
|
||||
const plotData = result.plots[plotDef.id] as PlotData | undefined;
|
||||
@@ -787,21 +776,15 @@ export class ChartManager {
|
||||
if (filtered.length === 0) continue;
|
||||
|
||||
const isPlotVisible = !indicatorHidden
|
||||
&& (isDualLinePlotForcedVisible(config.type, plotDef.id)
|
||||
|| (this._isCustomOverlayApplied() && (config.type === 'SMA' || config.type === 'BollingerBands' || config.type === 'IchimokuCloud')
|
||||
? isCustomPlotSelected(this._getAppliedCustomOverlaySelection(), config.type, plotDef.id)
|
||||
: config.plotVisibility?.[plotDef.id] !== false));
|
||||
&& (this._isCustomOverlayApplied() && (config.type === 'SMA' || config.type === 'BollingerBands' || config.type === 'IchimokuCloud')
|
||||
? isCustomPlotSelected(this._getAppliedCustomOverlaySelection(), config.type, plotDef.id)
|
||||
: config.plotVisibility?.[plotDef.id] !== false);
|
||||
const showPriceLabel = this.shouldShowSeriesPriceLabel(config, true, pane);
|
||||
const showSeriesTitle = pane < 2 && showPriceLabel;
|
||||
const regPlot = def?.plots?.find(p => p.id === plotDef.id);
|
||||
const fallbackColor = config.type === 'OBV' && plotDef.id === 'plot0'
|
||||
? (regPlot?.color ?? '#2196F3')
|
||||
: (regPlot?.color ?? plotDef.color ?? '#2962FF');
|
||||
const series = this.chart.addSeries(LineSeries, {
|
||||
color: resolvePlotLineColor(plotDef.color, fallbackColor),
|
||||
lineWidth: (config.type === 'OBV' && plotDef.id === 'plot0'
|
||||
? Math.max(2, plotDef.lineWidth ?? regPlot?.lineWidth ?? 2)
|
||||
: Math.max(1, plotDef.lineWidth ?? 1)) as 1 | 2 | 3 | 4,
|
||||
color: resolvePlotLineColor(plotDef.color, regPlot?.color ?? plotDef.color ?? '#2962FF'),
|
||||
lineWidth: Math.max(1, plotDef.lineWidth ?? regPlot?.lineWidth ?? 1) as 1 | 2 | 3 | 4,
|
||||
lineStyle: plotSeriesLineStyle(plotDef.lineStyle),
|
||||
priceLineVisible: false,
|
||||
lastValueVisible: showPriceLabel,
|
||||
@@ -899,7 +882,7 @@ export class ChartManager {
|
||||
|
||||
const plotDefsRaw = config.plots ?? def?.plots ?? [];
|
||||
const plotDefs = DUAL_LINE_INDICATOR_TYPES.has(config.type)
|
||||
? sortPlotDefsForSeriesAdd(config.type, plotDefsRaw)
|
||||
? sortDualLinePlotDefs(plotDefsRaw)
|
||||
: plotDefsRaw;
|
||||
|
||||
for (const plotDef of plotDefs) {
|
||||
@@ -919,21 +902,15 @@ export class ChartManager {
|
||||
seriesMeta.push({ plotId: plotDef.id, isHistogram: true, color: plotDef.color });
|
||||
} else {
|
||||
const isPlotVisible = !indicatorHidden
|
||||
&& (isDualLinePlotForcedVisible(config.type, plotDef.id)
|
||||
|| (this._isCustomOverlayApplied() && (config.type === 'SMA' || config.type === 'BollingerBands' || config.type === 'IchimokuCloud')
|
||||
? isCustomPlotSelected(this._getAppliedCustomOverlaySelection(), config.type, plotDef.id)
|
||||
: config.plotVisibility?.[plotDef.id] !== false));
|
||||
&& (this._isCustomOverlayApplied() && (config.type === 'SMA' || config.type === 'BollingerBands' || config.type === 'IchimokuCloud')
|
||||
? isCustomPlotSelected(this._getAppliedCustomOverlaySelection(), config.type, plotDef.id)
|
||||
: config.plotVisibility?.[plotDef.id] !== false);
|
||||
const showPriceLabel = this.shouldShowSeriesPriceLabel(config, true, pane);
|
||||
const showSeriesTitle = pane < 2 && showPriceLabel;
|
||||
const regPlot = def?.plots?.find(p => p.id === plotDef.id);
|
||||
const fallbackColor = config.type === 'OBV' && plotDef.id === 'plot0'
|
||||
? (regPlot?.color ?? '#2196F3')
|
||||
: (regPlot?.color ?? plotDef.color ?? '#2962FF');
|
||||
series = this.chart.addSeries(LineSeries, {
|
||||
color: resolvePlotLineColor(plotDef.color, fallbackColor),
|
||||
lineWidth: (config.type === 'OBV' && plotDef.id === 'plot0'
|
||||
? Math.max(2, plotDef.lineWidth ?? regPlot?.lineWidth ?? 2)
|
||||
: Math.max(1, plotDef.lineWidth ?? 1)) as 1 | 2 | 3 | 4,
|
||||
color: resolvePlotLineColor(plotDef.color, regPlot?.color ?? plotDef.color ?? '#2962FF'),
|
||||
lineWidth: Math.max(1, plotDef.lineWidth ?? regPlot?.lineWidth ?? 1) as 1 | 2 | 3 | 4,
|
||||
lineStyle: plotSeriesLineStyle(plotDef.lineStyle),
|
||||
priceLineVisible: false,
|
||||
lastValueVisible: showPriceLabel,
|
||||
@@ -2695,7 +2672,6 @@ export class ChartManager {
|
||||
/** custom 미적용 시 지표 설정 plotVisibility, 적용 시 custom 선택만 반영 */
|
||||
private _resolveSeriesVisible(config: IndicatorConfig, plotId: string | undefined): boolean {
|
||||
if (!plotId || !this._isIndicatorEffectivelyVisible(config)) return false;
|
||||
if (isDualLinePlotForcedVisible(config.type, plotId)) return true;
|
||||
if (!this._isCustomOverlayApplied()) {
|
||||
return config.plotVisibility?.[plotId] !== false;
|
||||
}
|
||||
@@ -2926,13 +2902,8 @@ export class ChartManager {
|
||||
}
|
||||
if (!entry.seriesMeta[i]?.isHistogram) {
|
||||
const regPlot = def?.plots?.find(p => p.id === pid);
|
||||
const fallbackColor = entry.type === 'OBV' && pid === 'plot0'
|
||||
? (regPlot?.color ?? '#2196F3')
|
||||
: (regPlot?.color ?? plot.color ?? '#aaa');
|
||||
opts['color'] = resolvePlotLineColor(plot.color, fallbackColor);
|
||||
opts['lineWidth'] = entry.type === 'OBV' && pid === 'plot0'
|
||||
? Math.max(2, plot.lineWidth ?? regPlot?.lineWidth ?? 2)
|
||||
: Math.max(1, plot.lineWidth ?? regPlot?.lineWidth ?? 1);
|
||||
opts['color'] = resolvePlotLineColor(plot.color, regPlot?.color ?? plot.color ?? '#aaa');
|
||||
opts['lineWidth'] = Math.max(1, plot.lineWidth ?? regPlot?.lineWidth ?? 1);
|
||||
opts['lineStyle'] = plotSeriesLineStyle(plot.lineStyle);
|
||||
let plotAllows = true;
|
||||
if (entry.type === 'IchimokuCloud') {
|
||||
|
||||
Reference in New Issue
Block a user