What?
The RealtimeStatistics
widget periodically fetches data on each new momentum, but does not update the RealtimeTxsChart
widget with the newly retrived data. The new data is only loaded when navigating from another tab.
Why?
The RealtimeTxsChart
widget generates the Znn and Qsr spots data when the widget is initialized in the initState
method.
@override
void initState() {
super.initState();
_znnSpots = _generateZnnSpots();
_qsrSpots = _generateQsrSpots();
}
This method is only called once when the widget is created. When the stream is updated, the widget gets rebuild but does not generate new spots.
How?
The RealtimeTxsChart
widget must generate the Znn and Qsr spots data whenever the widget configuration changes by overriding the didUpdateWidget
method.
@override
void didUpdateWidget(RealtimeTxsChart oldWidget) {
_znnSpots = _generateZnnSpots();
_qsrSpots = _generateQsrSpots();
super.didUpdateWidget(oldWidget);
}
Anything else?
This PR depends on PR Fix realtime graph by KingGorrin · Pull Request #7 · zenon-network/syrius · GitHub; otherwise no chart will be displayed.