MCPcopy Create free account
hub / github.com/KDE/labplot / addCurvesToPlots

Method addCurvesToPlots

src/frontend/spreadsheet/PlotDataDialog.cpp:558–633  ·  view source on GitHub ↗

! * for the selected columns in this dialog, creates a plot and a curve in the already existing worksheet \c worksheet. */

Source from the content-addressed store, hash-verified

556 * for the selected columns in this dialog, creates a plot and a curve in the already existing worksheet \c worksheet.
557 */
558void PlotDataDialog::addCurvesToPlots(Worksheet* worksheet) {
559 QApplication::processEvents(QEventLoop::AllEvents, 100);
560 worksheet->setSuppressLayoutUpdate(true);
561
562 switch (m_plotType) {
563 case Plot::PlotType::Line:
564 case Plot::PlotType::LineHorizontalStep:
565 case Plot::PlotType::LineVerticalStep:
566 case Plot::PlotType::LineSpline:
567 case Plot::PlotType::Scatter:
568 case Plot::PlotType::ScatterYError:
569 case Plot::PlotType::ScatterXYError:
570 case Plot::PlotType::LineSymbol:
571 case Plot::PlotType::LineSymbol2PointSegment:
572 case Plot::PlotType::LineSymbol3PointSegment:
573 case Plot::PlotType::Formula: {
574 const QString& xColumnName = ui->cbXColumn->currentText();
575 Column* xColumn = columnFromName(xColumnName);
576 for (auto* comboBox : m_columnComboBoxes) {
577 const QString& name = comboBox->currentText();
578 Column* yColumn = columnFromName(name);
579 if (yColumn == xColumn)
580 continue;
581
582 auto* plot = new CartesianPlot(i18n("Plot Area %1", name));
583 plot->setType(CartesianPlot::Type::FourAxes);
584 worksheet->addChild(plot);
585 setAxesColumnLabels(plot, yColumn);
586 addCurve(name, xColumn, yColumn, plot);
587 plot->scaleAuto(-1, -1);
588 plot->retransform();
589 setAxesTitles(plot, name);
590 }
591 break;
592 }
593 case Plot::PlotType::Histogram:
594 case Plot::PlotType::KDEPlot:
595 case Plot::PlotType::QQPlot:
596 case Plot::PlotType::ProcessBehaviorChart:
597 case Plot::PlotType::RunChart: {
598 for (auto* comboBox : m_columnComboBoxes) {
599 const QString& name = comboBox->currentText();
600 Column* column = columnFromName(name);
601
602 auto* plot = new CartesianPlot(i18n("Plot Area %1", name));
603 plot->setType(CartesianPlot::Type::FourAxes);
604 setAxesTitles(plot, name);
605 worksheet->addChild(plot);
606 addSingleSourceColumnPlot(column, plot);
607 plot->scaleAuto(-1, -1);
608 plot->retransform();
609 }
610 break;
611 }
612 case Plot::PlotType::BoxPlot:
613 case Plot::PlotType::BarPlot:
614 case Plot::PlotType::LollipopPlot: {
615 for (auto* comboBox : m_columnComboBoxes) {

Callers

nothing calls this directly

Calls 7

currentTextMethod · 0.80
scaleAutoMethod · 0.80
updateLayoutMethod · 0.80
setTypeMethod · 0.45
addChildMethod · 0.45
retransformMethod · 0.45

Tested by

no test coverage detected