From 02c54cb354d1bb6b3226798e4b1c288f5a923bd5 Mon Sep 17 00:00:00 2001 From: DiTus Date: Tue, 24 Mar 2026 08:24:14 +0100 Subject: [PATCH] feat: set default zoom to 300 candles desktop, 125 candles mobile --- js/ui/chart.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/js/ui/chart.js b/js/ui/chart.js index edc989a..dd71a79 100644 --- a/js/ui/chart.js +++ b/js/ui/chart.js @@ -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); }