* @brief Updates the range of the multiplot. */
| 666 | * @brief Updates the range of the multiplot. |
| 667 | */ |
| 668 | void Widgets::MultiPlot::updateRange() |
| 669 | { |
| 670 | if (!VALIDATE_WIDGET(SerialStudio::DashboardMultiPlot, m_index)) |
| 671 | return; |
| 672 | |
| 673 | const auto& data = UI::Dashboard::instance().multiplotData(m_index); |
| 674 | m_data.clear(); |
| 675 | m_data.squeeze(); |
| 676 | m_data.resize(data.y.size()); |
| 677 | |
| 678 | if (m_timeAxis && m_sweepEnabled) { |
| 679 | const double range = UI::Dashboard::instance().plotTimeRange(); |
| 680 | const double timebase = m_timebaseMs * 0.001; |
| 681 | m_minX = 0; |
| 682 | m_maxX = (timebase > 0 && timebase < range) ? timebase : range; |
| 683 | } |
| 684 | |
| 685 | else if (m_timeAxis) { |
| 686 | m_minX = -UI::Dashboard::instance().plotTimeRange(); |
| 687 | m_maxX = 0; |
| 688 | } |
| 689 | |
| 690 | else { |
| 691 | m_minX = 0; |
| 692 | m_maxX = UI::Dashboard::instance().points(); |
| 693 | } |
| 694 | |
| 695 | Q_EMIT rangeChanged(); |
| 696 | } |
| 697 | |
| 698 | /** |
| 699 | * @brief Calculates the auto scale range of the multiplot. |
nothing calls this directly
no test coverage detected