58 lines
1.7 KiB
C++
58 lines
1.7 KiB
C++
// SPDX-FileCopyrightText: 2025 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
|
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
#include <QVBoxLayout>
|
|
#include "JFJochViewerSidePanelChart.h"
|
|
|
|
JFJochViewerSidePanelChart::JFJochViewerSidePanelChart(QWidget *parent) : QWidget(parent) {
|
|
auto layout = new QVBoxLayout(this);
|
|
|
|
combo_box = new QComboBox(this);
|
|
combo_box->addItem("Azimuthal integration (1D)", 0);
|
|
combo_box->addItem("Wilson plot", 1);
|
|
combo_box->addItem("I/sigma", 2);
|
|
|
|
layout->addWidget(combo_box);
|
|
|
|
connect(combo_box, &QComboBox::currentIndexChanged,
|
|
this, &JFJochViewerSidePanelChart::comboBoxSelected);
|
|
|
|
azint_plot = new JFJochSimpleChartView(this);
|
|
layout->addWidget(azint_plot);
|
|
|
|
setLayout(layout);
|
|
}
|
|
|
|
void JFJochViewerSidePanelChart::comboBoxSelected(int val) {
|
|
redrawPlot();
|
|
}
|
|
|
|
void JFJochViewerSidePanelChart::redrawPlot() {
|
|
std::vector<float> x,y;
|
|
if (image) {
|
|
auto index = combo_box->currentIndex();
|
|
switch (combo_box->itemData(index).toInt()) {
|
|
case 0:
|
|
x = image->GetAzInt1D_BinToQ();
|
|
y = image->GetAzInt1D();
|
|
break;
|
|
case 1:
|
|
x = image->ImageData().integration_one_over_d;
|
|
y = image->ImageData().integration_logI;
|
|
break;
|
|
case 2:
|
|
x = image->ImageData().integration_one_over_d;
|
|
y = image->ImageData().integration_Isigma;
|
|
break;
|
|
}
|
|
}
|
|
if (!x.empty() && !y.empty())
|
|
azint_plot->UpdateData(x,y);
|
|
else
|
|
azint_plot->ClearData();
|
|
}
|
|
|
|
void JFJochViewerSidePanelChart::loadImage(std::shared_ptr<const JFJochReaderImage> in_image) {
|
|
image = in_image;
|
|
redrawPlot();
|
|
} |