First time poster, new LightningChart user.
My current project pulls data from an ECG device. but bursts sample readings with a nano second epoc time stamp.
So sample frequency needs to be derived from timestamps. not a problem here.
Burst data at 72 sample blocks aprox every 540ms. From epoc time stamp difference, resulting in aprox 128 sample frequency or 7.7ms sample rate.
My problem is understanding how to translate burst data to a smooth sweeping/scrolling sample output in the chart per derived SF.
The use of SampleGenerator within examples makes it difficult to understand how to develop a suto SampleGererator of my own that consumes data from within the application. so far I have developed something that steps through the data at the sample rate using something like:
C#
Code: Select all
for (var i = 0; i <= np0; i++)
{
tics = StF * Sec_nSec_const * TSEDBuf(i); // SampleInterval to Tics
Thread.Sleep(new TimeSpan(tics));
DisplayData(BufS(i))
}
TSEDBuf() = TimeStamp Difference Buffer. Corresponds to current timestamp of the sample to be displayed - previous timestamp
BufS() = sample buffer, datatype single
the above has a bad jitter effect in the actual sample rate. using 7.7ms sample rate can result in as much as a 9ms SR.
The problem, of course, the chart will lag behind. and of course no longer displaying real-time data
The confusion stems from a strange, at this point in my understanding, correlation between SampleFrequiency and xLength.
So far I have found, to get a display of 72 samples at 128hz within the viewable chart, I have found:
xLength = samplecount/samplefrequiency
_xLength = 72 / 128
result: xLength = 0.5625
So, 2 real questions:
How to regenerate a data display at a frequency per sample.
How to setup the chart to display a sweeping/scrolling set number of samples at a particular sample rate.
Thank you,
Greg.