Question

I’m new to Android and need to plot real-time data in my app.

After reading some related topics, I find the solution for me could be “achartengine” or “Androidplot”.

I understand both libraries are with the plot functions I’m looking for, just a little confused about which one might be more suitable for my requirements. So if anyone is experienced in developing apps with similar purposes, please provide your suggestions and that would be of great help to me!

Here is what I plan to do in my Android app:

  1. My target SDK is Android 4.2.

  2. I will receive 3 sets of real-time data through bluetooth, and I need 3 dynamic X-Y scatter charts to show these data.

  3. The sampling frequency is 1024.

  4. I’m going to use an activity with the navigation type “scrollable tabs + swipe” to show these 3 dynamic charts, one tab for one chart.

  5. Allow pinch-to-zoom to work on the dynamic charts.

Thanks in advance!

Was it helpful?

Solution

I suggest using Androidplot for dynamic data. Full disclosure: I'm the primary developer of Androidplot so I'm a little biased but I'll try to defend my suggestion:

One of Androidplot's core focuses is the accurate representation of dynamic data, whereas other libraries seems to focus on either static data or for lack of a better term semi-dynamic data. It's possible to animate plots from other plotting libraries to get a "dynamic" display but there is high potential for race conditions between the data model and the display data, especially in the scenario you mention above where the model is updated at a much higher frequency than the display.

There are also issues with plotting large amounts of data, or even small amounts of data at high frequency using the main thread. This can impact the UX by adding latency to UI interactions and even potentially occupying the main thread long enough for the OS to assume the application has hung. Androidplot solves this problem by providing the option to do all rendering in a background thread, keeping the main thread free of delays. This is a feature (rendering from a background thread) that (as far as I am currently aware) is unique only to Androidplot.

I won't say Androidplot is the end-all-be-all charting library for Android and certainly there are several other good libraries, but your particular requirements especially fit one of the primary use cases for which Androidplot was designed.

/sales pitch over :)

EDIT: As far as scrolling / zooming of dynamic data: It's as easy as using the XYPlotZoomPan class instead of XYPlot :-)

OTHER TIPS

For real-time data plotting I use jjoe64. Pretty new to this library myself, but I got it running as it suited my requirement and I am sure it will benifit you too..

If it's the primary developers parade on this thread then I must say a couple of words. It's your choice for the best library that fits the needs.

AChartEngine provides pinch zoom and drag for pan out of the box. You can also enable the built-in buttons for zoom in, out and reset or you can create custom buttons for this.

Dynamic charting is as simple as modifying the contents of your dataset and calling a repaint() on your chart view.

I also suggest you take a look at these usage statistics.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top