Commit Graph

9991 Commits

Author SHA1 Message Date
Mark Liversedge
b893e702b3 Iverview Data Table Negative Numbers
.. negative numbers were treated as strings because the
   matching pattern did not contain a '-'.
2021-08-12 13:35:55 +01:00
Mark Liversedge
18dbedc586 Fix Overview tile config
.. because the config widget is created before the tile
   configuration is loaded it needs to be updated before
   being shown to the user.

Fixes #4001.
2021-08-12 10:01:00 +01:00
grauser
fcad1ed196 RideWithGPS : Correct/implement API v2
Fix #3371
2021-08-11 22:20:23 +02:00
Mark Liversedge
8375f539db Bar Chart and Group By Category Labels
.. slightly improved category labels on a bar chart when groupby
   and date range is used. Labels for week, month and year are now
   specific e.g. 23/5, May and 2021 labels are applied respectively.
2021-08-10 21:02:59 +01:00
Mark Liversedge
cc0bb2e6d6 UserChart Smoothing and GroupBy
.. axis settings updated to enable users to smooth and group by
   for data series on the axis.

.. since group by needs to aggregate the series also have a new
   config term to define the aggregation method (Average, Total,
   Peak et al).

.. grouping and smoothing is applied in UserChart not the Generic
   chart or plot, so this functionality will not be available from
   Python and R charts (mostly because axis management and config
   is done differently).

Fixes #3999.
2021-08-10 18:47:39 +01:00
Alejandro Martinez
95cd28a279 Python embedded - Include Pandas 1.2.3
Pandas 1.3.x provokes problems on some charts, like HRV Trends
and otheres reported at the forum. Let's wait until it stabilizes
2021-08-09 20:27:46 -03:00
Alejandro Martinez
39fc9e4537 Enable View - Reset Layout considering perspectives
It behaves as before: current view layout is discarded and default
layout with perspectives is fetched from goldencheetah.org first and,
if not available, baked in layout is used.
Website defaults are not updated yet, so baked in layouts are used now.
2021-08-09 17:30:10 -03:00
Alejandro Martinez
1f77f08ae0 V3.6 Upgrade processing - put the current chart config into a general perspective
Renamed Resouces/xml/*-layout.xml files to Resources/xml/*-perspectives.xml
Removed deprecated Summary from Activities and Trends, and added default Overview to Trends
Added enclosing <Layouts></Layouts> and General perspective with proper type to each one
This provides default layouts for newly created athletes.
We still need to update layouts before release and to enable Reset Layout.
2021-08-08 14:24:29 -03:00
Mark Liversedge
91f2c46c3e Athlete/View switch update perspective selector
.. along the way renamed AthleteTab related methods in MainWindow
   to reflect the last commit renaming the classes.

.. there are also a handful of fixups to SEGV when no ride is
   selected in DataFilter (triggered by opening a second athlete
   and switching to trends view, which need to recreate the athlete
   switch bug that is also part of #3997).

.. and the logic to reset perspectives is changed in MainWindow
   with a special method resetPerspective that is called everywhere
   but will check the athlete/view combination has not already
   been set (to avoid multiple passes).

.. multi-athlete and perspectives need better testing as there are
   probably more SEGV in there, and if we fix them we could also
   remove the requirement for the opening view to always be Analysis.

Fixes #3997.
2021-08-08 15:19:36 +01:00
Mark Liversedge
01e0d14757 Renaming classes
.. Tab becomes AthleteTab - since Tab is almost meaningless
   TabView becomes AbstractView - since its the base for all the views

   there are no functional changes or fixes in this commit.
2021-08-08 13:05:06 +01:00
Mark Liversedge
29a76773a6 Overview Data Table tweaks
.. honour the sort order when refreshing (e.g. select new daterange or
   a new activity).

.. thin line to separate headings from data to make easier to read.
2021-08-07 20:44:13 +01:00
Mark Liversedge
abdce42223 User Sort DataTable on Overview
.. by clicking the header column the user can toggle sorting of
   the contents.

.. we try to infer the type of data in the column for sorting which
   probably works 80/20, but is better than adding yet more of a
   burden on the program that supplies the data.
2021-08-07 14:39:10 +01:00
Mark Liversedge
98466cc9cf Overview Data Table and Intervals
.. add legacy program to analysis view for an interval table.

.. highlight row in data table when mouse hovers over a row, but
   only when not using clickthru, since that already highlights
   the row to indicate click is available.
2021-08-07 09:23:12 +01:00
Alejandro Martinez
924da10958 DataFilter intervals() and intervalstrings() for Activity and Trends views
intervals(symbol|name|start|stop|type|test|color|route|selected|date|filename [,start [,stop]])
    returns a vector of values for the metric or field specified for each interval
    if no start/stop is supplied it uses the currently selected date range, or activity when no date range.

intervalstring(symbol|name|start|stop|type|test|color|route|selected|date|filename [,start [,stop]])
    same as intervals above but instead of returning a vector of numbers, the values
    are converted to strings as appropriate for the metric (e.g. Pace_Rowing mm:ss/500m).

Both metricname and metricunit now support name, start, stop, type, test, color, route, selected, date, filename,
in addition to metric names and date, to get corresponding localized string.

Example program to build an intervals table in Activities displaying all intervals for selected activity,
similar to the one in RideSummary:

{

names {
    metricname(name,
               Duration,
               Distance,
               Pace,
               xPace,
               Average_Heart_Rate
               );
}

units {
    metricunit(name,
               Duration,
               Distance,
               Pace,
               xPace,
               Average_Heart_Rate
               );
}

values {
    c(
      intervalstrings(name),
      intervalstrings(Duration),
      intervalstrings(Distance),
      intervalstrings(Pace),
      intervalstrings(xPace),
      intervalstrings(Average_Heart_Rate)
      );
}

}

Fixes #3626
2021-08-06 16:54:23 -03:00
Alejandro Martinez
0f9b92f8cf Datafilter - remove tabs introduced accidentally in previous commit 2021-08-06 14:44:07 -03:00
Mark Liversedge
171760097d GenericPlot scale labels
.. the scale factor was not being applied to data labels on
   a user chart.
2021-08-06 11:46:26 +01:00
Mark Liversedge
db9623a201 Alternate Json string protection
.. when embedding json in xml element attributes the string
   decoding mangles results.

   this is because of the way \ and " are handled at each
   pass, causing combinations to be lost early when decoding.

   This is largely a non-issue, except the user chart config
   is stored in perspectives.xml and worse, when embedded on
   an overview is encoded as .gcchart (xml) before being
   encoded in the perspective.xml.

   To avoid this issue, specifically with user charts and
   to leave all other json string encoding and decoding
   unaffected (e.g. ridefile.json) a new protect/unprotect
   method has been introduced.

   Utils::jsonprotect2() and Utils::jsonunprotect2() will
   still decode older style encoding for backwards
   compatibility, but now will translate \ and " in the
   encoded string with :sl: and :qu:

   This means that, for example, the following substitutions
   will be made:

   newline (\n) -> :sl:n
   cr (\r) -> :sl:r
   \ -> :sl:
   " -> :qu:

   If users add text with these characters (e.g. :sl:) then
   it will be decoded to a slash, but it is highly unlikely
   they will do this, and if they do, it should be harmless
   as these text strings aren't part of the the datafilter
   syntax.

Fixes #3996
2021-08-06 07:28:21 +01:00
Mark Liversedge
62012f1990 Fix Overview BubbleViz refresh bug
.. since axis min and max values were not initialised the
   visualisation would fail to refresh and was generally
   unpredictable.

.. we now set initial values and check when updating.
2021-08-05 18:06:22 +01:00
Alejandro Martinez
b36bbdc3c0 CP Chart - Reposition model helper when off window
This is already fixed when it is out to the right,
but still can happen to the left.

Fixes #3995
2021-08-05 13:09:17 -03:00
Mark Liversedge
00b50b47c3 activities() datafilter function
.. activities("Workout_Code=\"FTP\"", metrics(BikeStress))

   A new function that provides an activities filter
   to apply as a closure to an expression, following the
   same approach as the daterange() function.

   In the example above metrics() will only return values where the
   activity has a workout code "FTP".
2021-08-05 13:48:18 +01:00
Mark Liversedge
1986df1c95 DataFilter string escaping
.. unescape datafilter strings since the lexer supports that
   but they are not parsed.

.. Only supports \n, \r and \" for now, but that should be
   enough.
2021-08-05 10:56:23 +01:00
Alejandro Martinez
15bbe288a0 Enable DataFilter zones to be used in Trends View
Formula doesn't change.
When date range is set Trends View is assumed and we use the sport of included
activities with default to Bike (Run for Pace) when mixed, and date is the end
date for the date range.
Otherwise we use activity sport and date as before.
2021-08-04 16:06:28 -03:00
Mark Liversedge
534a6a4ef1 Overview table clickthru fix for single row
.. need to highlight first row of table when only a
   single row for click thru. Since values are shown in
   rows not columns.
2021-08-04 15:15:52 +01:00
Mark Liversedge
d41e7dd1f6 Logical and is '&&' not 'and'
.. annoyingly gcc allows this which is why I keep making
   this silly mistake.
2021-08-04 13:36:28 +01:00
Mark Liversedge
a98ac12d0e Fix clickthru SEGV for Bubble and TopN overview items
.. they raised signals in paint events which was highly
   problematic (!)

Fixes #3993
2021-08-04 13:21:09 +01:00
Mark Liversedge
49989f95b6 Overview Data Table - Part 3 of 4
.. click thru from the data row to the trends view to
   view it on the activity view.

.. Added a function "f {}" that returns the activity
   filenames- the same semantics used in the user chart.

.. the mechanism used in the overview items to click thru
   from the itemPaint function is dropped and we now
   do it from the mouse release event.

.. see issue #3993 which will get fixed using the same
   scheme as this one.
2021-08-04 13:05:46 +01:00
Mark Liversedge
98e49c3228 Fixup UserChart mouse interaction on a Chartspace
.. when a user chart is placed on an overview we filter mouse
   events from the chartspace and not the widget due to
   events being discarded.

   See this issue for more details:
   https://github.com/GoldenCheetah/GoldenCheetah/issues/3992
2021-08-03 22:38:15 +01:00
Alejandro Martinez
171882dc9f DataFilter zones - use translated strings from WPrime and RideFile
Also use joules for fatigue zone limits like the old summary.
2021-08-03 17:14:44 -03:00
Mark Liversedge
bd864344bb Fixup for legend mouse events in chartspace
.. when a userchart is embedded into an overview mouse events
   do not propagate in their entirety- as a result the legend
   widgets do not see MouseRelease (even though they see
   MousePress).

   So the click to show/hide when hovering over a legend item
   responds to the press not the release.
2021-08-03 19:39:31 +01:00
Mark Liversedge
72f91c31a8 Fix user chart axis color
.. when using named colors the axis was always black because
   the color was not being translated via the RGBColor macro.
2021-08-03 15:51:36 +01:00
Mark Liversedge
155273232f User Chart on Overview - Part 2 of 3
.. User charts can be scaled (lines, texts, markers, legend)

.. Plot area background color honours overview card color
   when we're on an overview.

.. when adding a user chart to an overview make it span a couple
   of columns and 3 times deeper than a metric tile.

NOTE:

   There are two bugs that need to be squashed individually
   and are related to user charts on overview:

   1. Mouse event handling seems to be broken for user
      charts in Overview.

   2. User chart axis colors are always black when the series
      are configured to use named colors.
2021-08-03 14:36:35 +01:00
Alejandro Martinez
a0f77fbf70 Remove sport parameter from zones DataFilter function
zones(hr|power|pace|fatigue, name|description|low|high|units|time|percent)
applies to the currently selected activity and sport is implicit.

Also changed name() by metricname() and unit() by metricunit() in script comments.
2021-08-02 20:32:47 -03:00
Alejandro Martinez
fd384d69ba Fix zero div crash in Overview Data Table when names() returns an error
Found while removing sport parameter from zones.
2021-08-02 20:21:13 -03:00
Alejandro Martinez
7e998d965a Report full OS version string for all supported platforms
Fixes #3991
2021-08-02 18:00:13 -03:00
Alejandro Martinez
f1045d1aed DataFilter zones - use pace units instead of %CV
Like old Summary and most APPs, easier for athletes and coaches.
2021-08-01 16:55:58 -03:00
Mark Liversedge
557a0a27ec Fix User Chart Legend CPU hog
.. was caused by an eventfilter that caused a redraw on every single
   event (which included the repaint it caused, hence an infinite loop).

Fixes #3989
2021-08-01 18:40:33 +01:00
Mark Liversedge
e772e068d5 Add User Chart to Overview - Part 1 of 3
.. You can now add a user chart to the overview dashboard
   using a new tile UserChartOverviewItem.

.. Had to refactor UserChart away from a GcChartWindow and
   into a QWidget so the QGraphicsProxyWidget would play
   along.

.. A new UserChartWindow has been added to manage adding
   a UserChart to a perspective.

.. fixed chartspace item config widgets being destroyed across
   the add wizard and config dialog (existing bug).

.. fixed initialisation of items when added via wizard

NOTE the following issues/todo:

.. mouse click events are squiffy for some reason

.. need to add a way to scale as the text is tiny

.. legend has a performance issue (see #3989)

.. overall performance is good even tho we are using
   a QGraphicsProxyWidget- might need to reevaluate
   this later and embed the QChart directly into the
   QGraphicsScene. To be reviewed.
2021-08-01 10:20:24 +01:00
Mark Liversedge
c91f6d89ac Quieten gcc warnings a little
.. for R and Python embedding code, where casting and pointers
   are complex and not an issue, but gcc likes to warn us.
2021-07-31 11:54:41 +01:00
Mark Liversedge
031b268270 Sustain metrics needed isTime()
.. to ensure they are formatted as time metrics.
2021-07-30 22:02:03 +01:00
Mark Liversedge
b086b779cf Overview Data Table - Part 2 of 4
.. config dialog offers options to recreate the old summary
   window sections;
   * totals, averages, maximums, metrics
   * zone summary
2021-07-30 18:40:02 +01:00
Mark Liversedge
c60f6f4bb6 Zones DataFilter Function
.. a new zones datafilter function to retrieve zone info
   and metrics for the current activity.

.. zones(sport, series, field)

   sport is one of run, bike, swim
   series is one of power, hr, pace
   field is one of
   * name - zone name (e.g. L1)
   * description - zone desc (e.g. Active Recovery)
   * low - the low mark for the zone (e.g. 0)
   * high - the high mark for the zone (e.g. 100)
   * unit - units for low/high (e.g watts)
   * time - time spent in zone
   * percent - time spent in zone as a percentage

   each call will return a vector of strings for all
   zones available.

.. to support the syntax the old functions 'name' and
   'unit' have been renamed to 'metricname' and
   'metricunit' to avoid clashing with symbols and
   were bad choices in the first place.

.. the motivation for this function is mostly about the
   overview data table, where we might create a tile
   with the following program to display the zone
   table that was previously available on RideSummary

   names {
       c("Name","Description","Low","High","Time","%");
   }

   units {

       c("", "",
         zones(bike,power,units),
         zones(bike,power,units),
         "", "");
   }

   values {

      c(zones(bike,power,name),
        zones(bike,power,description),
        zones(bike,power,low),
        zones(bike,power,high),
        zones(bike,power,time),
        zones(bike,power,percent));
   }
2021-07-30 13:57:04 +01:00
Mark Liversedge
173b1a754e Stop Filter box expanding in config dialogs
.. we have a filter box on most trends charts config dialogs
   and elsewhere. But when you resized the dialog the filter
   box would also stretch (even though it is a QLineEdit).

.. this commit sets the vertical size policy to fixed to stop
   this ugly behaviour.
2021-07-28 21:46:49 +01:00
Mark Liversedge
0f432a7824 ChartSpace fixups for spanned tiles
.. when a column contains no tiles it may still be spanned
   by a tile (since we add that feature).

.. this means we should check if the column contains a spanned
   tile before shifting all remaining tiles left.

.. also enabled dropping into an empty column which was
   not possible previoisly (impossible to have an empty
   column)
2021-07-28 20:36:04 +01:00
Mark Liversedge
0ffca019ea Chartspace scene resize when spanning into empty column
.. when you extend a tile across an empty column to the right
   the scene was not being resized to take this into account.
2021-07-28 10:25:22 +01:00
Mark Liversedge
360bc29d52 DataFilter unit() and name() functions support 'date'
.. so we can get a translation of the word "Date".

.. also fixed up the default trends view data table tile to
   use it, instead of hardcoded "Date".
2021-07-28 08:20:29 +01:00
Mark Liversedge
7f005935e5 Overview Data Table - Part 1 of 4
A new overview tile that can be placed on trends or activity view to
display a table of data.

.. It uses a program to fetch the data to display via 3 functions:
   * names() returns a list of column names
   * units() returns a list of column unit names
   * values() returns a list of values to show

.. If there are more values than names then it is assumed there
   are multiple rows to be shown.

.. When adding a data tile an example program is provided to
   demonstrate how this works (will need to also document this
   on the wiki, or possibly a video tutorial).
2021-07-27 21:34:46 +01:00
Alejandro Martinez
b9fbcce56e Fix copy paste error in FixElevation
Introduced by 061cb93.
Fixes #3973
2021-07-26 11:29:57 -03:00
Alejandro Martinez
a918a5c28e Histogram Chart - Disable Show Zone Limits option for Trends
Since time in zone is computed using the active zones for the series according
to sport and date, there is no good choice of limits to show in the general case.
This is part 4 of #3911
2021-07-24 20:52:48 -03:00
Alejandro Martinez
c89d15e067 Histogram Chart - Add Show Zone Limits option for Polarized zones
Power, HR and Pace use separate scales now.
This is part 3 and fixes #3911
The sport used to select zones in rangemode needs an update,
this will be included in a separate commit.
2021-07-23 17:21:46 -03:00
Alejandro Martinez
86e6b4781c Allow Running Model estimates in DataFilter formulas
This should have been part of ff0b329
Fixes #3958
2021-07-23 15:26:25 -03:00