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

Method updateRange

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

* @brief Updates the range of the multiplot. */

Source from the content-addressed store, hash-verified

666 * @brief Updates the range of the multiplot.
667 */
668void 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.

Callers

nothing calls this directly

Calls 6

VALIDATE_WIDGETFunction · 0.85
clearMethod · 0.45
resizeMethod · 0.45
sizeMethod · 0.45
plotTimeRangeMethod · 0.45
pointsMethod · 0.45

Tested by

no test coverage detected