freyastreamlit / streamlit-lightweight-charts

Streamlit wrapper for lightweight-charts
MIT License
130 stars 29 forks source link

ChartOptions 'barSpacing' not working #46

Open simonislee opened 2 hours ago

simonislee commented 2 hours ago

tried to play with the sample code 'Multipane Chart (intraday) from CSV' The default size of the chandlestick should be changed by varying the option 'barSpacing'. But seems this option have no effect on the chart after several tries. Now my solution is to set the 'minBarSpacing', but that is not the best, not sure the problem is from tradingview API side or this side

chartMultipaneOptions = 
    {
        "width": 600,
        "height": 400,
        "layout": {
            "background": {
                "type": "solid",
                "color": 'white'
            },
            "textColor": "black"
        },
        "grid": {
            "vertLines": {
                "color": "rgba(197, 203, 206, 0.5)"
                },
            "horzLines": {
                "color": "rgba(197, 203, 206, 0.5)"
            }
        },
        "crosshair": {
            "mode": 0
        },
        "priceScale": {
            "borderColor": "rgba(197, 203, 206, 0.8)"
        },
        "timeScale": {
            "borderColor": "rgba(197, 203, 206, 0.8)",
            "barSpacing": 10, # <- that is the problem I talk about
            "minBarSpacing": 8,
            "timeVisible": True,
            "secondsVisible": False,
        },
        "watermark": {
            "visible": True,
            "fontSize": 48,
            "horzAlign": 'center',
            "vertAlign": 'center',
            "color": 'rgba(171, 71, 188, 0.3)',
            "text": 'Intraday',
        }
    },
]
freyastreamlit commented 2 hours ago

Hi @simonislee

Multipane is a challenge - we have am old fork that aligns the panes nicely - have a look at https://github.com/freyastreamlit/streamlit-lightweight-charts-ntf

Best,

Joe Rosa