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

Method resolveXAxis

app/src/UI/Widgets/Plot.cpp:85–117  ·  view source on GitHub ↗

* @brief Resolves the X-axis mode, label, and monotonicity for the plot. */

Source from the content-addressed store, hash-verified

83 * @brief Resolves the X-axis mode, label, and monotonicity for the plot.
84 */
85void Widgets::Plot::resolveXAxis(const DataModel::Dataset& yDataset)
86{
87 if (UI::Dashboard::instance().useTimeXAxis(yDataset)) {
88 m_timeAxis = true;
89 m_monotonicData = true;
90 m_xLabel = tr("Time (s)");
91 return;
92 }
93
94#ifdef BUILD_COMMERCIAL
95 const auto& tk = Licensing::CommercialToken::current();
96 const auto xAxisId =
97 (tk.isValid() && SS_LICENSE_GUARD() && tk.featureTier() >= Licensing::FeatureTier::Trial)
98 ? yDataset.xAxisId
99 : -1;
100#else
101 const auto xAxisId = -1;
102#endif
103
104 const auto& datasets = UI::Dashboard::instance().datasets();
105 if (datasets.contains(xAxisId)) {
106 m_monotonicData = false;
107 const auto& xDataset = datasets[xAxisId];
108 m_xLabel = xDataset.title;
109 if (!xDataset.units.isEmpty())
110 m_xLabel += " (" + xDataset.units + ")";
111
112 return;
113 }
114
115 m_monotonicData = true;
116 m_xLabel = tr("Samples");
117}
118
119//--------------------------------------------------------------------------------------------------
120// Data dimension getters

Callers

nothing calls this directly

Calls 5

useTimeXAxisMethod · 0.80
featureTierMethod · 0.80
isEmptyMethod · 0.80
isValidMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected