tradingview / charting-library-tutorial

This tutorial explains step by step how to connect your data to the Charting Library
MIT License
397 stars 305 forks source link

Is there any way to start chart with zoom in? #68

Open gilperon opened 1 year ago

gilperon commented 1 year ago

Hello, I would like to know if there is any way to start the chart with zoom 3x applied? According to the documentation we have these parameters below. Is there any parameters to set the initial zoom percentage onload?

const symbolInfo = {
            ticker: symbolItem.full_name,
            name: symbolItem.symbol,
            description: symbolItem.description,
            type: symbolItem.type,
            session: '24x7',
            timezone: 'Etc/UTC',
            exchange: symbolItem.exchange,
            minmov: 1,
            pricescale: 100,
            has_intraday: false,
            has_no_volume: true,
            has_weekly_and_monthly: false,
            supported_resolutions: configurationData.supported_resolutions,
            volume_precision: 2,
            data_status: 'streaming',
};
romfrancois commented 1 year ago

Hi @gilperon !

There's no direct zoom option as it may not make sense in all situation and could lead to more issues than initially planned. However you could use the setVisibleRange API. By specifying a different from & to date the chart will act as if it was zoomed (in/out)