Graphing Data at 10 Hz

I have a situation where I’m using a Garmin to collect Moxy data at 10 Hz via a ConnectIQ app. ConnectIQ only allows writing to the .fit file once per second so I set it up to write an array of timestamps, SmO2, and THb data in 3 developer data fields.

Now, I’d like to graph the data in Intervals. I can unpack the data in a custom stream script with the code below

{
    for (let m of icu.fit.record) {
        let timeArray = m['1st Time Sensor 7769 on Location Not Set']?.value;
        let smo2Array = m['1st SmO2 Sensor 7769 on Location Not Set']?.value;
        for (let i = 0; i < timeArray.length; i++) {
            if (timeArray[i] > 0) {
                console.log(timeArray[i]/1000 + "," + smo2Array[i])
            } 
        }
    }
}

I’d like to make a Custom Activity Chart to plot the data, but I’m not sure how to proceed. I’m not able to create an Activity Stream of the arrays of data. I’m not able to access the .fit data directly in the Custom Activity Chart.

Does anyone know of an approach for plotting this data?

Here’s a link to the .fit file with the arrayed data in it.

Here’s a link to the .csv file made from the .fit file.

I need to figure out how best to support high resolution data in activity streams. Right now everything except HRV is 1 Hz and there is special hackery for HRV. The easiest is to keep 1 Hz but have an array of values like what you have done. However I am worried that there will be some application needing ms precision on the timestamp for each value.

Custom activity streams can now store an array of numbers (32 bit floats) per second. You have to create the stream using Javascript, you can’t just select a record field.

{
  for (let m of icu.fit.record) {
    let v = m['1st SmO2 Sensor 7769 on Location Not Set']?.value
    if (v) data.setAt(m.timestamp.value, v)
  }
}

This is what ends up in the stream:

The Intervals.icu activity trace charts will display the first value from each array. You can build your own charts in JavaScript to get at the high resolution data.

The CSV download uses a single column with colons to separate the values (like HRV):

I could make this work for the simple record field version but that would change existing behaviour. At the moment if you use that on an array field the first value from the array is used. Maybe I should just go ahead and make the change?