Custom activity charts

I have added the power, pace and hr curves to the icu object. These are also available to custom activity field scripts.

  • powerCurve (power duration curve)
  • powerCurveFatigued0 (power curve after some KJ of work done)
  • powerCurveFatigued1 (power curve after more KJ of work done)
  • hrCurve (heart rate duration curve)
  • paceCurve (distance vs time curve)
  • gapCurve (distance vs time using gradient adjusted pace)

PDC chart:

{
  let pc = icu.powerCurve

  let trace1 = {
    x: pc.secs,
    y: pc.watts,
    type: 'scatter'
  }

  let data = [trace1]

  let layout = {
    title: {
      text: "Power curve"
    },
    xaxis: {
      type: 'log',
      autorange: true
    }
  }

  chart = {data, layout}
}

Data model:

JsHRCurve

A heart rate duration curve.

  • secs int ~ Time points. Note that not all seconds are included. The curve gets sparse as time goes out.
  • bpm int ~ HR for corresponding entry in secs.
  • start_index int ~ Where corresponding point starts in the activity
  • end_index int ~ Where corresponding point ends in the activity (exclusive)
  • indexOf(int seconds) int ~ What is the index of the point on the curve that has a duration of at least seconds? Returns -1 if the curve
    is not that long.
  • getBpm(int seconds) Integer

JsPaceCurve

A pace duration curve.

  • isGap boolean ~ Is this gradient adjusted pace?
  • distance float ~ Distance points. Note that not all distances are included. The curve gets sparse as time goes out.
  • secs int ~ Time to cover the matching distance.
  • start_index int ~ Where corresponding point starts in the activity
  • end_index int ~ Where corresponding point ends in the activity (exclusive)
  • indexOf(float distance) int ~ What is the index of the point on the curve that has a distance of at least distance? Returns -1 if the curve
    is not that long.
  • getSpeed(float distance) Float ~ Returns speed in meters/second or null if curve not that long. Note that the distance might be more than the
    distance parameter.

JsPowerCurve

A power duration curve.

  • secs int ~ Time points. Note that not all seconds are included. The curve gets sparse as time goes out.
  • watts int ~ Power for corresponding entry in secs.
  • watts_per_kg float ~ Power/weight for corresponding entry in secs.
  • start_index int ~ Where corresponding point starts in the activity
  • end_index int ~ Where corresponding point ends in the activity (exclusive)
  • after_kj int ~ If the curve is fatigued then this is the amount of work done before the curve.
  • indexOf(int seconds) int ~ What is the index of the point on the curve that has a duration of at least seconds? Returns -1 if the curve
    is not that long.
  • getWatts(int seconds) Integer
  • getWattsPerKg(int seconds) Float
4 Likes