You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm creating a timeline style of graph using line chart where I update the data based on time every x amount of seconds. The issue is that some lines slide to the right, as expected, but other simply move vertically.
Reproduce
List<LineChartBarData> _getDatas(WidgetRef ref) {
List<LineChartBarData> datas = [];
for (final host in hosts) {
var provider = ref.watch(pingListProvider(host));
List<FlSpot> points = provider.points;
var data =LineChartBarData(
spots: points,
isStepLineChart:true,
show: points.isNotEmpty,
color:CustomColors.fromString(provider.host),
dotData:FlDotData(
show:false,
),
);
datas.add(data);
}
return datas;
}
It is because of an animation that we have inside the chart.
So when a list changes and the lengths is the same, we lerp through all the elements and animate them. So in this case we should not do that.
For now, you can disable the animations by setting zero in the swapAnimationDuration.
If you or someone else want to work on it, this is a good starting point:
I'm creating a timeline style of graph using line chart where I update the data based on time every x amount of seconds. The issue is that some lines slide to the right, as expected, but other simply move vertically.
Reproduce
Video
Video
To Reproduce
Repository
Notes
Strangely, the lines that are above 100 all move vertically, and the lines below 100 slide.
Versions
The text was updated successfully, but these errors were encountered: