Easy custom formulas on activity timeline charts

We (tx @ryandev !) have added support for custom formulas on custom charts on the activity timeline. These are simple math expressions and (hopefully!) easy for non-software developers to write (similar to the /fitness chart support).

This example shows altitude adjusted power (alt_watts) less power (watts) indicating how many watts are “lost” due to the altitude:

Click “Charts” to bring up the activity timeline charts dialog, then click “+Chart” to create a new custom chart:

Click “Add Plot” and search for “Formula”:

Click “Edit Formula”:

Use the “Plots” drop down to insert plots into the expression:

This expression shows how many watts are being “lost” due to the altitude:

You can also reference fields on the activity. Here is an expression for % of heart rate reserve:

(heartrate - activity.icu_resting_hr) * 100 / (activity.athlete_max_hr - activity.icu_resting_hr)

Note that “%HRR” is built in.

15 Likes

This is nice and will open a lot of opportunity for experimentation.
But I’m missing “weight” avaliable as activity field, so we can fiddle with w/kg and Compound Score!

1 Like

Weight is available but missing from the drop down (we will fix). Use:

activity.icu_weight

1 Like

Compound score is currently available as a custom activity field.

5 Likes

Will it be possible to indicate how many watts are lost due to core temperature as well?

Great feature!
Can I add “if” statements? If I use the syntax from the math.js I get an error stating the { is not expected.
if (watts > 150) {

}

1 Like

You need to use the ternary (?) operator:

watts > 150 ? 2 : 1

Will return 2 if watts > 150 and 1 otherwise.

4 Likes

Thanks! This is just simply great and very useful!

1 Like

I wish my maths was good enough to understand half the maths that goes into making these custom charts. I’ve forgotten the meaning of things like “standard deviations”, etc. :frowning:

This is great, thank you!

Not to sound ungrateful, but is there a plan to add formula support to the compare-activities page?