-
-
Notifications
You must be signed in to change notification settings - Fork 173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Real-time data performance #43
Comments
I think it is suite for your case. There are some optimizations for fast updating in this lib. I believe your updating is triggered by setState in the widget tree, make sure to set But to be careful, I suggest you to make some performace tests. 1000 points is not a problem at all, but 30ms is a rare requirement that I havent tried. |
I hope you could please feedback your result in this issue, whether this lib satisfy your demand at last. |
Thanks for the quick response! My code looks like this: // timer that is started in initState and adds new data points to the data list
timer = Timer.periodic(const Duration(milliseconds: 30), (_) {
if (data.length >= 1000) {
data.removeAt(0);
}
setState(() {
data.add(ChartData(counter, r.nextInt(1000)));
});
print(data[0]);
counter++;
}); Chart(
rebuild: false,
changeData: true,
data: data,
variables: {
'index':
Variable(accessor: (ChartData data) => data.index),
'value':
Variable(accessor: (ChartData data) => data.value)
},
elements: [
LineElement(
shape: ShapeAttr(value: BasicLineShape(smooth: true)))
],
axes: [
Defaults.horizontalAxis,
Defaults.verticalAxis,
],
) |
The problem is caused by a bug, when you didn't create new instance of the data list but modified it, the It has been fixed in 0.8.0, please upgrade and try. But I have to say usually we consider widget property as immutable and create new instance when setState in Flutter. That's why this bug is hardly to expose. I suggest you to do so. |
Thank you! I got it working now. First impressions are that performance is adequat, although it is pushing it to the limit. Pretty much comparable to Syncfusion Charts, which I used before. I've got some issues with stuttering where I don't know yet what causes the problem, but so far I think it's not related to this library, as similar issues occured with the Syncfusion one. I will do further testing and report back when I know more. |
Hello, I'm working on something similar, updating the data every second and then plotting a line graph of the data in real time, can you share your code with me? |
I have a project were I need to render multiple charts of incoming sensor data. The charts should be updated at least every 30ms and show up to 1000 data points at a time, as a line chart. Is this library suited for this use-case and capable of this performance?
Thanks for any tips.
The text was updated successfully, but these errors were encountered: