mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
f76752ee03
commit
1e5191e33e
10 changed files with 137 additions and 21 deletions
|
@ -84,6 +84,7 @@ StatsWidget::StatsWidget(QWidget *parent) : QWidget(parent)
|
|||
connect(ui.var1Binner, QOverload<int>::of(&QComboBox::activated), this, &StatsWidget::var1BinnerChanged);
|
||||
connect(ui.var2Binner, QOverload<int>::of(&QComboBox::activated), this, &StatsWidget::var2BinnerChanged);
|
||||
connect(ui.var2Operation, QOverload<int>::of(&QComboBox::activated), this, &StatsWidget::var2OperationChanged);
|
||||
connect(ui.var1Sort, QOverload<int>::of(&QComboBox::activated), this, &StatsWidget::var1SortChanged);
|
||||
connect(ui.restrictButton, &QToolButton::clicked, this, &StatsWidget::restrict);
|
||||
connect(ui.unrestrictButton, &QToolButton::clicked, this, &StatsWidget::unrestrict);
|
||||
|
||||
|
@ -129,6 +130,8 @@ void StatsWidget::updateUi()
|
|||
setBinList(ui.var1Binner, uiState.binners1);
|
||||
setBinList(ui.var2Binner, uiState.binners2);
|
||||
setVariableList(ui.var2Operation, uiState.operations2);
|
||||
setVariableList(ui.var1Sort, uiState.sortMode1);
|
||||
ui.sortGroup->setVisible(!uiState.sortMode1.variables.empty());
|
||||
|
||||
// Add checkboxes for additional features
|
||||
features.clear();
|
||||
|
@ -198,6 +201,12 @@ void StatsWidget::var2OperationChanged(int idx)
|
|||
updateUi();
|
||||
}
|
||||
|
||||
void StatsWidget::var1SortChanged(int idx)
|
||||
{
|
||||
state.sortMode1Changed(ui.var1Sort->itemData(idx).toInt());
|
||||
updateUi();
|
||||
}
|
||||
|
||||
void StatsWidget::featureChanged(int idx, bool status)
|
||||
{
|
||||
state.featureChanged(idx, status);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue