This was a user request: Sort bar charts by height of the bars.
Obviously, this can only work for categorical charts, not for
histograms.
The UI is a break from the old concept: the sorting is chosen
based on the chart, whereas for the rest of the features, the
viable charts are presented based on the binning, etc.
I found it confusing to have the possible charts be selected
based on sorting. I.e. if a non-bin sort mode is selected,
the histogram charts disappear. On the flip side, this would
be more consistent. We can change it later.
For value-based bar charts, there are three sort modes: by
bin, by count (i.e. number of dives in that bar) and by
value (i.e. length of the bar). This hopefully satisfies all
needs.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This is not perfect - the polygon of the confidence area is
calculated even if it is not shown. Oh well.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The old ways was to select the chart first, then depending on
the chart choose the binning.
Willem says that it should work the other way round: select
the binning (or operation) and make the charts depend on
that.
I'm not arguing one way or the other, just note that the new
way is much more tricky, because it is easy to get unsupported
combinations. For example, there is no chart where the
first variable is unbinned, but the second axis is binned
or has an operation. This makes things distinctly more tricky
and this code still needs a thorough audit.
Since this is all more tricky, implement a "invalid" chart
state. Ideally that should be never shown to the user, but
let's try to be defensive.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The StatsState structure fully describes the current state of
the chart: the selected axes, operations and additional chart
features, such as legend or labels.
The code implements sanity checks and reacts accordingly,
if an invalid combination of variables and charts is chosen.
The chart and variable lists to be displayed can be queried
and are encapsulated in the StatsState::UIState structure.
Some variable / chart combinations are possible, but not
recommended, which is represented by a warning flag.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>