@@ -0,0 +1,8 | |||
|
1 | !include( ../examples.pri ) { | |
|
2 | error( "Couldn't find the examples.pri file!" ) | |
|
3 | } | |
|
4 | ||
|
5 | TARGET = colormap | |
|
6 | SOURCES += main.cpp | |
|
7 | ||
|
8 | HEADERS += |
@@ -0,0 +1,80 | |||
|
1 | /*------------------------------------------------------------------------------ | |
|
2 | -- This file is a part of the ColorMapChart API | |
|
3 | -- Copyright (C) 2016, Plasma Physics Laboratory - CNRS | |
|
4 | -- | |
|
5 | -- This program is free software; you can redistribute it and/or modify | |
|
6 | -- it under the terms of the GNU General Public License as published by | |
|
7 | -- the Free Software Foundation; either version 2 of the License, or | |
|
8 | -- (at your option) any later version. | |
|
9 | -- | |
|
10 | -- This program is distributed in the hope that it will be useful, | |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
|
13 | -- GNU General Public License for more details. | |
|
14 | -- | |
|
15 | -- You should have received a copy of the GNU General Public License | |
|
16 | -- along with this program; if not, write to the Free Software | |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
|
18 | -------------------------------------------------------------------------------*/ | |
|
19 | /*-- Author : Hugo Winter | |
|
20 | -- Mail : hugo.winter@lpp.polytechnique.fr | |
|
21 | ----------------------------------------------------------------------------*/ | |
|
22 | ||
|
23 | #include <QtWidgets/QApplication> | |
|
24 | #include <QtWidgets/QMainWindow> | |
|
25 | #include <QtCharts/QChartView> | |
|
26 | #include <QtCharts/QColorMapSeries> | |
|
27 | #include <QtCharts/colormapdatapart.h> | |
|
28 | ||
|
29 | QT_CHARTS_USE_NAMESPACE | |
|
30 | ||
|
31 | int main(int argc, char *argv[]) | |
|
32 | { | |
|
33 | QApplication a(argc, argv); | |
|
34 | ||
|
35 | QVector<double> *xSeries = new QVector<double>(); | |
|
36 | xSeries->reserve(1028); | |
|
37 | for(int i=0;i<1028;i++) | |
|
38 | { | |
|
39 | xSeries->append(i); | |
|
40 | } | |
|
41 | QVector<double> *ySeries = new QVector<double>(); | |
|
42 | ySeries->reserve(768); | |
|
43 | for(int i=0;i<768;i++) | |
|
44 | { | |
|
45 | ySeries->append(i); | |
|
46 | } | |
|
47 | QVector<double> *zSeries = new QVector<double>(); | |
|
48 | zSeries->reserve(1028*768); | |
|
49 | for(int i=0;i<1028*768;i++) | |
|
50 | { | |
|
51 | zSeries->append(i); | |
|
52 | } | |
|
53 | ||
|
54 | ColorMapDataPart * data = new ColorMapDataPart(xSeries,ySeries,zSeries); | |
|
55 | ||
|
56 | QColorMapSeries *series = new QColorMapSeries(); | |
|
57 | series->append(data); | |
|
58 | ||
|
59 | QChart *chart = new QChart(); | |
|
60 | chart->addSeries(series); | |
|
61 | ||
|
62 | chart->createDefaultAxes(); | |
|
63 | ||
|
64 | chart->setTitle("Simple Colormap Example"); | |
|
65 | ||
|
66 | chart->axisX()->setGridLineVisible(false); | |
|
67 | chart->axisY()->setGridLineVisible(false); | |
|
68 | ||
|
69 | chart->legend()->setVisible(false); | |
|
70 | ||
|
71 | QChartView *chartView = new QChartView(chart); | |
|
72 | chartView->setRenderHint(QPainter::Antialiasing); | |
|
73 | ||
|
74 | QMainWindow window; | |
|
75 | window.setCentralWidget(chartView); | |
|
76 | window.resize(400, 400); | |
|
77 | window.show(); | |
|
78 | ||
|
79 | return a.exec(); | |
|
80 | } |
@@ -1,66 +1,67 | |||
|
1 | 1 | TEMPLATE = subdirs |
|
2 | 2 | SUBDIRS += areachart \ |
|
3 | 3 | customchart \ |
|
4 | 4 | linechart \ |
|
5 | 5 | percentbarchart \ |
|
6 | 6 | piechart \ |
|
7 | 7 | piechartdrilldown \ |
|
8 | 8 | scatterchart \ |
|
9 | 9 | scatterinteractions \ |
|
10 | 10 | splinechart \ |
|
11 | 11 | stackedbarchart \ |
|
12 | 12 | stackedbarchartdrilldown \ |
|
13 | 13 | zoomlinechart \ |
|
14 | 14 | modeldata \ |
|
15 | 15 | barchart \ |
|
16 | 16 | boxplotchart \ |
|
17 | 17 | legend \ |
|
18 | 18 | barmodelmapper \ |
|
19 | 19 | lineandbar \ |
|
20 | 20 | horizontalbarchart \ |
|
21 | 21 | horizontalstackedbarchart \ |
|
22 | 22 | horizontalpercentbarchart \ |
|
23 | 23 | donutbreakdown \ |
|
24 | 24 | temperaturerecords \ |
|
25 | 25 | donutchart \ |
|
26 | 26 | multiaxis \ |
|
27 | 27 | legendmarkers \ |
|
28 | 28 | logvalueaxis \ |
|
29 | 29 | polarchart \ |
|
30 | 30 | piechartcustomization \ |
|
31 | 31 | dynamicspline \ |
|
32 | 32 | nesteddonuts \ |
|
33 | 33 | chartinteractions \ |
|
34 | 34 | callout \ |
|
35 | chartthemes | |
|
35 | chartthemes \ | |
|
36 | colormap | |
|
36 | 37 | |
|
37 | 38 | qtHaveModule(quick) { |
|
38 | 39 | SUBDIRS += qmlboxplot \ |
|
39 | 40 | qmlpiechart \ |
|
40 | 41 | qmlweather \ |
|
41 | 42 | qmlf1legends \ |
|
42 | 43 | qmlcustomizations \ |
|
43 | 44 | qmlaxes \ |
|
44 | 45 | qmlcustomlegend \ |
|
45 | 46 | qmlpolarchart \ |
|
46 | 47 | qmlchart \ |
|
47 | 48 | qmloscilloscope |
|
48 | 49 | } |
|
49 | 50 | |
|
50 | 51 | qtHaveModule(multimedia) { |
|
51 | 52 | SUBDIRS += audio |
|
52 | 53 | } else { |
|
53 | 54 | message("QtMultimedia library not available. Some examples are disabled.") |
|
54 | 55 | } |
|
55 | 56 | |
|
56 | 57 | contains(QT_CONFIG, opengl) { |
|
57 | 58 | SUBDIRS += openglseries |
|
58 | 59 | } else { |
|
59 | 60 | message("OpenGL not available. Some examples are disabled.") |
|
60 | 61 | } |
|
61 | 62 | |
|
62 | 63 | !contains(QT_COORD_TYPE, float): { |
|
63 | 64 | SUBDIRS += \ |
|
64 | 65 | datetimeaxis |
|
65 | 66 | } |
|
66 | 67 |
@@ -1,931 +1,937 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2016 The Qt Company Ltd. |
|
4 | 4 | ** Contact: https://www.qt.io/licensing/ |
|
5 | 5 | ** |
|
6 | 6 | ** This file is part of the Qt Charts module of the Qt Toolkit. |
|
7 | 7 | ** |
|
8 | 8 | ** $QT_BEGIN_LICENSE:GPL$ |
|
9 | 9 | ** Commercial License Usage |
|
10 | 10 | ** Licensees holding valid commercial Qt licenses may use this file in |
|
11 | 11 | ** accordance with the commercial license agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and The Qt Company. For licensing terms |
|
14 | 14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
|
15 | 15 | ** information use the contact form at https://www.qt.io/contact-us. |
|
16 | 16 | ** |
|
17 | 17 | ** GNU General Public License Usage |
|
18 | 18 | ** Alternatively, this file may be used under the terms of the GNU |
|
19 | 19 | ** General Public License version 3 or (at your option) any later version |
|
20 | 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by |
|
21 | 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 |
|
22 | 22 | ** included in the packaging of this file. Please review the following |
|
23 | 23 | ** information to ensure the GNU General Public License requirements will |
|
24 | 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. |
|
25 | 25 | ** |
|
26 | 26 | ** $QT_END_LICENSE$ |
|
27 | 27 | ** |
|
28 | 28 | ****************************************************************************/ |
|
29 | 29 | |
|
30 | 30 | #include <QtCharts/QChart> |
|
31 | 31 | #include <private/qchart_p.h> |
|
32 | 32 | #include <private/legendscroller_p.h> |
|
33 | 33 | #include <private/qlegend_p.h> |
|
34 | 34 | #include <private/chartbackground_p.h> |
|
35 | 35 | #include <QtCharts/QAbstractAxis> |
|
36 | 36 | #include <private/abstractchartlayout_p.h> |
|
37 | 37 | #include <private/charttheme_p.h> |
|
38 | 38 | #include <private/chartpresenter_p.h> |
|
39 | 39 | #include <private/chartdataset_p.h> |
|
40 | 40 | #include <QtWidgets/QGraphicsScene> |
|
41 | 41 | #include <QGraphicsSceneResizeEvent> |
|
42 | 42 | |
|
43 | 43 | QT_CHARTS_BEGIN_NAMESPACE |
|
44 | 44 | |
|
45 | 45 | /*! |
|
46 | 46 | \enum QChart::ChartTheme |
|
47 | 47 | |
|
48 | 48 | This enum describes the theme used by the chart. |
|
49 | 49 | |
|
50 | 50 | \value ChartThemeLight The default theme |
|
51 | 51 | \value ChartThemeBlueCerulean |
|
52 | 52 | \value ChartThemeDark |
|
53 | 53 | \value ChartThemeBrownSand |
|
54 | 54 | \value ChartThemeBlueNcs |
|
55 | 55 | \value ChartThemeHighContrast |
|
56 | 56 | \value ChartThemeBlueIcy |
|
57 | 57 | \value ChartThemeQt |
|
58 | 58 | */ |
|
59 | 59 | |
|
60 | 60 | /*! |
|
61 | 61 | \enum QChart::AnimationOption |
|
62 | 62 | |
|
63 | 63 | For enabling/disabling animations. Defaults to NoAnimation. |
|
64 | 64 | |
|
65 | 65 | \value NoAnimation |
|
66 | 66 | \value GridAxisAnimations |
|
67 | 67 | \value SeriesAnimations |
|
68 | 68 | \value AllAnimations |
|
69 | 69 | */ |
|
70 | 70 | |
|
71 | 71 | /*! |
|
72 | 72 | \enum QChart::ChartType |
|
73 | 73 | |
|
74 | 74 | This enum describes the chart type. |
|
75 | 75 | |
|
76 | 76 | \value ChartTypeUndefined |
|
77 | 77 | \value ChartTypeCartesian |
|
78 | 78 | \value ChartTypePolar |
|
79 | 79 | */ |
|
80 | 80 | |
|
81 | 81 | /*! |
|
82 | 82 | \class QChart |
|
83 | 83 | \inmodule Qt Charts |
|
84 | 84 | \brief Main chart API for Qt Charts. |
|
85 | 85 | |
|
86 | 86 | QChart is a QGraphicsWidget that you can show in a QGraphicsScene. It manages the graphical |
|
87 | 87 | representation of different types of series and other chart related objects like legend and |
|
88 | 88 | axes. If you simply want to show a chart in a layout, you can use the |
|
89 | 89 | convenience class QChartView instead of QChart. |
|
90 | 90 | \sa QChartView, QPolarChart |
|
91 | 91 | */ |
|
92 | 92 | |
|
93 | 93 | /*! |
|
94 | 94 | \property QChart::animationOptions |
|
95 | 95 | The animation \a options for the chart. Animations are enabled/disabled based on this setting. |
|
96 | 96 | */ |
|
97 | 97 | |
|
98 | 98 | /*! |
|
99 | 99 | \property QChart::animationDuration |
|
100 | 100 | The duration of the animation for the chart. |
|
101 | 101 | */ |
|
102 | 102 | |
|
103 | 103 | /*! |
|
104 | 104 | \property QChart::animationEasingCurve |
|
105 | 105 | The easing curve of the animation for the chart. |
|
106 | 106 | */ |
|
107 | 107 | |
|
108 | 108 | /*! |
|
109 | 109 | \property QChart::backgroundVisible |
|
110 | 110 | Specifies whether the chart background is visible or not. |
|
111 | 111 | \sa setBackgroundBrush(), setBackgroundPen(), plotAreaBackgroundVisible |
|
112 | 112 | */ |
|
113 | 113 | |
|
114 | 114 | /*! |
|
115 | 115 | \property QChart::dropShadowEnabled |
|
116 | 116 | If set to true, the background drop shadow effect is enabled. If set to false, it is disabled. Note that the drop |
|
117 | 117 | shadow effect depends on theme, which means the setting may be changed if you switch to another theme. |
|
118 | 118 | */ |
|
119 | 119 | |
|
120 | 120 | /*! |
|
121 | 121 | \property QChart::backgroundRoundness |
|
122 | 122 | The diameter of the rounding circle at the corners of the chart background. |
|
123 | 123 | */ |
|
124 | 124 | |
|
125 | 125 | /*! |
|
126 | 126 | \property QChart::margins |
|
127 | 127 | Margins between the plot area (axes) and the edge of the chart widget. |
|
128 | 128 | */ |
|
129 | 129 | |
|
130 | 130 | /*! |
|
131 | 131 | \property QChart::theme |
|
132 | 132 | Theme is a built-in collection of UI style related settings applied for all visual elements of a chart, like colors, |
|
133 | 133 | pens, brushes, and fonts of series, axes, title, and legend. \l {Chart themes example} shows an example with a few |
|
134 | 134 | different themes. |
|
135 | 135 | \note Changing the theme will overwrite all customizations previously applied to the series. |
|
136 | 136 | */ |
|
137 | 137 | |
|
138 | 138 | /*! |
|
139 | 139 | \property QChart::title |
|
140 | 140 | Title is the name (label) of a chart. It is shown as a headline on top of the chart. Chart title supports html formatting. |
|
141 | 141 | */ |
|
142 | 142 | |
|
143 | 143 | /*! |
|
144 | 144 | \property QChart::chartType |
|
145 | 145 | Chart type indicates if the chart is a cartesian chart or a polar chart. |
|
146 | 146 | This property is set internally and it is read only. |
|
147 | 147 | \sa QPolarChart |
|
148 | 148 | */ |
|
149 | 149 | |
|
150 | 150 | /*! |
|
151 | 151 | \property QChart::plotAreaBackgroundVisible |
|
152 | 152 | Specifies whether the chart plot area background is visible or not. |
|
153 | 153 | \note By default the plot area background is not visible and the plot area uses |
|
154 | 154 | the general chart background. |
|
155 | 155 | \sa setPlotAreaBackgroundBrush(), setPlotAreaBackgroundPen(), backgroundVisible |
|
156 | 156 | */ |
|
157 | 157 | |
|
158 | 158 | /*! |
|
159 | 159 | \property QChart::localizeNumbers |
|
160 | 160 | \since QtCharts 2.0 |
|
161 | 161 | When \c{true}, all generated numbers appearing in various series and axis labels will be |
|
162 | 162 | localized using the QLocale set with the locale property. |
|
163 | 163 | When \c{false}, the "C" locale is always used. |
|
164 | 164 | Defaults to \c{false}. |
|
165 | 165 | \note This property doesn't affect QDateTimeAxis labels, which always use the QLocale set with |
|
166 | 166 | the locale property. |
|
167 | 167 | |
|
168 | 168 | \sa locale |
|
169 | 169 | */ |
|
170 | 170 | |
|
171 | 171 | /*! |
|
172 | 172 | \property QChart::locale |
|
173 | 173 | \since QtCharts 2.0 |
|
174 | 174 | Sets the locale used to format various chart labels when localizeNumbers is \c{true}. |
|
175 | 175 | This also determines the locale used to format QDateTimeAxis labels regardless of |
|
176 | 176 | localizeNumbers property. |
|
177 | 177 | Defaults to application default locale at the time the chart is constructed. |
|
178 | 178 | |
|
179 | 179 | \sa localizeNumbers |
|
180 | 180 | */ |
|
181 | 181 | |
|
182 | 182 | /*! |
|
183 | 183 | \property QChart::plotArea |
|
184 | 184 | Holds the rectangle within which the drawing of the chart is done. |
|
185 | 185 | It does not include the area defined by margins. |
|
186 | 186 | */ |
|
187 | 187 | |
|
188 | 188 | /*! |
|
189 | 189 | \internal |
|
190 | 190 | Constructs a chart object of \a type which is a child of a \a parent. |
|
191 | 191 | Parameter \a wFlags is passed to the QGraphicsWidget constructor. |
|
192 | 192 | This constructor is called only by subclasses. |
|
193 | 193 | */ |
|
194 | 194 | QChart::QChart(QChart::ChartType type, QGraphicsItem *parent, Qt::WindowFlags wFlags) |
|
195 | 195 | : QGraphicsWidget(parent, wFlags), |
|
196 | 196 | d_ptr(new QChartPrivate(this, type)) |
|
197 | 197 | { |
|
198 | 198 | d_ptr->init(); |
|
199 | 199 | } |
|
200 | 200 | |
|
201 | 201 | /*! |
|
202 | 202 | Constructs a chart object which is a child of a \a parent. |
|
203 | 203 | Parameter \a wFlags is passed to the QGraphicsWidget constructor. |
|
204 | 204 | */ |
|
205 | 205 | QChart::QChart(QGraphicsItem *parent, Qt::WindowFlags wFlags) |
|
206 | 206 | : QGraphicsWidget(parent, wFlags), |
|
207 | 207 | d_ptr(new QChartPrivate(this, ChartTypeCartesian)) |
|
208 | 208 | { |
|
209 | 209 | d_ptr->init(); |
|
210 | 210 | } |
|
211 | 211 | |
|
212 | 212 | /*! |
|
213 | 213 | Destroys the chart object and its children, like series and axis objects added to it. |
|
214 | 214 | */ |
|
215 | 215 | QChart::~QChart() |
|
216 | 216 | { |
|
217 | 217 | //start by deleting dataset, it will remove all series and axes |
|
218 | 218 | delete d_ptr->m_dataset; |
|
219 | 219 | d_ptr->m_dataset = 0; |
|
220 | 220 | } |
|
221 | 221 | |
|
222 | 222 | /*! |
|
223 | 223 | Adds the \a series onto the chart and takes the ownership of it. |
|
224 | 224 | |
|
225 | 225 | \note A newly added series is attached to no axes by default, including any axes that were created for the chart |
|
226 | 226 | using createDefaultAxes() before the series was added to the chart. If no axes are attached to |
|
227 | 227 | the newly added series before the chart is shown, the series will get drawn as if it had axes with ranges |
|
228 | 228 | that exactly fit the series to the plot area of the chart. This can be confusing if the same chart also displays other |
|
229 | 229 | series that have properly attached axes, so always make sure you either call createDefaultAxes() after |
|
230 | 230 | a series has been added or explicitly attach axes for the series. |
|
231 | 231 | |
|
232 | 232 | \sa removeSeries(), removeAllSeries(), createDefaultAxes(), QAbstractSeries::attachAxis() |
|
233 | 233 | */ |
|
234 | 234 | void QChart::addSeries(QAbstractSeries *series) |
|
235 | 235 | { |
|
236 | 236 | Q_ASSERT(series); |
|
237 | 237 | d_ptr->m_dataset->addSeries(series); |
|
238 | 238 | } |
|
239 | 239 | |
|
240 | 240 | /*! |
|
241 | 241 | Removes the \a series from the chart. |
|
242 | 242 | The chart releases its ownership of the specified \a series object. |
|
243 | 243 | |
|
244 | 244 | \sa addSeries(), removeAllSeries() |
|
245 | 245 | */ |
|
246 | 246 | void QChart::removeSeries(QAbstractSeries *series) |
|
247 | 247 | { |
|
248 | 248 | Q_ASSERT(series); |
|
249 | 249 | d_ptr->m_dataset->removeSeries(series); |
|
250 | 250 | } |
|
251 | 251 | |
|
252 | 252 | /*! |
|
253 | 253 | Removes and deletes all series objects that have been added to the chart. |
|
254 | 254 | |
|
255 | 255 | \sa addSeries(), removeSeries() |
|
256 | 256 | */ |
|
257 | 257 | void QChart::removeAllSeries() |
|
258 | 258 | { |
|
259 | 259 | foreach (QAbstractSeries *s , d_ptr->m_dataset->series()){ |
|
260 | 260 | removeSeries(s); |
|
261 | 261 | delete s; |
|
262 | 262 | } |
|
263 | 263 | } |
|
264 | 264 | |
|
265 | 265 | /*! |
|
266 | 266 | Sets the \a brush that is used for painting the background of the chart area. |
|
267 | 267 | */ |
|
268 | 268 | void QChart::setBackgroundBrush(const QBrush &brush) |
|
269 | 269 | { |
|
270 | 270 | d_ptr->m_presenter->setBackgroundBrush(brush); |
|
271 | 271 | } |
|
272 | 272 | |
|
273 | 273 | /*! |
|
274 | 274 | Gets the brush that is used for painting the background of the chart area. |
|
275 | 275 | */ |
|
276 | 276 | QBrush QChart::backgroundBrush() const |
|
277 | 277 | { |
|
278 | 278 | return d_ptr->m_presenter->backgroundBrush(); |
|
279 | 279 | } |
|
280 | 280 | |
|
281 | 281 | /*! |
|
282 | 282 | Sets the \a pen that is used for painting the background of the chart area. |
|
283 | 283 | */ |
|
284 | 284 | void QChart::setBackgroundPen(const QPen &pen) |
|
285 | 285 | { |
|
286 | 286 | d_ptr->m_presenter->setBackgroundPen(pen); |
|
287 | 287 | } |
|
288 | 288 | |
|
289 | 289 | /*! |
|
290 | 290 | Gets the pen that is used for painting the background of the chart area. |
|
291 | 291 | */ |
|
292 | 292 | QPen QChart::backgroundPen() const |
|
293 | 293 | { |
|
294 | 294 | return d_ptr->m_presenter->backgroundPen(); |
|
295 | 295 | } |
|
296 | 296 | |
|
297 | 297 | void QChart::setTitle(const QString &title) |
|
298 | 298 | { |
|
299 | 299 | d_ptr->m_presenter->setTitle(title); |
|
300 | 300 | } |
|
301 | 301 | |
|
302 | 302 | QString QChart::title() const |
|
303 | 303 | { |
|
304 | 304 | return d_ptr->m_presenter->title(); |
|
305 | 305 | } |
|
306 | 306 | |
|
307 | 307 | /*! |
|
308 | 308 | Sets the \a font that is used for drawing the chart title. |
|
309 | 309 | */ |
|
310 | 310 | void QChart::setTitleFont(const QFont &font) |
|
311 | 311 | { |
|
312 | 312 | d_ptr->m_presenter->setTitleFont(font); |
|
313 | 313 | } |
|
314 | 314 | |
|
315 | 315 | /*! |
|
316 | 316 | Gets the font that is used for drawing the chart title. |
|
317 | 317 | */ |
|
318 | 318 | QFont QChart::titleFont() const |
|
319 | 319 | { |
|
320 | 320 | return d_ptr->m_presenter->titleFont(); |
|
321 | 321 | } |
|
322 | 322 | |
|
323 | 323 | /*! |
|
324 | 324 | Sets the \a brush used for drawing the title text. |
|
325 | 325 | */ |
|
326 | 326 | void QChart::setTitleBrush(const QBrush &brush) |
|
327 | 327 | { |
|
328 | 328 | d_ptr->m_presenter->setTitleBrush(brush); |
|
329 | 329 | } |
|
330 | 330 | |
|
331 | 331 | /*! |
|
332 | 332 | Returns the brush used for drawing the title text. |
|
333 | 333 | */ |
|
334 | 334 | QBrush QChart::titleBrush() const |
|
335 | 335 | { |
|
336 | 336 | return d_ptr->m_presenter->titleBrush(); |
|
337 | 337 | } |
|
338 | 338 | |
|
339 | 339 | void QChart::setTheme(QChart::ChartTheme theme) |
|
340 | 340 | { |
|
341 | 341 | d_ptr->m_themeManager->setTheme(theme); |
|
342 | 342 | } |
|
343 | 343 | |
|
344 | 344 | QChart::ChartTheme QChart::theme() const |
|
345 | 345 | { |
|
346 | 346 | return d_ptr->m_themeManager->theme()->id(); |
|
347 | 347 | } |
|
348 | 348 | |
|
349 | 349 | /*! |
|
350 | 350 | Zooms in the view by a factor of two. |
|
351 | 351 | */ |
|
352 | 352 | void QChart::zoomIn() |
|
353 | 353 | { |
|
354 | 354 | d_ptr->zoomIn(2.0); |
|
355 | 355 | } |
|
356 | 356 | |
|
357 | void QChart::zoomIn2(double factor) | |
|
357 | void QChart::zoomIn2(double factor, Qt::Orientation orientation) | |
|
358 | 358 | { |
|
359 | d_ptr->zoomIn2(factor); | |
|
359 | d_ptr->zoomIn2(factor, orientation); | |
|
360 | 360 | } |
|
361 | 361 | |
|
362 | 362 | /*! |
|
363 | 363 | Zooms in the view to a maximum level at which \a rect is still fully visible. |
|
364 | 364 | \note This is not supported for polar charts. |
|
365 | 365 | */ |
|
366 | 366 | void QChart::zoomIn(const QRectF &rect) |
|
367 | 367 | { |
|
368 | 368 | if (d_ptr->m_type == QChart::ChartTypePolar) |
|
369 | 369 | return; |
|
370 | 370 | d_ptr->zoomIn(rect); |
|
371 | 371 | } |
|
372 | 372 | |
|
373 | 373 | /*! |
|
374 | 374 | Zooms out the view by a factor of two. |
|
375 | 375 | */ |
|
376 | 376 | void QChart::zoomOut() |
|
377 | 377 | { |
|
378 | 378 | d_ptr->zoomOut(2.0); |
|
379 | 379 | } |
|
380 | 380 | |
|
381 | void QChart::zoomOut2(double factor) | |
|
381 | void QChart::zoomOut2(double factor, Qt::Orientation orientation) | |
|
382 | 382 | { |
|
383 | d_ptr->zoomOut2(factor); | |
|
383 | d_ptr->zoomOut2(factor, orientation); | |
|
384 | 384 | } |
|
385 | 385 | |
|
386 | 386 | /*! |
|
387 | 387 | Zooms in the view by a custom \a factor. |
|
388 | 388 | |
|
389 | 389 | A factor over 1.0 zooms the view in and factor between 0.0 and 1.0 zooms out. |
|
390 | 390 | */ |
|
391 | 391 | void QChart::zoom(qreal factor) |
|
392 | 392 | { |
|
393 | 393 | if (qFuzzyCompare(factor, 0)) |
|
394 | 394 | return; |
|
395 | 395 | |
|
396 | 396 | if (qFuzzyCompare(factor, (qreal)1.0)) |
|
397 | 397 | return; |
|
398 | 398 | |
|
399 | 399 | if (factor < 0) |
|
400 | 400 | return; |
|
401 | 401 | |
|
402 | 402 | if (factor > 1.0) |
|
403 | 403 | d_ptr->zoomIn(factor); |
|
404 | 404 | else |
|
405 | 405 | d_ptr->zoomOut(1.0 / factor); |
|
406 | 406 | } |
|
407 | 407 | |
|
408 | 408 | |
|
409 | 409 | /*! |
|
410 | 410 | Resets the series domains to what they were before any zoom method was called. |
|
411 | 411 | Note that this will also reset any scrolls and explicit axis range settings done between |
|
412 | 412 | the first zoom operation and calling this method. If no zoom operation has been |
|
413 | 413 | done, this method does nothing. |
|
414 | 414 | */ |
|
415 | 415 | void QChart::zoomReset() |
|
416 | 416 | { |
|
417 | 417 | d_ptr->zoomReset(); |
|
418 | 418 | } |
|
419 | 419 | |
|
420 | 420 | /*! |
|
421 | 421 | Returns true if any series has a zoomed domain. |
|
422 | 422 | */ |
|
423 | 423 | bool QChart::isZoomed() |
|
424 | 424 | { |
|
425 | return d_ptr->isZoomed(); | |
|
425 | return d_ptr->isZoomed(); | |
|
426 | 426 | } |
|
427 | 427 | |
|
428 | 428 | /*! |
|
429 | 429 | Returns a pointer to the horizontal axis attached to the specified \a series. |
|
430 | 430 | If no \a series is specified, the first horizontal axis added to the chart is returned. |
|
431 | 431 | |
|
432 | 432 | \sa addAxis(), QAbstractSeries::attachAxis() |
|
433 | 433 | */ |
|
434 | 434 | QAbstractAxis *QChart::axisX(QAbstractSeries *series) const |
|
435 | 435 | { |
|
436 | 436 | QList<QAbstractAxis *> axisList = axes(Qt::Horizontal, series); |
|
437 | 437 | if (axisList.count()) |
|
438 | 438 | return axisList[0]; |
|
439 | 439 | return 0; |
|
440 | 440 | } |
|
441 | 441 | |
|
442 | 442 | /*! |
|
443 | 443 | Returns a pointer to the vertical axis attached to the specified \a series. |
|
444 | 444 | If no \a series is specified, the first vertical axis added to the chart is returned. |
|
445 | 445 | |
|
446 | 446 | \sa addAxis(), QAbstractSeries::attachAxis() |
|
447 | 447 | */ |
|
448 | 448 | QAbstractAxis *QChart::axisY(QAbstractSeries *series) const |
|
449 | 449 | { |
|
450 | 450 | QList<QAbstractAxis *> axisList = axes(Qt::Vertical, series); |
|
451 | 451 | if (axisList.count()) |
|
452 | 452 | return axisList[0]; |
|
453 | 453 | return 0; |
|
454 | 454 | } |
|
455 | 455 | |
|
456 | 456 | /*! |
|
457 | 457 | Returns the axes attached to the \a series with \a orientation. If no \a series is provided, |
|
458 | 458 | then all axes added to the chart with the specified orientation are returned. |
|
459 | 459 | \sa addAxis(), createDefaultAxes() |
|
460 | 460 | */ |
|
461 | 461 | QList<QAbstractAxis *> QChart::axes(Qt::Orientations orientation, QAbstractSeries *series) const |
|
462 | 462 | { |
|
463 | 463 | QList<QAbstractAxis *> result ; |
|
464 | 464 | |
|
465 | 465 | if (series) { |
|
466 | 466 | foreach (QAbstractAxis *axis, series->attachedAxes()){ |
|
467 | 467 | if (orientation.testFlag(axis->orientation())) |
|
468 | 468 | result << axis; |
|
469 | 469 | } |
|
470 | 470 | } else { |
|
471 | 471 | foreach (QAbstractAxis *axis, d_ptr->m_dataset->axes()){ |
|
472 | 472 | if (orientation.testFlag(axis->orientation()) && !result.contains(axis)) |
|
473 | 473 | result << axis; |
|
474 | 474 | } |
|
475 | 475 | } |
|
476 | 476 | |
|
477 | 477 | return result; |
|
478 | 478 | } |
|
479 | 479 | |
|
480 | 480 | /*! |
|
481 | 481 | Creates axes for the chart based on the series that have already been added to the chart. Any axes previously added to |
|
482 | 482 | the chart will be deleted. |
|
483 | 483 | |
|
484 | 484 | \note This function has to be called after all series have been added to the chart. The axes created by this function |
|
485 | 485 | will NOT get automatically attached to any series added to the chart after this function has been called. |
|
486 | 486 | A series with no axes attached will by default scale to utilize the entire plot area of the chart, which can be confusing |
|
487 | 487 | if there are other series with properly attached axes also present. |
|
488 | 488 | |
|
489 | 489 | \table |
|
490 | 490 | \header |
|
491 | 491 | \li Series type |
|
492 | 492 | \li X-axis |
|
493 | 493 | \li Y-axis |
|
494 | 494 | \row |
|
495 | 495 | \li QXYSeries |
|
496 | 496 | \li QValueAxis |
|
497 | 497 | \li QValueAxis |
|
498 | 498 | \row |
|
499 | 499 | \li QBarSeries |
|
500 | 500 | \li QBarCategoryAxis |
|
501 | 501 | \li QValueAxis |
|
502 | 502 | \row |
|
503 | 503 | \li QPieSeries |
|
504 | 504 | \li None |
|
505 | 505 | \li None |
|
506 | 506 | \endtable |
|
507 | 507 | |
|
508 | 508 | If there are several QXYSeries derived series added to the chart and no series of other types have been added, then only one pair of axes is created. |
|
509 | 509 | If there are several series of different types added to the chart, then each series gets its own axes pair. |
|
510 | 510 | |
|
511 | 511 | The axes specific to the series can be later obtained from the chart by providing the series as the parameter for axes() function call. |
|
512 | 512 | QPieSeries does not create any axes. |
|
513 | 513 | |
|
514 | 514 | \sa axisX(), axisY(), axes(), setAxisX(), setAxisY(), QAbstractSeries::attachAxis() |
|
515 | 515 | */ |
|
516 | 516 | void QChart::createDefaultAxes() |
|
517 | 517 | { |
|
518 | 518 | d_ptr->m_dataset->createDefaultAxes(); |
|
519 | 519 | } |
|
520 | 520 | |
|
521 | 521 | /*! |
|
522 | 522 | Returns the legend object of the chart. Ownership stays with the chart. |
|
523 | 523 | */ |
|
524 | 524 | QLegend *QChart::legend() const |
|
525 | 525 | { |
|
526 | 526 | return d_ptr->m_legend; |
|
527 | 527 | } |
|
528 | 528 | |
|
529 | 529 | void QChart::setMargins(const QMargins &margins) |
|
530 | 530 | { |
|
531 | 531 | d_ptr->m_presenter->layout()->setMargins(margins); |
|
532 | 532 | } |
|
533 | 533 | |
|
534 | 534 | QMargins QChart::margins() const |
|
535 | 535 | { |
|
536 | 536 | return d_ptr->m_presenter->layout()->margins(); |
|
537 | 537 | } |
|
538 | 538 | |
|
539 | 539 | QChart::ChartType QChart::chartType() const |
|
540 | 540 | { |
|
541 | 541 | return d_ptr->m_type; |
|
542 | 542 | } |
|
543 | 543 | |
|
544 | 544 | QRectF QChart::plotArea() const |
|
545 | 545 | { |
|
546 | 546 | return d_ptr->m_presenter->geometry(); |
|
547 | 547 | } |
|
548 | 548 | |
|
549 | 549 | /*! |
|
550 | 550 | Sets the \a brush for the background of the plot area of the chart. |
|
551 | 551 | |
|
552 | 552 | \sa plotArea(), plotAreaBackgroundVisible, setPlotAreaBackgroundPen(), plotAreaBackgroundBrush() |
|
553 | 553 | */ |
|
554 | 554 | void QChart::setPlotAreaBackgroundBrush(const QBrush &brush) |
|
555 | 555 | { |
|
556 | 556 | d_ptr->m_presenter->setPlotAreaBackgroundBrush(brush); |
|
557 | 557 | } |
|
558 | 558 | |
|
559 | 559 | /*! |
|
560 | 560 | Returns the brush for the background of the plot area of the chart. |
|
561 | 561 | |
|
562 | 562 | \sa plotArea(), plotAreaBackgroundVisible, plotAreaBackgroundPen(), setPlotAreaBackgroundBrush() |
|
563 | 563 | */ |
|
564 | 564 | QBrush QChart::plotAreaBackgroundBrush() const |
|
565 | 565 | { |
|
566 | 566 | return d_ptr->m_presenter->plotAreaBackgroundBrush(); |
|
567 | 567 | } |
|
568 | 568 | |
|
569 | 569 | /*! |
|
570 | 570 | Sets the \a pen for the background of the plot area of the chart. |
|
571 | 571 | |
|
572 | 572 | \sa plotArea(), plotAreaBackgroundVisible, setPlotAreaBackgroundBrush(), plotAreaBackgroundPen() |
|
573 | 573 | */ |
|
574 | 574 | void QChart::setPlotAreaBackgroundPen(const QPen &pen) |
|
575 | 575 | { |
|
576 | 576 | d_ptr->m_presenter->setPlotAreaBackgroundPen(pen); |
|
577 | 577 | } |
|
578 | 578 | |
|
579 | 579 | /*! |
|
580 | 580 | Returns the pen for the background of the plot area of the chart. |
|
581 | 581 | |
|
582 | 582 | \sa plotArea(), plotAreaBackgroundVisible, plotAreaBackgroundBrush(), setPlotAreaBackgroundPen() |
|
583 | 583 | */ |
|
584 | 584 | QPen QChart::plotAreaBackgroundPen() const |
|
585 | 585 | { |
|
586 | 586 | return d_ptr->m_presenter->plotAreaBackgroundPen(); |
|
587 | 587 | } |
|
588 | 588 | |
|
589 | 589 | void QChart::setPlotAreaBackgroundVisible(bool visible) |
|
590 | 590 | { |
|
591 | 591 | d_ptr->m_presenter->setPlotAreaBackgroundVisible(visible); |
|
592 | 592 | } |
|
593 | 593 | |
|
594 | 594 | bool QChart::isPlotAreaBackgroundVisible() const |
|
595 | 595 | { |
|
596 | 596 | return d_ptr->m_presenter->isPlotAreaBackgroundVisible(); |
|
597 | 597 | } |
|
598 | 598 | |
|
599 | 599 | void QChart::setLocalizeNumbers(bool localize) |
|
600 | 600 | { |
|
601 | 601 | d_ptr->m_presenter->setLocalizeNumbers(localize); |
|
602 | 602 | } |
|
603 | 603 | |
|
604 | 604 | bool QChart::localizeNumbers() const |
|
605 | 605 | { |
|
606 | 606 | return d_ptr->m_presenter->localizeNumbers(); |
|
607 | 607 | } |
|
608 | 608 | |
|
609 | 609 | void QChart::setLocale(const QLocale &locale) |
|
610 | 610 | { |
|
611 | 611 | d_ptr->m_presenter->setLocale(locale); |
|
612 | 612 | } |
|
613 | 613 | |
|
614 | 614 | QLocale QChart::locale() const |
|
615 | 615 | { |
|
616 | 616 | return d_ptr->m_presenter->locale(); |
|
617 | 617 | } |
|
618 | 618 | |
|
619 | 619 | void QChart::setAnimationOptions(AnimationOptions options) |
|
620 | 620 | { |
|
621 | 621 | d_ptr->m_presenter->setAnimationOptions(options); |
|
622 | 622 | } |
|
623 | 623 | |
|
624 | 624 | QChart::AnimationOptions QChart::animationOptions() const |
|
625 | 625 | { |
|
626 | 626 | return d_ptr->m_presenter->animationOptions(); |
|
627 | 627 | } |
|
628 | 628 | |
|
629 | 629 | void QChart::setAnimationDuration(int msecs) |
|
630 | 630 | { |
|
631 | 631 | d_ptr->m_presenter->setAnimationDuration(msecs); |
|
632 | 632 | } |
|
633 | 633 | |
|
634 | 634 | int QChart::animationDuration() const |
|
635 | 635 | { |
|
636 | 636 | return d_ptr->m_presenter->animationDuration(); |
|
637 | 637 | } |
|
638 | 638 | |
|
639 | 639 | void QChart::setAnimationEasingCurve(const QEasingCurve &curve) |
|
640 | 640 | { |
|
641 | 641 | d_ptr->m_presenter->setAnimationEasingCurve(curve); |
|
642 | 642 | } |
|
643 | 643 | |
|
644 | 644 | QEasingCurve QChart::animationEasingCurve() const |
|
645 | 645 | { |
|
646 | 646 | return d_ptr->m_presenter->animationEasingCurve(); |
|
647 | 647 | } |
|
648 | 648 | |
|
649 | 649 | /*! |
|
650 | 650 | Scrolls the visible area of the chart by the distance defined in the \a dx and \a dy. |
|
651 | 651 | |
|
652 | 652 | For polar charts, \a dx indicates the angle along angular axis instead of distance. |
|
653 | 653 | */ |
|
654 | 654 | void QChart::scroll(qreal dx, qreal dy) |
|
655 | 655 | { |
|
656 | 656 | d_ptr->scroll(dx,dy); |
|
657 | 657 | } |
|
658 | 658 | |
|
659 | 659 | void QChart::setBackgroundVisible(bool visible) |
|
660 | 660 | { |
|
661 | 661 | d_ptr->m_presenter->setBackgroundVisible(visible); |
|
662 | 662 | } |
|
663 | 663 | |
|
664 | 664 | bool QChart::isBackgroundVisible() const |
|
665 | 665 | { |
|
666 | 666 | return d_ptr->m_presenter->isBackgroundVisible(); |
|
667 | 667 | } |
|
668 | 668 | |
|
669 | 669 | void QChart::setDropShadowEnabled(bool enabled) |
|
670 | 670 | { |
|
671 | 671 | d_ptr->m_presenter->setBackgroundDropShadowEnabled(enabled); |
|
672 | 672 | } |
|
673 | 673 | |
|
674 | 674 | bool QChart::isDropShadowEnabled() const |
|
675 | 675 | { |
|
676 | 676 | return d_ptr->m_presenter->isBackgroundDropShadowEnabled(); |
|
677 | 677 | } |
|
678 | 678 | |
|
679 | 679 | void QChart::setBackgroundRoundness(qreal diameter) |
|
680 | 680 | { |
|
681 | 681 | d_ptr->m_presenter->setBackgroundRoundness(diameter); |
|
682 | 682 | } |
|
683 | 683 | |
|
684 | 684 | qreal QChart::backgroundRoundness() const |
|
685 | 685 | { |
|
686 | 686 | return d_ptr->m_presenter->backgroundRoundness(); |
|
687 | 687 | } |
|
688 | 688 | |
|
689 | 689 | /*! |
|
690 | 690 | Returns all series that are added to the chart. |
|
691 | 691 | |
|
692 | 692 | \sa addSeries(), removeSeries(), removeAllSeries() |
|
693 | 693 | */ |
|
694 | 694 | QList<QAbstractSeries *> QChart::series() const |
|
695 | 695 | { |
|
696 | 696 | return d_ptr->m_dataset->series(); |
|
697 | 697 | } |
|
698 | 698 | |
|
699 | 699 | /*! |
|
700 | 700 | Adds the \a axis to the chart and attaches it to the \a series as a bottom-aligned horizontal axis. |
|
701 | 701 | The chart takes ownership of both the \a axis and the \a series. |
|
702 | 702 | Any horizontal axes previously attached to the \a series are deleted. |
|
703 | 703 | |
|
704 | 704 | \sa axisX(), axisY(), setAxisY(), createDefaultAxes(), QAbstractSeries::attachAxis() |
|
705 | 705 | */ |
|
706 | 706 | void QChart::setAxisX(QAbstractAxis *axis ,QAbstractSeries *series) |
|
707 | 707 | { |
|
708 | 708 | QList<QAbstractAxis*> list = axes(Qt::Horizontal, series); |
|
709 | 709 | |
|
710 | 710 | foreach (QAbstractAxis* a, list) { |
|
711 | 711 | d_ptr->m_dataset->removeAxis(a); |
|
712 | 712 | delete a; |
|
713 | 713 | } |
|
714 | 714 | |
|
715 | 715 | if (!d_ptr->m_dataset->axes().contains(axis)) |
|
716 | 716 | d_ptr->m_dataset->addAxis(axis, Qt::AlignBottom); |
|
717 | 717 | d_ptr->m_dataset->attachAxis(series, axis); |
|
718 | 718 | } |
|
719 | 719 | |
|
720 | 720 | /*! |
|
721 | 721 | Adds the \a axis to the chart and attaches it to the \a series as a left-aligned vertical axis. |
|
722 | 722 | The chart takes ownership of both the \a axis and the \a series. |
|
723 | 723 | Any vertical axes previously attached to the \a series are deleted. |
|
724 | 724 | |
|
725 | 725 | \sa axisX(), axisY(), setAxisX(), createDefaultAxes(), QAbstractSeries::attachAxis() |
|
726 | 726 | */ |
|
727 | 727 | void QChart::setAxisY(QAbstractAxis *axis ,QAbstractSeries *series) |
|
728 | 728 | { |
|
729 | 729 | QList<QAbstractAxis*> list = axes(Qt::Vertical, series); |
|
730 | 730 | |
|
731 | 731 | foreach (QAbstractAxis* a, list) { |
|
732 | 732 | d_ptr->m_dataset->removeAxis(a); |
|
733 | 733 | delete a; |
|
734 | 734 | } |
|
735 | 735 | |
|
736 | 736 | if (!d_ptr->m_dataset->axes().contains(axis)) |
|
737 | 737 | d_ptr->m_dataset->addAxis(axis, Qt::AlignLeft); |
|
738 | 738 | d_ptr->m_dataset->attachAxis(series, axis); |
|
739 | 739 | } |
|
740 | 740 | |
|
741 | 741 | /*! |
|
742 | 742 | Adds the \a axis to the chart with \a alignment. The chart takes the ownership of the axis. |
|
743 | 743 | |
|
744 | 744 | \sa removeAxis(), createDefaultAxes(), QAbstractSeries::attachAxis() |
|
745 | 745 | */ |
|
746 | 746 | void QChart::addAxis(QAbstractAxis *axis, Qt::Alignment alignment) |
|
747 | 747 | { |
|
748 | 748 | d_ptr->m_dataset->addAxis(axis, alignment); |
|
749 | 749 | } |
|
750 | 750 | |
|
751 | 751 | /*! |
|
752 | 752 | Removes the \a axis from the chart. |
|
753 | 753 | The chart releases its ownership of the specified \a axis object. |
|
754 | 754 | |
|
755 | 755 | \sa addAxis(), createDefaultAxes(), QAbstractSeries::detachAxis() |
|
756 | 756 | */ |
|
757 | 757 | void QChart::removeAxis(QAbstractAxis *axis) |
|
758 | 758 | { |
|
759 | 759 | d_ptr->m_dataset->removeAxis(axis); |
|
760 | 760 | } |
|
761 | 761 | |
|
762 | 762 | /*! |
|
763 | 763 | Returns the value in the \a series domain that corresponds to the \a position relative to chart widget. |
|
764 | 764 | */ |
|
765 | 765 | QPointF QChart::mapToValue(const QPointF &position, QAbstractSeries *series) |
|
766 | 766 | { |
|
767 | 767 | return d_ptr->m_dataset->mapToValue(position, series); |
|
768 | 768 | } |
|
769 | 769 | |
|
770 | 770 | /*! |
|
771 | 771 | Returns the position on the chart widget that corresponds to the \a value in the \a series domain. |
|
772 | 772 | */ |
|
773 | 773 | QPointF QChart::mapToPosition(const QPointF &value, QAbstractSeries *series) |
|
774 | 774 | { |
|
775 | 775 | return d_ptr->m_dataset->mapToPosition(value, series); |
|
776 | 776 | } |
|
777 | 777 | |
|
778 | 778 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
779 | 779 | |
|
780 | 780 | QChartPrivate::QChartPrivate(QChart *q, QChart::ChartType type): |
|
781 | 781 | q_ptr(q), |
|
782 | 782 | m_legend(0), |
|
783 | 783 | m_dataset(new ChartDataSet(q)), |
|
784 | 784 | m_presenter(new ChartPresenter(q, type)), |
|
785 | 785 | m_themeManager(new ChartThemeManager(q)), |
|
786 | 786 | m_type(type) |
|
787 | 787 | { |
|
788 | 788 | QObject::connect(m_dataset, SIGNAL(seriesAdded(QAbstractSeries*)), m_presenter, SLOT(handleSeriesAdded(QAbstractSeries*))); |
|
789 | 789 | QObject::connect(m_dataset, SIGNAL(seriesRemoved(QAbstractSeries*)), m_presenter, SLOT(handleSeriesRemoved(QAbstractSeries*))); |
|
790 | 790 | QObject::connect(m_dataset, SIGNAL(axisAdded(QAbstractAxis*)), m_presenter, SLOT(handleAxisAdded(QAbstractAxis*))); |
|
791 | 791 | QObject::connect(m_dataset, SIGNAL(axisRemoved(QAbstractAxis*)), m_presenter, SLOT(handleAxisRemoved(QAbstractAxis*))); |
|
792 | 792 | QObject::connect(m_dataset, SIGNAL(seriesAdded(QAbstractSeries*)), m_themeManager, SLOT(handleSeriesAdded(QAbstractSeries*))); |
|
793 | 793 | QObject::connect(m_dataset, SIGNAL(seriesRemoved(QAbstractSeries*)), m_themeManager, SLOT(handleSeriesRemoved(QAbstractSeries*))); |
|
794 | 794 | QObject::connect(m_dataset, SIGNAL(axisAdded(QAbstractAxis*)), m_themeManager, SLOT(handleAxisAdded(QAbstractAxis*))); |
|
795 | 795 | QObject::connect(m_dataset, SIGNAL(axisRemoved(QAbstractAxis*)), m_themeManager, SLOT(handleAxisRemoved(QAbstractAxis*))); |
|
796 | 796 | QObject::connect(m_presenter, &ChartPresenter::plotAreaChanged, q, &QChart::plotAreaChanged); |
|
797 | 797 | } |
|
798 | 798 | |
|
799 | 799 | QChartPrivate::~QChartPrivate() |
|
800 | 800 | { |
|
801 | 801 | delete m_themeManager; |
|
802 | 802 | } |
|
803 | 803 | |
|
804 | 804 | // Hackish solution to the problem of explicitly assigning the default pen/brush/font |
|
805 | 805 | // to a series or axis and having theme override it: |
|
806 | 806 | // Initialize pens, brushes, and fonts to something nobody is likely to ever use, |
|
807 | 807 | // so that default theme initialization will always set these properly. |
|
808 | 808 | QPen &QChartPrivate::defaultPen() |
|
809 | 809 | { |
|
810 | 810 | static QPen defaultPen(QColor(1, 2, 0), 0.93247536); |
|
811 | 811 | return defaultPen; |
|
812 | 812 | } |
|
813 | 813 | |
|
814 | 814 | QBrush &QChartPrivate::defaultBrush() |
|
815 | 815 | { |
|
816 | 816 | static QBrush defaultBrush(QColor(1, 2, 0), Qt::Dense7Pattern); |
|
817 | 817 | return defaultBrush; |
|
818 | 818 | } |
|
819 | 819 | |
|
820 | 820 | QFont &QChartPrivate::defaultFont() |
|
821 | 821 | { |
|
822 | 822 | static bool defaultFontInitialized(false); |
|
823 | 823 | static QFont defaultFont; |
|
824 | 824 | if (!defaultFontInitialized) { |
|
825 | 825 | defaultFont.setPointSizeF(8.34563465); |
|
826 | 826 | defaultFontInitialized = true; |
|
827 | 827 | } |
|
828 | 828 | return defaultFont; |
|
829 | 829 | } |
|
830 | 830 | |
|
831 | 831 | void QChartPrivate::init() |
|
832 | 832 | { |
|
833 | 833 | m_legend = new LegendScroller(q_ptr); |
|
834 | 834 | q_ptr->setTheme(QChart::ChartThemeLight); |
|
835 | 835 | q_ptr->setLayout(m_presenter->layout()); |
|
836 | 836 | } |
|
837 | 837 | |
|
838 | 838 | void QChartPrivate::zoomIn(qreal factor) |
|
839 | 839 | { |
|
840 | 840 | QRectF rect = m_presenter->geometry(); |
|
841 | 841 | rect.setWidth(rect.width() / factor); |
|
842 | 842 | rect.setHeight(rect.height() / factor); |
|
843 | 843 | rect.moveCenter(m_presenter->geometry().center()); |
|
844 | 844 | zoomIn(rect); |
|
845 | 845 | } |
|
846 | 846 | |
|
847 | void QChartPrivate::zoomIn2(qreal factor) | |
|
847 | void QChartPrivate::zoomIn2(qreal factor, Qt::Orientation orientation) | |
|
848 | 848 | { |
|
849 | 849 | QRectF rect = m_presenter->geometry(); |
|
850 | rect.setWidth(rect.width() / factor); | |
|
850 | if(orientation == Qt::Vertical) | |
|
851 | rect.setHeight(rect.height() / factor); | |
|
852 | else | |
|
853 | rect.setWidth(rect.width() / factor); | |
|
851 | 854 | rect.moveCenter(m_presenter->geometry().center()); |
|
852 | 855 | zoomIn(rect); |
|
853 | 856 | } |
|
854 | 857 | |
|
855 | 858 | void QChartPrivate::zoomIn(const QRectF &rect) |
|
856 | 859 | { |
|
857 | 860 | if (!rect.isValid()) |
|
858 | 861 | return; |
|
859 | 862 | |
|
860 | 863 | QRectF r = rect.normalized(); |
|
861 | 864 | const QRectF geometry = m_presenter->geometry(); |
|
862 | 865 | r.translate(-geometry.topLeft()); |
|
863 | 866 | |
|
864 | 867 | if (!r.isValid()) |
|
865 | 868 | return; |
|
866 | 869 | |
|
867 | 870 | QPointF zoomPoint(r.center().x() / geometry.width(), r.center().y() / geometry.height()); |
|
868 | 871 | m_presenter->setState(ChartPresenter::ZoomInState,zoomPoint); |
|
869 | 872 | m_dataset->zoomInDomain(r); |
|
870 | 873 | m_presenter->setState(ChartPresenter::ShowState,QPointF()); |
|
871 | 874 | |
|
872 | 875 | } |
|
873 | 876 | |
|
874 | 877 | void QChartPrivate::zoomReset() |
|
875 | 878 | { |
|
876 | 879 | m_dataset->zoomResetDomain(); |
|
877 | 880 | } |
|
878 | 881 | |
|
879 | 882 | bool QChartPrivate::isZoomed() |
|
880 | 883 | { |
|
881 | 884 | return m_dataset->isZoomedDomain(); |
|
882 | 885 | } |
|
883 | 886 | |
|
884 | 887 | void QChartPrivate::zoomOut(qreal factor) |
|
885 | 888 | { |
|
886 | 889 | const QRectF geometry = m_presenter->geometry(); |
|
887 | 890 | |
|
888 | 891 | QRectF r; |
|
889 | 892 | r.setSize(geometry.size() / factor); |
|
890 | 893 | r.moveCenter(QPointF(geometry.size().width()/2 ,geometry.size().height()/2)); |
|
891 | 894 | if (!r.isValid()) |
|
892 | 895 | return; |
|
893 | 896 | |
|
894 | 897 | QPointF zoomPoint(r.center().x() / geometry.width(), r.center().y() / geometry.height()); |
|
895 | 898 | m_presenter->setState(ChartPresenter::ZoomOutState,zoomPoint); |
|
896 | 899 | m_dataset->zoomOutDomain(r); |
|
897 | 900 | m_presenter->setState(ChartPresenter::ShowState,QPointF()); |
|
898 | 901 | } |
|
899 | 902 | |
|
900 | void QChartPrivate::zoomOut2(qreal factor) | |
|
903 | void QChartPrivate::zoomOut2(qreal factor, Qt::Orientation orientation) | |
|
901 | 904 | { |
|
902 | 905 | const QRectF geometry = m_presenter->geometry(); |
|
903 | 906 | |
|
904 | 907 | QRectF r; |
|
905 | 908 | QSizeF size = geometry.size(); |
|
906 | size.setWidth(size.width()/factor); | |
|
909 | if(orientation == Qt::Vertical) | |
|
910 | size.setHeight(size.height()/factor); | |
|
911 | else | |
|
912 | size.setWidth(size.width()/factor); | |
|
907 | 913 | r.setSize(size); |
|
908 | 914 | r.moveCenter(QPointF(geometry.size().width()/2 ,geometry.size().height()/2)); |
|
909 | 915 | if (!r.isValid()) |
|
910 | 916 | return; |
|
911 | 917 | |
|
912 | 918 | QPointF zoomPoint(r.center().x() / geometry.width(), r.center().y() / geometry.height()); |
|
913 | 919 | m_presenter->setState(ChartPresenter::ZoomOutState,zoomPoint); |
|
914 | 920 | m_dataset->zoomOutDomain(r); |
|
915 | 921 | m_presenter->setState(ChartPresenter::ShowState,QPointF()); |
|
916 | 922 | } |
|
917 | 923 | |
|
918 | 924 | void QChartPrivate::scroll(qreal dx, qreal dy) |
|
919 | 925 | { |
|
920 | 926 | if (dx < 0) m_presenter->setState(ChartPresenter::ScrollLeftState,QPointF()); |
|
921 | 927 | if (dx > 0) m_presenter->setState(ChartPresenter::ScrollRightState,QPointF()); |
|
922 | 928 | if (dy < 0) m_presenter->setState(ChartPresenter::ScrollUpState,QPointF()); |
|
923 | 929 | if (dy > 0) m_presenter->setState(ChartPresenter::ScrollDownState,QPointF()); |
|
924 | 930 | |
|
925 | 931 | m_dataset->scrollDomain(dx, dy); |
|
926 | 932 | m_presenter->setState(ChartPresenter::ShowState,QPointF()); |
|
927 | 933 | } |
|
928 | 934 | |
|
929 | 935 | #include "moc_qchart.cpp" |
|
930 | 936 | |
|
931 | 937 | QT_CHARTS_END_NAMESPACE |
@@ -1,205 +1,205 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2016 The Qt Company Ltd. |
|
4 | 4 | ** Contact: https://www.qt.io/licensing/ |
|
5 | 5 | ** |
|
6 | 6 | ** This file is part of the Qt Charts module of the Qt Toolkit. |
|
7 | 7 | ** |
|
8 | 8 | ** $QT_BEGIN_LICENSE:GPL$ |
|
9 | 9 | ** Commercial License Usage |
|
10 | 10 | ** Licensees holding valid commercial Qt licenses may use this file in |
|
11 | 11 | ** accordance with the commercial license agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and The Qt Company. For licensing terms |
|
14 | 14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
|
15 | 15 | ** information use the contact form at https://www.qt.io/contact-us. |
|
16 | 16 | ** |
|
17 | 17 | ** GNU General Public License Usage |
|
18 | 18 | ** Alternatively, this file may be used under the terms of the GNU |
|
19 | 19 | ** General Public License version 3 or (at your option) any later version |
|
20 | 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by |
|
21 | 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 |
|
22 | 22 | ** included in the packaging of this file. Please review the following |
|
23 | 23 | ** information to ensure the GNU General Public License requirements will |
|
24 | 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. |
|
25 | 25 | ** |
|
26 | 26 | ** $QT_END_LICENSE$ |
|
27 | 27 | ** |
|
28 | 28 | ****************************************************************************/ |
|
29 | 29 | |
|
30 | 30 | #ifndef QCHART_H |
|
31 | 31 | #define QCHART_H |
|
32 | 32 | |
|
33 | 33 | #include <QtCharts/QAbstractSeries> |
|
34 | 34 | #include <QtCharts/QLegend> |
|
35 | 35 | #include <QtWidgets/QGraphicsWidget> |
|
36 | 36 | #include <QtCore/QMargins> |
|
37 | 37 | |
|
38 | 38 | QT_BEGIN_NAMESPACE |
|
39 | 39 | class QGraphicsSceneResizeEvent; |
|
40 | 40 | QT_END_NAMESPACE |
|
41 | 41 | |
|
42 | 42 | QT_CHARTS_BEGIN_NAMESPACE |
|
43 | 43 | |
|
44 | 44 | class QAbstractSeries; |
|
45 | 45 | class QAbstractAxis; |
|
46 | 46 | class QLegend; |
|
47 | 47 | class QChartPrivate; |
|
48 | 48 | class QBoxPlotSeries; |
|
49 | 49 | |
|
50 | 50 | class QT_CHARTS_EXPORT QChart : public QGraphicsWidget |
|
51 | 51 | { |
|
52 | 52 | Q_OBJECT |
|
53 | 53 | Q_PROPERTY(QChart::ChartTheme theme READ theme WRITE setTheme) |
|
54 | 54 | Q_PROPERTY(QString title READ title WRITE setTitle) |
|
55 | 55 | Q_PROPERTY(bool backgroundVisible READ isBackgroundVisible WRITE setBackgroundVisible) |
|
56 | 56 | Q_PROPERTY(bool dropShadowEnabled READ isDropShadowEnabled WRITE setDropShadowEnabled) |
|
57 | 57 | Q_PROPERTY(qreal backgroundRoundness READ backgroundRoundness WRITE setBackgroundRoundness) |
|
58 | 58 | Q_PROPERTY(QChart::AnimationOptions animationOptions READ animationOptions WRITE setAnimationOptions) |
|
59 | 59 | Q_PROPERTY(int animationDuration READ animationDuration WRITE setAnimationDuration) |
|
60 | 60 | Q_PROPERTY(QEasingCurve animationEasingCurve READ animationEasingCurve WRITE setAnimationEasingCurve) |
|
61 | 61 | Q_PROPERTY(QMargins margins READ margins WRITE setMargins) |
|
62 | 62 | Q_PROPERTY(QChart::ChartType chartType READ chartType) |
|
63 | 63 | Q_PROPERTY(bool plotAreaBackgroundVisible READ isPlotAreaBackgroundVisible WRITE setPlotAreaBackgroundVisible) |
|
64 | 64 | Q_PROPERTY(bool localizeNumbers READ localizeNumbers WRITE setLocalizeNumbers) |
|
65 | 65 | Q_PROPERTY(QLocale locale READ locale WRITE setLocale) |
|
66 | 66 | Q_PROPERTY(QRectF plotArea READ plotArea NOTIFY plotAreaChanged) |
|
67 | 67 | Q_ENUMS(ChartTheme) |
|
68 | 68 | Q_ENUMS(AnimationOption) |
|
69 | 69 | Q_ENUMS(ChartType) |
|
70 | 70 | |
|
71 | 71 | public: |
|
72 | 72 | enum ChartType { |
|
73 | 73 | ChartTypeUndefined = 0, |
|
74 | 74 | ChartTypeCartesian, |
|
75 | 75 | ChartTypePolar |
|
76 | 76 | }; |
|
77 | 77 | |
|
78 | 78 | enum ChartTheme { |
|
79 | 79 | ChartThemeLight = 0, |
|
80 | 80 | ChartThemeBlueCerulean, |
|
81 | 81 | ChartThemeDark, |
|
82 | 82 | ChartThemeBrownSand, |
|
83 | 83 | ChartThemeBlueNcs, |
|
84 | 84 | ChartThemeHighContrast, |
|
85 | 85 | ChartThemeBlueIcy, |
|
86 | 86 | ChartThemeQt |
|
87 | 87 | }; |
|
88 | 88 | |
|
89 | 89 | enum AnimationOption { |
|
90 | 90 | NoAnimation = 0x0, |
|
91 | 91 | GridAxisAnimations = 0x1, |
|
92 | 92 | SeriesAnimations = 0x2, |
|
93 | 93 | AllAnimations = 0x3 |
|
94 | 94 | }; |
|
95 | 95 | |
|
96 | 96 | Q_DECLARE_FLAGS(AnimationOptions, AnimationOption) |
|
97 | 97 | |
|
98 | 98 | public: |
|
99 | 99 | explicit QChart(QGraphicsItem *parent = Q_NULLPTR, Qt::WindowFlags wFlags = Qt::WindowFlags()); |
|
100 | 100 | ~QChart(); |
|
101 | 101 | |
|
102 | 102 | void addSeries(QAbstractSeries *series); |
|
103 | 103 | void removeSeries(QAbstractSeries *series); |
|
104 | 104 | void removeAllSeries(); |
|
105 | 105 | QList<QAbstractSeries *> series() const; |
|
106 | 106 | |
|
107 | 107 | // *** deprecated *** |
|
108 | 108 | void setAxisX(QAbstractAxis *axis, QAbstractSeries *series = Q_NULLPTR); |
|
109 | 109 | void setAxisY(QAbstractAxis *axis, QAbstractSeries *series = Q_NULLPTR); |
|
110 | 110 | QAbstractAxis *axisX(QAbstractSeries *series = Q_NULLPTR) const; |
|
111 | 111 | QAbstractAxis *axisY(QAbstractSeries *series = Q_NULLPTR) const; |
|
112 | 112 | // ****************** |
|
113 | 113 | |
|
114 | 114 | void addAxis(QAbstractAxis *axis, Qt::Alignment alignment); |
|
115 | 115 | void removeAxis(QAbstractAxis *axis); |
|
116 | 116 | QList<QAbstractAxis*> axes(Qt::Orientations orientation = Qt::Horizontal|Qt::Vertical, QAbstractSeries *series = Q_NULLPTR) const; |
|
117 | 117 | |
|
118 | 118 | void createDefaultAxes(); |
|
119 | 119 | |
|
120 | 120 | void setTheme(QChart::ChartTheme theme); |
|
121 | 121 | QChart::ChartTheme theme() const; |
|
122 | 122 | |
|
123 | 123 | void setTitle(const QString &title); |
|
124 | 124 | QString title() const; |
|
125 | 125 | void setTitleFont(const QFont &font); |
|
126 | 126 | QFont titleFont() const; |
|
127 | 127 | void setTitleBrush(const QBrush &brush); |
|
128 | 128 | QBrush titleBrush() const; |
|
129 | 129 | |
|
130 | 130 | void setBackgroundBrush(const QBrush &brush); |
|
131 | 131 | QBrush backgroundBrush() const; |
|
132 | 132 | void setBackgroundPen(const QPen &pen); |
|
133 | 133 | QPen backgroundPen() const; |
|
134 | 134 | void setBackgroundVisible(bool visible = true); |
|
135 | 135 | bool isBackgroundVisible() const; |
|
136 | 136 | |
|
137 | 137 | void setDropShadowEnabled(bool enabled = true); |
|
138 | 138 | bool isDropShadowEnabled() const; |
|
139 | 139 | void setBackgroundRoundness(qreal diameter); |
|
140 | 140 | qreal backgroundRoundness() const; |
|
141 | 141 | |
|
142 | 142 | void setAnimationOptions(AnimationOptions options); |
|
143 | 143 | AnimationOptions animationOptions() const; |
|
144 | 144 | void setAnimationDuration(int msecs); |
|
145 | 145 | int animationDuration() const; |
|
146 | 146 | void setAnimationEasingCurve(const QEasingCurve &curve); |
|
147 | 147 | QEasingCurve animationEasingCurve() const; |
|
148 | 148 | |
|
149 | 149 | void zoomIn(); |
|
150 | void zoomIn2(double factor); | |
|
150 | void zoomIn2(double factor, Qt::Orientation orientation); | |
|
151 | 151 | void zoomOut(); |
|
152 | void zoomOut2(double factor); | |
|
152 | void zoomOut2(double factor, Qt::Orientation orientation); | |
|
153 | 153 | |
|
154 | 154 | void zoomIn(const QRectF &rect); |
|
155 | 155 | void zoom(qreal factor); |
|
156 | 156 | void zoomReset(); |
|
157 | 157 | bool isZoomed(); |
|
158 | 158 | |
|
159 | 159 | void scroll(qreal dx, qreal dy); |
|
160 | 160 | |
|
161 | 161 | QLegend *legend() const; |
|
162 | 162 | |
|
163 | 163 | void setMargins(const QMargins &margins); |
|
164 | 164 | QMargins margins() const; |
|
165 | 165 | |
|
166 | 166 | QRectF plotArea() const; |
|
167 | 167 | void setPlotAreaBackgroundBrush(const QBrush &brush); |
|
168 | 168 | QBrush plotAreaBackgroundBrush() const; |
|
169 | 169 | void setPlotAreaBackgroundPen(const QPen &pen); |
|
170 | 170 | QPen plotAreaBackgroundPen() const; |
|
171 | 171 | void setPlotAreaBackgroundVisible(bool visible = true); |
|
172 | 172 | bool isPlotAreaBackgroundVisible() const; |
|
173 | 173 | void setLocalizeNumbers(bool localize); |
|
174 | 174 | bool localizeNumbers() const; |
|
175 | 175 | void setLocale(const QLocale &locale); |
|
176 | 176 | QLocale locale() const; |
|
177 | 177 | |
|
178 | 178 | QPointF mapToValue(const QPointF &position, QAbstractSeries *series = Q_NULLPTR); |
|
179 | 179 | QPointF mapToPosition(const QPointF &value, QAbstractSeries *series = Q_NULLPTR); |
|
180 | 180 | |
|
181 | 181 | ChartType chartType() const; |
|
182 | 182 | |
|
183 | 183 | Q_SIGNALS: |
|
184 | 184 | void plotAreaChanged(const QRectF &plotArea); |
|
185 | 185 | |
|
186 | 186 | protected: |
|
187 | 187 | explicit QChart(QChart::ChartType type, QGraphicsItem *parent, Qt::WindowFlags wFlags); |
|
188 | 188 | QScopedPointer<QChartPrivate> d_ptr; |
|
189 | 189 | friend class QLegend; |
|
190 | 190 | friend class DeclarativeChart; |
|
191 | 191 | friend class ChartDataSet; |
|
192 | 192 | friend class ChartPresenter; |
|
193 | 193 | friend class ChartThemeManager; |
|
194 | 194 | friend class QAbstractSeries; |
|
195 | 195 | friend class QBoxPlotSeriesPrivate; |
|
196 | 196 | |
|
197 | 197 | private: |
|
198 | 198 | Q_DISABLE_COPY(QChart) |
|
199 | 199 | }; |
|
200 | 200 | |
|
201 | 201 | QT_CHARTS_END_NAMESPACE |
|
202 | 202 | |
|
203 | 203 | Q_DECLARE_OPERATORS_FOR_FLAGS(QT_CHARTS_NAMESPACE::QChart::AnimationOptions) |
|
204 | 204 | |
|
205 | 205 | #endif // QCHART_H |
@@ -1,81 +1,81 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2016 The Qt Company Ltd. |
|
4 | 4 | ** Contact: https://www.qt.io/licensing/ |
|
5 | 5 | ** |
|
6 | 6 | ** This file is part of the Qt Charts module of the Qt Toolkit. |
|
7 | 7 | ** |
|
8 | 8 | ** $QT_BEGIN_LICENSE:GPL$ |
|
9 | 9 | ** Commercial License Usage |
|
10 | 10 | ** Licensees holding valid commercial Qt licenses may use this file in |
|
11 | 11 | ** accordance with the commercial license agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and The Qt Company. For licensing terms |
|
14 | 14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
|
15 | 15 | ** information use the contact form at https://www.qt.io/contact-us. |
|
16 | 16 | ** |
|
17 | 17 | ** GNU General Public License Usage |
|
18 | 18 | ** Alternatively, this file may be used under the terms of the GNU |
|
19 | 19 | ** General Public License version 3 or (at your option) any later version |
|
20 | 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by |
|
21 | 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 |
|
22 | 22 | ** included in the packaging of this file. Please review the following |
|
23 | 23 | ** information to ensure the GNU General Public License requirements will |
|
24 | 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. |
|
25 | 25 | ** |
|
26 | 26 | ** $QT_END_LICENSE$ |
|
27 | 27 | ** |
|
28 | 28 | ****************************************************************************/ |
|
29 | 29 | |
|
30 | 30 | // W A R N I N G |
|
31 | 31 | // ------------- |
|
32 | 32 | // |
|
33 | 33 | // This file is not part of the Qt Chart API. It exists purely as an |
|
34 | 34 | // implementation detail. This header file may change from version to |
|
35 | 35 | // version without notice, or even be removed. |
|
36 | 36 | // |
|
37 | 37 | // We mean it. |
|
38 | 38 | |
|
39 | 39 | #ifndef QCHART_P_H |
|
40 | 40 | #define QCHART_P_H |
|
41 | 41 | |
|
42 | 42 | #include <QtCharts/QChartGlobal> |
|
43 | 43 | #include <QtCharts/QChart> |
|
44 | 44 | |
|
45 | 45 | QT_CHARTS_BEGIN_NAMESPACE |
|
46 | 46 | |
|
47 | 47 | class ChartThemeManager; |
|
48 | 48 | class ChartPresenter; |
|
49 | 49 | class QLegend; |
|
50 | 50 | class ChartDataSet; |
|
51 | 51 | |
|
52 | 52 | class QChartPrivate |
|
53 | 53 | { |
|
54 | 54 | |
|
55 | 55 | public: |
|
56 | 56 | QChartPrivate(QChart *q, QChart::ChartType type); |
|
57 | 57 | ~QChartPrivate(); |
|
58 | 58 | QChart *q_ptr; |
|
59 | 59 | QLegend *m_legend; |
|
60 | 60 | ChartDataSet *m_dataset; |
|
61 | 61 | ChartPresenter *m_presenter; |
|
62 | 62 | ChartThemeManager *m_themeManager; |
|
63 | 63 | QChart::ChartType m_type; |
|
64 | 64 | |
|
65 | 65 | static QPen &defaultPen(); |
|
66 | 66 | static QBrush &defaultBrush(); |
|
67 | 67 | static QFont &defaultFont(); |
|
68 | 68 | |
|
69 | 69 | void init(); |
|
70 | 70 | void zoomIn(qreal factor); |
|
71 | void zoomIn2(qreal factor); | |
|
71 | void zoomIn2(qreal factor, Qt::Orientation orientation); | |
|
72 | 72 | void zoomOut(qreal factor); |
|
73 | void zoomOut2(qreal factor); | |
|
73 | void zoomOut2(qreal factor, Qt::Orientation orientation); | |
|
74 | 74 | void zoomIn(const QRectF &rect); |
|
75 | 75 | void zoomReset(); |
|
76 | 76 | bool isZoomed(); |
|
77 | 77 | void scroll(qreal dx, qreal dy); |
|
78 | 78 | }; |
|
79 | 79 | |
|
80 | 80 | QT_CHARTS_END_NAMESPACE |
|
81 | 81 | #endif |
General Comments 0
You need to be logged in to leave comments.
Login now