subsurface/desktop-widgets/statswidget.h
Berthold Stoeger 1e5191e33e statistics: add a sort mode for categorical bar charts
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>
2022-01-04 11:14:24 -08:00

44 lines
940 B
C++

// SPDX-License-Identifier: GPL-2.0
#ifndef STATSWIDGET_H
#define STATSWIDGET_H
#include "stats/statsstate.h"
#include "stats/chartlistmodel.h"
#include "ui_statswidget.h"
#include <vector>
#include <memory>
class QCheckBox;
class StatsView;
class StatsWidget : public QWidget {
Q_OBJECT
public:
StatsWidget(QWidget *parent = 0);
private
slots:
void closeStats();
void chartTypeChanged(int);
void var1Changed(int);
void var2Changed(int);
void var1BinnerChanged(int);
void var2BinnerChanged(int);
void var2OperationChanged(int);
void var1SortChanged(int);
void featureChanged(int, bool);
void restrict();
void unrestrict();
private:
Ui::StatsWidget ui;
StatsState state;
StatsView *view;
void updateUi();
void updateRestrictionLabel();
std::vector<std::unique_ptr<QCheckBox>> features;
ChartListModel charts;
void showEvent(QShowEvent *) override;
void hideEvent(QHideEvent *) override;
};
#endif // STATSWIDGET_H