qchart.h
203 lines
| 6.9 KiB
| text/x-c
|
CLexer
|
r2854 | /**************************************************************************** | ||
|
r742 | ** | ||
|
r2854 | ** Copyright (C) 2016 The Qt Company Ltd. | ||
** Contact: https://www.qt.io/licensing/ | ||||
|
r742 | ** | ||
|
r2854 | ** This file is part of the Qt Charts module of the Qt Toolkit. | ||
|
r742 | ** | ||
|
r2854 | ** $QT_BEGIN_LICENSE:GPL$ | ||
|
r2845 | ** Commercial License Usage | ||
** Licensees holding valid commercial Qt licenses may use this file in | ||||
** accordance with the commercial license agreement provided with the | ||||
** Software or, alternatively, in accordance with the terms contained in | ||||
** a written agreement between you and The Qt Company. For licensing terms | ||||
|
r2854 | ** and conditions see https://www.qt.io/terms-conditions. For further | ||
** information use the contact form at https://www.qt.io/contact-us. | ||||
** | ||||
** GNU General Public License Usage | ||||
** Alternatively, this file may be used under the terms of the GNU | ||||
** General Public License version 3 or (at your option) any later version | ||||
** approved by the KDE Free Qt Foundation. The licenses are as published by | ||||
** the Free Software Foundation and appearing in the file LICENSE.GPL3 | ||||
** included in the packaging of this file. Please review the following | ||||
** information to ensure the GNU General Public License requirements will | ||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html. | ||||
|
r742 | ** | ||
|
r2845 | ** $QT_END_LICENSE$ | ||
** | ||||
|
r2854 | ****************************************************************************/ | ||
|
r742 | |||
|
r264 | #ifndef QCHART_H | ||
#define QCHART_H | ||||
|
r12 | |||
|
r2712 | #include <QtCharts/QAbstractSeries> | ||
#include <QtCharts/QLegend> | ||||
|
r2714 | #include <QtWidgets/QGraphicsWidget> | ||
#include <QtCore/QMargins> | ||||
|
r12 | |||
|
r2774 | QT_BEGIN_NAMESPACE | ||
|
r115 | class QGraphicsSceneResizeEvent; | ||
|
r2774 | QT_END_NAMESPACE | ||
|
r115 | |||
|
r2712 | QT_CHARTS_BEGIN_NAMESPACE | ||
|
r12 | |||
|
r988 | class QAbstractSeries; | ||
|
r1541 | class QAbstractAxis; | ||
|
r524 | class QLegend; | ||
|
r2277 | class QChartPrivate; | ||
|
r2548 | class QBoxPlotSeries; | ||
|
r21 | |||
|
r2712 | class QT_CHARTS_EXPORT QChart : public QGraphicsWidget | ||
|
r38 | { | ||
|
r48 | Q_OBJECT | ||
|
r1524 | Q_PROPERTY(QChart::ChartTheme theme READ theme WRITE setTheme) | ||
Q_PROPERTY(QString title READ title WRITE setTitle) | ||||
Q_PROPERTY(bool backgroundVisible READ isBackgroundVisible WRITE setBackgroundVisible) | ||||
Q_PROPERTY(bool dropShadowEnabled READ isDropShadowEnabled WRITE setDropShadowEnabled) | ||||
|
r2549 | Q_PROPERTY(qreal backgroundRoundness READ backgroundRoundness WRITE setBackgroundRoundness) | ||
|
r1524 | Q_PROPERTY(QChart::AnimationOptions animationOptions READ animationOptions WRITE setAnimationOptions) | ||
|
r2804 | Q_PROPERTY(int animationDuration READ animationDuration WRITE setAnimationDuration) | ||
Q_PROPERTY(QEasingCurve animationEasingCurve READ animationEasingCurve WRITE setAnimationEasingCurve) | ||||
|
r1965 | Q_PROPERTY(QMargins margins READ margins WRITE setMargins) | ||
|
r2483 | Q_PROPERTY(QChart::ChartType chartType READ chartType) | ||
|
r2498 | Q_PROPERTY(bool plotAreaBackgroundVisible READ isPlotAreaBackgroundVisible WRITE setPlotAreaBackgroundVisible) | ||
|
r2707 | Q_PROPERTY(bool localizeNumbers READ localizeNumbers WRITE setLocalizeNumbers) | ||
|
r2708 | Q_PROPERTY(QLocale locale READ locale WRITE setLocale) | ||
|
r2716 | Q_PROPERTY(QRectF plotArea READ plotArea NOTIFY plotAreaChanged) | ||
|
r836 | Q_ENUMS(ChartTheme) | ||
|
r1094 | Q_ENUMS(AnimationOption) | ||
|
r2483 | Q_ENUMS(ChartType) | ||
|
r836 | |||
|
r64 | public: | ||
|
r2483 | enum ChartType { | ||
ChartTypeUndefined = 0, | ||||
ChartTypeCartesian, | ||||
ChartTypePolar | ||||
}; | ||||
|
r298 | enum ChartTheme { | ||
|
r853 | ChartThemeLight = 0, | ||
|
r651 | ChartThemeBlueCerulean, | ||
ChartThemeDark, | ||||
ChartThemeBrownSand, | ||||
ChartThemeBlueNcs, | ||||
|
r757 | ChartThemeHighContrast, | ||
|
r2625 | ChartThemeBlueIcy, | ||
ChartThemeQt | ||||
|
r64 | }; | ||
|
r742 | enum AnimationOption { | ||
|
r298 | NoAnimation = 0x0, | ||
GridAxisAnimations = 0x1, | ||||
|
r2097 | SeriesAnimations = 0x2, | ||
|
r298 | AllAnimations = 0x3 | ||
|
r742 | }; | ||
Q_DECLARE_FLAGS(AnimationOptions, AnimationOption) | ||||
|
r298 | |||
|
r12 | public: | ||
|
r746 | explicit QChart(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0); | ||
|
r48 | ~QChart(); | ||
|
r12 | |||
|
r1541 | void addSeries(QAbstractSeries *series); | ||
|
r988 | void removeSeries(QAbstractSeries *series); | ||
|
r740 | void removeAllSeries(); | ||
|
r2104 | QList<QAbstractSeries *> series() const; | ||
|
r12 | |||
|
r2360 | // *** deprecated *** | ||
|
r2104 | void setAxisX(QAbstractAxis *axis, QAbstractSeries *series = 0); | ||
void setAxisY(QAbstractAxis *axis, QAbstractSeries *series = 0); | ||||
QAbstractAxis *axisX(QAbstractSeries *series = 0) const; | ||||
QAbstractAxis *axisY(QAbstractSeries *series = 0) const; | ||||
|
r2360 | // ****************** | ||
|
r2273 | |||
|
r2483 | void addAxis(QAbstractAxis *axis, Qt::Alignment alignment); | ||
|
r2273 | void removeAxis(QAbstractAxis *axis); | ||
QList<QAbstractAxis*> axes(Qt::Orientations orientation = Qt::Horizontal|Qt::Vertical, QAbstractSeries *series = 0) const; | ||||
|
r1542 | |||
|
r1577 | void createDefaultAxes(); | ||
|
r740 | void setTheme(QChart::ChartTheme theme); | ||
QChart::ChartTheme theme() const; | ||||
|
r28 | |||
|
r2104 | void setTitle(const QString &title); | ||
|
r645 | QString title() const; | ||
|
r2104 | void setTitleFont(const QFont &font); | ||
|
r645 | QFont titleFont() const; | ||
void setTitleBrush(const QBrush &brush); | ||||
QBrush titleBrush() const; | ||||
|
r874 | |||
|
r783 | void setBackgroundBrush(const QBrush &brush); | ||
|
r645 | QBrush backgroundBrush() const; | ||
|
r783 | void setBackgroundPen(const QPen &pen); | ||
|
r645 | QPen backgroundPen() const; | ||
|
r987 | void setBackgroundVisible(bool visible = true); | ||
|
r645 | bool isBackgroundVisible() const; | ||
|
r122 | |||
|
r1462 | void setDropShadowEnabled(bool enabled = true); | ||
bool isDropShadowEnabled() const; | ||||
|
r2549 | void setBackgroundRoundness(qreal diameter); | ||
qreal backgroundRoundness() const; | ||||
|
r2804 | |||
|
r298 | void setAnimationOptions(AnimationOptions options); | ||
AnimationOptions animationOptions() const; | ||||
|
r2804 | void setAnimationDuration(int msecs); | ||
int animationDuration() const; | ||||
void setAnimationEasingCurve(const QEasingCurve &curve); | ||||
QEasingCurve animationEasingCurve() const; | ||||
|
r298 | |||
|
r67 | void zoomIn(); | ||
void zoomOut(); | ||||
|
r2273 | |||
void zoomIn(const QRectF &rect); | ||||
|
r1187 | void zoom(qreal factor); | ||
|
r2545 | void zoomReset(); | ||
bool isZoomed(); | ||||
|
r2273 | |||
|
r1553 | void scroll(qreal dx, qreal dy); | ||
|
r67 | |||
|
r2104 | QLegend *legend() const; | ||
|
r1534 | |||
|
r2104 | void setMargins(const QMargins &margins); | ||
|
r1965 | QMargins margins() const; | ||
|
r1883 | |||
|
r1648 | QRectF plotArea() const; | ||
|
r2498 | void setPlotAreaBackgroundBrush(const QBrush &brush); | ||
QBrush plotAreaBackgroundBrush() const; | ||||
void setPlotAreaBackgroundPen(const QPen &pen); | ||||
QPen plotAreaBackgroundPen() const; | ||||
void setPlotAreaBackgroundVisible(bool visible = true); | ||||
bool isPlotAreaBackgroundVisible() const; | ||||
|
r2707 | void setLocalizeNumbers(bool localize); | ||
bool localizeNumbers() const; | ||||
|
r2708 | void setLocale(const QLocale &locale); | ||
QLocale locale() const; | ||||
|
r803 | |||
|
r2344 | QPointF mapToValue(const QPointF &position, QAbstractSeries *series = 0); | ||
QPointF mapToPosition(const QPointF &value, QAbstractSeries *series = 0); | ||||
|
r2483 | ChartType chartType() const; | ||
|
r2793 | Q_SIGNALS: | ||
|
r2716 | void plotAreaChanged(const QRectF &plotArea); | ||
|
r740 | protected: | ||
|
r2483 | explicit QChart(QChart::ChartType type, QGraphicsItem *parent, Qt::WindowFlags wFlags); | ||
|
r740 | QScopedPointer<QChartPrivate> d_ptr; | ||
|
r790 | friend class QLegend; | ||
|
r2068 | friend class DeclarativeChart; | ||
|
r2273 | friend class ChartDataSet; | ||
friend class ChartPresenter; | ||||
friend class ChartThemeManager; | ||||
friend class QAbstractSeries; | ||||
|
r2548 | friend class QBoxPlotSeriesPrivate; | ||
|
r2723 | |||
private: | ||||
|
r760 | Q_DISABLE_COPY(QChart) | ||
|
r12 | }; | ||
|
r2712 | QT_CHARTS_END_NAMESPACE | ||
|
r12 | |||
|
r2712 | Q_DECLARE_OPERATORS_FOR_FLAGS(QT_CHARTS_NAMESPACE::QChart::AnimationOptions) | ||
|
r298 | |||
|
r2046 | #endif // QCHART_H | ||