feat: set default zoom to 300 candles desktop, 125 candles mobile

This commit is contained in:
DiTus
2026-03-24 08:24:14 +01:00
parent c3ca5670e3
commit 02c54cb354

View File

@ -739,6 +739,18 @@ export class TradingDashboard {
if (fitToContent) {
this.chart.timeScale().scrollToRealTime();
const isMobile = window.innerWidth < 768;
const defaultCandles = isMobile ? 125 : 300;
const dataLength = this.candleSeries.data().length;
if (dataLength > defaultCandles) {
const logicalRange = {
from: dataLength - 1 - defaultCandles,
to: dataLength - 1
};
this.chart.timeScale().setVisibleLogicalRange(logicalRange);
}
} else if (visibleRange) {
this.chart.timeScale().setVisibleLogicalRange(visibleRange);
}