27 std::numeric_limits<QPointFValueType>::max(),
28 std::numeric_limits<QPointFValueType>::max()
31 std::numeric_limits<QPointFValueType>::lowest(),
32 std::numeric_limits<QPointFValueType>::lowest()
40 bool TimingInfoFound =
false;
45 for (
auto& Samples : BasicSamplesSeries)
52 std::stable_sort(Samples.begin(), Samples.end(), [](
const auto& a,
const auto& b) {
53 return a.Time < b.Time;
56 TimingInfoFound =
true;
59 if (Samples.front().Time == Samples.back().Time && Samples.size() > 1)
70 if (std::abs(Samples.front().Time) < 1e-9 && std::abs(Samples.back().Time) < 1e-9)
72 else if (std::abs(Samples.front().Time) < 1e-6 && std::abs(Samples.back().Time) < 1e-6)
74 else if (std::abs(Samples.front().Time) < 1e-3 && std::abs(Samples.back().Time) < 1e-3)
76 else if (std::abs(Samples.front().Time) < 1.0 && std::abs(Samples.back().Time) < 1.0)
92 if (RawSamples.empty())
95 auto YMin{ std::numeric_limits<QPointFValueType>::max() };
96 auto YMax{ std::numeric_limits<QPointFValueType>::lowest() };
98 for (qsizetype i = 0; i < RawSamples.size(); ++i)
101 const auto Y =
ApplyYLog(RawSamples.at(i).y());
102 Samples.append({ X, Y });
104 if (std::isfinite(Y))
106 YMin = std::min(YMin, Y);
107 YMax = std::max(YMax, Y);
124 QList<QPointF>& Samples,
const size_t SeriesIndex)
126 if (BasicSamples.empty())
129 auto YMin{ std::numeric_limits<QPointFValueType>::max() };
130 auto YMax{ std::numeric_limits<QPointFValueType>::lowest() };
132 for (
size_t i = 0; i < BasicSamples.size(); ++i)
135 const auto Y =
ApplyYLog(BasicSamples[i].Value);
136 Samples.append({ X, Y });
138 if (std::isfinite(Y))
140 YMin = std::min(YMin, Y);
141 YMax = std::max(YMax, Y);
158 QList<QPointF>& Samples,
const size_t SeriesIndex)
163 auto YMin{ std::numeric_limits<QPointFValueType>::max() };
164 auto YMax{ std::numeric_limits<QPointFValueType>::lowest() };
171 Samples.append({ X, Y });
173 if (std::isfinite(Y))
175 YMin = std::min(YMin, Y);
176 YMax = std::max(YMax, Y);
210 auto YRangeDelta = std::abs(
MinValues.y()) * .01;
211 YRangeDelta = YRangeDelta == 0. ? 2. : YRangeDelta;
223 for (
size_t i = 0; i < Util::NumToT<size_t>(Samples.size()); ++i)
239 const auto Dist = XDist * XDist + YDist * YDist;
Defines helper classes for QML graphs.
std::vector< BasicSample > BasicSampleListType
Type of a list containing data stream samples of type BasicSample.
Type describing a spectrum as acquired by the Spectrometer instrument.
bool HasSpectrum() const noexcept
Indicates whether the spectrum is empty.
auto & GetSpectrum() const noexcept
Getter for Samples.
bool IsIndexUnit(UnitType Unit)
Checks whether Unit is a sample index unit (UnitType::Index).
bool IsTimeUnitStrict(UnitType Unit)
Checks whether Unit is a time unit (excluding UnitType::Index).
QPointF LastMinValues
Lower axes limits of x and y axes from previous graph update.
size_t MaxSampleCountPerSeries
Indicates the number of samples contained in the longest data series to plot. A value of 0 indicates ...
decltype(std::declval< QPointF >().x()) QPointFValueType
Data type of sample values for plotting.
DynExp::Units::UnitType XUnit
Joint unit of the plot's x axis.
QPointF CursorPosition
Relative position of the mouse cursor inside the coordinate system (between 0. and 1....
void AdjustAxesLimits()
Adjusts MinValues and MaxValues to best display all data series.
QPointF HoveredPoint
Hovered point belonging to any series in normalized coordinate system coordinates (between 0....
size_t HoveredSeries
Index of the data series the hovered point belongs to.
void CheckSampleHovered(const QPointFValueType X, const QPointFValueType Y, const size_t SeriesIndex)
Checks whether the given sample is close to the mouse cursor (hovered).
bool ProcessSpectrum(DynExpInstr::SpectrometerData::SpectrumType Spectrum, QList< QPointF > &Samples, const size_t SeriesIndex)
Converts Spectrum to displayable format and stores its minimal and maximal values in this DynExpLineG...
QPointF MinValues
Current lower axes limits of x and y axes.
void ReprocessSamples(const QList< QPointF > &Samples, const size_t SeriesIndex)
If data plotting is not enabled (running), the available and already plotted samples have to be repro...
double ApplyXLog(double Value) const
QPointF LastMaxValues
Upper axes limits of x and y axes from previous graph update.
QString GetMultiplierLabel() const
Returns the multiplier prefix associated with Multiplier.
QPointFValueType HoveredDistance
Distance between the mouse cursor and the hovered point.
void ResetHoveredSample()
Removes the stored hovered sample.
void Reset()
Resets the instance to generate information from new sample series.
unsigned int Multiplier
Best order of magnitude to scale the plot's joint time axis with.
bool ProcessBasicSamples(DynExpInstr::DataStreamBase::BasicSampleListType BasicSamples, QList< QPointF > &Samples, const size_t SeriesIndex)
Converts BasicSamples to displayable format and stores their minimal and maximal values in this DynEx...
void GenerateSampleTimingInfo(std::vector< DynExpInstr::DataStreamBase::BasicSampleListType > &BasicSamplesSeries)
Extracts sample timing information for x axis scaling from BasicSamples and stores the results in thi...
double ApplyYLog(double Value) const
QPointF HoveredSample
Hovered sample belonging to any series in the graphs's real coordinate system.
bool ProcessSamples(QList< QPointF > RawSamples, QList< QPointF > &Samples, const size_t SeriesIndex)
Converts RawSamples to displayable format and stores their minimal and maximal values in this DynExpL...
QPointF MaxValues
Current upper axes limits of x and y axes.