| 1 | // Copyright (C) 2016 The Qt Company Ltd. |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef QAREASERIES_H |
| 5 | #define QAREASERIES_H |
| 6 | |
| 7 | #include <QtCharts/QChartGlobal> |
| 8 | #include <QtCharts/QAbstractSeries> |
| 9 | #include <QtGui/QPen> |
| 10 | #include <QtGui/QBrush> |
| 11 | |
| 12 | Q_MOC_INCLUDE(<QtCharts/qlineseries.h>) |
| 13 | |
| 14 | QT_BEGIN_NAMESPACE |
| 15 | class QLineSeries; |
| 16 | class QAreaSeriesPrivate; |
| 17 | |
| 18 | class Q_CHARTS_EXPORT QAreaSeries : public QAbstractSeries |
| 19 | { |
| 20 | Q_OBJECT |
| 21 | Q_PROPERTY(QLineSeries *upperSeries READ upperSeries) |
| 22 | Q_PROPERTY(QLineSeries *lowerSeries READ lowerSeries) |
| 23 | Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged) |
| 24 | Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor NOTIFY borderColorChanged) |
| 25 | Q_PROPERTY(QString pointLabelsFormat READ pointLabelsFormat WRITE setPointLabelsFormat NOTIFY pointLabelsFormatChanged) |
| 26 | Q_PROPERTY(bool pointLabelsVisible READ pointLabelsVisible WRITE setPointLabelsVisible NOTIFY pointLabelsVisibilityChanged) |
| 27 | Q_PROPERTY(QFont pointLabelsFont READ pointLabelsFont WRITE setPointLabelsFont NOTIFY pointLabelsFontChanged) |
| 28 | Q_PROPERTY(QColor pointLabelsColor READ pointLabelsColor WRITE setPointLabelsColor NOTIFY pointLabelsColorChanged) |
| 29 | Q_PROPERTY(bool pointLabelsClipping READ pointLabelsClipping WRITE setPointLabelsClipping NOTIFY pointLabelsClippingChanged) |
| 30 | |
| 31 | public: |
| 32 | explicit QAreaSeries(QObject *parent = nullptr); |
| 33 | explicit QAreaSeries(QLineSeries *upperSeries, QLineSeries *lowerSeries = nullptr); |
| 34 | ~QAreaSeries(); |
| 35 | |
| 36 | public: |
| 37 | QAbstractSeries::SeriesType type() const override; |
| 38 | |
| 39 | void setUpperSeries(QLineSeries *series); |
| 40 | QLineSeries *upperSeries() const; |
| 41 | void setLowerSeries(QLineSeries *series); |
| 42 | QLineSeries *lowerSeries() const; |
| 43 | |
| 44 | void setPen(const QPen &pen); |
| 45 | QPen pen() const; |
| 46 | |
| 47 | void setBrush(const QBrush &brush); |
| 48 | QBrush brush() const; |
| 49 | |
| 50 | void setColor(const QColor &color); |
| 51 | QColor color() const; |
| 52 | |
| 53 | void setBorderColor(const QColor &color); |
| 54 | QColor borderColor() const; |
| 55 | |
| 56 | void setPointsVisible(bool visible = true); |
| 57 | bool pointsVisible() const; |
| 58 | |
| 59 | void setPointLabelsFormat(const QString &format); |
| 60 | QString pointLabelsFormat() const; |
| 61 | |
| 62 | void setPointLabelsVisible(bool visible = true); |
| 63 | bool pointLabelsVisible() const; |
| 64 | |
| 65 | void setPointLabelsFont(const QFont &font); |
| 66 | QFont pointLabelsFont() const; |
| 67 | |
| 68 | void setPointLabelsColor(const QColor &color); |
| 69 | QColor pointLabelsColor() const; |
| 70 | |
| 71 | void setPointLabelsClipping(bool enabled = true); |
| 72 | bool pointLabelsClipping() const; |
| 73 | |
| 74 | Q_SIGNALS: |
| 75 | void clicked(const QPointF &point); |
| 76 | void hovered(const QPointF &point, bool state); |
| 77 | void pressed(const QPointF &point); |
| 78 | void released(const QPointF &point); |
| 79 | void doubleClicked(const QPointF &point); |
| 80 | void selected(); |
| 81 | void colorChanged(QColor color); |
| 82 | void borderColorChanged(QColor color); |
| 83 | void pointLabelsFormatChanged(const QString &format); |
| 84 | void pointLabelsVisibilityChanged(bool visible); |
| 85 | void pointLabelsFontChanged(const QFont &font); |
| 86 | void pointLabelsColorChanged(const QColor &color); |
| 87 | void pointLabelsClippingChanged(bool clipping); |
| 88 | |
| 89 | private: |
| 90 | Q_DECLARE_PRIVATE(QAreaSeries) |
| 91 | Q_DISABLE_COPY(QAreaSeries) |
| 92 | friend class AreaLegendMarker; |
| 93 | friend class AreaChartItem; |
| 94 | friend class QAreaLegendMarkerPrivate; |
| 95 | }; |
| 96 | |
| 97 | QT_END_NAMESPACE |
| 98 | |
| 99 | #endif // QAREASERIES_H |
| 100 | |