feat: set default zoom to 300 candles desktop, 125 candles mobile
This commit is contained in:
@ -739,6 +739,18 @@ export class TradingDashboard {
|
|||||||
|
|
||||||
if (fitToContent) {
|
if (fitToContent) {
|
||||||
this.chart.timeScale().scrollToRealTime();
|
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) {
|
} else if (visibleRange) {
|
||||||
this.chart.timeScale().setVisibleLogicalRange(visibleRange);
|
this.chart.timeScale().setVisibleLogicalRange(visibleRange);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user