fixed: preserve pane assignments across redraws instead of clearing
This commit is contained in:
@ -887,8 +887,10 @@ export function drawIndicatorsOnChart() {
|
||||
'dashed': LightweightCharts.LineStyle.Dashed
|
||||
};
|
||||
|
||||
indicatorPanes.clear();
|
||||
nextPaneIndex = 1;
|
||||
// Don't clear indicatorPanes - preserve pane assignments across redraws
|
||||
// Only reset nextPaneIndex to avoid creating duplicate panes
|
||||
const maxExistingPane = Math.max(...indicatorPanes.values(), 0);
|
||||
nextPaneIndex = maxExistingPane + 1;
|
||||
|
||||
const overlayIndicators = [];
|
||||
const paneIndicators = [];
|
||||
@ -938,8 +940,12 @@ export function drawIndicatorsOnChart() {
|
||||
});
|
||||
|
||||
paneIndicators.forEach(({ indicator, meta, instance }, idx) => {
|
||||
const paneIndex = nextPaneIndex++;
|
||||
// Use existing pane index if already assigned, otherwise create new one
|
||||
let paneIndex = indicatorPanes.get(indicator.id);
|
||||
if (paneIndex === undefined) {
|
||||
paneIndex = nextPaneIndex++;
|
||||
indicatorPanes.set(indicator.id, paneIndex);
|
||||
}
|
||||
|
||||
console.log(`[Indicators] Processing pane: ${indicator.name} (pane ${paneIndex})`);
|
||||
console.log(`[Indicators] Before renderIndicatorOnPane: indicator.cachedResults length = ${indicator.cachedResults?.length || 0}`);
|
||||
|
||||
Reference in New Issue
Block a user