fixed: remember RSI pane height across data updates

This commit is contained in:
DiTus
2026-03-01 22:45:44 +01:00
parent ea49c9b15a
commit 6dd4d1c5dd

View File

@ -649,7 +649,8 @@ function addIndicator(type) {
params, params,
plots: metadata.plots, plots: metadata.plots,
series: [], series: [],
visible: true visible: true,
paneHeight: Math.floor(window.innerHeight * 0.2) // default 20% of screen
}); });
// Don't set configuringId so indicators are NOT expanded by default // Don't set configuringId so indicators are NOT expanded by default
@ -920,10 +921,9 @@ export function drawIndicatorsOnChart() {
} }
}); });
// Calculate heights based on VISIBLE indicators only // Set main pane height (60% if indicator panes exist, 100% otherwise)
const totalPanes = 1 + paneIndicators.length; const totalPanes = 1 + paneIndicators.length;
const mainPaneHeight = paneIndicators.length > 0 ? 60 : 100; const mainPaneHeight = paneIndicators.length > 0 ? 60 : 100;
const paneHeight = paneIndicators.length > 0 ? Math.floor(40 / paneIndicators.length) : 0;
window.dashboard.chart.panes()[0]?.setHeight(mainPaneHeight); window.dashboard.chart.panes()[0]?.setHeight(mainPaneHeight);
@ -948,7 +948,10 @@ export function drawIndicatorsOnChart() {
const pane = window.dashboard.chart.panes()[paneIndex]; const pane = window.dashboard.chart.panes()[paneIndex];
if (pane) { if (pane) {
pane.setHeight(paneHeight); // Use stored height or default to 20% of chart height
const defaultHeight = Math.floor(window.innerHeight * 0.2);
const storedHeight = indicator.paneHeight || defaultHeight;
pane.setHeight(storedHeight);
} }
}); });