알림목록 obv 그래프 문제 최종수정
This commit is contained in:
@@ -442,6 +442,37 @@ export function mergePlotDefs(saved: PlotDef[] | undefined, defaults: PlotDef[])
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* DB visual PATCH 저장 plots — registry 필드를 무분별히 상속하지 않음.
|
||||
* (저장 객체에 lineStyle·color 키가 없으면 registry 점선·주황이 끼어드는 문제 방지)
|
||||
*/
|
||||
export function mergePlotDefsFromSavedVisual(
|
||||
saved: PlotDef[] | undefined,
|
||||
registryPlots: PlotDef[],
|
||||
indicatorType?: string,
|
||||
): PlotDef[] {
|
||||
if (!registryPlots.length) return (saved ?? []).map(p => ({ ...p }));
|
||||
const savedMap = new Map((saved ?? []).map(p => [p.id, p]));
|
||||
return registryPlots.map(def => {
|
||||
const s = savedMap.get(def.id);
|
||||
if (!s) return { ...def };
|
||||
const out: PlotDef = {
|
||||
...def,
|
||||
color: s.color ?? def.color,
|
||||
lineWidth: s.lineWidth ?? def.lineWidth,
|
||||
lineStyle: Object.prototype.hasOwnProperty.call(s, 'lineStyle')
|
||||
? s.lineStyle
|
||||
: def.lineStyle,
|
||||
type: s.type ?? def.type,
|
||||
histogramUpColor: s.histogramUpColor ?? def.histogramUpColor,
|
||||
histogramDownColor: s.histogramDownColor ?? def.histogramDownColor,
|
||||
id: def.id,
|
||||
title: def.title,
|
||||
};
|
||||
return out;
|
||||
});
|
||||
}
|
||||
|
||||
/** OBV·CCI·RSI·TRIX — 이중 plot 병합·표시 보장 */
|
||||
const SIGNAL_LINE_INDICATOR_TYPES = new Set(['OBV', 'CCI', 'RSI', 'TRIX']);
|
||||
|
||||
@@ -474,16 +505,15 @@ function normalizeSignalLineIndicatorPlots(
|
||||
const nextPlots = merged.map(p => {
|
||||
const reg = registryPlots.find(r => r.id === p.id);
|
||||
if (!reg) return p;
|
||||
const defaultLineStyle = p.id === 'plot1' ? 'solid' as const : undefined;
|
||||
return normalizeDualLinePlotDef(p, reg, defaultLineStyle);
|
||||
return normalizeDualLinePlotDef(p, reg);
|
||||
});
|
||||
nextPlots.sort((a, b) => {
|
||||
const order = ['plot0', 'plot1'];
|
||||
return order.indexOf(a.id) - order.indexOf(b.id);
|
||||
});
|
||||
const nextVis = { ...plotVisibility };
|
||||
if (nextVis.plot0 !== false) nextVis.plot0 = true;
|
||||
if (nextVis.plot1 !== false) nextVis.plot1 = true;
|
||||
nextVis.plot0 = true;
|
||||
nextVis.plot1 = true;
|
||||
return { plots: nextPlots, plotVisibility: nextVis };
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user