Shimoku docs
Search…
Append data to trend chart

The method to use

The method is shimoku.plt.append_data_to_trend_chart()
It makes possible to append data to already existing charts. For example:
app_path: str = 'test'
menu_path: str = f'{app_path}/append-data'
data = [
{'date': dt.date(2021, 1, 1), 'x': 5, 'y': 3},
{'date': dt.date(2021, 1, 2), 'x': 6, 'y': 7},
{'date': dt.date(2021, 1, 3), 'x': 4, 'y': 5},
{'date': dt.date(2021, 1, 4), 'x': 7, 'y': 6},
{'date': dt.date(2021, 1, 5), 'x': 3, 'y': 5},
]
shimoku.plt.line(
data=data,
x='date', y=['x', 'y'],
menu_path=menu_path,
order=0,
rows_size=2, cols_size=12,
)
# these are the data to append
data_ = [
{'date': dt.date(2021, 1, 6), 'x': 5, 'y': 5},
{'date': dt.date(2021, 1, 7), 'x': 6, 'y': 5},
]
shimoku.plt.append_data_to_trend_chart(
menu_path=menu_path,
order=0,
component_type='line',
data=data_,
x='date', y=['x', 'y'],
)
It will first create the chart and then append the new 2 days of data:
The trend chart with appended data.
Copy link