| 709 | } |
| 710 | |
| 711 | void PlotDataDialog::addSingleSourceColumnPlot(const Column* column, CartesianPlot* plotArea) { |
| 712 | const QString& name = column->name(); |
| 713 | QApplication::processEvents(QEventLoop::AllEvents, 100); |
| 714 | Plot* plot{nullptr}; |
| 715 | if (m_plotType == Plot::PlotType::Histogram) { |
| 716 | if (!m_fitDistributionMode) { |
| 717 | auto* hist = new Histogram(name); |
| 718 | hist->setDataColumn(column); |
| 719 | plot = hist; |
| 720 | } else { |
| 721 | // histogram |
| 722 | auto* histogram = new Histogram(i18n("Probability Density of '%1'", name)); |
| 723 | histogram->setNormalization(Histogram::Normalization::ProbabilityDensity); |
| 724 | histogram->setDataColumn(column); |
| 725 | plotArea->addChild(histogram); |
| 726 | |
| 727 | // set fit model category and type and initialize fit |
| 728 | auto* fitCurve = new XYFitCurve(i18nc("Curve fitting", "Distribution Fit to '%1'", name)); |
| 729 | fitCurve->setDataSourceType(XYAnalysisCurve::DataSourceType::Histogram); |
| 730 | fitCurve->setDataSourceHistogram(histogram); |
| 731 | |
| 732 | auto fitData = fitCurve->fitData(); |
| 733 | fitData.modelCategory = nsl_fit_model_distribution; |
| 734 | fitData.modelType = (int)m_fitDistribution; |
| 735 | fitData.algorithm = nsl_fit_algorithm_ml; // ML distribution fit |
| 736 | XYFitCurve::initFitData(fitData); |
| 737 | fitCurve->setFitData(fitData); |
| 738 | |
| 739 | fitCurve->recalculate(); |
| 740 | plot = fitCurve; |
| 741 | } |
| 742 | } else if (m_plotType == Plot::PlotType::KDEPlot) { |
| 743 | auto* kdePlot = new KDEPlot(name); |
| 744 | kdePlot->setDataColumn(column); |
| 745 | plot = kdePlot; |
| 746 | } else if (m_plotType == Plot::PlotType::QQPlot) { |
| 747 | auto* qqPlot = new QQPlot(name); |
| 748 | qqPlot->setDataColumn(column); |
| 749 | plot = qqPlot; |
| 750 | } else if (m_plotType == Plot::PlotType::ProcessBehaviorChart) { |
| 751 | auto* chart = new ProcessBehaviorChart(name); |
| 752 | chart->setDataColumn(column); |
| 753 | plot = chart; |
| 754 | } else if (m_plotType == Plot::PlotType::RunChart) { |
| 755 | auto* chart = new RunChart(name); |
| 756 | chart->setDataColumn(column); |
| 757 | plot = chart; |
| 758 | } |
| 759 | |
| 760 | if (plot) { |
| 761 | plotArea->addChild(plot); |
| 762 | m_lastAddedCurve = plot; |
| 763 | } |
| 764 | } |
| 765 | |
| 766 | void PlotDataDialog::addMultiSourceColumnsPlot(const QVector<const AbstractColumn*>& columns, CartesianPlot* plotArea) { |
| 767 | QString name; |
nothing calls this directly
no test coverage detected