그래프 수정
This commit is contained in:
@@ -225,6 +225,21 @@ function sortDualLinePlotDefs(plotDefs: PlotDef[]): PlotDef[] {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* OBV 등 이중 plot — 설정 lineWidth 기준 굵은 선 먼저(하단), 가는 선 나중(상단).
|
||||
* 값이 겹쳐도 점선·실선·색상(설정값)이 함께 보이도록 z-order만 조정.
|
||||
*/
|
||||
function sortPlotDefsForSeriesAdd(type: string, plotDefs: PlotDef[]): PlotDef[] {
|
||||
const sorted = sortDualLinePlotDefs(plotDefs);
|
||||
if (type !== 'OBV') return sorted;
|
||||
return [...sorted].sort((a, b) => {
|
||||
const wA = a.lineWidth ?? 1;
|
||||
const wB = b.lineWidth ?? 1;
|
||||
if (wA !== wB) return wB - wA;
|
||||
return DUAL_LINE_PLOT_ORDER.indexOf(a.id) - DUAL_LINE_PLOT_ORDER.indexOf(b.id);
|
||||
});
|
||||
}
|
||||
|
||||
export class ChartManager {
|
||||
private chart: IChartApi;
|
||||
private container: HTMLElement;
|
||||
@@ -761,7 +776,7 @@ export class ChartManager {
|
||||
indicatorHidden: boolean,
|
||||
def: ReturnType<typeof getIndicatorDef>,
|
||||
): void {
|
||||
const plotDefs = sortDualLinePlotDefs(config.plots ?? def?.plots ?? []);
|
||||
const plotDefs = sortPlotDefsForSeriesAdd(config.type, config.plots ?? def?.plots ?? []);
|
||||
const existingIds = new Set(seriesMeta.map(m => m.plotId));
|
||||
const indicatorPriceFormat = priceFormatForIndicatorPane(pane);
|
||||
|
||||
@@ -882,7 +897,7 @@ export class ChartManager {
|
||||
|
||||
const plotDefsRaw = config.plots ?? def?.plots ?? [];
|
||||
const plotDefs = DUAL_LINE_INDICATOR_TYPES.has(config.type)
|
||||
? sortDualLinePlotDefs(plotDefsRaw)
|
||||
? sortPlotDefsForSeriesAdd(config.type, plotDefsRaw)
|
||||
: plotDefsRaw;
|
||||
|
||||
for (const plotDef of plotDefs) {
|
||||
|
||||
Reference in New Issue
Block a user