MCPcopy Create free account
hub / github.com/PlotJuggler/PlotJuggler / autoZoomPlotVertically

Method autoZoomPlotVertically

pj_plotting/widget/src/PlotWidget.cpp:196–216  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

194}
195
196void PlotWidget::autoZoomPlotVertically() {
197 // Skip during layout restore (the saved range wins), when there is nothing to
198 // fit, and for XY plots (their X axis is data, not the shared time axis).
199 if (loading_state_ || curveList().empty() || isXYPlot()) {
200 return;
201 }
202 if (!QSettings().value(QStringLiteral("Preferences::auto_zoom_plots"), true).toBool()) {
203 return;
204 }
205 // Rescale only Y, over the current X window, so the shared time axis — and
206 // therefore the other plots — stay put.
207 const Range<double> range_x = getVisualizationRangeX();
208 const Range<double> range_y = getVisualizationRangeY(range_x);
209 // Guard against a non-finite or degenerate range (e.g. a curve that is all
210 // NaN/inf over the window) — feeding it to setAxisScale yields a blank axis.
211 if (!std::isfinite(range_y.min) || !std::isfinite(range_y.max) || range_y.min >= range_y.max) {
212 return;
213 }
214 setAxisScale(QwtPlot::yLeft, range_y.min, range_y.max);
215 replot();
216}
217
218void PlotWidget::replaceCurve(const QString& source_key, const QString& output_key) {
219 // No-op (header contract) if services are unset or the output is not in the catalog: never

Callers

nothing calls this directly

Calls 3

QSettingsClass · 0.50
emptyMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected