It’s hard to tell what could cause this issue without seeing entire code and data set which causes such output. Code that you provided looks valid at first look. For me it looks like there is problem with data series ( output lines look line rendering of unsorted data ) or switching traces so NaN values weren’t added in correct places. Do you see any exceptions in logcat? Can you provide an example with data set which produces such output?
The data I am using for plotting is being dynamically generated. A sample of that data has been added to this question. I have verified that the random lines that appear on the graph are not a result of appending erroneous data, by comparing the graph to logs of the data being generated. Furthermore, if there was an error in the data, it would not work at all. But the problem I am facing is that it works, and the output I expected on the graph does appear (Expected appearance added in the images of the question) but at a later stage, goes haywire, making it difficult to reproduce too… Another observation I made was that the previously plotted points change too. The whole line that was drawn before the most recent point morphs into random lines scattered all over (a video of that: https://imgur.com/7SO4DFb). I also observed that the white dot (ScatterSeries with EllipsePointMarker) does follow the correct data points. It is only the XyDataSeries Line that is giving me trouble.
Well, data looks valid. May I ask how do you apppend data set like you have in file into data series? Where do ppA, ppB and other values come from? Since you’re using vital signs demo as base can you modify it to demonstrate the issue with data that you provided? Or maybe you can provide some other project which reproduces output like on screenshots/video that you provided?
I tried a lot to replicate the error but no luck. I have a feeling it was a memory leak related problem. Once I identified and fixed some of those problems, the error went away. If I encounter it again, I’ll drop a comment here. Thank you for your help!