Custom activity streams can now be computed using Javascript. You can access other streams, fields on the activity or athlete, wellness data and anything else needed. Click “Charts” under the activity timeline chart, then choose “Custom Streams”:
Note that you need to enter a value for units.
Here is a sample script to calculate power / HR (note that is one is built in so you don’t need this script):
{
let heartrate = icu.streams.fixed_heartrate
let watts = icu.streams.fixed_watts
for (let i = 0; i < data.length; i++) data[i] = watts[i] / heartrate[i]
}
The script is given a data object (JsStreamData) to hold the stream data and an icu object (ActivityJsData) for access to the athlete, activity, streams etc..
These scripts are recomputed when the activity is re-analysed so they do not have access to the fit file (if any). The stream can be referenced in computed activity fields, added to custom activity trace charts and so on.
If you need to get a record field from the fit file you don’t have to write any code:
If you need to do other stuff with fit file messages please see this post:







