* @brief Computes Y range from dataset pltMin/pltMax bounds. */
| 721 | * @brief Computes Y range from dataset pltMin/pltMax bounds. |
| 722 | */ |
| 723 | bool 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. |
nothing calls this directly
no test coverage detected