Av. Pace per HR Zone per date

349 views
Skip to first unread message

Luis Vico

unread,
Aug 13, 2022, 7:38:12 PM8/13/22
to golden-cheetah-users
Hello,

Im trying to create a graph for running, similar to the one that fixxtrack is offering. However I didnt find a solution yet. It is showing your average pace at a specific HR zone per date. See below. I would appreciate any hint to get this done. Thanks
Captura de Pantalla 2022-08-12 a las 12.19.33.png

Ale Martinez

unread,
Aug 13, 2022, 10:54:24 PM8/13/22
to golden-cheetah-users
El sábado, 13 de agosto de 2022 a la(s) 20:38:12 UTC-3, luis.vic...@gmail.com escribió:
Hello,

Im trying to create a graph for running, similar to the one that fixxtrack is offering. However I didnt find a solution yet. It is showing your average pace at a specific HR zone per date. See below. I would appreciate any hint to get this done. Thanks

You would need to define a custom metric for each zone averaging speed for the samples with hr in the zone, then convert speed to pace. Afterwards, che chart is the easy part using a Metrics Trends chart, or a User Chart for prettier look with some more code. See the wiki for details.

Luis Vico

unread,
Aug 16, 2022, 10:19:03 AM8/16/22
to golden-cheetah-users
Hello Ale,

Thanks for the hint, It helped me advance a lot. I created the following metric:
For the red marked part: Is it possible to link the HR to the Zones (Z1,Z2...Z5) defined for the athlete? I found that with the config function I can call the Lactate Threshold and then calculate it, but I was wondering if there is a more direct way.

{

# only calculate for runs containing HR

relevant { Data contains "H" and isRun ; }

# initialise aggregating variables

init { seconds <- 0; velocidad <- 0;}

# add time for each sample moving and pedaling

sample {

       if (HEARTRATE < 180 and HEARTRATE > 159) {

           seconds <- seconds + RECINTSECS;

           velocidad <- velocidad + SPEED;

       }

}

# calculate mean speed and convert to pace

value { 1/(velocidad/seconds)*3600; }

}

Ale Martinez

unread,
Aug 16, 2022, 10:33:13 AM8/16/22
to golden-cheetah-users
El martes, 16 de agosto de 2022 a la(s) 11:19:03 UTC-3, luis...@gmail.com escribió:
Hello Ale,

Thanks for the hint, It helped me advance a lot. I created the following metric:
For the red marked part: Is it possible to link the HR to the Zones (Z1,Z2...Z5) defined for the athlete? I found that with the config function I can call the Lactate Threshold and then calculate it, but I was wondering if there is a more direct way.

pinaman

unread,
Aug 23, 2022, 3:46:09 PM8/23/22
to golden-cheetah-users
Hey Luis,

are you still looking for Avg. Pace per HR Zone chart?

I started working on this chart with Python. Chart will be created/displayed with Plotly (interactive chart). Plotly chart can be displayed in GC itself, or it can create .html file, which can be open in browser.

So if you know how to use Python, i can post code when i'm done.

Peret

unread,
Aug 24, 2022, 6:12:43 AM8/24/22
to golden-cheetah-users
The chart is very interesting. So, if you code it in python, it is great. Then, we will manage to use it :) Thanks!

pinaman

unread,
Aug 24, 2022, 1:24:25 PM8/24/22
to golden-cheetah-users
Here is quick look at the chart (attached screenshot), but it is not done yet. On screenshot is speed not pace, etc.

Chart was originally meant to be for Running Pace. But you will be able to change two values at the top of the code (i marked it), to change chart for Cycling Speed.
Number of Zones is scalable. Since i can't get HR Zones from user data (for now), HR Zones need to be set in python code (marked). I will update the code, when HR Zones from user will be accessible.
Will add option to set Zone colors.


Blue frame - Plotly bar, with which you can manipulate view, take snapshots
Green frame - Legend with option to hide a Zone if you click on it. Or if you double click on Zone it will hide all other Zones and show only Zone you double clicked.
Red frames - if you change to "Bike" it will change "Pace" to "Speed" and "Pace (min/km)" to "Speed (km/h)"
Pace_per_Zone_Chart.png

pinaman

unread,
Sep 3, 2022, 2:42:17 AM9/3/22
to golden-cheetah-users
I was a bit busy, so it took me a while to get it done. But here are few screenshots of final results.

AVG_Pace_in_HR_Zones.png - running pace with straight lines
AVG_Pace_in_HR_Zones_spline.png - running pace with spline (curved lines)
AVG_Speed_in_HR_Zones.png - same chart used for cycling (speed NOT pace)

Zone Colors are taken from image posted by OP. There are few values you can edit to change the way chart is displayed, even if you don't know Python.
As you can see, when you move cursor close to specific point, it will show data for all HR Zones and at the bottom, date and time of activity.
All data is displayed on tooltip/pop-up with same color as is assigned to HR Zone, which should make it more transparent.

I just need to clean up the code and i will post .gchart, with a bit of extra info how to change Sports, etc.
AVG_Pace_in_HR_Zones.png
AVG_Pace_in_HR_Zones_spline.png
AVG_Speed_in_HR_Zones.png

pinaman

unread,
Sep 3, 2022, 5:17:51 PM9/3/22
to golden-cheetah-users
.gchart file for python/plotly chart attached.

I wrote it in Dev 3.6 Aug 27 Build for Linux. But i also tested it with latest Sep 3 build in Windows.

So here is what chart "can do":
- it displays Speed or Pace (based on selected sport - in python code) in Metric or Imperial units (based on your settings).
- i added "Time in Zone" data for each HR Zone, which was not on original chart (image)
- if you have HR Zones with zero speed/pace, you can click on specific zone in Legend and it will hide it.
...
Just click on some buttons and you might find more.

If you have any questions or ideas for extra info that might be useful. Let me know.
Avg_Pace_in_HR_Zones.gchart

pinaman

unread,
Sep 3, 2022, 5:56:30 PM9/3/22
to golden-cheetah-users
After importing my chart, i noticed one of the lines is incorrect. Even if code/chart is exported as it should be, it will import it incorrectly, because of "\n", which breaks code line.

New file attached.
Avg_Pace_in_HR_Zones_fix.gchart

Ale Martinez

unread,
Sep 3, 2022, 10:01:57 PM9/3/22
to golden-cheetah-users
El sábado, 3 de septiembre de 2022 a la(s) 18:17:51 UTC-3, pinaman escribió:
.gchart file for python/plotly chart attached.

I wrote it in Dev 3.6 Aug 27 Build for Linux. But i also tested it with latest Sep 3 build in Windows.

So here is what chart "can do":
- it displays Speed or Pace (based on selected sport - in python code)

A critérium I used in built in charts is: if all activities are the same sport, then use that sport automatically. This allows to select sport using sidebar filters or auto filters instead of fixing it in the chart. 

pinaman

unread,
Sep 3, 2022, 11:21:39 PM9/3/22
to golden-cheetah-users
You are correct. Will update code to work with filters.

Two more images i didn't include before.
- added message in case you select date range in which you don't have any activities.
- warning message regarding colors for each HR Zone. So if you see this warning, is more or less one time edit. Users don't constantly change (add more) HR Zones. Is more like, set and forget. I already added 7 colors, which i think it should be enough for most users.

Images attached.
No_Activities_Message.png
ZoneColor_Message.png

Luis Vico

unread,
Sep 4, 2022, 10:02:00 AM9/4/22
to golden-cheetah-users
Wow! Thank you all for the collaboration. I was 3 weeks on holidays and come back to this. What an amazing community.

Luis Vico

unread,
Sep 6, 2022, 4:56:45 AM9/6/22
to golden-cheetah-users
Hello,

I get the following message when trying to use the gchart. 

Captura de Pantalla 2022-09-06 a las 10.54.51.png

Ale Martinez

unread,
Sep 6, 2022, 7:07:28 AM9/6/22
to golden-cheetah-users
hrzoneslow was added after RC2, you need to install the latest snapshot from https://www.goldencheetah.org/#section-download
Reply all
Reply to author
Forward
0 new messages