tysonwu / dash-tradingview

Tradingview Lightweight Charts wrapper for Plotly Dash apps
MIT License
134 stars 25 forks source link

unable to use fullTimeScaleOptions #11

Open jisaac01 opened 1 year ago

jisaac01 commented 1 year ago

Do you have an example of showing intraday data with minutes/seconds visible? I've played around with this for hours, but can't seem to get it. Graph shows up, but only date is visible on the x-axis and on hover. Here's what I tried last:

        candlestick_data = [{'time': 1685129401, 'open': 175.375, 'close': 175.305, 'low': 175.28, 'high': 175.39, 'volume': 147318},
                            {'time': 1685129501, 'open': 175.375, 'close': 175.305, 'low': 175.28, 'high': 175.39, 'volume': 147318}]
        #candlestick_data = [{'time': '2021-01-01T10:00:01', 'open': 175.375, 'close': 175.305, 'low': 175.28, 'high': 175.39, 'volume': 147318}]
        tv_chart = dash_tvlwc.Tvlwc(
                seriesData=[candlestick_data],
                seriesTypes=['candlestick'],
                fullTimeScaleOptions={ 
                    'rightOffset': 100,
                    'barSpacing': 100,
                    'minBarSpacing': 5,
                    'fixLeftEdge': False,
                    'fixRightEdge': False,
                    'lockVisibleTimeRangeOnResize': False,
                    'rightBarStaysOnScroll': False,
                    'borderVisible': False,
                    'borderColor': "#fff",
                    'visible': True,
            'timeVisible': True,
                    'secondsVisible': True,
                    'shiftVisibleRangeOnNewBar': True,
                    #'tickMarkFormatter': 'time',
                }
            )
fouvy commented 1 year ago

@jisaac01 Tradingview chartOptions timeVisible, secondsVisible set to true, time using UTCTimestamp.

candlestick_data = [{'time': 1685129401, 'open': 175.375, 'close': 175.305, 'low': 175.28, 'high': 175.39, 'volume': 147318},
                    {'time': 1685129501, 'open': 175.375, 'close': 175.305, 'low': 175.28, 'high': 175.39, 'volume': 147318}]
chart_options = {
    'layout': {
        'background': {'type': 'solid', 'color': '#1B2631'},
        'textColor': 'white',
    },
    'grid': {
        'vertLines': {'visible': False},
        'horzLines': {'visible': False},
    },
    'timeScale': {'timeVisible': True, 'secondsVisible': True}
}
tv_chart = dash_tvlwc.Tvlwc(
        seriesData=[candlestick_data],
        seriesTypes=['candlestick'],
        chartOptions=chart_options
    )
algorithmy1 commented 7 months ago

barSpacing in chart_options is not working :/