Hi!
I’ve added the following donut chart in my app:
dmc.Group(
children = [
html.Div(
style = {
"margin-left":"28px",
"margin-top": "12px",
},
children = [
# Interval component for triggering updates every second.
dcc.Interval(id='donutchart-neighbors-progress-interval', interval=1000),
dmc.Box(
[
dmc.DonutChart(
id="donutchart-neighbors-progress",
size = 130,
data=[
{"name": "Current Neighbor", "value": 0, "color": "grape"},
{"name": "Total Neighbors", "value": 0, "color": "gray.7"},
],
chartLabel=f"",
fw=700,
thickness=10,
withTooltip=False,
tooltipDataSource="segment",
pieProps={"isAnimationActive": False},
),
]
)
],
),
],
)
this is its calllback function:
@callback(
[Output('donutchart-neighbors-progress', 'data'),
Output('donutchart-neighbors-progress', 'chartLabel')],
Input('donutchart-neighbors-progress-interval', 'n_intervals'),
prevent_initial_call=True
)
def progress_neighbors(n_intervals):
current_tx_idx = self.get_state('current_transaction_idx') + 1
total_neighbors_txs = self.get_state('current_nr_txs')
updated_data = [
{"name": "Current Neighbor", "value": current_tx_idx, "color": "grape"},
{"name": "Total Neighbors", "value": total_neighbors_txs - current_tx_idx, "color": "gray.7"},
]
chart_label = f"{current_tx_idx}/{total_neighbors_txs}"
return updated_data, chart_label
i’ve also added a 2nd donut chart with the same logic. The variables in the scripts are integers. The lists are not long. Yet, memory consumption has increased significantly.