The "Spots + background" dataset plot now scales each quantity on its own axis - background on the left, spot count on the right - with each axis's labels and line coloured like its curve, so which axis reads which quantity is visible at a glance. Each axis is ranged from its own series alone, so live growth of one quantity never rescales the other; on top of that the background's range is inflated upward and the spot count's downward, each by its own span, so the two curves occupy separate halves of the plot instead of crossing. The spot count stays the primary series (current-image marker, hover, click-to-load, overlays). Trade-off accepted: the spots axis shows ticks below zero in its empty lower band. The per-image plot selector no longer offers the X-ray fluorescence spectrum; the reader-side fluorescence plumbing is untouched. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WbjnQhutnboy4qbxwmgDAX
72 lines
2.3 KiB
C++
72 lines
2.3 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);
|
|
layout->setContentsMargins(0, 0, 0, 0);
|
|
|
|
azint_plot = new JFJochSimpleChartView(this);
|
|
layout->addWidget(azint_plot);
|
|
setLayout(layout);
|
|
|
|
connect(azint_plot, &JFJochSimpleChartView::writeStatusBar,
|
|
[&](QString string, int timeout_ms) { emit writeStatusBar(string, timeout_ms); });
|
|
}
|
|
|
|
QList<QPair<QString, int>> JFJochViewerSidePanelChart::PlotTypes() {
|
|
return {
|
|
{"Azimuthal integration (1D)", 0},
|
|
{"Wilson plot", 1},
|
|
{"I/sigma", 2},
|
|
{"Spots (count)", 5},
|
|
{"Spots (intensity)", 6},
|
|
};
|
|
}
|
|
|
|
void JFJochViewerSidePanelChart::setPlotType(int code) {
|
|
plot_type_ = code;
|
|
redrawPlot();
|
|
}
|
|
|
|
void JFJochViewerSidePanelChart::redrawPlot() {
|
|
if (!image)
|
|
return;
|
|
|
|
std::vector<float> x, y;
|
|
switch (plot_type_) {
|
|
case 0:
|
|
x = image->GetAzInt1D_BinToQ();
|
|
y = image->GetAzInt1D();
|
|
azint_plot->UpdateData(x, y, "Q [Å^-1]", "", false);
|
|
break;
|
|
case 1:
|
|
x = image->ImageData().integration_B_one_over_d_square;
|
|
y = image->ImageData().integration_B_logI;
|
|
azint_plot->UpdateData(x, y, "d [Å]", "ln(<I>)", true);
|
|
break;
|
|
case 2:
|
|
x = image->ImageData().integration_Isigma_one_over_d_square;
|
|
y = image->ImageData().integration_Isigma;
|
|
azint_plot->UpdateData(x, y, "d [Å]", "I/sigma", true);
|
|
break;
|
|
case 5:
|
|
x = image->ImageData().spot_plot_one_over_d_square;
|
|
y = image->ImageData().spot_plot_count;
|
|
azint_plot->UpdateData(x, y, "d [Å]", "Count", true);
|
|
break;
|
|
case 6:
|
|
x = image->ImageData().spot_plot_one_over_d_square;
|
|
y = image->ImageData().spot_plot_intensity;
|
|
azint_plot->UpdateData(x, y, "d [Å]", "Count", true);
|
|
break;
|
|
}
|
|
}
|
|
|
|
void JFJochViewerSidePanelChart::loadImage(std::shared_ptr<const JFJochReaderImage> in_image) {
|
|
image = in_image;
|
|
redrawPlot();
|
|
}
|