.. added a new variant for annotations to plot a voronoi diagram
via a datafilter.
the centers are as returned by the kmeans() function so the
x and y values follow each other (i.e. x1 x2 x3 y1 y2 y3)
.. it is ingrated into the userchart and down to the genericplot
for the series it arrives in.
.. next commit will add the drawing code to generic plot.
.. 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.
.. 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.
.. 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.
.. When creating user charts we can now select a standard color as
configured in appearances.
.. This means users can select e.g. the "Power color" when plotting a
power series.
.. The second part of this commit will update the themes to ensure that
the standard color settings are appropriate for the background (as
they are inappropriate currently. e.g. Critical power is always
yellow, even on a light background).
.. mostly straight replacement as qt5 containers are templated
and qSort semantics are the same as std::sort
.. prepping for Qt6.2 which is due late 2021.
Signed-off-by: Mark Liversedge <liversedge@gmail.com>
.. Global settings (themes, metadata etc) are now maintained
in the config dialog as in the past, whilst athlete settings
(such as zones, measures etc) are now maintained in a new
config dialog accessible from the athlete view (gear icon).
.. Config changes are communicated via two signals;
* Context::configChanged(qint32)
* GlobalContext::configChanged(qint32)
Crucially, all global context signals are cascaded through
the athlete contexts-- so athlete specific widgets only
need to connect to the athlete context signal (and will get
athlete and global config change notifications).
Whilst global widgets such as the sidebar and mainwindow
need only connect to the globalcontext signal since they
are not interested in athlete specific details.
[publish binaries]
.. GlobalContext::context() provides a global context that is not
tied to an athlete or MainWindow.
.. At present it just offers signals for config changes but will
likely see more context move across as the application preferences
and athlete configuration are separated as we enhance support
for multiple athletes.
.. Scatter chart click thru from trends.
.. Need to decide how click thru will work from a line chart as the UX
doesn't quite work as the auto hover points are elusive (they move
when you go to click on them). Will review and fixup shortly.
.. Enable click through from the data points on a generic chart
when on trends view.
.. This commit includes the 'addCurve' bindings to pass the
activity filenames from R, Python and the User Chart.
.. It also includes a new DataFilter function 'filename' to
get a vector of strings that are the filenames for the
activities in the selected date range (or the filename
for the currently selected activity).
.. The second commit will include the interaction code for
GenericPlot to click-thru a selection.
.. metadata("name") returns the value for the metadata field on analysis
view or a vector of values if on trends view.
.. also fixed a few nits when working with category data on the user
chart; sort/multisort had bugs, blank labels and pie chart legend.
.. since we can now set category data using string vectors we can
support bar and pie charts in the user chart.
.. there were a few issues switching between bar and pie charts
related to the way axes were being configured that have been
resolved in this commit.
.. the generic plot didn't register quadtrees if it thought they didn't
contain any nodes, but didn't take into account the fact the root
node could contain up to 25 points.
.. allow data labels for points on the chart, added to User, R and
Python chart addCurve() etc.
.. NOTE: opengl painting ignores this setting so should be disabled
for data series that want labels. We do not do this
automatically, but might consider that later.
.. add annotation labels from within a datafilter, ultimately
gets shown alongside the legend in generic plot.
.. this only works from a user chart, so need to add an equivalent
API to call from Python and R.
.. when adding symbols to lines or lines to a scatter we
need to show/hide the decoration with the main series.
.. in addition if the decoration is the only thing visible
e.g. symbols for line (with no line style) then still
need to show the hover on the symbols.
.. honour both the symbol and line style settigns for curves. This
means you can have a series on a line chart that is dots and a
series on a scatter that is a line.
.. need to think about best way to manage hover, but suspect it should
only apply when a line chart has a series with no line but has
symbols -- we should hover on them. Currently they are ignored.
.. you can now configure if a series is shown on the legend, this is
for lines or curves that are there for illustration but do not
need to be displayed in the legend / hovered.
.. support for axes that are time based, assuming the user has
supplied in seconds starting from 0 (which is true for an
activity).
.. since QT charts requires times to be in MS since Epoch
and we don't know if we need to convert from seconds
until the axis is configured the series data is updated
just before charts are created in GenericChart.
This means that anyone using generic plot directly will
need to do this conversion. For this reason all integration
across the GC codebase should be via GenericChart.
R, Python and now User charts integrate via Generic Chart
so this should not really be an issue.
.. basic user chart only on analysis view. Users can specify
a data filter script to prepare data for the x and y axes.
It uses the generic chart to visualise so one step closer
to a UX where all charts have the same behaviour.
.. will need to update to place on trends view, including
updating the way userdata works and possibly adding a
few new functions to support working with models and mmp
data amongst a few other things.
.. likely contains quite a few nits as most of the code
is related to configuration and is a bit thorny.
Fixup stack view a) minimum height for plots, b) added a
scroll area to manage more plots than fit on the screen
and will layout horizontally or vertically.
Stack charts now when set as an option, in which case all
data series are given their own plot.
Or alternatively, where data series have different x-axis
names, they get a plot for each x-axis.
Need to fixup a) minimum height as can get squashed and
b) scroll area needed as well as c) layout direction.
.. updated to support different linestyles and also legend can
now be placed above, below, left or right of the chart and
orientated to list series vertically or horizontally.
.. the vertical legend is a bit ugly as nothing lines up, will
fix up separately.
Isolate curves by hovering on axis for scatter and line
charts. Also added horizontal guide line and click to
add horizontal annotations (but not added yet).
Annotations will come later, but added as was the right
part of the code.
Also tidied up a bit of the paint code in selection tool
since it was a bit messy.
.. for some reason in earlier version of Qt Charts there are errant
items in the same area as the axes that are blank, these break
the code that derives the axes rectangles in Qt Charts <= 5.10
.. now we have the axis rectangle (previous commit) we can paint
the cursor values in the axis rather than on the canvas. Lots
of work to fix a cosmetic issue, but damn, it was worth it.
.. amongst a few other nits when a plot is resized or the chart is
being finalised we get the scene rectangle for each of the axes.
This is so we can trap when the mouse hovers over an axis and
also so we can paint the current mouse coordinates on the y-axis
in the scatter plot (they are painted on the canvas at present
and paint over each other causing a nasty artefact).
Will fixup y-value cursor tracking shortly.
Use legend to select which series are plotted by clicking to
show hide a series. Hover just shows a hover background and
does not temporarily isolate the series, this may be something
to consider for later.
Applies to scatter and line charts.
.. created separate source files for the legend and selection tool
classes and removed some of the interdependency.
.. partly because GenericPlot.h and GenericPlot.cpp were becoming
unwieldy and partly to support using the generic legend in
other charts (notably CP, LTM and AllPlot).
The scene was being updated unneccessarily when it was active but
not changing (i.e. selection rectangle was stationary etc).
Added a state variable rectchanged to the selection tool to notify
the updateScene() method that nothing has changed since the last
event. So do nothing.
Added selection on line chart, uses a range selector and
works in pretty much the same way as the scatter rectangle
selector.
I've removed a lot of the calculated values from the plot
since it gets very busy very quickly.
I also noticed there is a significant performance problem
when selections are active- suspect there are a large
number of unneccessary scene updates. Will investigate.
.. when no value present was miscalculating the nearest point to the
cursor on the x-axis because distance was calculated as a large
negative by using a series point value of 0 (when no value was
available). Fixed by just ignoring zero values.