| 1286 | } |
| 1287 | |
| 1288 | void BoxPlotPrivate::updateRug() { |
| 1289 | if (!rugEnabled || !q->plot()) { |
| 1290 | recalcShapeAndBoundingRect(); |
| 1291 | return; |
| 1292 | } |
| 1293 | |
| 1294 | auto cs = q->plot()->coordinateSystem(q->coordinateSystemIndex()); |
| 1295 | const double xMin = q->plot()->range(Dimension::X, cs->index(Dimension::X)).start(); |
| 1296 | const double yMin = q->plot()->range(Dimension::Y, cs->index(Dimension::Y)).start(); |
| 1297 | |
| 1298 | QPainterPath rugPath; |
| 1299 | QVector<QPointF> points; |
| 1300 | |
| 1301 | for (int i = 0; i < q->dataColumns().count(); ++i) { |
| 1302 | const auto* column = static_cast<const Column*>(q->dataColumns().at(i)); |
| 1303 | rugPath.clear(); |
| 1304 | points.clear(); |
| 1305 | |
| 1306 | if (orientation == BoxPlot::Orientation::Horizontal) { |
| 1307 | for (int row = 0; row < column->rowCount(); ++row) { |
| 1308 | if (column->isValid(row) && !column->isMasked(row)) |
| 1309 | points << QPointF(column->valueAt(row), yMin); |
| 1310 | } |
| 1311 | |
| 1312 | // map the points to scene coordinates |
| 1313 | points = q->cSystem->mapLogicalToScene(points); |
| 1314 | |
| 1315 | // path for the vertical rug lines |
| 1316 | for (const auto& point : std::as_const(points)) { |
| 1317 | rugPath.moveTo(point.x(), point.y() - rugOffset); |
| 1318 | rugPath.lineTo(point.x(), point.y() - rugOffset - rugLength); |
| 1319 | } |
| 1320 | } else { // horizontal |
| 1321 | for (int row = 0; row < column->rowCount(); ++row) { |
| 1322 | if (column->isValid(row) && !column->isMasked(row)) |
| 1323 | points << QPointF(xMin, column->valueAt(row)); |
| 1324 | } |
| 1325 | |
| 1326 | // map the points to scene coordinates |
| 1327 | points = q->cSystem->mapLogicalToScene(points); |
| 1328 | |
| 1329 | // path for the horizontal rug lines |
| 1330 | for (const auto& point : std::as_const(points)) { |
| 1331 | rugPath.moveTo(point.x() + rugOffset, point.y()); |
| 1332 | rugPath.lineTo(point.x() + rugOffset + rugLength, point.y()); |
| 1333 | } |
| 1334 | } |
| 1335 | |
| 1336 | m_rugPath[i] = rugPath; |
| 1337 | } |
| 1338 | |
| 1339 | recalcShapeAndBoundingRect(); |
| 1340 | } |
| 1341 | |
| 1342 | void BoxPlotPrivate::updateFillingRect(int index, const QVector<QLineF>& lines) { |
| 1343 | const auto& unclippedLines = q->cSystem->mapLogicalToScene(lines, AbstractCoordinateSystem::MappingFlag::SuppressPageClipping); |
nothing calls this directly
no test coverage detected