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.
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.