File indexing completed on 2025-01-26 03:34:13

0001 /*
0002     File                 : QQPlot.h
0003     Project              : LabPlot
0004     Description          : QQ-Plot
0005     --------------------------------------------------------------------
0006     SPDX-FileCopyrightText: 2023 Alexander Semke <alexander.semke@web.de>
0007     SPDX-License-Identifier: GPL-2.0-or-later
0008 */
0009 
0010 #ifndef QQPLOT_H
0011 #define QQPLOT_H
0012 
0013 #include "Plot.h"
0014 #include "backend/nsl/nsl_sf_stats.h"
0015 
0016 class AbstractColumn;
0017 class Background;
0018 class Line;
0019 class Symbol;
0020 class QQPlotPrivate;
0021 
0022 #ifdef SDK
0023 #include "labplot_export.h"
0024 class LABPLOT_EXPORT QQPlot : public Plot {
0025 #else
0026 class QQPlot : public Plot {
0027 #endif
0028     Q_OBJECT
0029 
0030 public:
0031     friend class QQPlotSetDataColumnCmd;
0032 
0033     explicit QQPlot(const QString& name);
0034     ~QQPlot() override;
0035 
0036     void finalizeAdd() override;
0037 
0038     QIcon icon() const override;
0039 
0040     void save(QXmlStreamWriter*) const override;
0041     bool load(XmlStreamReader*, bool preview) override;
0042 
0043     void loadThemeConfig(const KConfig&) override;
0044     void saveThemeConfig(const KConfig&) override;
0045 
0046     POINTER_D_ACCESSOR_DECL(const AbstractColumn, dataColumn, DataColumn)
0047     CLASS_D_ACCESSOR_DECL(QString, dataColumnPath, DataColumnPath)
0048     BASIC_D_ACCESSOR_DECL(nsl_sf_stats_distribution, distribution, Distribution)
0049 
0050     Line* line() const;
0051     Symbol* symbol() const;
0052 
0053     void retransform() override;
0054     void recalc();
0055     void handleResize(double horizontalRatio, double verticalRatio, bool pageResize) override;
0056     void setVisible(bool) override;
0057 
0058     bool minMax(const CartesianCoordinateSystem::Dimension dim, const Range<int>& indexRange, Range<double>& r, bool includeErrorBars = true) const override;
0059     double minimum(CartesianCoordinateSystem::Dimension) const override;
0060     double maximum(CartesianCoordinateSystem::Dimension) const override;
0061     bool hasData() const override;
0062     bool usingColumn(const Column*) const override;
0063     void updateColumnDependencies(const AbstractColumn*) override;
0064     QColor color() const override;
0065 
0066     typedef QQPlotPrivate Private;
0067 
0068 private Q_SLOTS:
0069     void dataColumnAboutToBeRemoved(const AbstractAspect*);
0070 
0071 protected:
0072     QQPlot(const QString& name, QQPlotPrivate* dd);
0073 
0074 private:
0075     Q_DECLARE_PRIVATE(QQPlot)
0076     void init();
0077     void connectDataColumn(const AbstractColumn*);
0078 
0079     QAction* navigateToAction{nullptr};
0080     bool m_menusInitialized{false};
0081 
0082 Q_SIGNALS:
0083     void linesUpdated(const QQPlot*, const QVector<QLineF>&);
0084 
0085     // General-Tab
0086     void dataChanged(); // emitted when the actual curve data to be plotted was changed to re-adjust the plot
0087     void dataDataChanged();
0088     void dataColumnChanged(const AbstractColumn*);
0089     void distributionChanged(nsl_sf_stats_distribution);
0090 };
0091 
0092 #endif