1

The app is getting data from Bluetooth and draws real-time graph.

However, the graph often gets the discontinuities.

The source of data is Bluetooth module (separate thread) and it fails to send all the data to SciChart lib. Frankly, when I insert Log.d() line in the bluetooth thread to print the data, things start working fine magically.

I am suspecting that the Bluetooth thread does not get executed on time.

Here is some code that is part of Scichart modified by me in DataManager.java file.

public void setSensingData(PBSensorData pbSensorData) {

        try {
            sensorDataQueueBlocking.put(pbSensorData);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        // This is the magic line. When the line is here, things work fine
        Log.d("DataManager", "put: " + (System.currentTimeMillis() - startTime) + " (ms)" ); 
        startTime = System.currentTimeMillis();
}

Thank you in advance!

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Eddie
  • 761
  • 3
  • 9
  • 22

1 Answers1

1

Unfortunately you didn't provide any code which configures SciChartSurface or its parts (e.g. code which fill up data series) so I'm not 100% sure why you get discontinuities in your application.

It could be caused by too often updates of chart or maybe you allocate too many objects during updates. In this case you can get micro freezes in your application when Android OS pauses VM to perform GC which potentially can lead to discontinuities which you described. In any case I would suggest to start from profiling of your application to find if there are some spikes in CPU or memory usage. Also I would suggest to take a look on this answer which contains some suggestions how to improve performance of chart.

Also I would suggest you to take a look on Audio Analyzer demo from SciChart Showcase application which shows how to display real time data from microphone. Hope that this example will help you.

Yura Khariton
  • 484
  • 2
  • 6