MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / computeRangeFromDatasets

Method computeRangeFromDatasets

app/src/UI/Widgets/MultiPlot.cpp:723–745  ·  view source on GitHub ↗

* @brief Computes Y range from dataset pltMin/pltMax bounds. */

Source from the content-addressed store, hash-verified

721 * @brief Computes Y range from dataset pltMin/pltMax bounds.
722 */
723bool Widgets::MultiPlot::computeRangeFromDatasets()
724{
725 if (!VALIDATE_WIDGET(SerialStudio::DashboardMultiPlot, m_index))
726 return false;
727
728 const auto& group = GET_GROUP(SerialStudio::DashboardMultiPlot, m_index);
729 m_minY = std::numeric_limits<double>::max();
730 m_maxY = std::numeric_limits<double>::lowest();
731
732 int index = 0;
733 for (const auto& dataset : group.datasets) {
734 const bool curveOk = DSP::notEqual(dataset.pltMin, dataset.pltMax)
735 && index < m_visibleCurves.size() && m_visibleCurves[index];
736 if (!curveOk)
737 return false;
738
739 m_minY = qMin(m_minY, qMin(dataset.pltMin, dataset.pltMax));
740 m_maxY = qMax(m_maxY, qMax(dataset.pltMin, dataset.pltMax));
741 ++index;
742 }
743
744 return true;
745}
746
747/**
748 * @brief Scans visible curves for finite min/max values.

Callers

nothing calls this directly

Calls 3

VALIDATE_WIDGETFunction · 0.85
notEqualFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected