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

Method updateData

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

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

Source from the content-addressed store, hash-verified

586 * @brief Updates the data of the multiplot.
587 */
588void Widgets::MultiPlot::updateData()
589{
590 static thread_local DSP::DownsampleWorkspace ws;
591
592 if (!isEnabled() || !VALIDATE_WIDGET(SerialStudio::DashboardMultiPlot, m_index))
593 return;
594
595 syncStringCurves();
596
597 if (m_timeAxis && m_sweepEnabled) {
598 double xLo = m_minX;
599 double xHi = m_maxX;
600 clampToVisibleX(xLo, xHi);
601
602 const auto& engine = UI::Dashboard::instance().multiplotSweep(m_index);
603 const qsizetype plotCount = static_cast<qsizetype>(engine.front.size());
604 if (m_data.size() != plotCount)
605 m_data.resize(plotCount);
606
607 for (qsizetype i = 0; i < plotCount; ++i) {
608 if (i >= m_visibleCurves.size() || !m_visibleCurves[i])
609 continue;
610
611 const auto& ring = engine.display(static_cast<size_t>(i));
612 (void)DSP::downsampleWindowAbsolute(
613 ring.time, ring.value, xLo, xHi, m_dataW, m_dataH, m_data[i], &ws);
614 }
615
616 calculateAutoScaleRange();
617 return;
618 }
619
620 if (m_timeAxis) {
621 double xLo = m_minX;
622 double xHi = m_maxX;
623 clampToVisibleX(xLo, xHi);
624
625 const auto& rings = UI::Dashboard::instance().multiplotTimeRings(m_index);
626 const qsizetype plotCount = static_cast<qsizetype>(rings.size());
627 if (m_data.size() != plotCount)
628 m_data.resize(plotCount);
629
630 for (qsizetype i = 0; i < plotCount; ++i) {
631 if (i >= m_visibleCurves.size() || !m_visibleCurves[i])
632 continue;
633
634 const auto& ring = rings[static_cast<size_t>(i)];
635 (void)DSP::downsampleTimeWindow(
636 ring.time, ring.value, xLo, xHi, m_dataW, m_dataH, m_data[i], &ws);
637 }
638
639 calculateAutoScaleRange();
640 return;
641 }
642
643 const auto& data = UI::Dashboard::instance().multiplotData(m_index);
644 const auto& X = *data.x;
645

Callers

nothing calls this directly

Calls 7

VALIDATE_WIDGETFunction · 0.85
downsampleWindowAbsoluteFunction · 0.85
downsampleTimeWindowFunction · 0.85
downsampleMonotonicFunction · 0.85
sizeMethod · 0.45
resizeMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected