How to making echarts re-render on data change or after a period?

Hi there,

I’m trying out the streamlit-echarts component. I want my echart to refresh on data change or after a few seconds (like a real-time chart update). My approach was putting st_echarts(options, key=key) inside a for loop:

for i in range(5):

options = {
“xAxis”: {
“type”: “category”,
“data”: [“Mon”, “Tue”, “Wed”, “Thu”, “Fri”, “Sat”, “Sun”],
“yAxis”: {“type”: “value”},
“series”: [
{“data”: [820, 932, 901, 934, 1290, 1330, 1320], “type”: “line”}
options[‘series’][0][‘data’][0] += 80
st_echarts(options=options, key=‘chart’)

But this results in error:

DuplicateWidgetID: There are multiple widgets with the same key='chart'.

To fix this, please make sure that the key argument is unique for each widget you create.

Is it possible in the current version of streamlit-echarts?


What do you need the key parameter for? What happens if you remove it?

try this:
st_echarts(options=options, key=‘chart’+str(i))

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.