User Chart Date

623 views
Skip to first unread message

Andreas Lau

unread,
Aug 30, 2021, 1:06:12 PM8/30/21
to golden-cheetah-users
Hello,

another fairly simple example that I can't get to work like I want:

{

relevant { isRun;}

finalise {

# we just fetch samples at end

xx <- metrics(date);

yy <- metrics(Pace);

}


x { xx; }

y { yy; }

}

When doing this, there is a data point in the chart for every day, but I only run once or twice a week. So if I select the range "last 14 days", I get 14 points in the graph, but I wanted like 2-3.

Is that possible to change?

Thanks. Andreas

Mark Liversedge

unread,
Aug 30, 2021, 1:15:13 PM8/30/21
to golden-cheetah-users
When the axis is set to type "Date" you can group by day, week, month and year.
Similarly, if an axis is type "Time" you can apply smoothing.

If using group by take care to set the series types correctly as they control how the series will be aggregated.

Mark

Andreas Lau

unread,
Aug 30, 2021, 3:02:10 PM8/30/21
to golden-cheetah-users
Hello Mark,
thank you for your reply.
When using Group By Day for example, I still get 14 points. When I choose Week I get one for every week.
However, what I want is one point for every workout, no interpolation.
When possible, the X axis should be linear in terms of distance between points,  even though the dates are not linear.

Mark Liversedge

unread,
Aug 30, 2021, 4:11:48 PM8/30/21
to golden-cheetah-users
I don't understand what you are trying to do, sorry.

Andreas Lau

unread,
Aug 30, 2021, 4:19:46 PM8/30/21
to golden-cheetah-users
I want a graph that shows me the pace for each run and every run should be one data point. The y axis is the pace and the x axis is the date. So I can see my pace over time.

Ale Martinez

unread,
Aug 30, 2021, 4:59:05 PM8/30/21
to golden-cheetah-users
El lunes, 30 de agosto de 2021 a la(s) 17:19:46 UTC-3, Andreas Lau escribió:
I want a graph that shows me the pace for each run and every run should be one data point. The y axis is the pace and the x axis is the date. So I can see my pace over time.

1) If you want one point per activity, use a date axis, but without grouping.
1) If you don't want interpolation, don't use a line in the chart, use points instead.
3) to plot only runs you need to filter the metrics() vectors to exclude non running activities, or use the activity function to build the vectors with only runs, the relevant function doesn't do that for Trends charts.

Ale Martinez

unread,
Aug 30, 2021, 7:52:53 PM8/30/21
to golden-cheetah-users
Second 1) should be 2) and it means to use a Scatter chart (without line), instead of a line chart, to avoid interpolation.

Bob Demers

unread,
Aug 31, 2021, 3:51:07 AM8/31/21
to golden-cheetah-users
Create a Trends chart. Under "Curves" tab, select the Metric "Pace". Select the checkbox "Data labels" if you want the pace displayed above each workout. Should default to Group By: "Days"

Andreas Lau

unread,
Aug 31, 2021, 1:47:07 PM8/31/21
to golden-cheetah-users
Ale, thank you for your detailed answer. Unfortunately, I was unable to get this to work. How do I filter the metrics vector for isRun? I was looking through the docs, but couldn't find anything related. Thanks.

Ale Martinez

unread,
Aug 31, 2021, 8:44:24 PM8/31/21
to golden-cheetah-users
El martes, 31 de agosto de 2021 a la(s) 13:47:07 UTC-4, Andreas Lau escribió:
Ale, thank you for your detailed answer. Unfortunately, I was unable to get this to work. How do I filter the metrics vector for isRun? I was looking through the docs, but couldn't find anything related. Thanks.

I am not a computer to give a detailed example, but I have posted about this before. To use isRun you need to implement the activities function to check if each activity is a run and append to a vector or ignore it.

Mark Liversedge

unread,
Sep 1, 2021, 3:54:17 AM9/1/21
to golden-cheetah-users
The new perspectives feature is designed for this use-case, you can create a perspective that filters on isRun and then all the charts in that perspective will only work with data for runs.
At least that is what is supposed to happen !

Mark

Mark Liversedge

unread,
Sep 1, 2021, 4:32:11 AM9/1/21
to golden-cheetah-users
Sorry, I should have been more specific:

1. You can create a perspective called e.g. "Running" and set the filter to isRun, all charts in that perspective will have the filter
2. When creating a user chart the filters are honoured if you have an activity function, it doesn't need to do anything e.g. activity { 0; }
3. Any calls in finalise etc will honor the filters but ONLY if there is an activity function

This was not by design, but is quite useful, it means you can override the filtering entirely by not having an activity function present, or use the activity function to construct data one activity at a time, or use the vectorised functions in finalise and control whether or not filtering is applied by the existence of an empty activity function.

In truth, this was entirely by accident but works quite nicely.

Mark

Mark Liversedge

unread,
Sep 1, 2021, 4:49:04 AM9/1/21
to golden-cheetah-users
Also, to the original question about how to apply a filter in an expression, there is now a closure called "activities" which can be used to apply a filter to some code e.g.

{
    # honor filtering in this series
    # it is explicitly done below via activities()
    #activity {0;}

    calc {
        xx <- metrics(date);
        yy <- metrics(Pace);
    }

    finalise {
        activities ("isRun", calc());
    }

   x { xx; }
   y { yy; }

Ale Martinez

unread,
Sep 2, 2021, 11:15:01 AM9/2/21
to golden-cheetah-users
Thank you Mark, the activities closure is very handy!

Now I understand why the perspective filter didn’t work for my, I try to avoid the activities function.

Andreas Lau

unread,
Sep 2, 2021, 5:21:01 PM9/2/21
to golden-cheetah-users
Thanks guys for the input and discussion.
I am not really familiar with all the terms that you are using.
@Bob, that works. Thank you! However, it is not directly on the Overview page. But it is certainly a good tool to have and to know about (which I didn't before your post)
@Mark, thanks for the code you posted.  It works sometimes, but most of time, the graph is empty. I don't know if that is a bug. When switching between Date Ranges, the graph empties itself. Even when I am in the "Edit" Dialog, I can see the graph and then I click on "OK" and the graph is gone (sometimes, not always). I couldn't find a pattern when this is happening. It is not like some date ranges work and some don't - it has more to do with the switching itself I guess.

As a beginner user, I think the wizard approach of the trends chart is much easier to use. Maybe it is possible to consider that in a future iteration for the user charts as well. For example, now I don't know how to get min/km instead of miles. But this is just some feedback, please take no offense to this.

Mark Liversedge

unread,
Sep 3, 2021, 4:15:36 AM9/3/21
to golden-cheetah-users
On Thursday, 2 September 2021 at 22:21:01 UTC+1 Andreas Lau wrote:
As a beginner user, I think the wizard approach of the trends chart is much easier to use. Maybe it is possible to consider that in a future iteration for the user charts as well. For example, now I don't know how to get min/km instead of miles. But this is just some feedback, please take no offense to this.

No offense.

We have retained the old charts such as trends, performance and so on specifically so new users and beginners can create and configure charts easily. But of course, there is a limit to what you can do with these (although trends chart has quite a lot up its sleeves). They will always be available, but will probably receive very little updates.

The addition of python and R charts in the previous releases was to support more advanced users, but we soon recognised that this is too difficult for many users especially those outside an academic setting or without an IT background. Embedding Python out the box was introduced in 3.6 to at least get that hurdle out the way. But still, writing Python code isn't an option for many.

The user chart is a stepping stone between the limited flexibility of the configured charts and the programmabiity of the python and R charts. We always make sure there are worked examples and a default setup to get you started. We are working on standard charts now, it is why you will see tweaks to the capabilities of the chart as we add functionality that is needed to get these right.

Please don't take this as insulting or passive aggressive, but If you are finding the user chart is beyond your ability and you do not have the time to work this through then I would recommend sticking with the configured charts for now- over time more user charts will appear in the chart DB and you can download instead of building your own.

Cheers
Mark
Reply all
Reply to author
Forward
0 new messages