| 1 | /**************************************************************************** |
| 2 | ** |
| 3 | ** Copyright (C) 2016 The Qt Company Ltd. |
| 4 | ** Contact: https://www.qt.io/licensing/ |
| 5 | ** |
| 6 | ** This file is part of the Qt Charts module of the Qt Toolkit. |
| 7 | ** |
| 8 | ** $QT_BEGIN_LICENSE:GPL$ |
| 9 | ** Commercial License Usage |
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in |
| 11 | ** accordance with the commercial license agreement provided with the |
| 12 | ** Software or, alternatively, in accordance with the terms contained in |
| 13 | ** a written agreement between you and The Qt Company. For licensing terms |
| 14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
| 15 | ** information use the contact form at https://www.qt.io/contact-us. |
| 16 | ** |
| 17 | ** GNU General Public License Usage |
| 18 | ** Alternatively, this file may be used under the terms of the GNU |
| 19 | ** General Public License version 3 or (at your option) any later version |
| 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by |
| 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 |
| 22 | ** included in the packaging of this file. Please review the following |
| 23 | ** information to ensure the GNU General Public License requirements will |
| 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. |
| 25 | ** |
| 26 | ** $QT_END_LICENSE$ |
| 27 | ** |
| 28 | ****************************************************************************/ |
| 29 | |
| 30 | #ifndef MAINWINDOW_H |
| 31 | #define MAINWINDOW_H |
| 32 | |
| 33 | #include <QtCharts/QPolarChart> |
| 34 | #include <QtWidgets/QMainWindow> |
| 35 | #include <QtGui/QFont> |
| 36 | #include <QtCharts/QChart> |
| 37 | #include <QtCharts/QScatterSeries> |
| 38 | #include <QtCharts/QLineSeries> |
| 39 | #include <QtCharts/QSplineSeries> |
| 40 | #include <QtCharts/QAreaSeries> |
| 41 | |
| 42 | QT_BEGIN_NAMESPACE |
| 43 | class QBrush; |
| 44 | class QPen; |
| 45 | |
| 46 | namespace Ui { |
| 47 | class MainWindow; |
| 48 | } |
| 49 | QT_END_NAMESPACE |
| 50 | |
| 51 | |
| 52 | QT_CHARTS_USE_NAMESPACE |
| 53 | |
| 54 | class MainWindow : public QMainWindow |
| 55 | { |
| 56 | Q_OBJECT |
| 57 | |
| 58 | public: |
| 59 | explicit MainWindow(QWidget *parent = 0); |
| 60 | ~MainWindow(); |
| 61 | |
| 62 | public slots: |
| 63 | void angularTicksChanged(int value); |
| 64 | void radialTicksChanged(int value); |
| 65 | void angularMinorTicksChanged(int value); |
| 66 | void radialMinorTicksChanged(int value); |
| 67 | void anglesChanged(int value); |
| 68 | void angularMinChanged(double value); |
| 69 | void angularMaxChanged(double value); |
| 70 | void radialMinChanged(double value); |
| 71 | void radialMaxChanged(double value); |
| 72 | void angularShadesIndexChanged(int index); |
| 73 | void radialShadesIndexChanged(int index); |
| 74 | void labelFormatEdited(const QString &text); |
| 75 | void labelFontChanged(const QFont &font); |
| 76 | void labelFontSizeChanged(int value); |
| 77 | void animationIndexChanged(int index); |
| 78 | void labelsIndexChanged(int index); |
| 79 | void titleIndexChanged(int index); |
| 80 | void titleFontChanged(const QFont &font); |
| 81 | void titleFontSizeChanged(int value); |
| 82 | void gridIndexChanged(int index); |
| 83 | void minorGridIndexChanged(int index); |
| 84 | void gridLineColorIndexChanged(int index); |
| 85 | void arrowIndexChanged(int index); |
| 86 | void angularRangeChanged(qreal min, qreal max); |
| 87 | void radialRangeChanged(qreal min, qreal max); |
| 88 | void angularAxisIndexChanged(int index); |
| 89 | void radialAxisIndexChanged(int index); |
| 90 | void logBaseChanged(double value); |
| 91 | void niceNumbersChecked(); |
| 92 | void dateFormatEdited(const QString &text); |
| 93 | void moreCategoriesChecked(); |
| 94 | void categoryLabelLocationChecked(); |
| 95 | void series1CheckBoxChecked(); |
| 96 | void series2CheckBoxChecked(); |
| 97 | void series3CheckBoxChecked(); |
| 98 | void series4CheckBoxChecked(); |
| 99 | void series5CheckBoxChecked(); |
| 100 | void series6CheckBoxChecked(); |
| 101 | void series7CheckBoxChecked(); |
| 102 | void themeIndexChanged(int index); |
| 103 | void seriesHovered(QPointF point, bool state); |
| 104 | void seriesClicked(const QPointF &point); |
| 105 | void backgroundIndexChanged(int index); |
| 106 | void plotAreaIndexChanged(int index); |
| 107 | |
| 108 | private: |
| 109 | enum AxisMode { |
| 110 | AxisModeNone, |
| 111 | AxisModeValue, |
| 112 | AxisModeLogValue, |
| 113 | AxisModeDateTime, |
| 114 | AxisModeCategory |
| 115 | }; |
| 116 | |
| 117 | void initXYValueChart(); |
| 118 | void setAngularAxis(AxisMode mode); |
| 119 | void setRadialAxis(AxisMode mode); |
| 120 | |
| 121 | void applyRanges(); |
| 122 | void applyCategories(); |
| 123 | |
| 124 | Ui::MainWindow *ui; |
| 125 | |
| 126 | int m_angularTickCount; |
| 127 | int m_radialTickCount; |
| 128 | int m_angularMinorTickCount; |
| 129 | int m_radialMinorTickCount; |
| 130 | qreal m_labelsAngle; |
| 131 | qreal m_angularMin; |
| 132 | qreal m_angularMax; |
| 133 | qreal m_radialMin; |
| 134 | qreal m_radialMax; |
| 135 | bool m_angularShadesVisible; |
| 136 | bool m_radialShadesVisible; |
| 137 | bool m_labelsVisible; |
| 138 | bool m_titleVisible; |
| 139 | bool m_gridVisible; |
| 140 | bool m_arrowVisible; |
| 141 | bool m_minorGridVisible; |
| 142 | bool m_minorArrowVisible; |
| 143 | QBrush *m_angularShadesBrush; |
| 144 | QBrush *m_radialShadesBrush; |
| 145 | QBrush *m_labelBrush; |
| 146 | QBrush *m_titleBrush; |
| 147 | QBrush *m_backgroundBrush; |
| 148 | QBrush *m_plotAreaBackgroundBrush; |
| 149 | QPen *m_angularShadesPen; |
| 150 | QPen *m_radialShadesPen; |
| 151 | QPen *m_gridPen; |
| 152 | QPen *m_arrowPen; |
| 153 | QPen *m_minorGridPen; |
| 154 | QPen *m_backgroundPen; |
| 155 | QPen *m_plotAreaBackgroundPen; |
| 156 | QString m_labelFormat; |
| 157 | QFont m_currentLabelFont; |
| 158 | QFont m_currentTitleFont; |
| 159 | QChart::AnimationOptions m_animationOptions; |
| 160 | QString m_angularTitle; |
| 161 | QString m_radialTitle; |
| 162 | qreal m_base; |
| 163 | QString m_dateFormat; |
| 164 | |
| 165 | QPolarChart *m_chart; |
| 166 | QAbstractAxis *m_angularAxis; |
| 167 | QAbstractAxis *m_radialAxis; |
| 168 | AxisMode m_angularAxisMode; |
| 169 | AxisMode m_radialAxisMode; |
| 170 | bool m_moreCategories; |
| 171 | |
| 172 | QScatterSeries *m_series1; |
| 173 | QLineSeries *m_series2; |
| 174 | QLineSeries *m_series3; |
| 175 | QLineSeries *m_series4; |
| 176 | QAreaSeries *m_series5; |
| 177 | QSplineSeries *m_series6; |
| 178 | QScatterSeries *m_series7; |
| 179 | }; |
| 180 | |
| 181 | #endif // MAINWINDOW_H |
| 182 | |