set format of axis from data column
| 2484 | |
| 2485 | // set format of axis from data column |
| 2486 | void CartesianPlot::checkAxisFormat(const int cSystemIndex, const AbstractColumn* column, Axis::Orientation orientation) { |
| 2487 | if (isLoading()) |
| 2488 | return; |
| 2489 | |
| 2490 | const auto* col = qobject_cast<const Column*>(column); |
| 2491 | if (!col) |
| 2492 | return; |
| 2493 | |
| 2494 | const int xIndex = coordinateSystem(cSystemIndex)->index(Dimension::X); |
| 2495 | const int yIndex = coordinateSystem(cSystemIndex)->index(Dimension::Y); |
| 2496 | |
| 2497 | Q_D(CartesianPlot); |
| 2498 | if (col->columnMode() == AbstractColumn::ColumnMode::DateTime) { |
| 2499 | setUndoAware(false); |
| 2500 | if (orientation == Axis::Orientation::Horizontal) |
| 2501 | setXRangeFormat(xIndex, RangeT::Format::DateTime); |
| 2502 | else |
| 2503 | setYRangeFormat(yIndex, RangeT::Format::DateTime); |
| 2504 | setUndoAware(true); |
| 2505 | |
| 2506 | // set column's datetime format for all horizontal axis |
| 2507 | for (auto* axis : children<Axis>()) { |
| 2508 | if (axis->orientation() == orientation) { |
| 2509 | const auto* cSystem{coordinateSystem(axis->coordinateSystemIndex())}; |
| 2510 | const auto* filter = static_cast<DateTime2StringFilter*>(col->outputFilter()); |
| 2511 | d->xRanges[cSystem ? cSystem->index(Dimension::X) : 0].range.setDateTimeFormat(filter->format()); |
| 2512 | axis->setUndoAware(false); |
| 2513 | axis->setLabelsDateTimeFormat(rangeDateTimeFormat(Dimension::X, xIndex)); |
| 2514 | axis->setUndoAware(true); |
| 2515 | } |
| 2516 | } |
| 2517 | } else { |
| 2518 | setUndoAware(false); |
| 2519 | if (orientation == Axis::Orientation::Horizontal) |
| 2520 | setXRangeFormat(xIndex, RangeT::Format::Numeric); |
| 2521 | else |
| 2522 | setYRangeFormat(yIndex, RangeT::Format::Numeric); |
| 2523 | |
| 2524 | setUndoAware(true); |
| 2525 | } |
| 2526 | } |
| 2527 | |
| 2528 | void CartesianPlot::boxPlotOrientationChanged(BoxPlot::Orientation orientation) { |
| 2529 | const auto& axes = children<Axis>(); |
nothing calls this directly
no test coverage detected