| 251 | } |
| 252 | |
| 253 | void StatisticsColumnWidget::showOverviewPlot() { |
| 254 | if (!m_column->isNumeric()) |
| 255 | return; |
| 256 | |
| 257 | // add plot |
| 258 | auto* plot = addPlot(&m_overviewPlotWidget); |
| 259 | plot->setSymmetricPadding(false); |
| 260 | const double padding = Worksheet::convertToSceneUnits(0.5, Worksheet::Unit::Centimeter); |
| 261 | plot->setHorizontalPadding(2 * padding); |
| 262 | plot->setRightPadding(2 * padding); |
| 263 | plot->setVerticalPadding(padding); |
| 264 | plot->setBottomPadding(padding); |
| 265 | plot->plotArea()->borderLine()->setStyle(Qt::NoPen); |
| 266 | |
| 267 | // set the axes labels |
| 268 | auto axes = plot->children<Axis>(); |
| 269 | for (auto* axis : std::as_const(axes)) { |
| 270 | axis->setSuppressRetransform(true); |
| 271 | if (axis->orientation() == Axis::Orientation::Vertical) |
| 272 | axis->title()->setText(QString()); |
| 273 | else { |
| 274 | // TODO: set the font and the offset smaller and show the "Index" title after this |
| 275 | // axis->title()->setText(i18n("Index")); |
| 276 | axis->title()->setText(QString()); |
| 277 | } |
| 278 | |
| 279 | auto font = axis->labelsFont(); |
| 280 | font.setPointSizeF(Worksheet::convertToSceneUnits(8, Worksheet::Unit::Point)); |
| 281 | axis->setLabelsFont(font); |
| 282 | axis->setLabelsOffset(2); |
| 283 | axis->setMajorTicksDirection(Axis::ticksIn); |
| 284 | axis->majorGridLine()->setStyle(Qt::NoPen); |
| 285 | axis->setMinorTicksDirection(Axis::noTicks); |
| 286 | axis->setArrowType(Axis::ArrowType::NoArrow); |
| 287 | axis->setSuppressRetransform(false); |
| 288 | } |
| 289 | |
| 290 | QApplication::processEvents(QEventLoop::AllEvents, 100); |
| 291 | |
| 292 | // x |
| 293 | auto* xColumn = new Column(QStringLiteral("x"), AbstractColumn::ColumnMode::Integer); |
| 294 | m_project->addChild(xColumn); |
| 295 | int rows = m_column->rowCount(); |
| 296 | QVector<int> xData; |
| 297 | xData.resize(rows); |
| 298 | for (int i = 0; i < rows; ++i) |
| 299 | xData[i] = i; |
| 300 | xColumn->setIntegers(xData); |
| 301 | |
| 302 | // add curve |
| 303 | auto* curve = new XYCurve(QString()); |
| 304 | curve->setSuppressRetransform(false); |
| 305 | plot->addChild(curve); |
| 306 | curve->line()->setStyle(Qt::SolidLine); |
| 307 | curve->symbol()->setStyle(Symbol::Style::NoSymbols); |
| 308 | curve->background()->setPosition(Background::Position::No); |
| 309 | curve->setXColumn(xColumn); |
| 310 | curve->setYColumn(m_column); |
nothing calls this directly
no test coverage detected