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

Method getVisualizationRangeX

pj_plotting/widget/src/PlotWidgetBase.cpp:315–342  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

313}
314
315Range<double> PlotWidgetBase::getVisualizationRangeX() const {
316 double left = std::numeric_limits<double>::max();
317 double right = std::numeric_limits<double>::lowest();
318
319 for (const auto& info : curveList()) {
320 if (info.curve == nullptr || !info.curve->isVisible() || info.curve->data() == nullptr) {
321 continue;
322 }
323 const QRectF rect = info.curve->data()->boundingRect();
324 if (!isUsableRect(rect)) {
325 continue;
326 }
327 left = std::min(left, rect.left());
328 right = std::max(right, rect.right());
329 }
330
331 if (left > right) {
332 left = 0.0;
333 right = 0.0;
334 }
335
336 if (isXYPlot() && std::abs(right - left) > std::numeric_limits<double>::epsilon()) {
337 const double margin = (right - left) * 0.025;
338 left -= margin;
339 right += margin;
340 }
341 return Range<double>{.min = left, .max = right};
342}
343
344Range<double> PlotWidgetBase::getVisualizationRangeY(Range<double> range_x) const {
345 double bottom = std::numeric_limits<double>::max();

Callers

nothing calls this directly

Calls 4

isUsableRectFunction · 0.85
isVisibleMethod · 0.45
dataMethod · 0.45
boundingRectMethod · 0.45

Tested by

no test coverage detected