Skip to content
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

Using Charts library for real-time plotting #565

Closed
rforouzanfar opened this issue Nov 23, 2015 · 9 comments
Closed

Using Charts library for real-time plotting #565

rforouzanfar opened this issue Nov 23, 2015 · 9 comments

Comments

@rforouzanfar
Copy link

Hi Daniel,

Thanks a lot for this great API.

I'm using Charts to plot ECG data points (versus time) in real-time and I have 100 data points coming from hardware per second. I'm saving the data in database and then plot them. Here is what I'm using to clear the chartview as well ECG voltages and times each time I'm reseting the graph:

[self.chartView clear];
[self.chartView notifyDataSetChanged];
[self.ecgVoltage removeAllObjects];
[self.ecgDate removeAllObjects];

Although I have changed the database from Core Data to Realm, I am still experiencing slow processing. Is there anything else I could do on the plotting end to save some extra processing? I'm drawing every 50 x-index, though I was wondering if there would be any way that I could assign x-index to some of my y-values as it seems to have a high CPU usage?

P.S. I thought of using custom min and max y values, as they should be refreshed due to possible noises

@liuxuan30
Copy link
Member

Have you checked what functions takes lots of time or the CG is slow? I guess you need to use timer to measure it first. Then you will have a clear mind which part can be improved.

@danielgindi
Copy link
Collaborator

You do not need to read the whole dataset for each frame rendering, and do not need to clear.

Just add the new entries (and drop old, unnecessary entries).
Then you could call notifyDataSetChanged

Btw - native Realm support coming soon cross-platform, courtesy of Realm. :-)

@liuxuan30
Copy link
Member

god, I just know Realm today and seems awesome. Seems time to rewrite my model? LOL

@AwaisFayyaz
Copy link

Hi Daniel,

Thanks for the great library. Can you tell me if this kind of real time plotting is possible using your charts library?

demo

@thierryH91200
Copy link
Contributor

do you want something like that?

realtime.mov.zip

@AwaisFayyaz
Copy link

AwaisFayyaz commented Sep 18, 2018

@thierryH91200 My values can go positive as well as negative, as depicted in the attached gif. and i need bars, not line.

@thierryH91200
Copy link
Contributor

thierryH91200 commented Sep 18, 2018

do you want the source ??

this is just an example

capture d ecran 2018-09-18 16 28 15

capture d ecran 2018-09-18 16 57 17

@kartiksharma007
Copy link

hi just wanted to ask if we in any way you can help as the data which we have is in a single array , so that means no x or y axis.

@kartiksharma007
Copy link

data.json.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants