| 342 | } |
| 343 | |
| 344 | Range<double> PlotWidgetBase::getVisualizationRangeY(Range<double> range_x) const { |
| 345 | double bottom = std::numeric_limits<double>::max(); |
| 346 | double top = std::numeric_limits<double>::lowest(); |
| 347 | |
| 348 | for (const auto& info : curveList()) { |
| 349 | if (info.curve == nullptr || !info.curve->isVisible() || info.curve->data() == nullptr) { |
| 350 | continue; |
| 351 | } |
| 352 | |
| 353 | if (const auto* adapter = dynamic_cast<const DatastoreCurveAdapter*>(info.curve->data())) { |
| 354 | const auto y_range = adapter->visibleYRange(range_x); |
| 355 | if (y_range.has_value()) { |
| 356 | bottom = std::min(bottom, y_range->min); |
| 357 | top = std::max(top, y_range->max); |
| 358 | } |
| 359 | continue; |
| 360 | } |
| 361 | |
| 362 | const QRectF rect = info.curve->data()->boundingRect(); |
| 363 | if (!isUsableRect(rect)) { |
| 364 | continue; |
| 365 | } |
| 366 | bottom = std::min(bottom, rect.top()); |
| 367 | top = std::max(top, rect.bottom()); |
| 368 | } |
| 369 | |
| 370 | if (bottom > top) { |
| 371 | bottom = -1.0; |
| 372 | top = 1.0; |
| 373 | } |
| 374 | |
| 375 | const double margin = (top - bottom) * 0.025; |
| 376 | return Range<double>{.min = bottom - margin, .max = top + margin}; |
| 377 | } |
| 378 | |
| 379 | void PlotWidgetBase::setModeXY(bool enable) { |
| 380 | // XY (scatter) plots use the plot-level curve style like any other plot — the |
nothing calls this directly
no test coverage detected