This is a project fork from https://github.com/jjoe64/GraphView-Demos
The graphing code is JJoe64’s, but the realtime data handling code is mine.
Because of the massive amount of data that comes over a J1939 bus, I needed a way to visualize changes to individual PIDs. This code includes data parsing from a serial stream over Bluetooth – but the easiest code to demonstrate is the realtime sensor data.
The second button on the main menu starts a process that monitors the phone’s accelerometer. It takes the data and displays it for each of the 3 axes (X, Y and Z) – you can think of the changes like an airplane (pitch, roll and yaw).
Since the chart dynamically modifies the scale, the sensor data changes can monitor very fine movements when the device has been sitting still for a while. A large change shows as a sudden delta on the graph and all of the fine data points smooth out.
The code can be downloaded from GitHub: https://github.com/geekinc/GraphViewDemos