1

I m designing an application that is suppose to plot multiple graphs for sensor data on a single tablet screen.All the graphs shall have common x-axis that displays time(1 sec to 2 mins) but y axis data for all the plots is different. I was able to successfully plot all the graphs but not sure how to display a common x- axis for the graphs? Has anyone tried doing this?

Anjali
  • 21
  • 2
  • Hi Anjali, It's not clear what you're asking here. It sounds like you are trying to use a dual scale on the y-axis. If so, the latest release of Androidplot (1.0.0) has added support for this. Does the plot on the far left of [this image](https://github.com/halfhp/androidplot/blob/master/docs/images/preview.png?raw=true) look like what you're trying to do? – Nick Aug 16 '16 at 14:23
  • Actually I need to plot multiple series( say data for ECG ,spo2,cpap and so on) together in a single plot such that x- axis is common – Anjali Aug 16 '16 at 16:39
  • Multiple series is already supported. But in the specified image do the line labels (on both the left and right side) look like what you're trying to add? – Nick Aug 16 '16 at 16:40
  • Actually the y axis data should be non overlapping. Say for spo2 sensor, y axis range shall be 0 to 100%, for ECG sensor, y axis range shall be 0 to 1000. Both the sensor data shall have common x axis displaying time from 1 sec to 10 sec..is this achievable? – Anjali Aug 16 '16 at 16:47
  • For reference the fourth graph displayed on the Android plot site(http://androidplot.com/)is something similar that I want but with a common x axis.most sites suggest that common x axis is possible only if y axis is common. – Anjali Aug 16 '16 at 17:02
  • ahh so you actually want separate plots for each graph then? ( I was under the impression you wanted all the series to be within a single plot space...sample #4 is a listview of plots which mean separate plots for each grouping of series data) that's actually pretty easy to do :-) I'll add a basic answer. – Nick Aug 16 '16 at 17:06
  • Thanks for prompt response. But the main challenge is Even though the plots are separate they need to be linked together using common x-axis such that if the x- axis time scale is changed from 10 sec to 1 min, then each of the individual plot should get updated as per the new time scale.so if initially say I display 4 series data for 10 seconds and if later the time changes to 1 mins, then data for all 4 series should get updated accordingly.hope I am not confusing you. – Anjali Aug 16 '16 at 17:19
  • i think i understand. should be as simple as making sure you consistently set the boundaries to the same thing on each plot instance. – Nick Aug 16 '16 at 19:30

1 Answers1

0

You can definitely display multiple plots (each containing it's own graph space) with identical domain (xAxis) labeling. The key to doing this is constraining each plot's boundaries in the same way.

Let's say that for the sake of this example your series data uses a time offset in milliseconds as it's x values. For 1 second that gives us:

xMin = 1000 (1 second)

xMax = 120000 (2 minutes)

which translates to:

plot.setDomainBoundaries(1000, 12000, BoundaryMode.FIXED);

If you're using real timestamps instead of offsets, the same principle applies. You'll just have to decide what the starting timestamp should be and then calculate the ending timestamp by adding 120000 to it.

Nick
  • 8,181
  • 4
  • 38
  • 63