.. 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.
.. 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.
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.
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.
.. 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.
.. 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.
.. 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.
.. 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.
.. 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.
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
.. 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
.. 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.
.. 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".
.. 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.
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.
.. 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.
.. 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.
.. 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.
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.
.. 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.
.. 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));
}
.. 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.
.. 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)
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).
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
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.