Currently I have ECG, Pulse rate, Respiratory Rate and NIBP to show in LightningChart JS
Medical Dashboard
which used a global sampling rate which is common to all channels [ecg,pulseRate,respRate,nibp]
. But the sampling rate would change for each channel. ECG and Pulse Rate will have 256, and Respiratory rate will have 128.
I tried below but didn’t work, as it now becomes 128 samples/second to all the channels.
Code:
const SAMPLE_RATE_NEW = 128;
Below is the function i used with my changes.
let tSamplePos = window.performance.now();
let tSamplePosNew = window.performance.now();
let iSampleX = 0;
const addData = () => {
const tNow = window.performance.now();
const seriesNewPoints = seriesList.map((_) => []);
while (tNow > tSamplePos) {
const x = tSamplePos;
const xNew = tSamplePosNew;
for (let i = 0; i < seriesList.length; i += 1) {
const channel = channels[i];
const dataSet = channel.dataSet;
const sample = dataSet[iSampleX % dataSet.length];
if (i !== 2) {
// @ts-ignore
seriesNewPoints[i].push({ x, y: sample });
} else {
// @ts-ignore
seriesNewPoints[i].push({ xNew, y: sample });
}
// // @ts-ignore
//seriesNewPoints[i].push({ x, y: sample });
if (channel.name === "Electrocardiogram") {
updateBpm(sample);
}
}
tSamplePos += 1000 / SAMPLE_RATE;
tSamplePosNew += 1000 / SAMPLE_RATE_NEW;
iSampleX += 1;
}
How do i get different sampling rates in different channel?
I am using this medical dashboard Online Medical Dashboard
Entire Code can be found above.
I have tried multiple different solution but none of them worked. Need guidance on how to do it.
I tried using different sampling rate and push the data inside array, but i am not getting different sampling rates. Why I want this? The charts formed are different in different devices(laptop/desktop). And since this is a medical application, so its very urgent.