.. added configChanged() to base class
.. added calling configChanged() when preferences are
changed and when the items config is updated.
.. updated MetaOverviewItem to use this, but also need
to update the Zone and Best tiles too.
.. the irony that adding a __LAST__ property to ensure we
had well formed JSON made sure it was /always/ invalid.
.. see fd546b4da for impact (almost none, but hey).
.. when adding an overview chart it configures from a .gchart
file built in via application.qrc
.. to update the default config all the developer needs to do
is design using GC then export the .gchart into the
appropriate src/Resources/charts/file.gchart
.. NOTE: the exported file has an errant comma (,) after the
__LAST__ element. This is invalid JSON and should
be fixed. It needs to be removed manually right now
otherwise the JSON does not parse.
.. progressively boldens as you hover and overlays contents
to avoid taking screen real estate and being a distraction.
.. only watches mouse events and ignores wheel events since
these clash with chartspace scrolling.
Fixes#4006.
.. commit 91f2c46 introduced a regression where the selector
is not updated when the perspectives are changed (via
the manage/add perspective functions).
.. this was because resetPerspective() returned if the
athlete/view combination was last used to set the
selector -- we now override this, but only when the
perspectives config is changed.
.. datestring() was using 2 digit years and Overview data table
sorting only expected 4 digit years.
.. datestring() now uses 4 digit years in line with everywhere
else in the code.
.. data table sorting now supports 2 digit years and xx/xx/xx
style dates too (just in case).
.. 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.