| 1419 | }; |
| 1420 | |
| 1421 | void CartesianPlot::setRange(const Dimension dim, const int index, const Range<double>& range) { |
| 1422 | Q_D(CartesianPlot); |
| 1423 | DEBUG(Q_FUNC_INFO << ", range = " << range.toStdString() << ", auto scale = " << range.autoScale()) |
| 1424 | |
| 1425 | if (range.start() == range.end()) { |
| 1426 | // User entered invalid range |
| 1427 | Q_EMIT rangeChanged(dim, index, this->range(dim, index)); // Feedback |
| 1428 | return; |
| 1429 | } |
| 1430 | |
| 1431 | auto r = d->checkRange(range); |
| 1432 | if (index >= 0 && index < rangeCount(dim) && r.finite() && r != d->rangeConst(dim, index)) { |
| 1433 | exec(new CartesianPlotSetRangeIndexCmd(d, dim, r, index)); |
| 1434 | } else if (index < 0 || index >= rangeCount(dim)) |
| 1435 | DEBUG(Q_FUNC_INFO << QStringLiteral("Warning: wrong index: %1").arg(index).toStdString()); |
| 1436 | |
| 1437 | DEBUG(Q_FUNC_INFO << ", DONE. range = " << range.toStdString() << ", auto scale = " << range.autoScale()) |
| 1438 | } |
| 1439 | |
| 1440 | const Range<double>& CartesianPlot::dataRange(const Dimension dim, int index) { |
| 1441 | if (index == -1) |
no test coverage detected