We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent be5db97 commit 4f942a5Copy full SHA for 4f942a5
lib/src/interactive_chart.dart
@@ -107,6 +107,16 @@ class _InteractiveChartState extends State<InteractiveChart> {
107
late Offset _initialFocalPoint;
108
PainterParams? _prevParams; // used in onTapUp event
109
110
+ @override
111
+ void didUpdateWidget(covariant InteractiveChart oldWidget) {
112
+ super.didUpdateWidget(oldWidget);
113
+ if (oldWidget.candles.length < widget.candles.length) {
114
+ // Change offset to show the latest candle when new data is added
115
+ _startOffset =
116
+ max(0, widget.candles.length * _candleWidth - _prevChartWidth!);
117
+ }
118
119
+
120
@override
121
Widget build(BuildContext context) {
122
return LayoutBuilder(
0 commit comments