I’m reading data from sensors, which I understand might not be the best use case for Streamlit. Nonetheless, I like all the other features so much that I am willing to use Streamlit.
I’m wondering if there’s a way to speed up how fast line_charts take.
Here is an example:
import time
import random
import streamlit as st
data1 = deque([0]*5)
data2 = deque([0]*5)
graph1 = st.empty()
graph2 = st.empty()
while True:
data1.popleft()
data1.append(5 + random.randint(-5, 5))
data2.popleft()
data2.append(4 + random.randint(3, 9))
graph1.line_chart(list(data1))
graph2.line_chart(list(data2))
time.sleep(1)
I expect the two graphs to update at around the same time every second, but instead the first one updates, a brief half second pause, and then the second one updates, and then there’s the 1 second delay. I don’t believe it’s because of the various deque operations as there is only 5 elements in these lists.
Also, because this is simulating sensor data, data is random and caching will be pretty much impossible.