I have created a candlestick bar chart which is being displayed on my streamlit application using the following code which I found on the forum here. This code snippet was posted by @dataprofessor, thank you for sharing the same.
import pandas as pd
from lightweight_charts.widgets import StreamlitChart
chart = StreamlitChart(width=900, height=600)
df = pd.read_csv(‘ohlcv.csv’)
chart.set(df)
chart.load()
I would like to convert this static chart into one that prints live, candle by candle with an interval time which can be set by the user. I have tried multiple different way but none of them are working. I would greatly appreciate if someone can help me with achieving this. There is a method in the lightweight_charts library called “chart.update()” which can be used to do this, but that method does not seem to be working on the streamlit application.
I am also looking for a solution to this. I would like to update timeframe using the switcher method. It works well using the normal chart.show() but not on streamlit chart.load()
This is my code
[chart.topbar.switcher(‘timeframe’, (‘1m’, ‘5m’, ‘15m’, ‘1h’, ‘1d’),
default=INITIAL_TIMEFRAME, func=on_timeframe_change)]
Thanks for your response. You’re right, I didn’t give attention to the second part of the documentation.
However could you please elaborate on the method you’ve mentioned for updating the data and the chart? I tried out multiple different methods none of which worked, but I never came across the method you have mentioned.