##// END OF EJS Templates
Make category axis label positioning at value work for polar charts...
Miikka Heikkinen -
r2801:acb3f8c5f190
parent child
Show More
@@ -1,427 +1,441
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2015 The Qt Company Ltd
4 4 ** All rights reserved.
5 5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 6 **
7 7 ** This file is part of the Qt Charts module.
8 8 **
9 9 ** Licensees holding valid commercial license for Qt may use this file in
10 10 ** accordance with the Qt License Agreement provided with the Software
11 11 ** or, alternatively, in accordance with the terms contained in a written
12 12 ** agreement between you and The Qt Company.
13 13 **
14 14 ** If you have questions regarding the use of this file, please use
15 15 ** contact form at http://qt.io
16 16 **
17 17 ****************************************************************************/
18 18
19 19 #include <private/chartaxiselement_p.h>
20 20 #include <private/qabstractaxis_p.h>
21 21 #include <private/chartpresenter_p.h>
22 22 #include <private/abstractchartlayout_p.h>
23 #include <QtCharts/QCategoryAxis>
23 24 #include <QtCore/QtMath>
24 25 #include <QtCore/QDateTime>
25 26 #include <QtGui/QTextDocument>
26 27 #include <cmath>
27 28
28 29 QT_CHARTS_BEGIN_NAMESPACE
29 30
30 31 static const char *labelFormatMatchString = "%[\\-\\+#\\s\\d\\.\\'lhjztL]*([dicuoxfegXFEG])";
31 32 static const char *labelFormatMatchLocalizedString = "^([^%]*)%\\.(\\d+)([defgiEG])(.*)$";
32 33 static QRegExp *labelFormatMatcher = 0;
33 34 static QRegExp *labelFormatMatcherLocalized = 0;
34 35 class StaticLabelFormatMatcherDeleter
35 36 {
36 37 public:
37 38 StaticLabelFormatMatcherDeleter() {}
38 39 ~StaticLabelFormatMatcherDeleter() {
39 40 delete labelFormatMatcher;
40 41 delete labelFormatMatcherLocalized;
41 42 }
42 43 };
43 44 static StaticLabelFormatMatcherDeleter staticLabelFormatMatcherDeleter;
44 45
45 46 ChartAxisElement::ChartAxisElement(QAbstractAxis *axis, QGraphicsItem *item, bool intervalAxis)
46 47 : ChartElement(item),
47 48 m_axis(axis),
48 49 m_animation(0),
49 50 m_grid(new QGraphicsItemGroup(item)),
50 51 m_arrow(new QGraphicsItemGroup(item)),
51 52 m_minorGrid(new QGraphicsItemGroup(item)),
52 53 m_minorArrow(new QGraphicsItemGroup(item)),
53 54 m_shades(new QGraphicsItemGroup(item)),
54 55 m_labels(new QGraphicsItemGroup(item)),
55 56 m_title(new QGraphicsTextItem(item)),
56 57 m_intervalAxis(intervalAxis)
57 58
58 59 {
59 60 //initial initialization
60 61 m_arrow->setHandlesChildEvents(false);
61 62 m_arrow->setZValue(ChartPresenter::AxisZValue);
62 63 m_minorArrow->setHandlesChildEvents(false);
63 64 m_minorArrow->setZValue(ChartPresenter::AxisZValue);
64 65 m_labels->setZValue(ChartPresenter::AxisZValue);
65 66 m_shades->setZValue(ChartPresenter::ShadesZValue);
66 67 m_grid->setZValue(ChartPresenter::GridZValue);
67 68 m_minorGrid->setZValue(ChartPresenter::GridZValue);
68 69 m_title->setZValue(ChartPresenter::GridZValue);
69 70 m_title->document()->setDocumentMargin(ChartPresenter::textMargin());
70 71 handleVisibleChanged(axis->isVisible());
71 72 connectSlots();
72 73
73 74 setFlag(QGraphicsItem::ItemHasNoContents, true);
74 75 }
75 76
76 77 ChartAxisElement::~ChartAxisElement()
77 78 {
78 79 }
79 80
80 81 void ChartAxisElement::connectSlots()
81 82 {
82 83 QObject::connect(axis(), SIGNAL(visibleChanged(bool)), this, SLOT(handleVisibleChanged(bool)));
83 84 QObject::connect(axis(), SIGNAL(lineVisibleChanged(bool)), this, SLOT(handleArrowVisibleChanged(bool)));
84 85 QObject::connect(axis(), SIGNAL(gridVisibleChanged(bool)), this, SLOT(handleGridVisibleChanged(bool)));
85 86 QObject::connect(axis(), SIGNAL(labelsVisibleChanged(bool)), this, SLOT(handleLabelsVisibleChanged(bool)));
86 87 QObject::connect(axis(), SIGNAL(shadesVisibleChanged(bool)), this, SLOT(handleShadesVisibleChanged(bool)));
87 88 QObject::connect(axis(), SIGNAL(labelsAngleChanged(int)), this, SLOT(handleLabelsAngleChanged(int)));
88 89 QObject::connect(axis(), SIGNAL(linePenChanged(const QPen&)), this, SLOT(handleArrowPenChanged(const QPen&)));
89 90 QObject::connect(axis(), SIGNAL(labelsBrushChanged(const QBrush&)), this, SLOT(handleLabelsBrushChanged(const QBrush&)));
90 91 QObject::connect(axis(), SIGNAL(labelsFontChanged(const QFont&)), this, SLOT(handleLabelsFontChanged(const QFont&)));
91 92 QObject::connect(axis(), SIGNAL(gridLinePenChanged(const QPen&)), this, SLOT(handleGridPenChanged(const QPen&)));
92 93 QObject::connect(axis(), SIGNAL(shadesPenChanged(const QPen&)), this, SLOT(handleShadesPenChanged(const QPen&)));
93 94 QObject::connect(axis(), SIGNAL(shadesBrushChanged(const QBrush&)), this, SLOT(handleShadesBrushChanged(const QBrush&)));
94 95 QObject::connect(axis(), SIGNAL(titleTextChanged(const QString&)), this, SLOT(handleTitleTextChanged(const QString&)));
95 96 QObject::connect(axis(), SIGNAL(titleFontChanged(const QFont&)), this, SLOT(handleTitleFontChanged(const QFont&)));
96 97 QObject::connect(axis(), SIGNAL(titleBrushChanged(const QBrush&)), this, SLOT(handleTitleBrushChanged(const QBrush&)));
97 98 QObject::connect(axis(), SIGNAL(titleVisibleChanged(bool)), this, SLOT(handleTitleVisibleChanged(bool)));
98 99 QObject::connect(axis()->d_ptr.data(), SIGNAL(rangeChanged(qreal, qreal)), this, SLOT(handleRangeChanged(qreal, qreal)));
99 100 QObject::connect(axis(), SIGNAL(reverseChanged(bool)), this, SLOT(handleReverseChanged(bool)));
100 101 QObject::connect(axis(), SIGNAL(lineVisibleChanged(bool)),
101 102 this, SLOT(handleMinorArrowVisibleChanged(bool)));
102 103 QObject::connect(axis(), SIGNAL(linePenChanged(const QPen&)), this,
103 104 SLOT(handleMinorArrowPenChanged(const QPen&)));
104 105 QObject::connect(axis(), SIGNAL(minorGridVisibleChanged(bool)),
105 106 this, SLOT(handleMinorGridVisibleChanged(bool)));
106 107 QObject::connect(axis(), SIGNAL(minorGridLinePenChanged(const QPen&)),
107 108 this, SLOT(handleMinorGridPenChanged(const QPen&)));
109
110 if (axis()->type() == QAbstractAxis::AxisTypeCategory) {
111 QCategoryAxis *categoryAxis = static_cast<QCategoryAxis *>(axis());
112 QObject::connect(categoryAxis,
113 SIGNAL(labelsPositionChanged(QCategoryAxis::AxisLabelsPosition)),
114 this, SLOT(handleLabelsPositionChanged()));
115 }
108 116 }
109 117
110 118 void ChartAxisElement::handleArrowVisibleChanged(bool visible)
111 119 {
112 120 m_arrow->setVisible(visible);
113 121 }
114 122
115 123 void ChartAxisElement::handleMinorArrowVisibleChanged(bool visible)
116 124 {
117 125 m_minorArrow->setVisible(visible);
118 126 }
119 127
120 128 void ChartAxisElement::handleGridVisibleChanged(bool visible)
121 129 {
122 130 m_grid->setVisible(visible);
123 131 }
124 132
125 133 void ChartAxisElement::handleMinorGridVisibleChanged(bool visible)
126 134 {
127 135 m_minorGrid->setVisible(visible);
128 136 }
129 137
138 void ChartAxisElement::handleLabelsPositionChanged()
139 {
140 QGraphicsLayoutItem::updateGeometry();
141 presenter()->layout()->invalidate();
142 }
143
130 144 void ChartAxisElement::handleLabelsVisibleChanged(bool visible)
131 145 {
132 146 QGraphicsLayoutItem::updateGeometry();
133 147 presenter()->layout()->invalidate();
134 148 m_labels->setVisible(visible);
135 149 }
136 150
137 151 void ChartAxisElement::handleShadesVisibleChanged(bool visible)
138 152 {
139 153 m_shades->setVisible(visible);
140 154 }
141 155
142 156 void ChartAxisElement::handleTitleVisibleChanged(bool visible)
143 157 {
144 158 QGraphicsLayoutItem::updateGeometry();
145 159 presenter()->layout()->invalidate();
146 160 m_title->setVisible(visible);
147 161 }
148 162
149 163 void ChartAxisElement::handleLabelsAngleChanged(int angle)
150 164 {
151 165 foreach (QGraphicsItem *item, m_labels->childItems())
152 166 item->setRotation(angle);
153 167
154 168 QGraphicsLayoutItem::updateGeometry();
155 169 presenter()->layout()->invalidate();
156 170 }
157 171
158 172 void ChartAxisElement::handleLabelsBrushChanged(const QBrush &brush)
159 173 {
160 174 foreach (QGraphicsItem *item, m_labels->childItems())
161 175 static_cast<QGraphicsTextItem *>(item)->setDefaultTextColor(brush.color());
162 176 }
163 177
164 178 void ChartAxisElement::handleLabelsFontChanged(const QFont &font)
165 179 {
166 180 foreach (QGraphicsItem *item, m_labels->childItems())
167 181 static_cast<QGraphicsTextItem *>(item)->setFont(font);
168 182 QGraphicsLayoutItem::updateGeometry();
169 183 presenter()->layout()->invalidate();
170 184 }
171 185
172 186 void ChartAxisElement::handleTitleTextChanged(const QString &title)
173 187 {
174 188 QGraphicsLayoutItem::updateGeometry();
175 189 presenter()->layout()->invalidate();
176 190 if (title.isEmpty() || !m_title->isVisible())
177 191 m_title->setHtml(title);
178 192 }
179 193
180 194 void ChartAxisElement::handleTitleBrushChanged(const QBrush &brush)
181 195 {
182 196 m_title->setDefaultTextColor(brush.color());
183 197 }
184 198
185 199 void ChartAxisElement::handleTitleFontChanged(const QFont &font)
186 200 {
187 201 if (m_title->font() != font) {
188 202 m_title->setFont(font);
189 203 QGraphicsLayoutItem::updateGeometry();
190 204 presenter()->layout()->invalidate();
191 205 }
192 206 }
193 207
194 208 void ChartAxisElement::handleVisibleChanged(bool visible)
195 209 {
196 210 setVisible(visible);
197 211 if (!visible) {
198 212 m_grid->setVisible(visible);
199 213 m_arrow->setVisible(visible);
200 214 m_minorGrid->setVisible(visible);
201 215 m_minorArrow->setVisible(visible);
202 216 m_shades->setVisible(visible);
203 217 m_labels->setVisible(visible);
204 218 m_title->setVisible(visible);
205 219 } else {
206 220 m_grid->setVisible(axis()->isGridLineVisible());
207 221 m_arrow->setVisible(axis()->isLineVisible());
208 222 m_minorGrid->setVisible(axis()->isMinorGridLineVisible());
209 223 m_minorArrow->setVisible(axis()->isLineVisible());
210 224 m_shades->setVisible(axis()->shadesVisible());
211 225 m_labels->setVisible(axis()->labelsVisible());
212 226 m_title->setVisible(axis()->isTitleVisible());
213 227 }
214 228
215 229 if (presenter()) presenter()->layout()->invalidate();
216 230 }
217 231
218 232 void ChartAxisElement::handleRangeChanged(qreal min, qreal max)
219 233 {
220 234 Q_UNUSED(min);
221 235 Q_UNUSED(max);
222 236
223 237 if (!isEmpty()) {
224 238 QVector<qreal> layout = calculateLayout();
225 239 updateLayout(layout);
226 240 QSizeF before = effectiveSizeHint(Qt::PreferredSize);
227 241 QSizeF after = sizeHint(Qt::PreferredSize);
228 242
229 243 if (before != after) {
230 244 QGraphicsLayoutItem::updateGeometry();
231 245 // We don't want to call invalidate on layout, since it will change minimum size of
232 246 // component, which we would like to avoid since it causes nasty flips when scrolling
233 247 // or zooming, instead recalculate layout and use plotArea for extra space.
234 248 presenter()->layout()->setGeometry(presenter()->layout()->geometry());
235 249 }
236 250 }
237 251 }
238 252
239 253 void ChartAxisElement::handleReverseChanged(bool reverse)
240 254 {
241 255 Q_UNUSED(reverse);
242 256
243 257 QGraphicsLayoutItem::updateGeometry();
244 258 presenter()->layout()->invalidate();
245 259 }
246 260
247 261 bool ChartAxisElement::isEmpty()
248 262 {
249 263 return axisGeometry().isEmpty()
250 264 || gridGeometry().isEmpty()
251 265 || qFuzzyCompare(min(), max());
252 266 }
253 267
254 268 qreal ChartAxisElement::min() const
255 269 {
256 270 return m_axis->d_ptr->min();
257 271 }
258 272
259 273 qreal ChartAxisElement::max() const
260 274 {
261 275 return m_axis->d_ptr->max();
262 276 }
263 277
264 278 QString ChartAxisElement::formatLabel(const QString &formatSpec, const QByteArray &array,
265 279 qreal value, int precision, const QString &preStr,
266 280 const QString &postStr) const
267 281 {
268 282 QString retVal;
269 283 if (!formatSpec.isEmpty()) {
270 284 if (formatSpec.at(0) == QLatin1Char('d')
271 285 || formatSpec.at(0) == QLatin1Char('i')
272 286 || formatSpec.at(0) == QLatin1Char('c')) {
273 287 if (presenter()->localizeNumbers())
274 288 retVal = preStr + presenter()->locale().toString(qint64(value)) + postStr;
275 289 else
276 290 retVal = QString().sprintf(array, qint64(value));
277 291 } else if (formatSpec.at(0) == QLatin1Char('u')
278 292 || formatSpec.at(0) == QLatin1Char('o')
279 293 || formatSpec.at(0) == QLatin1Char('x')
280 294 || formatSpec.at(0) == QLatin1Char('X')) {
281 295 // These formats are not supported by localized numbers
282 296 retVal = QString().sprintf(array, quint64(value));
283 297 } else if (formatSpec.at(0) == QLatin1Char('f')
284 298 || formatSpec.at(0) == QLatin1Char('F')
285 299 || formatSpec.at(0) == QLatin1Char('e')
286 300 || formatSpec.at(0) == QLatin1Char('E')
287 301 || formatSpec.at(0) == QLatin1Char('g')
288 302 || formatSpec.at(0) == QLatin1Char('G')) {
289 303 if (presenter()->localizeNumbers()) {
290 304 retVal = preStr
291 305 + presenter()->locale().toString(value, formatSpec.at(0).toLatin1(),
292 306 precision)
293 307 + postStr;
294 308 } else {
295 309 retVal = QString().sprintf(array, value);
296 310 }
297 311 }
298 312 }
299 313 return retVal;
300 314 }
301 315
302 316 QStringList ChartAxisElement::createValueLabels(qreal min, qreal max, int ticks,
303 317 const QString &format) const
304 318 {
305 319 QStringList labels;
306 320
307 321 if (max <= min || ticks < 1)
308 322 return labels;
309 323
310 324 if (format.isNull()) {
311 325 int n = qMax(int(-qFloor(std::log10((max - min) / (ticks - 1)))), 0) + 1;
312 326 for (int i = 0; i < ticks; i++) {
313 327 qreal value = min + (i * (max - min) / (ticks - 1));
314 328 labels << presenter()->numberToString(value, 'f', n);
315 329 }
316 330 } else {
317 331 QByteArray array = format.toLatin1();
318 332 QString formatSpec;
319 333 QString preStr;
320 334 QString postStr;
321 335 int precision = 6; // Six is the default precision in Qt API
322 336 if (presenter()->localizeNumbers()) {
323 337 if (!labelFormatMatcherLocalized)
324 338 labelFormatMatcherLocalized
325 339 = new QRegExp(QString::fromLatin1(labelFormatMatchLocalizedString));
326 340 if (labelFormatMatcherLocalized->indexIn(format, 0) != -1) {
327 341 preStr = labelFormatMatcherLocalized->cap(1);
328 342 if (!labelFormatMatcherLocalized->cap(2).isEmpty())
329 343 precision = labelFormatMatcherLocalized->cap(2).toInt();
330 344 formatSpec = labelFormatMatcherLocalized->cap(3);
331 345 postStr = labelFormatMatcherLocalized->cap(4);
332 346 }
333 347 } else {
334 348 if (!labelFormatMatcher)
335 349 labelFormatMatcher = new QRegExp(QString::fromLatin1(labelFormatMatchString));
336 350 if (labelFormatMatcher->indexIn(format, 0) != -1)
337 351 formatSpec = labelFormatMatcher->cap(1);
338 352 }
339 353 for (int i = 0; i < ticks; i++) {
340 354 qreal value = min + (i * (max - min) / (ticks - 1));
341 355 labels << formatLabel(formatSpec, array, value, precision, preStr, postStr);
342 356 }
343 357 }
344 358
345 359 return labels;
346 360 }
347 361
348 362 QStringList ChartAxisElement::createLogValueLabels(qreal min, qreal max, qreal base, int ticks,
349 363 const QString &format) const
350 364 {
351 365 QStringList labels;
352 366
353 367 if (max <= min || ticks < 1)
354 368 return labels;
355 369
356 370 int firstTick;
357 371 if (base > 1)
358 372 firstTick = qCeil(std::log10(min) / std::log10(base));
359 373 else
360 374 firstTick = qCeil(std::log10(max) / std::log10(base));
361 375
362 376 if (format.isNull()) {
363 377 int n = 0;
364 378 if (ticks > 1)
365 379 n = qMax(int(-qFloor(std::log10((max - min) / (ticks - 1)))), 0);
366 380 n++;
367 381 for (int i = firstTick; i < ticks + firstTick; i++) {
368 382 qreal value = qPow(base, i);
369 383 labels << presenter()->numberToString(value, 'f', n);
370 384 }
371 385 } else {
372 386 QByteArray array = format.toLatin1();
373 387 QString formatSpec;
374 388 QString preStr;
375 389 QString postStr;
376 390 int precision = 6; // Six is the default precision in Qt API
377 391 if (presenter()->localizeNumbers()) {
378 392 if (!labelFormatMatcherLocalized)
379 393 labelFormatMatcherLocalized =
380 394 new QRegExp(QString::fromLatin1(labelFormatMatchLocalizedString));
381 395 if (labelFormatMatcherLocalized->indexIn(format, 0) != -1) {
382 396 preStr = labelFormatMatcherLocalized->cap(1);
383 397 if (!labelFormatMatcherLocalized->cap(2).isEmpty())
384 398 precision = labelFormatMatcherLocalized->cap(2).toInt();
385 399 formatSpec = labelFormatMatcherLocalized->cap(3);
386 400 postStr = labelFormatMatcherLocalized->cap(4);
387 401 }
388 402 } else {
389 403 if (!labelFormatMatcher)
390 404 labelFormatMatcher = new QRegExp(QString::fromLatin1(labelFormatMatchString));
391 405 if (labelFormatMatcher->indexIn(format, 0) != -1)
392 406 formatSpec = labelFormatMatcher->cap(1);
393 407 }
394 408 for (int i = firstTick; i < ticks + firstTick; i++) {
395 409 qreal value = qPow(base, i);
396 410 labels << formatLabel(formatSpec, array, value, precision, preStr, postStr);
397 411 }
398 412 }
399 413
400 414 return labels;
401 415 }
402 416
403 417 QStringList ChartAxisElement::createDateTimeLabels(qreal min, qreal max,int ticks,
404 418 const QString &format) const
405 419 {
406 420 QStringList labels;
407 421
408 422 if (max <= min || ticks < 1)
409 423 return labels;
410 424
411 425 int n = qMax(int(-qFloor(std::log10((max - min) / (ticks - 1)))), 0);
412 426 n++;
413 427 for (int i = 0; i < ticks; i++) {
414 428 qreal value = min + (i * (max - min) / (ticks - 1));
415 429 labels << presenter()->locale().toString(QDateTime::fromMSecsSinceEpoch(value), format);
416 430 }
417 431 return labels;
418 432 }
419 433
420 434 void ChartAxisElement::axisSelected()
421 435 {
422 436 emit clicked();
423 437 }
424 438
425 439 #include "moc_chartaxiselement_p.cpp"
426 440
427 441 QT_CHARTS_END_NAMESPACE
@@ -1,163 +1,163
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2015 The Qt Company Ltd
4 4 ** All rights reserved.
5 5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 6 **
7 7 ** This file is part of the Qt Charts module.
8 8 **
9 9 ** Licensees holding valid commercial license for Qt may use this file in
10 10 ** accordance with the Qt License Agreement provided with the Software
11 11 ** or, alternatively, in accordance with the terms contained in a written
12 12 ** agreement between you and The Qt Company.
13 13 **
14 14 ** If you have questions regarding the use of this file, please use
15 15 ** contact form at http://qt.io
16 16 **
17 17 ****************************************************************************/
18 18
19 19 // W A R N I N G
20 20 // -------------
21 21 //
22 22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
23 23 // implementation detail. This header file may change from version to
24 24 // version without notice, or even be removed.
25 25 //
26 26 // We mean it.
27 27
28 28 #ifndef CHARTAXISELEMENT_H
29 29 #define CHARTAXISELEMENT_H
30 30
31 31 #include <QtCharts/QChartGlobal>
32 32 #include <private/chartelement_p.h>
33 33 #include <private/axisanimation_p.h>
34 34 #include <QtWidgets/QGraphicsItem>
35 35 #include <QtWidgets/QGraphicsLayoutItem>
36 36 #include <QtGui/QFont>
37 37
38 38 QT_CHARTS_BEGIN_NAMESPACE
39 39
40 40 class ChartPresenter;
41 41 class QAbstractAxis;
42 42
43 43 class ChartAxisElement : public ChartElement, public QGraphicsLayoutItem
44 44 {
45 45 Q_OBJECT
46 46
47 47 using QGraphicsLayoutItem::setGeometry;
48 48 public:
49 49 ChartAxisElement(QAbstractAxis *axis, QGraphicsItem *item, bool intervalAxis = false);
50 50 ~ChartAxisElement();
51 51
52 52 virtual QRectF gridGeometry() const = 0;
53 53 virtual void setGeometry(const QRectF &axis, const QRectF &grid) = 0;
54 54 virtual bool isEmpty() = 0;
55 55
56 56 void setAnimation(AxisAnimation *animation) { m_animation = animation; }
57 57 AxisAnimation *animation() const { return m_animation; }
58 58
59 59 QAbstractAxis *axis() const { return m_axis; }
60 60 void setLayout(QVector<qreal> &layout) { m_layout = layout; }
61 61 QVector<qreal> &layout() { return m_layout; } // Modifiable reference
62 62 inline qreal labelPadding() const { return qreal(4.0); }
63 63 inline qreal titlePadding() const { return qreal(2.0); }
64 64 void setLabels(const QStringList &labels) { m_labelsList = labels; }
65 65 QStringList labels() const { return m_labelsList; }
66 66
67 67 qreal min() const;
68 68 qreal max() const;
69 69
70 70 QRectF axisGeometry() const { return m_axisRect; }
71 71 void setAxisGeometry(const QRectF &axisGeometry) { m_axisRect = axisGeometry; }
72 72
73 73 void axisSelected();
74 74
75 75 //this flag indicates that axis is used to show intervals it means labels are in between ticks
76 76 bool intervalAxis() const { return m_intervalAxis; }
77 77
78 78 QStringList createValueLabels(qreal max, qreal min, int ticks, const QString &format) const;
79 79 QStringList createLogValueLabels(qreal min, qreal max, qreal base, int ticks,
80 80 const QString &format) const;
81 81 QStringList createDateTimeLabels(qreal max, qreal min, int ticks, const QString &format) const;
82 82
83 83 // from QGraphicsLayoutItem
84 84 QRectF boundingRect() const
85 85 {
86 86 return QRectF();
87 87 }
88 88
89 89 // from QGraphicsLayoutItem
90 90 void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*)
91 91 {
92 92 }
93 93
94 94 protected:
95 95 virtual QVector<qreal> calculateLayout() const = 0;
96 96 virtual void updateLayout(QVector<qreal> &layout) = 0;
97 97
98 98 QList<QGraphicsItem *> gridItems() { return m_grid->childItems(); }
99 99 QList<QGraphicsItem *> minorGridItems() { return m_minorGrid->childItems(); }
100 100 QList<QGraphicsItem *> labelItems() { return m_labels->childItems(); }
101 101 QList<QGraphicsItem *> shadeItems() { return m_shades->childItems(); }
102 102 QList<QGraphicsItem *> arrowItems() { return m_arrow->childItems(); }
103 103 QList<QGraphicsItem *> minorArrowItems() { return m_minorArrow->childItems(); }
104 104 QGraphicsTextItem *titleItem() const { return m_title.data(); }
105 105 QGraphicsItemGroup *gridGroup() { return m_grid.data(); }
106 106 QGraphicsItemGroup *minorGridGroup() { return m_minorGrid.data(); }
107 107 QGraphicsItemGroup *labelGroup() { return m_labels.data(); }
108 108 QGraphicsItemGroup *shadeGroup() { return m_shades.data(); }
109 109 QGraphicsItemGroup *arrowGroup() { return m_arrow.data(); }
110 110 QGraphicsItemGroup *minorArrowGroup() { return m_minorArrow.data(); }
111 111
112 112 public Q_SLOTS:
113 113 void handleVisibleChanged(bool visible);
114 114 void handleArrowVisibleChanged(bool visible);
115 115 void handleGridVisibleChanged(bool visible);
116 116 void handleLabelsVisibleChanged(bool visible);
117 117 void handleShadesVisibleChanged(bool visible);
118 118 void handleLabelsAngleChanged(int angle);
119 119 virtual void handleShadesBrushChanged(const QBrush &brush) = 0;
120 120 virtual void handleShadesPenChanged(const QPen &pen) = 0;
121 121 virtual void handleArrowPenChanged(const QPen &pen) = 0;
122 122 virtual void handleGridPenChanged(const QPen &pen) = 0;
123 123 virtual void handleMinorArrowPenChanged(const QPen &pen) = 0;
124 124 virtual void handleMinorGridPenChanged(const QPen &pen) = 0;
125 125 void handleLabelsBrushChanged(const QBrush &brush);
126 126 void handleLabelsFontChanged(const QFont &font);
127 127 void handleTitleBrushChanged(const QBrush &brush);
128 128 void handleTitleFontChanged(const QFont &font);
129 129 void handleTitleTextChanged(const QString &title);
130 130 void handleTitleVisibleChanged(bool visible);
131 131 void handleRangeChanged(qreal min, qreal max);
132 132 void handleReverseChanged(bool reverse);
133 133 void handleMinorArrowVisibleChanged(bool visible);
134 134 void handleMinorGridVisibleChanged(bool visible);
135
135 void handleLabelsPositionChanged();
136 136
137 137 Q_SIGNALS:
138 138 void clicked();
139 139
140 140 private:
141 141 void connectSlots();
142 142 QString formatLabel(const QString &formatSpec, const QByteArray &array,
143 143 qreal value, int precision, const QString &preStr,
144 144 const QString &postStr) const;
145 145
146 146 QAbstractAxis *m_axis;
147 147 AxisAnimation *m_animation;
148 148 QVector<qreal> m_layout;
149 149 QStringList m_labelsList;
150 150 QRectF m_axisRect;
151 151 QScopedPointer<QGraphicsItemGroup> m_grid;
152 152 QScopedPointer<QGraphicsItemGroup> m_arrow;
153 153 QScopedPointer<QGraphicsItemGroup> m_minorGrid;
154 154 QScopedPointer<QGraphicsItemGroup> m_minorArrow;
155 155 QScopedPointer<QGraphicsItemGroup> m_shades;
156 156 QScopedPointer<QGraphicsItemGroup> m_labels;
157 157 QScopedPointer<QGraphicsTextItem> m_title;
158 158 bool m_intervalAxis;
159 159 };
160 160
161 161 QT_CHARTS_END_NAMESPACE
162 162
163 163 #endif /* CHARTAXISELEMENT_H */
@@ -1,506 +1,518
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2015 The Qt Company Ltd
4 4 ** All rights reserved.
5 5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 6 **
7 7 ** This file is part of the Qt Charts module.
8 8 **
9 9 ** Licensees holding valid commercial license for Qt may use this file in
10 10 ** accordance with the Qt License Agreement provided with the Software
11 11 ** or, alternatively, in accordance with the terms contained in a written
12 12 ** agreement between you and The Qt Company.
13 13 **
14 14 ** If you have questions regarding the use of this file, please use
15 15 ** contact form at http://qt.io
16 16 **
17 17 ****************************************************************************/
18 18
19 19 #include <private/polarchartaxisangular_p.h>
20 20 #include <private/chartpresenter_p.h>
21 21 #include <private/abstractchartlayout_p.h>
22 22 #include <QtCharts/QAbstractAxis>
23 #include <QtCharts/QCategoryAxis>
23 24 #include <private/qabstractaxis_p.h>
24 25 #include <QtCore/QDebug>
25 26 #include <QtCore/QtMath>
26 27 #include <QtGui/QTextDocument>
27 28
28 29 QT_CHARTS_BEGIN_NAMESPACE
29 30
30 31 PolarChartAxisAngular::PolarChartAxisAngular(QAbstractAxis *axis, QGraphicsItem *item, bool intervalAxis)
31 32 : PolarChartAxis(axis, item, intervalAxis)
32 33 {
33 34 }
34 35
35 36 PolarChartAxisAngular::~PolarChartAxisAngular()
36 37 {
37 38 }
38 39
39 40 void PolarChartAxisAngular::updateGeometry()
40 41 {
41 42 QGraphicsLayoutItem::updateGeometry();
42 43
43 44 const QVector<qreal> &layout = this->layout();
44 45 if (layout.isEmpty())
45 46 return;
46 47
47 48 createAxisLabels(layout);
48 49 QStringList labelList = labels();
49 50 QPointF center = axisGeometry().center();
50 51 QList<QGraphicsItem *> arrowItemList = arrowItems();
51 52 QList<QGraphicsItem *> gridItemList = gridItems();
52 53 QList<QGraphicsItem *> labelItemList = labelItems();
53 54 QList<QGraphicsItem *> shadeItemList = shadeItems();
54 55 QList<QGraphicsItem *> minorGridItemList = minorGridItems();
55 56 QList<QGraphicsItem *> minorArrowItemList = minorArrowItems();
56 57 QGraphicsTextItem *title = titleItem();
57 58
58 59 QGraphicsEllipseItem *axisLine = static_cast<QGraphicsEllipseItem *>(arrowItemList.at(0));
59 60 axisLine->setRect(axisGeometry());
60 61
61 62 qreal radius = axisGeometry().height() / 2.0;
62 63
63 64 QRectF previousLabelRect;
64 65 QRectF firstLabelRect;
65 66
66 67 qreal labelHeight = 0;
67 68
68 69 bool firstShade = true;
69 70 bool nextTickVisible = false;
70 71 if (layout.size())
71 72 nextTickVisible = !(layout.at(0) < 0.0 || layout.at(0) > 360.0);
72 73
73 74 for (int i = 0; i < layout.size(); ++i) {
74 75 qreal angularCoordinate = layout.at(i);
75 76
76 77 QGraphicsLineItem *gridLineItem = static_cast<QGraphicsLineItem *>(gridItemList.at(i));
77 78 QGraphicsLineItem *tickItem = static_cast<QGraphicsLineItem *>(arrowItemList.at(i + 1));
78 79 QGraphicsTextItem *labelItem = static_cast<QGraphicsTextItem *>(labelItemList.at(i));
79 80 QGraphicsPathItem *shadeItem = 0;
80 81 if (i == 0)
81 82 shadeItem = static_cast<QGraphicsPathItem *>(shadeItemList.at(0));
82 83 else if (i % 2)
83 84 shadeItem = static_cast<QGraphicsPathItem *>(shadeItemList.at((i / 2) + 1));
84 85
85 86 // Ignore ticks outside valid range
86 87 bool currentTickVisible = nextTickVisible;
87 88 if ((i == layout.size() - 1)
88 89 || layout.at(i + 1) < 0.0
89 90 || layout.at(i + 1) > 360.0) {
90 91 nextTickVisible = false;
91 92 } else {
92 93 nextTickVisible = true;
93 94 }
94 95
95 96 qreal labelCoordinate = angularCoordinate;
96 qreal labelVisible = currentTickVisible;
97 bool labelVisible = currentTickVisible;
97 98 if (intervalAxis()) {
98 99 qreal farEdge;
99 100 if (i == (layout.size() - 1))
100 101 farEdge = 360.0;
101 102 else
102 103 farEdge = qMin(qreal(360.0), layout.at(i + 1));
103 104
104 105 // Adjust the labelCoordinate to show it if next tick is visible
105 106 if (nextTickVisible)
106 107 labelCoordinate = qMax(qreal(0.0), labelCoordinate);
107 108
108 labelCoordinate = (labelCoordinate + farEdge) / 2.0;
109 // Don't display label once the category gets too small near the axis
110 if (labelCoordinate < 5.0 || labelCoordinate > 355.0)
111 labelVisible = false;
112 else
113 labelVisible = true;
109 bool centeredLabel = true;
110 if (axis()->type() == QAbstractAxis::AxisTypeCategory) {
111 QCategoryAxis *categoryAxis = static_cast<QCategoryAxis *>(axis());
112 if (categoryAxis->labelsPosition() == QCategoryAxis::AxisLabelsPositionOnValue)
113 centeredLabel = false;
114 }
115 if (centeredLabel) {
116 labelCoordinate = (labelCoordinate + farEdge) / 2.0;
117 // Don't display label once the category gets too small near the axis
118 if (labelCoordinate < 5.0 || labelCoordinate > 355.0)
119 labelVisible = false;
120 else
121 labelVisible = true;
122 } else {
123 labelVisible = nextTickVisible;
124 labelCoordinate = farEdge;
125 }
114 126 }
115 127
116 128 // Need this also in label calculations, so determine it first
117 129 QLineF tickLine(QLineF::fromPolar(radius - tickWidth(), 90.0 - angularCoordinate).p2(),
118 130 QLineF::fromPolar(radius + tickWidth(), 90.0 - angularCoordinate).p2());
119 131 tickLine.translate(center);
120 132
121 133 // Angular axis label
122 134 if (axis()->labelsVisible() && labelVisible) {
123 135 QRectF boundingRect = ChartPresenter::textBoundingRect(axis()->labelsFont(),
124 136 labelList.at(i),
125 137 axis()->labelsAngle());
126 138 labelItem->setTextWidth(boundingRect.width());
127 139 labelItem->setHtml(labelList.at(i));
128 140 const QRectF &rect = labelItem->boundingRect();
129 141 QPointF labelCenter = rect.center();
130 142 labelItem->setTransformOriginPoint(labelCenter.x(), labelCenter.y());
131 143 boundingRect.moveCenter(labelCenter);
132 144 QPointF positionDiff(rect.topLeft() - boundingRect.topLeft());
133 145
134 146 QPointF labelPoint;
135 147 if (intervalAxis()) {
136 148 QLineF labelLine = QLineF::fromPolar(radius + tickWidth(), 90.0 - labelCoordinate);
137 149 labelLine.translate(center);
138 150 labelPoint = labelLine.p2();
139 151 } else {
140 152 labelPoint = tickLine.p2();
141 153 }
142 154
143 155 QRectF labelRect = moveLabelToPosition(labelCoordinate, labelPoint, boundingRect);
144 156 labelItem->setPos(labelRect.topLeft() + positionDiff);
145 157
146 158 // Store height for title calculations
147 159 qreal labelClearance = axisGeometry().top() - labelRect.top();
148 160 labelHeight = qMax(labelHeight, labelClearance);
149 161
150 162 // Label overlap detection
151 163 if (i && (previousLabelRect.intersects(labelRect) || firstLabelRect.intersects(labelRect))) {
152 164 labelVisible = false;
153 165 } else {
154 166 // Store labelRect for future comparison. Some area is deducted to make things look
155 167 // little nicer, as usually intersection happens at label corner with angular labels.
156 168 labelRect.adjust(-2.0, -4.0, -2.0, -4.0);
157 169 if (firstLabelRect.isEmpty())
158 170 firstLabelRect = labelRect;
159 171
160 172 previousLabelRect = labelRect;
161 173 labelVisible = true;
162 174 }
163 175 }
164 176
165 177 labelItem->setVisible(labelVisible);
166 178 if (!currentTickVisible) {
167 179 gridLineItem->setVisible(false);
168 180 tickItem->setVisible(false);
169 181 if (shadeItem)
170 182 shadeItem->setVisible(false);
171 183 continue;
172 184 }
173 185
174 186 // Angular grid line
175 187 QLineF gridLine = QLineF::fromPolar(radius, 90.0 - angularCoordinate);
176 188 gridLine.translate(center);
177 189 gridLineItem->setLine(gridLine);
178 190 gridLineItem->setVisible(true);
179 191
180 192 // Tick
181 193 tickItem->setLine(tickLine);
182 194 tickItem->setVisible(true);
183 195
184 196 // Shades
185 197 if (i % 2 || (i == 0 && !nextTickVisible)) {
186 198 QPainterPath path;
187 199 path.moveTo(center);
188 200 if (i == 0) {
189 201 // If first tick is also the last, we need to custom fill the first partial arc
190 202 // or it won't get filled.
191 203 path.arcTo(axisGeometry(), 90.0 - layout.at(0), layout.at(0));
192 204 path.closeSubpath();
193 205 } else {
194 206 qreal nextCoordinate;
195 207 if (!nextTickVisible) // Last visible tick
196 208 nextCoordinate = 360.0;
197 209 else
198 210 nextCoordinate = layout.at(i + 1);
199 211 qreal arcSpan = angularCoordinate - nextCoordinate;
200 212 path.arcTo(axisGeometry(), 90.0 - angularCoordinate, arcSpan);
201 213 path.closeSubpath();
202 214
203 215 // Add additional arc for first shade item if there is a partial arc to be filled
204 216 if (firstShade) {
205 217 QGraphicsPathItem *specialShadeItem = static_cast<QGraphicsPathItem *>(shadeItemList.at(0));
206 218 if (layout.at(i - 1) > 0.0) {
207 219 QPainterPath specialPath;
208 220 specialPath.moveTo(center);
209 221 specialPath.arcTo(axisGeometry(), 90.0 - layout.at(i - 1), layout.at(i - 1));
210 222 specialPath.closeSubpath();
211 223 specialShadeItem->setPath(specialPath);
212 224 specialShadeItem->setVisible(true);
213 225 } else {
214 226 specialShadeItem->setVisible(false);
215 227 }
216 228 }
217 229 }
218 230 shadeItem->setPath(path);
219 231 shadeItem->setVisible(true);
220 232 firstShade = false;
221 233 }
222 234
223 235 // Minor ticks
224 236 QValueAxis *valueAxis = qobject_cast<QValueAxis *>(axis());
225 237 if ((i + 1) != layout.size() && valueAxis) {
226 238 int minorTickCount = valueAxis->minorTickCount();
227 239 if (minorTickCount != 0) {
228 240 qreal minorAngularCoordinate = (layout[i + 1] - layout[i])
229 241 / qreal(minorTickCount + 1);
230 242 for (int j = 0; j < minorTickCount; j++) {
231 243 QGraphicsLineItem *minorGridItem =
232 244 static_cast<QGraphicsLineItem *>(minorGridItemList.at(i * minorTickCount + j));
233 245 QGraphicsLineItem *minorTickItem =
234 246 static_cast<QGraphicsLineItem *>(minorArrowItemList.at(i * minorTickCount + j));
235 247 qreal minorAngle = 90.0 - angularCoordinate
236 248 - minorAngularCoordinate * qreal(j + 1);
237 249 QLineF minorGridLine = QLineF::fromPolar(radius, minorAngle);
238 250 minorGridLine.translate(center);
239 251 minorGridItem->setLine(minorGridLine);
240 252 minorGridItem->setVisible(true);
241 253
242 254 QLineF minorTickLine(QLineF::fromPolar(radius - tickWidth() + 1,
243 255 minorAngle).p2(),
244 256 QLineF::fromPolar(radius + tickWidth() - 1,
245 257 minorAngle).p2());
246 258 minorTickLine.translate(center);
247 259 minorTickItem->setLine(minorTickLine);
248 260 minorTickItem->setVisible(true);
249 261 }
250 262 }
251 263 }
252 264 }
253 265
254 266 // Title, centered above the chart
255 267 QString titleText = axis()->titleText();
256 268 if (!titleText.isEmpty() && axis()->isTitleVisible()) {
257 269 QRectF truncatedRect;
258 270 qreal availableTitleHeight = axisGeometry().height() - labelPadding() - titlePadding() * 2.0;
259 271 qreal minimumLabelHeight = ChartPresenter::textBoundingRect(axis()->labelsFont(),
260 272 QStringLiteral("...")).height();
261 273 availableTitleHeight -= minimumLabelHeight;
262 274 title->setHtml(ChartPresenter::truncatedText(axis()->titleFont(), titleText, qreal(0.0),
263 275 axisGeometry().width(), availableTitleHeight,
264 276 truncatedRect));
265 277 title->setTextWidth(truncatedRect.width());
266 278
267 279 QRectF titleBoundingRect = title->boundingRect();
268 280 QPointF titleCenter = center - titleBoundingRect.center();
269 281 title->setPos(titleCenter.x(), axisGeometry().top() - titlePadding() * 2.0 - titleBoundingRect.height() - labelHeight);
270 282 }
271 283 }
272 284
273 285 Qt::Orientation PolarChartAxisAngular::orientation() const
274 286 {
275 287 return Qt::Horizontal;
276 288 }
277 289
278 290 void PolarChartAxisAngular::createItems(int count)
279 291 {
280 292 if (arrowItems().count() == 0) {
281 293 // angular axis line
282 294 QGraphicsEllipseItem *arrow = new QGraphicsEllipseItem(presenter()->rootItem());
283 295 arrow->setPen(axis()->linePen());
284 296 arrowGroup()->addToGroup(arrow);
285 297 }
286 298
287 299 QGraphicsTextItem *title = titleItem();
288 300 title->setFont(axis()->titleFont());
289 301 title->setDefaultTextColor(axis()->titleBrush().color());
290 302 title->setHtml(axis()->titleText());
291 303
292 304 for (int i = 0; i < count; ++i) {
293 305 QGraphicsLineItem *arrow = new QGraphicsLineItem(presenter()->rootItem());
294 306 QGraphicsLineItem *grid = new QGraphicsLineItem(presenter()->rootItem());
295 307 QGraphicsTextItem *label = new QGraphicsTextItem(presenter()->rootItem());
296 308 label->document()->setDocumentMargin(ChartPresenter::textMargin());
297 309 arrow->setPen(axis()->linePen());
298 310 grid->setPen(axis()->gridLinePen());
299 311 label->setFont(axis()->labelsFont());
300 312 label->setDefaultTextColor(axis()->labelsBrush().color());
301 313 label->setRotation(axis()->labelsAngle());
302 314 arrowGroup()->addToGroup(arrow);
303 315 gridGroup()->addToGroup(grid);
304 316 labelGroup()->addToGroup(label);
305 317 if (gridItems().size() == 1 || (((gridItems().size() + 1) % 2) && gridItems().size() > 0)) {
306 318 QGraphicsPathItem *shade = new QGraphicsPathItem(presenter()->rootItem());
307 319 shade->setPen(axis()->shadesPen());
308 320 shade->setBrush(axis()->shadesBrush());
309 321 shadeGroup()->addToGroup(shade);
310 322 }
311 323 }
312 324 }
313 325
314 326 void PolarChartAxisAngular::handleArrowPenChanged(const QPen &pen)
315 327 {
316 328 bool first = true;
317 329 foreach (QGraphicsItem *item, arrowItems()) {
318 330 if (first) {
319 331 first = false;
320 332 // First arrow item is the outer circle of axis
321 333 static_cast<QGraphicsEllipseItem *>(item)->setPen(pen);
322 334 } else {
323 335 static_cast<QGraphicsLineItem *>(item)->setPen(pen);
324 336 }
325 337 }
326 338 }
327 339
328 340 void PolarChartAxisAngular::handleGridPenChanged(const QPen &pen)
329 341 {
330 342 foreach (QGraphicsItem *item, gridItems())
331 343 static_cast<QGraphicsLineItem *>(item)->setPen(pen);
332 344 }
333 345
334 346 void PolarChartAxisAngular::handleMinorArrowPenChanged(const QPen &pen)
335 347 {
336 348 foreach (QGraphicsItem *item, minorArrowItems()) {
337 349 static_cast<QGraphicsLineItem *>(item)->setPen(pen);
338 350 }
339 351 }
340 352
341 353 void PolarChartAxisAngular::handleMinorGridPenChanged(const QPen &pen)
342 354 {
343 355 foreach (QGraphicsItem *item, minorGridItems())
344 356 static_cast<QGraphicsLineItem *>(item)->setPen(pen);
345 357 }
346 358
347 359 QSizeF PolarChartAxisAngular::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
348 360 {
349 361 Q_UNUSED(which);
350 362 Q_UNUSED(constraint);
351 363 return QSizeF(-1, -1);
352 364 }
353 365
354 366 qreal PolarChartAxisAngular::preferredAxisRadius(const QSizeF &maxSize)
355 367 {
356 368 qreal radius = maxSize.height() / 2.0;
357 369 if (maxSize.width() < maxSize.height())
358 370 radius = maxSize.width() / 2.0;
359 371
360 372 if (axis()->labelsVisible()) {
361 373 QVector<qreal> layout = calculateLayout();
362 374 if (layout.isEmpty())
363 375 return radius;
364 376
365 377 createAxisLabels(layout);
366 378 QStringList labelList = labels();
367 379 QFont font = axis()->labelsFont();
368 380
369 381 QRectF maxRect;
370 382 maxRect.setSize(maxSize);
371 383 maxRect.moveCenter(QPointF(0.0, 0.0));
372 384
373 385 // This is a horrible way to find out the maximum radius for angular axis and its labels.
374 386 // It just increments the radius down until everyhing fits the constraint size.
375 387 // Proper way would be to actually calculate it but this seems to work reasonably fast as it is.
376 388 bool nextTickVisible = false;
377 389 for (int i = 0; i < layout.size(); ) {
378 390 if ((i == layout.size() - 1)
379 391 || layout.at(i + 1) < 0.0
380 392 || layout.at(i + 1) > 360.0) {
381 393 nextTickVisible = false;
382 394 } else {
383 395 nextTickVisible = true;
384 396 }
385 397
386 398 qreal labelCoordinate = layout.at(i);
387 399 qreal labelVisible;
388 400
389 401 if (intervalAxis()) {
390 402 qreal farEdge;
391 403 if (i == (layout.size() - 1))
392 404 farEdge = 360.0;
393 405 else
394 406 farEdge = qMin(qreal(360.0), layout.at(i + 1));
395 407
396 408 // Adjust the labelCoordinate to show it if next tick is visible
397 409 if (nextTickVisible)
398 410 labelCoordinate = qMax(qreal(0.0), labelCoordinate);
399 411
400 412 labelCoordinate = (labelCoordinate + farEdge) / 2.0;
401 413 }
402 414
403 415 if (labelCoordinate < 0.0 || labelCoordinate > 360.0)
404 416 labelVisible = false;
405 417 else
406 418 labelVisible = true;
407 419
408 420 if (!labelVisible) {
409 421 i++;
410 422 continue;
411 423 }
412 424
413 425 QRectF boundingRect = ChartPresenter::textBoundingRect(axis()->labelsFont(), labelList.at(i), axis()->labelsAngle());
414 426 QPointF labelPoint = QLineF::fromPolar(radius + tickWidth(), 90.0 - labelCoordinate).p2();
415 427
416 428 boundingRect = moveLabelToPosition(labelCoordinate, labelPoint, boundingRect);
417 429 QRectF intersectRect = maxRect.intersected(boundingRect);
418 430 if (boundingRect.isEmpty() || intersectRect == boundingRect) {
419 431 i++;
420 432 } else {
421 433 qreal reduction(0.0);
422 434 // If there is no intersection, reduce by smallest dimension of label rect to be on the safe side
423 435 if (intersectRect.isEmpty()) {
424 436 reduction = qMin(boundingRect.height(), boundingRect.width());
425 437 } else {
426 438 // Approximate needed radius reduction is the amount label rect exceeds max rect in either dimension.
427 439 // Could be further optimized by figuring out the proper math how to calculate exact needed reduction.
428 440 reduction = qMax(boundingRect.height() - intersectRect.height(),
429 441 boundingRect.width() - intersectRect.width());
430 442 }
431 443 // Typically the approximated reduction is little low, so add one
432 444 radius -= (reduction + 1.0);
433 445
434 446 if (radius < 1.0) // safeguard
435 447 return 1.0;
436 448 }
437 449 }
438 450 }
439 451
440 452 if (!axis()->titleText().isEmpty() && axis()->isTitleVisible()) {
441 453 QRectF titleRect = ChartPresenter::textBoundingRect(axis()->titleFont(), axis()->titleText());
442 454
443 455 radius -= titlePadding() + (titleRect.height() / 2.0);
444 456 if (radius < 1.0) // safeguard
445 457 return 1.0;
446 458 }
447 459
448 460 return radius;
449 461 }
450 462
451 463 QRectF PolarChartAxisAngular::moveLabelToPosition(qreal angularCoordinate, QPointF labelPoint, QRectF labelRect) const
452 464 {
453 465 if (angularCoordinate == 0.0)
454 466 labelRect.moveCenter(labelPoint + QPointF(0, -labelRect.height() / 2.0));
455 467 else if (angularCoordinate < 90.0)
456 468 labelRect.moveBottomLeft(labelPoint);
457 469 else if (angularCoordinate == 90.0)
458 470 labelRect.moveCenter(labelPoint + QPointF(labelRect.width() / 2.0 + 2.0, 0)); // +2 so that it does not hit the radial axis
459 471 else if (angularCoordinate < 180.0)
460 472 labelRect.moveTopLeft(labelPoint);
461 473 else if (angularCoordinate == 180.0)
462 474 labelRect.moveCenter(labelPoint + QPointF(0, labelRect.height() / 2.0));
463 475 else if (angularCoordinate < 270.0)
464 476 labelRect.moveTopRight(labelPoint);
465 477 else if (angularCoordinate == 270.0)
466 478 labelRect.moveCenter(labelPoint + QPointF(-labelRect.width() / 2.0 - 2.0, 0)); // -2 so that it does not hit the radial axis
467 479 else if (angularCoordinate < 360.0)
468 480 labelRect.moveBottomRight(labelPoint);
469 481 else
470 482 labelRect.moveCenter(labelPoint + QPointF(0, -labelRect.height() / 2.0));
471 483 return labelRect;
472 484 }
473 485
474 486 void PolarChartAxisAngular::updateMinorTickItems()
475 487 {
476 488 QValueAxis *valueAxis = qobject_cast<QValueAxis *>(this->axis());
477 489 if (valueAxis) {
478 490 int currentCount = minorArrowItems().size();
479 491 int expectedCount = valueAxis->minorTickCount() * (valueAxis->tickCount() - 1);
480 492 int diff = expectedCount - currentCount;
481 493 if (diff > 0) {
482 494 for (int i = 0; i < diff; i++) {
483 495 QGraphicsLineItem *minorArrow = new QGraphicsLineItem(presenter()->rootItem());
484 496 QGraphicsLineItem *minorGrid = new QGraphicsLineItem(presenter()->rootItem());
485 497 minorArrow->setPen(valueAxis->linePen());
486 498 minorGrid->setPen(valueAxis->minorGridLinePen());
487 499 minorArrowGroup()->addToGroup(minorArrow);
488 500 minorGridGroup()->addToGroup(minorGrid);
489 501 }
490 502 } else {
491 503 QList<QGraphicsItem *> minorGridLines = minorGridItems();
492 504 QList<QGraphicsItem *> minorArrows = minorArrowItems();
493 505 for (int i = 0; i > diff; i--) {
494 506 if (!minorGridLines.isEmpty())
495 507 delete(minorGridLines.takeLast());
496 508 if (!minorArrows.isEmpty())
497 509 delete(minorArrows.takeLast());
498 510 }
499 511 }
500 512 }
501 513 }
502 514
503 515
504 516 #include "moc_polarchartaxisangular_p.cpp"
505 517
506 518 QT_CHARTS_END_NAMESPACE
@@ -1,369 +1,381
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2015 The Qt Company Ltd
4 4 ** All rights reserved.
5 5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 6 **
7 7 ** This file is part of the Qt Charts module.
8 8 **
9 9 ** Licensees holding valid commercial license for Qt may use this file in
10 10 ** accordance with the Qt License Agreement provided with the Software
11 11 ** or, alternatively, in accordance with the terms contained in a written
12 12 ** agreement between you and The Qt Company.
13 13 **
14 14 ** If you have questions regarding the use of this file, please use
15 15 ** contact form at http://qt.io
16 16 **
17 17 ****************************************************************************/
18 18
19 19 #include <private/polarchartaxisradial_p.h>
20 20 #include <private/chartpresenter_p.h>
21 21 #include <private/abstractchartlayout_p.h>
22 22 #include <private/qabstractaxis_p.h>
23 23 #include <private/linearrowitem_p.h>
24 #include <QtCharts/QCategoryAxis>
24 25 #include <QtGui/QTextDocument>
25 26
26 27 QT_CHARTS_BEGIN_NAMESPACE
27 28
28 29 PolarChartAxisRadial::PolarChartAxisRadial(QAbstractAxis *axis, QGraphicsItem *item, bool intervalAxis)
29 30 : PolarChartAxis(axis, item, intervalAxis)
30 31 {
31 32 }
32 33
33 34 PolarChartAxisRadial::~PolarChartAxisRadial()
34 35 {
35 36 }
36 37
37 38 void PolarChartAxisRadial::updateGeometry()
38 39 {
39 40 const QVector<qreal> &layout = this->layout();
40 41 if (layout.isEmpty())
41 42 return;
42 43
43 44 createAxisLabels(layout);
44 45 QStringList labelList = labels();
45 46 QPointF center = axisGeometry().center();
46 47 QList<QGraphicsItem *> arrowItemList = arrowItems();
47 48 QList<QGraphicsItem *> gridItemList = gridItems();
48 49 QList<QGraphicsItem *> labelItemList = labelItems();
49 50 QList<QGraphicsItem *> shadeItemList = shadeItems();
50 51 QList<QGraphicsItem *> minorGridItemList = minorGridItems();
51 52 QList<QGraphicsItem *> minorArrowItemList = minorArrowItems();
52 53 QGraphicsTextItem* title = titleItem();
53 54 qreal radius = axisGeometry().height() / 2.0;
54 55
55 56 QLineF line(center, center + QPointF(0, -radius));
56 57 QGraphicsLineItem *axisLine = static_cast<QGraphicsLineItem *>(arrowItemList.at(0));
57 58 axisLine->setLine(line);
58 59
59 60 QRectF previousLabelRect;
60 61 bool firstShade = true;
61 62 bool nextTickVisible = false;
62 63 if (layout.size())
63 64 nextTickVisible = !(layout.at(0) < 0.0 || layout.at(0) > radius);
64 65
65 66 for (int i = 0; i < layout.size(); ++i) {
66 67 qreal radialCoordinate = layout.at(i);
67 68
68 69 QGraphicsEllipseItem *gridItem = static_cast<QGraphicsEllipseItem *>(gridItemList.at(i));
69 70 QGraphicsLineItem *tickItem = static_cast<QGraphicsLineItem *>(arrowItemList.at(i + 1));
70 71 QGraphicsTextItem *labelItem = static_cast<QGraphicsTextItem *>(labelItemList.at(i));
71 72 QGraphicsPathItem *shadeItem = 0;
72 73 if (i == 0)
73 74 shadeItem = static_cast<QGraphicsPathItem *>(shadeItemList.at(0));
74 75 else if (i % 2)
75 76 shadeItem = static_cast<QGraphicsPathItem *>(shadeItemList.at((i / 2) + 1));
76 77
77 78 // Ignore ticks outside valid range
78 79 bool currentTickVisible = nextTickVisible;
79 80 if ((i == layout.size() - 1)
80 81 || layout.at(i + 1) < 0.0
81 82 || layout.at(i + 1) > radius) {
82 83 nextTickVisible = false;
83 84 } else {
84 85 nextTickVisible = true;
85 86 }
86 87
87 88 qreal labelCoordinate = radialCoordinate;
88 qreal labelVisible = currentTickVisible;
89 bool labelVisible = currentTickVisible;
89 90 qreal labelPad = labelPadding() / 2.0;
91 bool centeredLabel = true; // Only used with interval axes
90 92 if (intervalAxis()) {
91 93 qreal farEdge;
92 94 if (i == (layout.size() - 1))
93 95 farEdge = radius;
94 96 else
95 97 farEdge = qMin(radius, layout.at(i + 1));
96 98
97 99 // Adjust the labelCoordinate to show it if next tick is visible
98 100 if (nextTickVisible)
99 101 labelCoordinate = qMax(qreal(0.0), labelCoordinate);
100 102
101 labelCoordinate = (labelCoordinate + farEdge) / 2.0;
102 if (labelCoordinate > 0.0 && labelCoordinate < radius)
103 labelVisible = true;
104 else
105 labelVisible = false;
103 if (axis()->type() == QAbstractAxis::AxisTypeCategory) {
104 QCategoryAxis *categoryAxis = static_cast<QCategoryAxis *>(axis());
105 if (categoryAxis->labelsPosition() == QCategoryAxis::AxisLabelsPositionOnValue)
106 centeredLabel = false;
107 }
108 if (centeredLabel) {
109 labelCoordinate = (labelCoordinate + farEdge) / 2.0;
110 if (labelCoordinate > 0.0 && labelCoordinate < radius)
111 labelVisible = true;
112 else
113 labelVisible = false;
114 } else {
115 labelVisible = nextTickVisible;
116 labelCoordinate = farEdge;
117 }
106 118 }
107 119
108 120 // Radial axis label
109 121 if (axis()->labelsVisible() && labelVisible) {
110 122 QRectF boundingRect = ChartPresenter::textBoundingRect(axis()->labelsFont(),
111 123 labelList.at(i),
112 124 axis()->labelsAngle());
113 125 labelItem->setTextWidth(boundingRect.width());
114 126 labelItem->setHtml(labelList.at(i));
115 127 QRectF labelRect = labelItem->boundingRect();
116 128 QPointF labelCenter = labelRect.center();
117 129 labelItem->setTransformOriginPoint(labelCenter.x(), labelCenter.y());
118 130 boundingRect.moveCenter(labelCenter);
119 131 QPointF positionDiff(labelRect.topLeft() - boundingRect.topLeft());
120 132 QPointF labelPoint = center;
121 if (intervalAxis())
133 if (intervalAxis() && centeredLabel)
122 134 labelPoint += QPointF(labelPad, -labelCoordinate - (boundingRect.height() / 2.0));
123 135 else
124 136 labelPoint += QPointF(labelPad, labelPad - labelCoordinate);
125 137 labelRect.moveTopLeft(labelPoint);
126 138 labelItem->setPos(labelRect.topLeft() + positionDiff);
127 139
128 140 // Label overlap detection
129 141 labelRect.setSize(boundingRect.size());
130 142 if ((i && previousLabelRect.intersects(labelRect))
131 143 || !axisGeometry().contains(labelRect)) {
132 144 labelVisible = false;
133 145 } else {
134 146 previousLabelRect = labelRect;
135 147 labelVisible = true;
136 148 }
137 149 }
138 150
139 151 labelItem->setVisible(labelVisible);
140 152 if (!currentTickVisible) {
141 153 gridItem->setVisible(false);
142 154 tickItem->setVisible(false);
143 155 if (shadeItem)
144 156 shadeItem->setVisible(false);
145 157 continue;
146 158 }
147 159
148 160 // Radial grid line
149 161 QRectF gridRect;
150 162 gridRect.setWidth(radialCoordinate * 2.0);
151 163 gridRect.setHeight(radialCoordinate * 2.0);
152 164 gridRect.moveCenter(center);
153 165
154 166 gridItem->setRect(gridRect);
155 167 gridItem->setVisible(true);
156 168
157 169 // Tick
158 170 QLineF tickLine(-tickWidth(), 0.0, tickWidth(), 0.0);
159 171 tickLine.translate(center.rx(), gridRect.top());
160 172 tickItem->setLine(tickLine);
161 173 tickItem->setVisible(true);
162 174
163 175 // Shades
164 176 if (i % 2 || (i == 0 && !nextTickVisible)) {
165 177 QPainterPath path;
166 178 if (i == 0) {
167 179 // If first tick is also the last, we need to custom fill the inner circle
168 180 // or it won't get filled.
169 181 QRectF innerCircle(0.0, 0.0, layout.at(0) * 2.0, layout.at(0) * 2.0);
170 182 innerCircle.moveCenter(center);
171 183 path.addEllipse(innerCircle);
172 184 } else {
173 185 QRectF otherGridRect;
174 186 if (!nextTickVisible) { // Last visible tick
175 187 otherGridRect = axisGeometry();
176 188 } else {
177 189 qreal otherGridRectDimension = layout.at(i + 1) * 2.0;
178 190 otherGridRect.setWidth(otherGridRectDimension);
179 191 otherGridRect.setHeight(otherGridRectDimension);
180 192 otherGridRect.moveCenter(center);
181 193 }
182 194 path.addEllipse(gridRect);
183 195 path.addEllipse(otherGridRect);
184 196
185 197 // Add additional shading in first visible shade item if there is a partial tick
186 198 // to be filled at the center (log & category axes)
187 199 if (firstShade) {
188 200 QGraphicsPathItem *specialShadeItem = static_cast<QGraphicsPathItem *>(shadeItemList.at(0));
189 201 if (layout.at(i - 1) > 0.0) {
190 202 QRectF innerCircle(0.0, 0.0, layout.at(i - 1) * 2.0, layout.at(i - 1) * 2.0);
191 203 innerCircle.moveCenter(center);
192 204 QPainterPath specialPath;
193 205 specialPath.addEllipse(innerCircle);
194 206 specialShadeItem->setPath(specialPath);
195 207 specialShadeItem->setVisible(true);
196 208 } else {
197 209 specialShadeItem->setVisible(false);
198 210 }
199 211 }
200 212 }
201 213 shadeItem->setPath(path);
202 214 shadeItem->setVisible(true);
203 215 firstShade = false;
204 216 }
205 217
206 218 // Minor ticks
207 219 QValueAxis *valueAxis = qobject_cast<QValueAxis *>(axis());
208 220 if ((i + 1) != layout.size() && valueAxis) {
209 221 int minorTickCount = valueAxis->minorTickCount();
210 222 if (minorTickCount != 0) {
211 223 qreal minorRadialCoordinate = (layout[i + 1] - layout[i])
212 224 / qreal(minorTickCount + 1) * 2.0;
213 225 for (int j = 0; j < minorTickCount; j++) {
214 226 QGraphicsEllipseItem *minorGridItem =
215 227 static_cast<QGraphicsEllipseItem *>(minorGridItemList.at(i * minorTickCount + j));
216 228 QGraphicsLineItem *minorTickItem =
217 229 static_cast<QGraphicsLineItem *>(minorArrowItemList.at(i * minorTickCount + j));
218 230
219 231 QRectF minorGridRect;
220 232 minorGridRect.setWidth(minorRadialCoordinate * qreal(i + 1)
221 233 + minorRadialCoordinate * qreal(i * minorTickCount + j));
222 234 minorGridRect.setHeight(minorRadialCoordinate * qreal(i + 1)
223 235 + minorRadialCoordinate
224 236 * qreal(i * minorTickCount + j));
225 237 minorGridRect.moveCenter(center);
226 238 minorGridItem->setRect(minorGridRect);
227 239 minorGridItem->setVisible(true);
228 240
229 241 QLineF minorTickLine(-tickWidth() + 1, 0.0, tickWidth() - 1, 0.0);
230 242 tickLine.translate(center.rx(), minorGridRect.top());
231 243 minorTickItem->setLine(minorTickLine);
232 244 minorTickItem->setVisible(true);
233 245 }
234 246 }
235 247 }
236 248 }
237 249
238 250 // Title, along the 0 axis
239 251 QString titleText = axis()->titleText();
240 252 if (!titleText.isEmpty() && axis()->isTitleVisible()) {
241 253 QRectF truncatedRect;
242 254 title->setHtml(ChartPresenter::truncatedText(axis()->titleFont(), titleText, qreal(0.0),
243 255 radius, radius, truncatedRect));
244 256 title->setTextWidth(truncatedRect.width());
245 257
246 258 QRectF titleBoundingRect = title->boundingRect();
247 259 QPointF titleCenter = titleBoundingRect.center();
248 260 QPointF arrowCenter = axisLine->boundingRect().center();
249 261 QPointF titleCenterDiff = arrowCenter - titleCenter;
250 262 title->setPos(titleCenterDiff.x() - titlePadding() - (titleBoundingRect.height() / 2.0), titleCenterDiff.y());
251 263 title->setTransformOriginPoint(titleCenter);
252 264 title->setRotation(270.0);
253 265 }
254 266
255 267 QGraphicsLayoutItem::updateGeometry();
256 268 }
257 269
258 270 Qt::Orientation PolarChartAxisRadial::orientation() const
259 271 {
260 272 return Qt::Vertical;
261 273 }
262 274
263 275 void PolarChartAxisRadial::createItems(int count)
264 276 {
265 277 if (arrowItems().count() == 0) {
266 278 // radial axis center line
267 279 QGraphicsLineItem *arrow = new LineArrowItem(this, presenter()->rootItem());
268 280 arrow->setPen(axis()->linePen());
269 281 arrowGroup()->addToGroup(arrow);
270 282 }
271 283
272 284 QGraphicsTextItem *title = titleItem();
273 285 title->setFont(axis()->titleFont());
274 286 title->setDefaultTextColor(axis()->titleBrush().color());
275 287 title->setHtml(axis()->titleText());
276 288
277 289 for (int i = 0; i < count; ++i) {
278 290 QGraphicsLineItem *arrow = new QGraphicsLineItem(presenter()->rootItem());
279 291 QGraphicsEllipseItem *grid = new QGraphicsEllipseItem(presenter()->rootItem());
280 292 QGraphicsTextItem *label = new QGraphicsTextItem(presenter()->rootItem());
281 293 label->document()->setDocumentMargin(ChartPresenter::textMargin());
282 294 arrow->setPen(axis()->linePen());
283 295 grid->setPen(axis()->gridLinePen());
284 296 label->setFont(axis()->labelsFont());
285 297 label->setDefaultTextColor(axis()->labelsBrush().color());
286 298 label->setRotation(axis()->labelsAngle());
287 299 arrowGroup()->addToGroup(arrow);
288 300 gridGroup()->addToGroup(grid);
289 301 labelGroup()->addToGroup(label);
290 302 if (gridItems().size() == 1 || (((gridItems().size() + 1) % 2) && gridItems().size() > 0)) {
291 303 QGraphicsPathItem *shade = new QGraphicsPathItem(presenter()->rootItem());
292 304 shade->setPen(axis()->shadesPen());
293 305 shade->setBrush(axis()->shadesBrush());
294 306 shadeGroup()->addToGroup(shade);
295 307 }
296 308 }
297 309 }
298 310
299 311 void PolarChartAxisRadial::handleArrowPenChanged(const QPen &pen)
300 312 {
301 313 foreach (QGraphicsItem *item, arrowItems())
302 314 static_cast<QGraphicsLineItem *>(item)->setPen(pen);
303 315 }
304 316
305 317 void PolarChartAxisRadial::handleGridPenChanged(const QPen &pen)
306 318 {
307 319 foreach (QGraphicsItem *item, gridItems())
308 320 static_cast<QGraphicsEllipseItem *>(item)->setPen(pen);
309 321 }
310 322
311 323 void PolarChartAxisRadial::handleMinorArrowPenChanged(const QPen &pen)
312 324 {
313 325 foreach (QGraphicsItem *item, minorArrowItems())
314 326 static_cast<QGraphicsLineItem *>(item)->setPen(pen);
315 327 }
316 328
317 329 void PolarChartAxisRadial::handleMinorGridPenChanged(const QPen &pen)
318 330 {
319 331 foreach (QGraphicsItem *item, minorGridItems())
320 332 static_cast<QGraphicsEllipseItem *>(item)->setPen(pen);
321 333 }
322 334
323 335 QSizeF PolarChartAxisRadial::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
324 336 {
325 337 Q_UNUSED(which);
326 338 Q_UNUSED(constraint);
327 339 return QSizeF(-1.0, -1.0);
328 340 }
329 341
330 342 qreal PolarChartAxisRadial::preferredAxisRadius(const QSizeF &maxSize)
331 343 {
332 344 qreal radius = maxSize.height() / 2.0;
333 345 if (maxSize.width() < maxSize.height())
334 346 radius = maxSize.width() / 2.0;
335 347 return radius;
336 348 }
337 349
338 350 void PolarChartAxisRadial::updateMinorTickItems()
339 351 {
340 352 QValueAxis *valueAxis = qobject_cast<QValueAxis *>(this->axis());
341 353 if (valueAxis) {
342 354 int currentCount = minorArrowItems().size();
343 355 int expectedCount = valueAxis->minorTickCount() * (valueAxis->tickCount() - 1);
344 356 int diff = expectedCount - currentCount;
345 357 if (diff > 0) {
346 358 for (int i = 0; i < diff; i++) {
347 359 QGraphicsLineItem *minorArrow = new QGraphicsLineItem(presenter()->rootItem());
348 360 QGraphicsEllipseItem *minorGrid = new QGraphicsEllipseItem(presenter()->rootItem());
349 361 minorArrow->setPen(valueAxis->linePen());
350 362 minorGrid->setPen(valueAxis->minorGridLinePen());
351 363 minorArrowGroup()->addToGroup(minorArrow);
352 364 minorGridGroup()->addToGroup(minorGrid);
353 365 }
354 366 } else {
355 367 QList<QGraphicsItem *> minorGridLines = minorGridItems();
356 368 QList<QGraphicsItem *> minorArrows = minorArrowItems();
357 369 for (int i = 0; i > diff; i--) {
358 370 if (!minorGridLines.isEmpty())
359 371 delete(minorGridLines.takeLast());
360 372 if (!minorArrows.isEmpty())
361 373 delete(minorArrows.takeLast());
362 374 }
363 375 }
364 376 }
365 377 }
366 378
367 379 #include "moc_polarchartaxisradial_p.cpp"
368 380
369 381 QT_CHARTS_END_NAMESPACE
@@ -1,1235 +1,1288
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2015 The Qt Company Ltd
4 4 ** All rights reserved.
5 5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 6 **
7 7 ** This file is part of the Qt Charts module.
8 8 **
9 9 ** Licensees holding valid commercial license for Qt may use this file in
10 10 ** accordance with the Qt License Agreement provided with the Software
11 11 ** or, alternatively, in accordance with the terms contained in a written
12 12 ** agreement between you and The Qt Company.
13 13 **
14 14 ** If you have questions regarding the use of this file, please use
15 15 ** contact form at http://qt.io
16 16 **
17 17 ****************************************************************************/
18 18
19 19 #include "mainwindow.h"
20 20 #include "chartview.h"
21 21 #include <QtCharts/QScatterSeries>
22 22 #include <QtCharts/QLineSeries>
23 23 #include <QtCharts/QSplineSeries>
24 24 #include <QtCharts/QAreaSeries>
25 25 #include <QtCharts/QBarSeries>
26 26 #include <QtCharts/QBarSet>
27 27 #include <QtCharts/QValueAxis>
28 28 #include <QtCharts/QLogValueAxis>
29 29 #include <QtCharts/QDateTimeAxis>
30 30 #include <QtCharts/QCategoryAxis>
31 31 #include <QtCharts/QPolarChart>
32 32 #include <QtCore/QDebug>
33 33 #include <QtCore/QtMath>
34 34 #include <QtCore/QDateTime>
35 35
36 36 QT_CHARTS_USE_NAMESPACE
37 37 #include "ui_mainwindow.h"
38 38
39 39 MainWindow::MainWindow(QWidget *parent) :
40 40 QMainWindow(parent),
41 41 ui(new Ui::MainWindow),
42 42 m_angularTickCount(9),
43 43 m_radialTickCount(11),
44 44 m_labelsAngle(0),
45 45 m_angularMin(0.0),
46 46 m_angularMax(40000.0),
47 47 m_radialMin(0.0),
48 48 m_radialMax(30000.0),
49 49 m_angularShadesVisible(false),
50 50 m_radialShadesVisible(false),
51 51 m_labelsVisible(true),
52 52 m_titleVisible(true),
53 53 m_gridVisible(true),
54 54 m_arrowVisible(true),
55 55 m_minorGridVisible(true),
56 56 m_minorArrowVisible(true),
57 57 m_angularShadesBrush(new QBrush(Qt::NoBrush)),
58 58 m_radialShadesBrush(new QBrush(Qt::NoBrush)),
59 59 m_labelBrush(new QBrush(Qt::black)),
60 60 m_titleBrush(new QBrush(Qt::black)),
61 61 m_backgroundBrush(new QBrush(Qt::white)),
62 62 m_plotAreaBackgroundBrush(new QBrush(Qt::NoBrush)),
63 63 m_angularShadesPen(new QPen(Qt::NoPen)),
64 64 m_radialShadesPen(new QPen(Qt::NoPen)),
65 65 m_gridPen(new QPen(QRgb(0x010101))), // Note: Pure black is default color, so it gets overridden by
66 66 m_arrowPen(new QPen(QRgb(0x010101))), // default theme if set to that initially. This is an example of workaround.
67 67 m_minorGridPen(new QPen(QBrush(QRgb(0x010101)), 1, Qt::DashLine)),
68 68 m_backgroundPen(new QPen(Qt::NoPen)),
69 69 m_plotAreaBackgroundPen(new QPen(Qt::NoPen)),
70 70 m_labelFormat(QString("%.2f")),
71 71 m_animationOptions(QChart::NoAnimation),
72 72 m_angularTitle(QString("Angular Title")),
73 73 m_radialTitle(QString("Radial Title")),
74 74 m_base(2.0),
75 75 m_dateFormat(QString("mm-ss-zzz")),
76 76 m_chart(0),
77 77 m_angularAxis(0),
78 78 m_radialAxis(0),
79 79 m_angularAxisMode(AxisModeNone),
80 80 m_radialAxisMode(AxisModeNone),
81 81 m_moreCategories(false),
82 82 m_series1(0),
83 83 m_series2(0),
84 84 m_series3(0),
85 85 m_series4(0),
86 86 m_series5(0),
87 87 m_series6(0),
88 88 m_series7(0)
89 89 {
90 90 ui->setupUi(this);
91 91
92 92 ui->angularTicksSpin->setValue(m_angularTickCount);
93 93 ui->radialTicksSpin->setValue(m_radialTickCount);
94 94 ui->anglesSpin->setValue(m_labelsAngle);
95 95 ui->radialMinSpin->setValue(m_radialMin);
96 96 ui->radialMaxSpin->setValue(m_radialMax);
97 97 ui->angularMinSpin->setValue(m_angularMin);
98 98 ui->angularMaxSpin->setValue(m_angularMax);
99 99 ui->angularShadesComboBox->setCurrentIndex(0);
100 100 ui->radialShadesComboBox->setCurrentIndex(0);
101 101 ui->labelFormatEdit->setText(m_labelFormat);
102 102 ui->dateFormatEdit->setText(m_dateFormat);
103 103 ui->moreCategoriesCheckBox->setChecked(m_moreCategories);
104 104
105 105 ui->series1checkBox->setChecked(true);
106 106 ui->series2checkBox->setChecked(true);
107 107 ui->series3checkBox->setChecked(true);
108 108 ui->series4checkBox->setChecked(true);
109 109 ui->series5checkBox->setChecked(true);
110 110 ui->series6checkBox->setChecked(true);
111 111 ui->series7checkBox->setChecked(true);
112 112
113 113 m_currentLabelFont.setFamily(ui->labelFontComboBox->currentFont().family());
114 114 m_currentLabelFont.setPixelSize(15);
115 115 m_currentTitleFont.setFamily(ui->titleFontComboBox->currentFont().family());
116 116 m_currentTitleFont.setPixelSize(30);
117 117
118 118 ui->labelFontSizeSpin->setValue(m_currentLabelFont.pixelSize());
119 119 ui->titleFontSizeSpin->setValue(m_currentTitleFont.pixelSize());
120 120
121 121 ui->logBaseSpin->setValue(m_base);
122 122
123 123 initXYValueChart();
124 124 setAngularAxis(AxisModeValue);
125 125 setRadialAxis(AxisModeValue);
126 126
127 127 ui->angularAxisComboBox->setCurrentIndex(int(m_angularAxisMode));
128 128 ui->radialAxisComboBox->setCurrentIndex(int(m_radialAxisMode));
129 129
130 connect(ui->angularTicksSpin, SIGNAL(valueChanged(int)), this, SLOT(angularTicksChanged(int)));
131 connect(ui->radialTicksSpin, SIGNAL(valueChanged(int)), this, SLOT(radialTicksChanged(int)));
132 connect(ui->angularMinorTicksSpin, SIGNAL(valueChanged(int)), this, SLOT(angularMinorTicksChanged(int)));
133 connect(ui->radialMinorTicksSpin, SIGNAL(valueChanged(int)), this, SLOT(radialMinorTicksChanged(int)));
134 connect(ui->anglesSpin, SIGNAL(valueChanged(int)), this, SLOT(anglesChanged(int)));
135 connect(ui->radialMinSpin, SIGNAL(valueChanged(double)), this, SLOT(radialMinChanged(double)));
136 connect(ui->radialMaxSpin, SIGNAL(valueChanged(double)), this, SLOT(radialMaxChanged(double)));
137 connect(ui->angularMinSpin, SIGNAL(valueChanged(double)), this, SLOT(angularMinChanged(double)));
138 connect(ui->angularMaxSpin, SIGNAL(valueChanged(double)), this, SLOT(angularMaxChanged(double)));
139 connect(ui->angularShadesComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(angularShadesIndexChanged(int)));
140 connect(ui->radialShadesComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(radialShadesIndexChanged(int)));
141 connect(ui->animationsComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(animationIndexChanged(int)));
142 connect(ui->labelFormatEdit, SIGNAL(textEdited(QString)), this, SLOT(labelFormatEdited(QString)));
143 connect(ui->labelFontComboBox, SIGNAL(currentFontChanged(QFont)), this, SLOT(labelFontChanged(QFont)));
144 connect(ui->labelFontSizeSpin, SIGNAL(valueChanged(int)), this, SLOT(labelFontSizeChanged(int)));
145 connect(ui->labelComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(labelsIndexChanged(int)));
146 connect(ui->titleFontComboBox, SIGNAL(currentFontChanged(QFont)), this, SLOT(titleFontChanged(QFont)));
147 connect(ui->titleFontSizeSpin, SIGNAL(valueChanged(int)), this, SLOT(titleFontSizeChanged(int)));
148 connect(ui->titleComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(titleIndexChanged(int)));
149 connect(ui->gridComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(gridIndexChanged(int)));
150 connect(ui->minorGridComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(minorGridIndexChanged(int)));
151 connect(ui->arrowComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(arrowIndexChanged(int)));
152 connect(ui->logBaseSpin, SIGNAL(valueChanged(double)), this, SLOT(logBaseChanged(double)));
153 connect(ui->angularAxisComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(angularAxisIndexChanged(int)));
154 connect(ui->radialAxisComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(radialAxisIndexChanged(int)));
155 connect(ui->niceNumbersCheckBox, SIGNAL(clicked()), this, SLOT(niceNumbersChecked()));
156 connect(ui->dateFormatEdit, SIGNAL(textEdited(QString)), this, SLOT(dateFormatEdited(QString)));
157 connect(ui->moreCategoriesCheckBox, SIGNAL(clicked()), this, SLOT(moreCategoriesChecked()));
158 connect(ui->series1checkBox, SIGNAL(clicked()), this, SLOT(series1CheckBoxChecked()));
159 connect(ui->series2checkBox, SIGNAL(clicked()), this, SLOT(series2CheckBoxChecked()));
160 connect(ui->series3checkBox, SIGNAL(clicked()), this, SLOT(series3CheckBoxChecked()));
161 connect(ui->series4checkBox, SIGNAL(clicked()), this, SLOT(series4CheckBoxChecked()));
162 connect(ui->series5checkBox, SIGNAL(clicked()), this, SLOT(series5CheckBoxChecked()));
163 connect(ui->series6checkBox, SIGNAL(clicked()), this, SLOT(series6CheckBoxChecked()));
164 connect(ui->series7checkBox, SIGNAL(clicked()), this, SLOT(series7CheckBoxChecked()));
165 connect(ui->themeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(themeIndexChanged(int)));
166 connect(ui->backgroundComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(backgroundIndexChanged(int)));
167 connect(ui->plotAreaComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(plotAreaIndexChanged(int)));
130 connect(ui->angularTicksSpin, SIGNAL(valueChanged(int)),
131 this, SLOT(angularTicksChanged(int)));
132 connect(ui->radialTicksSpin, SIGNAL(valueChanged(int)),
133 this, SLOT(radialTicksChanged(int)));
134 connect(ui->angularMinorTicksSpin, SIGNAL(valueChanged(int)),
135 this, SLOT(angularMinorTicksChanged(int)));
136 connect(ui->radialMinorTicksSpin, SIGNAL(valueChanged(int)),
137 this, SLOT(radialMinorTicksChanged(int)));
138 connect(ui->anglesSpin, SIGNAL(valueChanged(int)),
139 this, SLOT(anglesChanged(int)));
140 connect(ui->radialMinSpin, SIGNAL(valueChanged(double)),
141 this, SLOT(radialMinChanged(double)));
142 connect(ui->radialMaxSpin, SIGNAL(valueChanged(double)),
143 this, SLOT(radialMaxChanged(double)));
144 connect(ui->angularMinSpin, SIGNAL(valueChanged(double)),
145 this, SLOT(angularMinChanged(double)));
146 connect(ui->angularMaxSpin, SIGNAL(valueChanged(double)),
147 this, SLOT(angularMaxChanged(double)));
148 connect(ui->angularShadesComboBox, SIGNAL(currentIndexChanged(int)),
149 this, SLOT(angularShadesIndexChanged(int)));
150 connect(ui->radialShadesComboBox, SIGNAL(currentIndexChanged(int)),
151 this, SLOT(radialShadesIndexChanged(int)));
152 connect(ui->animationsComboBox, SIGNAL(currentIndexChanged(int)),
153 this, SLOT(animationIndexChanged(int)));
154 connect(ui->labelFormatEdit, SIGNAL(textEdited(QString)),
155 this, SLOT(labelFormatEdited(QString)));
156 connect(ui->labelFontComboBox, SIGNAL(currentFontChanged(QFont)),
157 this, SLOT(labelFontChanged(QFont)));
158 connect(ui->labelFontSizeSpin, SIGNAL(valueChanged(int)),
159 this, SLOT(labelFontSizeChanged(int)));
160 connect(ui->labelComboBox, SIGNAL(currentIndexChanged(int)),
161 this, SLOT(labelsIndexChanged(int)));
162 connect(ui->titleFontComboBox, SIGNAL(currentFontChanged(QFont)),
163 this, SLOT(titleFontChanged(QFont)));
164 connect(ui->titleFontSizeSpin, SIGNAL(valueChanged(int)),
165 this, SLOT(titleFontSizeChanged(int)));
166 connect(ui->titleComboBox, SIGNAL(currentIndexChanged(int)),
167 this, SLOT(titleIndexChanged(int)));
168 connect(ui->gridComboBox, SIGNAL(currentIndexChanged(int)),
169 this, SLOT(gridIndexChanged(int)));
170 connect(ui->minorGridComboBox, SIGNAL(currentIndexChanged(int)),
171 this, SLOT(minorGridIndexChanged(int)));
172 connect(ui->arrowComboBox, SIGNAL(currentIndexChanged(int)),
173 this, SLOT(arrowIndexChanged(int)));
174 connect(ui->logBaseSpin, SIGNAL(valueChanged(double)),
175 this, SLOT(logBaseChanged(double)));
176 connect(ui->angularAxisComboBox, SIGNAL(currentIndexChanged(int)),
177 this, SLOT(angularAxisIndexChanged(int)));
178 connect(ui->radialAxisComboBox, SIGNAL(currentIndexChanged(int)),
179 this, SLOT(radialAxisIndexChanged(int)));
180 connect(ui->niceNumbersCheckBox, SIGNAL(clicked()),
181 this, SLOT(niceNumbersChecked()));
182 connect(ui->dateFormatEdit, SIGNAL(textEdited(QString)),
183 this, SLOT(dateFormatEdited(QString)));
184 connect(ui->moreCategoriesCheckBox, SIGNAL(clicked()),
185 this, SLOT(moreCategoriesChecked()));
186 connect(ui->categoryLabelLocationCheckBox, SIGNAL(clicked()),
187 this, SLOT(categoryLabelLocationChecked()));
188 connect(ui->series1checkBox, SIGNAL(clicked()),
189 this, SLOT(series1CheckBoxChecked()));
190 connect(ui->series2checkBox, SIGNAL(clicked()),
191 this, SLOT(series2CheckBoxChecked()));
192 connect(ui->series3checkBox, SIGNAL(clicked()),
193 this, SLOT(series3CheckBoxChecked()));
194 connect(ui->series4checkBox, SIGNAL(clicked()),
195 this, SLOT(series4CheckBoxChecked()));
196 connect(ui->series5checkBox, SIGNAL(clicked()),
197 this, SLOT(series5CheckBoxChecked()));
198 connect(ui->series6checkBox, SIGNAL(clicked()),
199 this, SLOT(series6CheckBoxChecked()));
200 connect(ui->series7checkBox, SIGNAL(clicked()),
201 this, SLOT(series7CheckBoxChecked()));
202 connect(ui->themeComboBox, SIGNAL(currentIndexChanged(int)),
203 this, SLOT(themeIndexChanged(int)));
204 connect(ui->backgroundComboBox, SIGNAL(currentIndexChanged(int)),
205 this, SLOT(backgroundIndexChanged(int)));
206 connect(ui->plotAreaComboBox, SIGNAL(currentIndexChanged(int)),
207 this, SLOT(plotAreaIndexChanged(int)));
168 208
169 209 ui->chartView->setChart(m_chart);
170 210 ui->chartView->setRenderHint(QPainter::Antialiasing);
171 211 }
172 212
173 213 MainWindow::~MainWindow()
174 214 {
175 215 delete ui;
176 216 delete m_angularShadesBrush;
177 217 delete m_radialShadesBrush;
178 218 delete m_angularShadesPen;
179 219 delete m_radialShadesPen;
180 220 }
181 221
182 222 void MainWindow::initXYValueChart()
183 223 {
184 224 qreal seriesAngularMin = 1;
185 225 qreal seriesAngularMax = 46000;
186 226 qreal seriesRadialMin = 1;
187 227 qreal seriesRadialMax = 23500;
188 228 qreal radialDimension = seriesRadialMax - seriesRadialMin;
189 229 qreal angularDimension = seriesAngularMax - seriesAngularMin;
190 230
191 231 // Scatter series, points outside min-max ranges should not be drawn
192 232 m_series1 = new QScatterSeries();
193 233 m_series1->setName("scatter");
194 234 qreal scatterCount = 10;
195 235 qreal scatterAngularStep = angularDimension / scatterCount;
196 236 qreal scatterRadialStep = radialDimension / scatterCount;
197 237 for (qreal i = 0.0; i < scatterCount; i++) {
198 238 m_series1->append((i * scatterAngularStep) + seriesAngularMin, (i * scatterRadialStep) + seriesRadialMin);
199 239 //qDebug() << m_series1->points().last();
200 240 }
201 241 m_series1->setMarkerSize(10);
202 242 *m_series1 << QPointF(50, 50) << QPointF(150, 150) << QPointF(250, 250) << QPointF(350, 350) << QPointF(450, 450);
203 243 *m_series1 << QPointF(1050, 0.50) << QPointF(1150, 0.25) << QPointF(1250, 0.12) << QPointF(1350, 0.075) << QPointF(1450, 0.036);
204 244 *m_series1 << QPointF(0.50, 2000) << QPointF(0.25, 3500) << QPointF(0.12, 5000) << QPointF(0.075, 6500) << QPointF(0.036, 8000);
205 245
206 246 // Line series, points outside min-max ranges should not be drawn,
207 247 // but lines should be properly interpolated at chart edges
208 248 m_series2 = new QLineSeries();
209 249 m_series2->setName("line 1");
210 250 qreal lineCount = 100;
211 251 qreal lineAngularStep = angularDimension / lineCount;
212 252 qreal lineRadialStep = radialDimension / lineCount;
213 253 for (qreal i = 0.0; i < lineCount; i++) {
214 254 m_series2->append((i * lineAngularStep) + seriesAngularMin, (i * lineRadialStep) + seriesRadialMin);
215 255 //qDebug() << m_series2->points().last();
216 256 }
217 257 QPen series2Pen = QPen(Qt::blue, 10);
218 258 //series2Pen.setStyle(Qt::DashDotDotLine);
219 259 m_series2->setPen(series2Pen);
220 260
221 261 m_series3 = new QLineSeries();
222 262 m_series3->setName("Area upper");
223 263 lineCount = 87;
224 264 lineAngularStep = angularDimension / lineCount;
225 265 lineRadialStep = radialDimension / lineCount;
226 266 for (qreal i = 1.0; i <= lineCount; i++) {
227 267 m_series3->append((i * lineAngularStep) + seriesAngularMin, (i * lineRadialStep) + seriesRadialMin + 200.0);
228 268 //qDebug() << m_series3->points().last();
229 269 }
230 270
231 271 m_series4 = new QLineSeries();
232 272 m_series4->setName("Area lower");
233 273 lineCount = 89;
234 274 lineAngularStep = angularDimension / lineCount;
235 275 lineRadialStep = radialDimension / lineCount;
236 276 for (qreal i = 1.0; i <= lineCount; i++) {
237 277 m_series4->append((i * lineAngularStep) + seriesAngularMin + 100.0, (i * lineRadialStep) + seriesRadialMin + i * 300.0);
238 278 //qDebug() << m_series4->points().last();
239 279 }
240 280
241 281 m_series5 = new QAreaSeries();
242 282 m_series5->setName("area");
243 283 m_series5->setUpperSeries(m_series3);
244 284 m_series5->setLowerSeries(m_series4);
245 285 m_series5->setOpacity(0.5);
246 286
247 287 m_series6 = new QSplineSeries();
248 288 m_series6->setName("spline");
249 289 qreal ad = angularDimension / 20;
250 290 qreal rd = radialDimension / 10;
251 291 m_series6->append(seriesAngularMin, seriesRadialMin + rd * 2);
252 292 m_series6->append(seriesAngularMin + ad, seriesRadialMin + rd * 5);
253 293 m_series6->append(seriesAngularMin + ad * 2, seriesRadialMin + rd * 4);
254 294 m_series6->append(seriesAngularMin + ad * 3, seriesRadialMin + rd * 9);
255 295 m_series6->append(seriesAngularMin + ad * 4, seriesRadialMin + rd * 11);
256 296 m_series6->append(seriesAngularMin + ad * 5, seriesRadialMin + rd * 12);
257 297 m_series6->append(seriesAngularMin + ad * 6, seriesRadialMin + rd * 9);
258 298 m_series6->append(seriesAngularMin + ad * 7, seriesRadialMin + rd * 11);
259 299 m_series6->append(seriesAngularMin + ad * 8, seriesRadialMin + rd * 12);
260 300 m_series6->append(seriesAngularMin + ad * 9, seriesRadialMin + rd * 6);
261 301 m_series6->append(seriesAngularMin + ad * 10, seriesRadialMin + rd * 4);
262 302 m_series6->append(seriesAngularMin + ad * 10, seriesRadialMin + rd * 8);
263 303 m_series6->append(seriesAngularMin + ad * 11, seriesRadialMin + rd * 9);
264 304 m_series6->append(seriesAngularMin + ad * 12, seriesRadialMin + rd * 11);
265 305 m_series6->append(seriesAngularMin + ad * 13, seriesRadialMin + rd * 12);
266 306 m_series6->append(seriesAngularMin + ad * 14, seriesRadialMin + rd * 6);
267 307 m_series6->append(seriesAngularMin + ad * 15, seriesRadialMin + rd * 3);
268 308 m_series6->append(seriesAngularMin + ad * 16, seriesRadialMin + rd * 2);
269 309 m_series6->append(seriesAngularMin + ad * 17, seriesRadialMin + rd * 6);
270 310 m_series6->append(seriesAngularMin + ad * 18, seriesRadialMin + rd * 6);
271 311 m_series6->append(seriesAngularMin + ad * 19, seriesRadialMin + rd * 6);
272 312 m_series6->append(seriesAngularMin + ad * 20, seriesRadialMin + rd * 6);
273 313 m_series6->append(seriesAngularMin + ad * 19, seriesRadialMin + rd * 2);
274 314 m_series6->append(seriesAngularMin + ad * 18, seriesRadialMin + rd * 9);
275 315 m_series6->append(seriesAngularMin + ad * 17, seriesRadialMin + rd * 7);
276 316 m_series6->append(seriesAngularMin + ad * 16, seriesRadialMin + rd * 3);
277 317 m_series6->append(seriesAngularMin + ad * 15, seriesRadialMin + rd * 1);
278 318 m_series6->append(seriesAngularMin + ad * 14, seriesRadialMin + rd * 7);
279 319 m_series6->append(seriesAngularMin + ad * 13, seriesRadialMin + rd * 5);
280 320 m_series6->append(seriesAngularMin + ad * 12, seriesRadialMin + rd * 9);
281 321 m_series6->append(seriesAngularMin + ad * 11, seriesRadialMin + rd * 1);
282 322 m_series6->append(seriesAngularMin + ad * 10, seriesRadialMin + rd * 4);
283 323 m_series6->append(seriesAngularMin + ad * 9, seriesRadialMin + rd * 1);
284 324 m_series6->append(seriesAngularMin + ad * 8, seriesRadialMin + rd * 2);
285 325 m_series6->append(seriesAngularMin + ad * 7, seriesRadialMin + rd * 4);
286 326 m_series6->append(seriesAngularMin + ad * 6, seriesRadialMin + rd * 8);
287 327 m_series6->append(seriesAngularMin + ad * 5, seriesRadialMin + rd * 12);
288 328 m_series6->append(seriesAngularMin + ad * 4, seriesRadialMin + rd * 9);
289 329 m_series6->append(seriesAngularMin + ad * 3, seriesRadialMin + rd * 8);
290 330 m_series6->append(seriesAngularMin + ad * 2, seriesRadialMin + rd * 7);
291 331 m_series6->append(seriesAngularMin + ad, seriesRadialMin + rd * 4);
292 332 m_series6->append(seriesAngularMin, seriesRadialMin + rd * 10);
293 333
294 334 m_series6->setPointsVisible(true);
295 335 QPen series6Pen = QPen(Qt::red, 10);
296 336 //series6Pen.setStyle(Qt::DashDotDotLine);
297 337 m_series6->setPen(series6Pen);
298 338
299 339 // m_series7 shows points at category intersections
300 340 m_series7 = new QScatterSeries();
301 341 m_series7->setName("Category check");
302 342 m_series7->setMarkerSize(7);
303 343 m_series7->setBrush(QColor(Qt::red));
304 344 m_series7->setMarkerShape(QScatterSeries::MarkerShapeRectangle);
305 345 *m_series7 << QPointF(1000, 1000)
306 346 << QPointF(1000, 2000)
307 347 << QPointF(1000, 4000)
308 348 << QPointF(1000, 9000)
309 349 << QPointF(1000, 14000)
310 350 << QPointF(1000, 16500)
311 351 << QPointF(1000, 19000)
312 352
313 353 << QPointF(4000, 1000)
314 354 << QPointF(4000, 2000)
315 355 << QPointF(4000, 4000)
316 356 << QPointF(4000, 9000)
317 357 << QPointF(4000, 14000)
318 358 << QPointF(4000, 16500)
319 359 << QPointF(4000, 19000)
320 360
321 361 << QPointF(7000, 1000)
322 362 << QPointF(7000, 2000)
323 363 << QPointF(7000, 4000)
324 364 << QPointF(7000, 9000)
325 365 << QPointF(7000, 14000)
326 366 << QPointF(7000, 16500)
327 367 << QPointF(7000, 19000)
328 368
329 369 << QPointF(12000, 1000)
330 370 << QPointF(12000, 2000)
331 371 << QPointF(12000, 4000)
332 372 << QPointF(12000, 9000)
333 373 << QPointF(12000, 14000)
334 374 << QPointF(12000, 16500)
335 375 << QPointF(12000, 19000)
336 376
337 377 << QPointF(17000, 1000)
338 378 << QPointF(17000, 2000)
339 379 << QPointF(17000, 4000)
340 380 << QPointF(17000, 9000)
341 381 << QPointF(17000, 14000)
342 382 << QPointF(17000, 16500)
343 383 << QPointF(17000, 19000)
344 384
345 385 << QPointF(22000, 1000)
346 386 << QPointF(22000, 2000)
347 387 << QPointF(22000, 4000)
348 388 << QPointF(22000, 9000)
349 389 << QPointF(22000, 14000)
350 390 << QPointF(22000, 16500)
351 391 << QPointF(22000, 19000)
352 392
353 393 << QPointF(28000, 1000)
354 394 << QPointF(28000, 2000)
355 395 << QPointF(28000, 4000)
356 396 << QPointF(28000, 9000)
357 397 << QPointF(28000, 14000)
358 398 << QPointF(28000, 16500)
359 399 << QPointF(28000, 19000);
360 400
361 401 m_chart = new QPolarChart();
362 402
363 403 m_chart->addSeries(m_series1);
364 404 m_chart->addSeries(m_series2);
365 405 m_chart->addSeries(m_series3);
366 406 m_chart->addSeries(m_series4);
367 407 m_chart->addSeries(m_series5);
368 408 m_chart->addSeries(m_series6);
369 409 m_chart->addSeries(m_series7);
370 410
371 411 connect(m_series1, SIGNAL(clicked(QPointF)), this, SLOT(seriesClicked(QPointF)));
372 412 connect(m_series2, SIGNAL(clicked(QPointF)), this, SLOT(seriesClicked(QPointF)));
373 413 connect(m_series3, SIGNAL(clicked(QPointF)), this, SLOT(seriesClicked(QPointF)));
374 414 connect(m_series4, SIGNAL(clicked(QPointF)), this, SLOT(seriesClicked(QPointF)));
375 415 connect(m_series5, SIGNAL(clicked(QPointF)), this, SLOT(seriesClicked(QPointF)));
376 416 connect(m_series6, SIGNAL(clicked(QPointF)), this, SLOT(seriesClicked(QPointF)));
377 417 connect(m_series7, SIGNAL(clicked(QPointF)), this, SLOT(seriesClicked(QPointF)));
378 418 connect(m_series1, SIGNAL(hovered(QPointF, bool)), this, SLOT(seriesHovered(QPointF, bool)));
379 419 connect(m_series2, SIGNAL(hovered(QPointF, bool)), this, SLOT(seriesHovered(QPointF, bool)));
380 420 connect(m_series3, SIGNAL(hovered(QPointF, bool)), this, SLOT(seriesHovered(QPointF, bool)));
381 421 connect(m_series4, SIGNAL(hovered(QPointF, bool)), this, SLOT(seriesHovered(QPointF, bool)));
382 422 connect(m_series5, SIGNAL(hovered(QPointF, bool)), this, SLOT(seriesHovered(QPointF, bool)));
383 423 connect(m_series6, SIGNAL(hovered(QPointF, bool)), this, SLOT(seriesHovered(QPointF, bool)));
384 424 connect(m_series7, SIGNAL(hovered(QPointF, bool)), this, SLOT(seriesHovered(QPointF, bool)));
385 425
386 426 m_chart->setTitle("Use arrow keys to scroll and +/- to zoom");
387 427 m_chart->setAnimationOptions(m_animationOptions);
388 428 //m_chart->legend()->setVisible(false);
389 429 m_chart->setAcceptHoverEvents(true);
390 430 m_chart->setBackgroundBrush(*m_backgroundBrush);
391 431 m_chart->setBackgroundPen(*m_backgroundPen);
392 432 m_chart->setPlotAreaBackgroundBrush(*m_plotAreaBackgroundBrush);
393 433 m_chart->setPlotAreaBackgroundPen(*m_plotAreaBackgroundPen);
394 434 }
395 435
396 436 void MainWindow::setAngularAxis(MainWindow::AxisMode mode)
397 437 {
398 438 if (m_angularAxis) {
399 439 m_chart->removeAxis(m_angularAxis);
400 440 delete m_angularAxis;
401 441 m_angularAxis = 0;
402 442 }
403 443
404 444 m_angularAxisMode = mode;
405 445
406 446 switch (m_angularAxisMode) {
407 447 case AxisModeNone:
408 448 return;
409 449 case AxisModeValue:
410 450 m_angularAxis = new QValueAxis();
411 451 static_cast<QValueAxis *>(m_angularAxis)->setTickCount(m_angularTickCount);
412 452 static_cast<QValueAxis *>(m_angularAxis)->setLabelFormat(m_labelFormat);
413 453 break;
414 454 case AxisModeLogValue:
415 455 m_angularAxis = new QLogValueAxis();
416 456 static_cast<QLogValueAxis *>(m_angularAxis)->setBase(m_base);
417 457 static_cast<QLogValueAxis *>(m_angularAxis)->setLabelFormat(m_labelFormat);
418 458 break;
419 459 case AxisModeDateTime:
420 460 m_angularAxis = new QDateTimeAxis();
421 461 static_cast<QDateTimeAxis *>(m_angularAxis)->setTickCount(m_angularTickCount);
422 462 static_cast<QDateTimeAxis *>(m_angularAxis)->setFormat(m_dateFormat);
423 463 break;
424 464 case AxisModeCategory:
425 465 m_angularAxis = new QCategoryAxis();
426 466 applyCategories();
427 467 break;
428 468 default:
429 469 qWarning() << "Unsupported AxisMode";
430 470 break;
431 471 }
432 472
433 473 m_angularAxis->setLabelsAngle(m_labelsAngle);
434 474 m_angularAxis->setLabelsFont(m_currentLabelFont);
435 475 m_angularAxis->setLabelsBrush(*m_labelBrush);
436 476 m_angularAxis->setLabelsVisible(m_labelsVisible);
437 477 m_angularAxis->setShadesBrush(*m_angularShadesBrush);
438 478 m_angularAxis->setShadesPen(*m_angularShadesPen);
439 479 m_angularAxis->setShadesVisible(m_angularShadesVisible);
440 480 m_angularAxis->setTitleFont(m_currentTitleFont);
441 481 m_angularAxis->setTitleBrush(*m_titleBrush);
442 482 m_angularAxis->setTitleVisible(m_titleVisible);
443 483 m_angularAxis->setTitleText(m_angularTitle);
444 484 m_angularAxis->setGridLinePen(*m_gridPen);
445 485 m_angularAxis->setGridLineVisible(m_gridVisible);
446 486 m_angularAxis->setLinePen(*m_arrowPen);
447 487 m_angularAxis->setLineVisible(m_arrowVisible);
448 488 m_angularAxis->setMinorGridLinePen(*m_minorGridPen);
449 489 m_angularAxis->setMinorGridLineVisible(m_minorGridVisible);
450 490
451 491 m_chart->addAxis(m_angularAxis, QPolarChart::PolarOrientationAngular);
452 492
453 493 m_series1->attachAxis(m_angularAxis);
454 494 m_series2->attachAxis(m_angularAxis);
455 495 m_series3->attachAxis(m_angularAxis);
456 496 m_series4->attachAxis(m_angularAxis);
457 497 m_series5->attachAxis(m_angularAxis);
458 498 m_series6->attachAxis(m_angularAxis);
459 499 m_series7->attachAxis(m_angularAxis);
460 500
461 501 applyRanges();
462 502
463 503 //connect(m_angularAxis, SIGNAL(rangeChanged(qreal, qreal)), this, SLOT(angularRangeChanged(qreal, qreal)));
464 504 }
465 505
466 506 void MainWindow::setRadialAxis(MainWindow::AxisMode mode)
467 507 {
468 508 if (m_radialAxis) {
469 509 m_chart->removeAxis(m_radialAxis);
470 510 delete m_radialAxis;
471 511 m_radialAxis = 0;
472 512 }
473 513
474 514 m_radialAxisMode = mode;
475 515
476 516 switch (m_radialAxisMode) {
477 517 case AxisModeNone:
478 518 return;
479 519 case AxisModeValue:
480 520 m_radialAxis = new QValueAxis();
481 521 static_cast<QValueAxis *>(m_radialAxis)->setTickCount(m_radialTickCount);
482 522 static_cast<QValueAxis *>(m_radialAxis)->setLabelFormat(m_labelFormat);
483 523 break;
484 524 case AxisModeLogValue:
485 525 m_radialAxis = new QLogValueAxis();
486 526 static_cast<QLogValueAxis *>(m_radialAxis)->setBase(m_base);
487 527 static_cast<QLogValueAxis *>(m_radialAxis)->setLabelFormat(m_labelFormat);
488 528 break;
489 529 case AxisModeDateTime:
490 530 m_radialAxis = new QDateTimeAxis();
491 531 static_cast<QDateTimeAxis *>(m_radialAxis)->setTickCount(m_radialTickCount);
492 532 static_cast<QDateTimeAxis *>(m_radialAxis)->setFormat(m_dateFormat);
493 533 break;
494 534 case AxisModeCategory:
495 535 m_radialAxis = new QCategoryAxis();
496 536 applyCategories();
497 537 break;
498 538 default:
499 539 qWarning() << "Unsupported AxisMode";
500 540 break;
501 541 }
502 542
503 543 m_radialAxis->setLabelsAngle(m_labelsAngle);
504 544 m_radialAxis->setLabelsFont(m_currentLabelFont);
505 545 m_radialAxis->setLabelsBrush(*m_labelBrush);
506 546 m_radialAxis->setLabelsVisible(m_labelsVisible);
507 547 m_radialAxis->setShadesBrush(*m_radialShadesBrush);
508 548 m_radialAxis->setShadesPen(*m_radialShadesPen);
509 549 m_radialAxis->setShadesVisible(m_radialShadesVisible);
510 550 m_radialAxis->setTitleFont(m_currentTitleFont);
511 551 m_radialAxis->setTitleBrush(*m_titleBrush);
512 552 m_radialAxis->setTitleVisible(m_titleVisible);
513 553 m_radialAxis->setTitleText(m_radialTitle);
514 554 m_radialAxis->setGridLinePen(*m_gridPen);
515 555 m_radialAxis->setGridLineVisible(m_gridVisible);
516 556 m_radialAxis->setLinePen(*m_arrowPen);
517 557 m_radialAxis->setLineVisible(m_arrowVisible);
518 558 m_radialAxis->setMinorGridLinePen(*m_minorGridPen);
519 559 m_radialAxis->setMinorGridLineVisible(m_minorGridVisible);
520 560
521 561 m_chart->addAxis(m_radialAxis, QPolarChart::PolarOrientationRadial);
522 562
523 563 m_series1->attachAxis(m_radialAxis);
524 564 m_series2->attachAxis(m_radialAxis);
525 565 m_series3->attachAxis(m_radialAxis);
526 566 m_series4->attachAxis(m_radialAxis);
527 567 m_series5->attachAxis(m_radialAxis);
528 568 m_series6->attachAxis(m_radialAxis);
529 569 m_series7->attachAxis(m_radialAxis);
530 570
531 571 applyRanges();
532 572
533 573 series1CheckBoxChecked();
534 574 series2CheckBoxChecked();
535 575 series3CheckBoxChecked();
536 576 series4CheckBoxChecked();
537 577 series5CheckBoxChecked();
538 578 series6CheckBoxChecked();
539 579 series7CheckBoxChecked();
540 580
541 581 //connect(m_radialAxis, SIGNAL(rangeChanged(qreal, qreal)), this, SLOT(radialRangeChanged(qreal, qreal)));
542 582 }
543 583
544 584 void MainWindow::applyRanges()
545 585 {
546 586 if (ui->niceNumbersCheckBox->isChecked()) {
547 587 if (m_angularAxisMode == AxisModeValue) {
548 588 static_cast<QValueAxis *>(m_angularAxis)->applyNiceNumbers();
549 589 m_angularMin = static_cast<QValueAxis *>(m_angularAxis)->min();
550 590 m_angularMax = static_cast<QValueAxis *>(m_angularAxis)->max();
551 591 m_angularTickCount = static_cast<QValueAxis *>(m_angularAxis)->tickCount();
552 592 }
553 593 if (m_radialAxisMode == AxisModeValue) {
554 594 static_cast<QValueAxis *>(m_radialAxis)->applyNiceNumbers();
555 595 m_radialMin = static_cast<QValueAxis *>(m_radialAxis)->min();
556 596 m_radialMax = static_cast<QValueAxis *>(m_radialAxis)->max();
557 597 m_radialTickCount = static_cast<QValueAxis *>(m_radialAxis)->tickCount();
558 598 }
559 599 }
560 600
561 601 if (m_angularAxis)
562 602 m_angularAxis->setRange(m_angularMin, m_angularMax);
563 603 if (m_radialAxis)
564 604 m_radialAxis->setRange(m_radialMin, m_radialMax);
565 605 }
566 606
567 607 void MainWindow::angularTicksChanged(int value)
568 608 {
569 609 m_angularTickCount = value;
570 610 if (m_angularAxisMode == AxisModeValue)
571 611 static_cast<QValueAxis *>(m_angularAxis)->setTickCount(m_angularTickCount);
572 612 else if (m_angularAxisMode == AxisModeDateTime)
573 613 static_cast<QDateTimeAxis *>(m_angularAxis)->setTickCount(m_angularTickCount);
574 614 }
575 615
576 616 void MainWindow::radialTicksChanged(int value)
577 617 {
578 618 m_radialTickCount = value;
579 619 if (m_radialAxisMode == AxisModeValue)
580 620 static_cast<QValueAxis *>(m_radialAxis)->setTickCount(m_radialTickCount);
581 621 else if (m_radialAxisMode == AxisModeDateTime)
582 622 static_cast<QDateTimeAxis *>(m_radialAxis)->setTickCount(m_radialTickCount);
583 623 }
584 624
585 625 void MainWindow::angularMinorTicksChanged(int value)
586 626 {
587 627 // Minor tick valid only for QValueAxis
588 628 m_angularMinorTickCount = value;
589 629 if (m_angularAxisMode == AxisModeValue)
590 630 static_cast<QValueAxis *>(m_angularAxis)->setMinorTickCount(m_angularMinorTickCount);
591 631 }
592 632
593 633 void MainWindow::radialMinorTicksChanged(int value)
594 634 {
595 635 // Minor tick valid only for QValueAxis
596 636 m_radialMinorTickCount = value;
597 637 if (m_radialAxisMode == AxisModeValue)
598 638 static_cast<QValueAxis *>(m_radialAxis)->setMinorTickCount(m_radialMinorTickCount);
599 639 }
600 640
601 641 void MainWindow::anglesChanged(int value)
602 642 {
603 643 m_labelsAngle = value;
604 644 m_radialAxis->setLabelsAngle(m_labelsAngle);
605 645 m_angularAxis->setLabelsAngle(m_labelsAngle);
606 646 }
607 647
608 648 void MainWindow::angularMinChanged(double value)
609 649 {
610 650 m_angularMin = value;
611 651 if (m_angularAxisMode != AxisModeDateTime) {
612 652 m_angularAxis->setMin(m_angularMin);
613 653 } else {
614 654 QDateTime dateTime;
615 655 dateTime.setMSecsSinceEpoch(qint64(m_angularMin));
616 656 m_angularAxis->setMin(dateTime);
617 657 }
618 658 }
619 659
620 660 void MainWindow::angularMaxChanged(double value)
621 661 {
622 662 m_angularMax = value;
623 663 if (m_angularAxisMode != AxisModeDateTime) {
624 664 m_angularAxis->setMax(m_angularMax);
625 665 } else {
626 666 QDateTime dateTime;
627 667 dateTime.setMSecsSinceEpoch(qint64(m_angularMax));
628 668 m_angularAxis->setMax(dateTime);
629 669 }
630 670 }
631 671
632 672 void MainWindow::radialMinChanged(double value)
633 673 {
634 674 m_radialMin = value;
635 675 if (m_radialAxisMode != AxisModeDateTime) {
636 676 m_radialAxis->setMin(m_radialMin);
637 677 } else {
638 678 QDateTime dateTime;
639 679 dateTime.setMSecsSinceEpoch(qint64(m_radialMin));
640 680 m_radialAxis->setMin(dateTime);
641 681 }
642 682 }
643 683
644 684 void MainWindow::radialMaxChanged(double value)
645 685 {
646 686 m_radialMax = value;
647 687 if (m_radialAxisMode != AxisModeDateTime) {
648 688 m_radialAxis->setMax(m_radialMax);
649 689 } else {
650 690 QDateTime dateTime;
651 691 dateTime.setMSecsSinceEpoch(qint64(m_radialMax));
652 692 m_radialAxis->setMax(dateTime);
653 693 }
654 694 }
655 695
656 696 void MainWindow::angularShadesIndexChanged(int index)
657 697 {
658 698 delete m_angularShadesBrush;
659 699 delete m_angularShadesPen;
660 700
661 701 switch (index) {
662 702 case 0:
663 703 m_angularShadesBrush = new QBrush(Qt::NoBrush);
664 704 m_angularShadesPen = new QPen(Qt::NoPen);
665 705 m_angularShadesVisible = false;
666 706 break;
667 707 case 1:
668 708 m_angularShadesBrush = new QBrush(Qt::lightGray);
669 709 m_angularShadesPen = new QPen(Qt::NoPen);
670 710 m_angularShadesVisible = true;
671 711 break;
672 712 case 2:
673 713 m_angularShadesBrush = new QBrush(Qt::yellow);
674 714 m_angularShadesPen = new QPen(Qt::DotLine);
675 715 m_angularShadesPen->setWidth(2);
676 716 m_angularShadesVisible = true;
677 717 break;
678 718 default:
679 719 break;
680 720 }
681 721
682 722 m_angularAxis->setShadesBrush(*m_angularShadesBrush);
683 723 m_angularAxis->setShadesPen(*m_angularShadesPen);
684 724 m_angularAxis->setShadesVisible(m_angularShadesVisible);
685 725 }
686 726
687 727 void MainWindow::radialShadesIndexChanged(int index)
688 728 {
689 729 delete m_radialShadesBrush;
690 730 delete m_radialShadesPen;
691 731
692 732 switch (index) {
693 733 case 0:
694 734 m_radialShadesBrush = new QBrush(Qt::NoBrush);
695 735 m_radialShadesPen = new QPen(Qt::NoPen);
696 736 m_radialShadesVisible = false;
697 737 break;
698 738 case 1:
699 739 m_radialShadesBrush = new QBrush(Qt::green);
700 740 m_radialShadesPen = new QPen(Qt::NoPen);
701 741 m_radialShadesVisible = true;
702 742 break;
703 743 case 2:
704 744 m_radialShadesBrush = new QBrush(Qt::blue);
705 745 m_radialShadesPen = new QPen(Qt::DotLine);
706 746 m_radialShadesPen->setWidth(2);
707 747 m_radialShadesVisible = true;
708 748 break;
709 749 default:
710 750 break;
711 751 }
712 752
713 753 m_radialAxis->setShadesBrush(*m_radialShadesBrush);
714 754 m_radialAxis->setShadesPen(*m_radialShadesPen);
715 755 m_radialAxis->setShadesVisible(m_radialShadesVisible);
716 756 }
717 757
718 758 void MainWindow::labelFormatEdited(const QString &text)
719 759 {
720 760 m_labelFormat = text;
721 761 if (m_angularAxisMode == AxisModeValue)
722 762 static_cast<QValueAxis *>(m_angularAxis)->setLabelFormat(m_labelFormat);
723 763 else if (m_angularAxisMode == AxisModeLogValue)
724 764 static_cast<QLogValueAxis *>(m_angularAxis)->setLabelFormat(m_labelFormat);
725 765
726 766 if (m_radialAxisMode == AxisModeValue)
727 767 static_cast<QValueAxis *>(m_radialAxis)->setLabelFormat(m_labelFormat);
728 768 else if (m_radialAxisMode == AxisModeLogValue)
729 769 static_cast<QLogValueAxis *>(m_radialAxis)->setLabelFormat(m_labelFormat);
730 770 }
731 771
732 772 void MainWindow::labelFontChanged(const QFont &font)
733 773 {
734 774 m_currentLabelFont = font;
735 775 m_currentLabelFont.setPixelSize(ui->labelFontSizeSpin->value());
736 776 m_angularAxis->setLabelsFont(m_currentLabelFont);
737 777 m_radialAxis->setLabelsFont(m_currentLabelFont);
738 778 }
739 779
740 780 void MainWindow::labelFontSizeChanged(int value)
741 781 {
742 782 m_currentLabelFont = ui->labelFontComboBox->currentFont();
743 783 m_currentLabelFont.setPixelSize(value);
744 784 m_angularAxis->setLabelsFont(m_currentLabelFont);
745 785 m_radialAxis->setLabelsFont(m_currentLabelFont);
746 786 }
747 787
748 788 void MainWindow::animationIndexChanged(int index)
749 789 {
750 790 switch (index) {
751 791 case 0:
752 792 m_animationOptions = QChart::NoAnimation;
753 793 break;
754 794 case 1:
755 795 m_animationOptions = QChart::SeriesAnimations;
756 796 break;
757 797 case 2:
758 798 m_animationOptions = QChart::GridAxisAnimations;
759 799 break;
760 800 case 3:
761 801 m_animationOptions = QChart::AllAnimations;
762 802 break;
763 803 default:
764 804 break;
765 805 }
766 806
767 807 m_chart->setAnimationOptions(m_animationOptions);
768 808 }
769 809
770 810 void MainWindow::labelsIndexChanged(int index)
771 811 {
772 812 delete m_labelBrush;
773 813
774 814 switch (index) {
775 815 case 0:
776 816 m_labelBrush = new QBrush(Qt::NoBrush);
777 817 m_labelsVisible = false;
778 818 break;
779 819 case 1:
780 820 m_labelBrush = new QBrush(Qt::black);
781 821 m_labelsVisible = true;
782 822 break;
783 823 case 2:
784 824 m_labelBrush = new QBrush(Qt::white);
785 825 m_labelsVisible = true;
786 826 break;
787 827 default:
788 828 break;
789 829 }
790 830
791 831 m_radialAxis->setLabelsBrush(*m_labelBrush);
792 832 m_radialAxis->setLabelsVisible(m_labelsVisible);
793 833 m_angularAxis->setLabelsBrush(*m_labelBrush);
794 834 m_angularAxis->setLabelsVisible(m_labelsVisible);
795 835 }
796 836
797 837 void MainWindow::titleIndexChanged(int index)
798 838 {
799 839 delete m_titleBrush;
800 840
801 841 switch (index) {
802 842 case 0:
803 843 m_titleBrush = new QBrush(Qt::NoBrush);
804 844 m_titleVisible = false;
805 845 m_angularTitle = QString();
806 846 m_radialTitle = QString();
807 847 break;
808 848 case 1:
809 849 m_titleBrush = new QBrush(Qt::NoBrush);
810 850 m_titleVisible = true;
811 851 m_angularTitle = QString();
812 852 m_radialTitle = QString();
813 853 break;
814 854 case 2:
815 855 m_titleBrush = new QBrush(Qt::NoBrush);
816 856 m_titleVisible = false;
817 857 m_angularTitle = QString("Invisible Ang. Title!");
818 858 m_radialTitle = QString("Invisible Rad. Title!");
819 859 break;
820 860 case 3:
821 861 m_titleBrush = new QBrush(Qt::black);
822 862 m_titleVisible = true;
823 863 m_angularTitle = QString("Angular Title");
824 864 m_radialTitle = QString("Radial Title");
825 865 break;
826 866 case 4:
827 867 m_titleBrush = new QBrush(Qt::white);
828 868 m_titleVisible = true;
829 869 m_angularTitle = QString("Angular Blue Title");
830 870 m_radialTitle = QString("Radial Blue Title");
831 871 break;
832 872 default:
833 873 break;
834 874 }
835 875
836 876 m_radialAxis->setTitleBrush(*m_titleBrush);
837 877 m_radialAxis->setTitleVisible(m_titleVisible);
838 878 m_radialAxis->setTitleText(m_radialTitle);
839 879 m_angularAxis->setTitleBrush(*m_titleBrush);
840 880 m_angularAxis->setTitleVisible(m_titleVisible);
841 881 m_angularAxis->setTitleText(m_angularTitle);
842 882 }
843 883
844 884 void MainWindow::titleFontChanged(const QFont &font)
845 885 {
846 886 m_currentTitleFont = font;
847 887 m_currentTitleFont.setPixelSize(ui->titleFontSizeSpin->value());
848 888 m_angularAxis->setTitleFont(m_currentTitleFont);
849 889 m_radialAxis->setTitleFont(m_currentTitleFont);
850 890 }
851 891
852 892 void MainWindow::titleFontSizeChanged(int value)
853 893 {
854 894 m_currentTitleFont = ui->titleFontComboBox->currentFont();
855 895 m_currentTitleFont.setPixelSize(value);
856 896 m_angularAxis->setTitleFont(m_currentTitleFont);
857 897 m_radialAxis->setTitleFont(m_currentTitleFont);
858 898 }
859 899
860 900 void MainWindow::gridIndexChanged(int index)
861 901 {
862 902 delete m_gridPen;
863 903
864 904 switch (index) {
865 905 case 0:
866 906 m_gridPen = new QPen(Qt::NoPen);
867 907 m_gridVisible = false;
868 908 break;
869 909 case 1:
870 910 m_gridPen = new QPen(Qt::black);
871 911 m_gridVisible = true;
872 912 break;
873 913 case 2:
874 914 m_gridPen = new QPen(Qt::red);
875 915 m_gridPen->setStyle(Qt::DashDotLine);
876 916 m_gridPen->setWidth(3);
877 917 m_gridVisible = true;
878 918 break;
879 919 default:
880 920 break;
881 921 }
882 922
883 923 m_angularAxis->setGridLinePen(*m_gridPen);
884 924 m_angularAxis->setGridLineVisible(m_gridVisible);
885 925 m_radialAxis->setGridLinePen(*m_gridPen);
886 926 m_radialAxis->setGridLineVisible(m_gridVisible);
887 927 }
888 928
889 929 void MainWindow::minorGridIndexChanged(int index)
890 930 {
891 931 delete m_minorGridPen;
892 932
893 933 switch (index) {
894 934 case 0:
895 935 m_minorGridPen = new QPen(Qt::NoPen);
896 936 m_minorGridVisible = false;
897 937 break;
898 938 case 1:
899 939 m_minorGridPen = new QPen(Qt::black);
900 940 m_minorGridPen->setStyle(Qt::DashLine);
901 941 m_minorGridVisible = true;
902 942 break;
903 943 case 2:
904 944 m_minorGridPen = new QPen(Qt::green);
905 945 m_minorGridPen->setStyle(Qt::DotLine);
906 946 m_minorGridPen->setWidth(1);
907 947 m_minorGridVisible = true;
908 948 break;
909 949 default:
910 950 break;
911 951 }
912 952
913 953 m_angularAxis->setMinorGridLinePen(*m_minorGridPen);
914 954 m_angularAxis->setMinorGridLineVisible(m_minorGridVisible);
915 955 m_radialAxis->setMinorGridLinePen(*m_minorGridPen);
916 956 m_radialAxis->setMinorGridLineVisible(m_minorGridVisible);
917 957 }
918 958
919 959 void MainWindow::arrowIndexChanged(int index)
920 960 {
921 961 delete m_arrowPen;
922 962
923 963 switch (index) {
924 964 case 0:
925 965 m_arrowPen = new QPen(Qt::NoPen);
926 966 m_arrowVisible = false;
927 967 break;
928 968 case 1:
929 969 m_arrowPen = new QPen(Qt::black);
930 970 m_arrowVisible = true;
931 971 break;
932 972 case 2:
933 973 m_arrowPen = new QPen(Qt::red);
934 974 m_arrowPen->setStyle(Qt::DashDotLine);
935 975 m_arrowPen->setWidth(3);
936 976 m_arrowVisible = true;
937 977 break;
938 978 default:
939 979 break;
940 980 }
941 981
942 982 m_angularAxis->setLinePen(*m_arrowPen);
943 983 m_angularAxis->setLineVisible(m_arrowVisible);
944 984 m_radialAxis->setLinePen(*m_arrowPen);
945 985 m_radialAxis->setLineVisible(m_arrowVisible);
946 986 }
947 987
948 988 void MainWindow::angularRangeChanged(qreal min, qreal max)
949 989 {
950 990 if (!qFuzzyCompare(qreal(ui->angularMinSpin->value()), min))
951 991 ui->angularMinSpin->setValue(min);
952 992 if (!qFuzzyCompare(qreal(ui->angularMaxSpin->value()), max))
953 993 ui->angularMaxSpin->setValue(max);
954 994 }
955 995
956 996 void MainWindow::radialRangeChanged(qreal min, qreal max)
957 997 {
958 998 if (!qFuzzyCompare(qreal(ui->radialMinSpin->value()), min))
959 999 ui->radialMinSpin->setValue(min);
960 1000 if (!qFuzzyCompare(qreal(ui->radialMaxSpin->value()), max))
961 1001 ui->radialMaxSpin->setValue(max);
962 1002 }
963 1003
964 1004 void MainWindow::angularAxisIndexChanged(int index)
965 1005 {
966 1006 switch (index) {
967 1007 case 0:
968 1008 setAngularAxis(AxisModeNone);
969 1009 break;
970 1010 case 1:
971 1011 setAngularAxis(AxisModeValue);
972 1012 angularMinorTicksChanged(ui->angularMinorTicksSpin->value());
973 1013 break;
974 1014 case 2:
975 1015 setAngularAxis(AxisModeLogValue);
976 1016 break;
977 1017 case 3:
978 1018 setAngularAxis(AxisModeDateTime);
979 1019 break;
980 1020 case 4:
981 1021 setAngularAxis(AxisModeCategory);
982 1022 break;
983 1023 default:
984 1024 qWarning("Invalid Index!");
985 1025 }
986 1026 }
987 1027
988 1028 void MainWindow::radialAxisIndexChanged(int index)
989 1029 {
990 1030 switch (index) {
991 1031 case 0:
992 1032 setRadialAxis(AxisModeNone);
993 1033 break;
994 1034 case 1:
995 1035 setRadialAxis(AxisModeValue);
996 1036 radialMinorTicksChanged(ui->radialMinorTicksSpin->value());
997 1037 break;
998 1038 case 2:
999 1039 setRadialAxis(AxisModeLogValue);
1000 1040 break;
1001 1041 case 3:
1002 1042 setRadialAxis(AxisModeDateTime);
1003 1043 break;
1004 1044 case 4:
1005 1045 setRadialAxis(AxisModeCategory);
1006 1046 break;
1007 1047 default:
1008 1048 qWarning("Invalid Index!");
1009 1049 }
1010 1050 }
1011 1051
1012 1052 void MainWindow::logBaseChanged(double value)
1013 1053 {
1014 1054 m_base = value;
1015 1055 if (m_angularAxisMode == AxisModeLogValue)
1016 1056 static_cast<QLogValueAxis *>(m_angularAxis)->setBase(m_base);
1017 1057 if (m_radialAxisMode == AxisModeLogValue)
1018 1058 static_cast<QLogValueAxis *>(m_radialAxis)->setBase(m_base);
1019 1059 }
1020 1060
1021 1061 void MainWindow::niceNumbersChecked()
1022 1062 {
1023 1063 if (ui->niceNumbersCheckBox->isChecked())
1024 1064 applyRanges();
1025 1065 }
1026 1066
1027 1067 void MainWindow::dateFormatEdited(const QString &text)
1028 1068 {
1029 1069 m_dateFormat = text;
1030 1070 if (m_angularAxisMode == AxisModeDateTime)
1031 1071 static_cast<QDateTimeAxis *>(m_angularAxis)->setFormat(m_dateFormat);
1032 1072 if (m_radialAxisMode == AxisModeDateTime)
1033 1073 static_cast<QDateTimeAxis *>(m_radialAxis)->setFormat(m_dateFormat);
1034 1074 }
1035 1075
1036 1076 void MainWindow::moreCategoriesChecked()
1037 1077 {
1038 1078 applyCategories();
1039 1079 m_moreCategories = ui->moreCategoriesCheckBox->isChecked();
1040 1080 }
1041 1081
1082 void MainWindow::categoryLabelLocationChecked()
1083 {
1084 applyCategories();
1085 }
1086
1042 1087 void MainWindow::series1CheckBoxChecked()
1043 1088 {
1044 1089 if (ui->series1checkBox->isChecked())
1045 1090 m_series1->setVisible(true);
1046 1091 else
1047 1092 m_series1->setVisible(false);
1048 1093 }
1049 1094
1050 1095 void MainWindow::series2CheckBoxChecked()
1051 1096 {
1052 1097 if (ui->series2checkBox->isChecked())
1053 1098 m_series2->setVisible(true);
1054 1099 else
1055 1100 m_series2->setVisible(false);
1056 1101 }
1057 1102
1058 1103 void MainWindow::series3CheckBoxChecked()
1059 1104 {
1060 1105 if (ui->series3checkBox->isChecked())
1061 1106 m_series3->setVisible(true);
1062 1107 else
1063 1108 m_series3->setVisible(false);
1064 1109 }
1065 1110
1066 1111 void MainWindow::series4CheckBoxChecked()
1067 1112 {
1068 1113 if (ui->series4checkBox->isChecked())
1069 1114 m_series4->setVisible(true);
1070 1115 else
1071 1116 m_series4->setVisible(false);
1072 1117 }
1073 1118
1074 1119 void MainWindow::series5CheckBoxChecked()
1075 1120 {
1076 1121 if (ui->series5checkBox->isChecked())
1077 1122 m_series5->setVisible(true);
1078 1123 else
1079 1124 m_series5->setVisible(false);
1080 1125 }
1081 1126
1082 1127 void MainWindow::series6CheckBoxChecked()
1083 1128 {
1084 1129 if (ui->series6checkBox->isChecked())
1085 1130 m_series6->setVisible(true);
1086 1131 else
1087 1132 m_series6->setVisible(false);
1088 1133 }
1089 1134
1090 1135 void MainWindow::series7CheckBoxChecked()
1091 1136 {
1092 1137 if (ui->series7checkBox->isChecked())
1093 1138 m_series7->setVisible(true);
1094 1139 else
1095 1140 m_series7->setVisible(false);
1096 1141 }
1097 1142
1098 1143 void MainWindow::themeIndexChanged(int index)
1099 1144 {
1100 1145 m_chart->setTheme(QChart::ChartTheme(index));
1101 1146 }
1102 1147
1103 1148 void MainWindow::seriesHovered(QPointF point, bool state)
1104 1149 {
1105 1150 QAbstractSeries *series = qobject_cast<QAbstractSeries *>(sender());
1106 1151 if (series) {
1107 1152 if (state) {
1108 1153 QString str("'%3' - %1 x %2");
1109 1154 ui->hoverLabel->setText(str.arg(point.x()).arg(point.y()).arg(series->name()));
1110 1155 } else {
1111 1156 ui->hoverLabel->setText("No hover");
1112 1157 }
1113 1158 } else {
1114 1159 qDebug() << "seriesHovered - invalid sender!";
1115 1160 }
1116 1161 }
1117 1162
1118 1163 void MainWindow::seriesClicked(const QPointF &point)
1119 1164 {
1120 1165 QAbstractSeries *series = qobject_cast<QAbstractSeries *>(sender());
1121 1166 if (series) {
1122 1167 QString str("'%3' clicked at: %1 x %2");
1123 1168 m_angularTitle = str.arg(point.x()).arg(point.y()).arg(series->name());
1124 1169 m_angularAxis->setTitleText(m_angularTitle);
1125 1170 } else {
1126 1171 qDebug() << "seriesClicked - invalid sender!";
1127 1172 }
1128 1173 }
1129 1174
1130 1175 void MainWindow::backgroundIndexChanged(int index)
1131 1176 {
1132 1177 delete m_backgroundBrush;
1133 1178 delete m_backgroundPen;
1134 1179
1135 1180 switch (index) {
1136 1181 case 0:
1137 1182 m_backgroundBrush = new QBrush(Qt::white);
1138 1183 m_backgroundPen = new QPen(Qt::NoPen);
1139 1184 break;
1140 1185 case 1:
1141 1186 m_backgroundBrush = new QBrush(Qt::blue);
1142 1187 m_backgroundPen = new QPen(Qt::NoPen);
1143 1188 break;
1144 1189 case 2:
1145 1190 m_backgroundBrush = new QBrush(Qt::yellow);
1146 1191 m_backgroundPen = new QPen(Qt::black, 2);
1147 1192 break;
1148 1193 default:
1149 1194 break;
1150 1195 }
1151 1196 m_chart->setBackgroundBrush(*m_backgroundBrush);
1152 1197 m_chart->setBackgroundPen(*m_backgroundPen);
1153 1198 }
1154 1199
1155 1200 void MainWindow::plotAreaIndexChanged(int index)
1156 1201 {
1157 1202 delete m_plotAreaBackgroundBrush;
1158 1203 delete m_plotAreaBackgroundPen;
1159 1204
1160 1205 switch (index) {
1161 1206 case 0:
1162 1207 m_plotAreaBackgroundBrush = new QBrush(Qt::green);
1163 1208 m_plotAreaBackgroundPen = new QPen(Qt::green);
1164 1209 m_chart->setPlotAreaBackgroundVisible(false);
1165 1210 break;
1166 1211 case 1:
1167 1212 m_plotAreaBackgroundBrush = new QBrush(Qt::magenta);
1168 1213 m_plotAreaBackgroundPen = new QPen(Qt::NoPen);
1169 1214 m_chart->setPlotAreaBackgroundVisible(true);
1170 1215 break;
1171 1216 case 2:
1172 1217 m_plotAreaBackgroundBrush = new QBrush(Qt::lightGray);
1173 1218 m_plotAreaBackgroundPen = new QPen(Qt::red, 6);
1174 1219 m_chart->setPlotAreaBackgroundVisible(true);
1175 1220 break;
1176 1221 default:
1177 1222 break;
1178 1223 }
1179 1224 m_chart->setPlotAreaBackgroundBrush(*m_plotAreaBackgroundBrush);
1180 1225 m_chart->setPlotAreaBackgroundPen(*m_plotAreaBackgroundPen);
1181 1226 }
1182 1227
1183 1228 void MainWindow::applyCategories()
1184 1229 {
1185 1230 // Basic layout is three categories, extended has five
1186 1231 if (m_angularAxisMode == AxisModeCategory) {
1187 1232 QCategoryAxis *angCatAxis = static_cast<QCategoryAxis *>(m_angularAxis);
1188 1233 if (angCatAxis->count() == 0) {
1189 1234 angCatAxis->setStartValue(4000);
1190 1235 angCatAxis->append("Category A", 7000);
1191 1236 angCatAxis->append("Category B", 12000);
1192 1237 angCatAxis->append("Category C", 17000);
1193 1238 }
1194 1239 if (angCatAxis->count() == 3 && ui->moreCategoriesCheckBox->isChecked()) {
1195 1240 angCatAxis->setStartValue(1000);
1196 1241 angCatAxis->replaceLabel("Category A", "Cat A");
1197 1242 angCatAxis->replaceLabel("Category B", "Cat B");
1198 1243 angCatAxis->replaceLabel("Category C", "Cat C");
1199 1244 angCatAxis->append("Cat D", 22000);
1200 1245 angCatAxis->append("Cat E", 28000);
1201 1246 } else if (angCatAxis->count() == 5 && !ui->moreCategoriesCheckBox->isChecked()) {
1202 1247 angCatAxis->setStartValue(4000);
1203 1248 angCatAxis->replaceLabel("Cat A", "Category A");
1204 1249 angCatAxis->replaceLabel("Cat B", "Category B");
1205 1250 angCatAxis->replaceLabel("Cat C", "Category C");
1206 1251 angCatAxis->remove("Cat D");
1207 1252 angCatAxis->remove("Cat E");
1208 1253 }
1254 if (ui->categoryLabelLocationCheckBox->isChecked())
1255 angCatAxis->setLabelsPosition(QCategoryAxis::AxisLabelsPositionOnValue);
1256 else
1257 angCatAxis->setLabelsPosition(QCategoryAxis::AxisLabelsPositionCenter);
1209 1258 }
1210 1259
1211 1260 if (m_radialAxisMode == AxisModeCategory) {
1212 1261 QCategoryAxis *radCatAxis = static_cast<QCategoryAxis *>(m_radialAxis);
1213 1262 if (radCatAxis->count() == 0) {
1214 1263 radCatAxis->setStartValue(2000);
1215 1264 radCatAxis->append("Category 1", 4000);
1216 1265 radCatAxis->append("Category 2", 9000);
1217 1266 radCatAxis->append("Category 3", 14000);
1218 1267 }
1219 1268 if (radCatAxis->count() == 3 && ui->moreCategoriesCheckBox->isChecked()) {
1220 1269 radCatAxis->setStartValue(1000);
1221 1270 radCatAxis->replaceLabel("Category 1", "Cat 1");
1222 1271 radCatAxis->replaceLabel("Category 2", "Cat 2");
1223 1272 radCatAxis->replaceLabel("Category 3", "Cat 3");
1224 1273 radCatAxis->append("Cat 4", 16500);
1225 1274 radCatAxis->append("Cat 5", 19000);
1226 1275 } else if (radCatAxis->count() == 5 && !ui->moreCategoriesCheckBox->isChecked()) {
1227 1276 radCatAxis->setStartValue(2000);
1228 1277 radCatAxis->replaceLabel("Cat 1", "Category 1");
1229 1278 radCatAxis->replaceLabel("Cat 2", "Category 2");
1230 1279 radCatAxis->replaceLabel("Cat 3", "Category 3");
1231 1280 radCatAxis->remove("Cat 4");
1232 1281 radCatAxis->remove("Cat 5");
1233 1282 }
1283 if (ui->categoryLabelLocationCheckBox->isChecked())
1284 radCatAxis->setLabelsPosition(QCategoryAxis::AxisLabelsPositionOnValue);
1285 else
1286 radCatAxis->setLabelsPosition(QCategoryAxis::AxisLabelsPositionCenter);
1234 1287 }
1235 1288 }
@@ -1,168 +1,169
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2015 The Qt Company Ltd
4 4 ** All rights reserved.
5 5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 6 **
7 7 ** This file is part of the Qt Charts module.
8 8 **
9 9 ** Licensees holding valid commercial license for Qt may use this file in
10 10 ** accordance with the Qt License Agreement provided with the Software
11 11 ** or, alternatively, in accordance with the terms contained in a written
12 12 ** agreement between you and The Qt Company.
13 13 **
14 14 ** If you have questions regarding the use of this file, please use
15 15 ** contact form at http://qt.io
16 16 **
17 17 ****************************************************************************/
18 18
19 19 #ifndef MAINWINDOW_H
20 20 #define MAINWINDOW_H
21 21
22 22 #include <QtCharts/QPolarChart>
23 23 #include <QtWidgets/QMainWindow>
24 24 #include <QtGui/QFont>
25 25 #include <QtCharts/QChart>
26 26 #include <QtCharts/QScatterSeries>
27 27 #include <QtCharts/QLineSeries>
28 28 #include <QtCharts/QSplineSeries>
29 29 #include <QtCharts/QAreaSeries>
30 30
31 31 QT_BEGIN_NAMESPACE
32 32 class QBrush;
33 33 class QPen;
34 34
35 35 namespace Ui {
36 36 class MainWindow;
37 37 }
38 38 QT_END_NAMESPACE
39 39
40 40
41 41 QT_CHARTS_USE_NAMESPACE
42 42
43 43 class MainWindow : public QMainWindow
44 44 {
45 45 Q_OBJECT
46 46
47 47 public:
48 48 explicit MainWindow(QWidget *parent = 0);
49 49 ~MainWindow();
50 50
51 51 public slots:
52 52 void angularTicksChanged(int value);
53 53 void radialTicksChanged(int value);
54 54 void angularMinorTicksChanged(int value);
55 55 void radialMinorTicksChanged(int value);
56 56 void anglesChanged(int value);
57 57 void angularMinChanged(double value);
58 58 void angularMaxChanged(double value);
59 59 void radialMinChanged(double value);
60 60 void radialMaxChanged(double value);
61 61 void angularShadesIndexChanged(int index);
62 62 void radialShadesIndexChanged(int index);
63 63 void labelFormatEdited(const QString &text);
64 64 void labelFontChanged(const QFont &font);
65 65 void labelFontSizeChanged(int value);
66 66 void animationIndexChanged(int index);
67 67 void labelsIndexChanged(int index);
68 68 void titleIndexChanged(int index);
69 69 void titleFontChanged(const QFont &font);
70 70 void titleFontSizeChanged(int value);
71 71 void gridIndexChanged(int index);
72 72 void minorGridIndexChanged(int index);
73 73 void arrowIndexChanged(int index);
74 74 void angularRangeChanged(qreal min, qreal max);
75 75 void radialRangeChanged(qreal min, qreal max);
76 76 void angularAxisIndexChanged(int index);
77 77 void radialAxisIndexChanged(int index);
78 78 void logBaseChanged(double value);
79 79 void niceNumbersChecked();
80 80 void dateFormatEdited(const QString &text);
81 81 void moreCategoriesChecked();
82 void categoryLabelLocationChecked();
82 83 void series1CheckBoxChecked();
83 84 void series2CheckBoxChecked();
84 85 void series3CheckBoxChecked();
85 86 void series4CheckBoxChecked();
86 87 void series5CheckBoxChecked();
87 88 void series6CheckBoxChecked();
88 89 void series7CheckBoxChecked();
89 90 void themeIndexChanged(int index);
90 91 void seriesHovered(QPointF point, bool state);
91 92 void seriesClicked(const QPointF &point);
92 93 void backgroundIndexChanged(int index);
93 94 void plotAreaIndexChanged(int index);
94 95
95 96 private:
96 97 enum AxisMode {
97 98 AxisModeNone,
98 99 AxisModeValue,
99 100 AxisModeLogValue,
100 101 AxisModeDateTime,
101 102 AxisModeCategory
102 103 };
103 104
104 105 void initXYValueChart();
105 106 void setAngularAxis(AxisMode mode);
106 107 void setRadialAxis(AxisMode mode);
107 108
108 109 void applyRanges();
109 110 void applyCategories();
110 111
111 112 Ui::MainWindow *ui;
112 113
113 114 int m_angularTickCount;
114 115 int m_radialTickCount;
115 116 int m_angularMinorTickCount;
116 117 int m_radialMinorTickCount;
117 118 qreal m_labelsAngle;
118 119 qreal m_angularMin;
119 120 qreal m_angularMax;
120 121 qreal m_radialMin;
121 122 qreal m_radialMax;
122 123 bool m_angularShadesVisible;
123 124 bool m_radialShadesVisible;
124 125 bool m_labelsVisible;
125 126 bool m_titleVisible;
126 127 bool m_gridVisible;
127 128 bool m_arrowVisible;
128 129 bool m_minorGridVisible;
129 130 bool m_minorArrowVisible;
130 131 QBrush *m_angularShadesBrush;
131 132 QBrush *m_radialShadesBrush;
132 133 QBrush *m_labelBrush;
133 134 QBrush *m_titleBrush;
134 135 QBrush *m_backgroundBrush;
135 136 QBrush *m_plotAreaBackgroundBrush;
136 137 QPen *m_angularShadesPen;
137 138 QPen *m_radialShadesPen;
138 139 QPen *m_gridPen;
139 140 QPen *m_arrowPen;
140 141 QPen *m_minorGridPen;
141 142 QPen *m_backgroundPen;
142 143 QPen *m_plotAreaBackgroundPen;
143 144 QString m_labelFormat;
144 145 QFont m_currentLabelFont;
145 146 QFont m_currentTitleFont;
146 147 QChart::AnimationOptions m_animationOptions;
147 148 QString m_angularTitle;
148 149 QString m_radialTitle;
149 150 qreal m_base;
150 151 QString m_dateFormat;
151 152
152 153 QPolarChart *m_chart;
153 154 QAbstractAxis *m_angularAxis;
154 155 QAbstractAxis *m_radialAxis;
155 156 AxisMode m_angularAxisMode;
156 157 AxisMode m_radialAxisMode;
157 158 bool m_moreCategories;
158 159
159 160 QScatterSeries *m_series1;
160 161 QLineSeries *m_series2;
161 162 QLineSeries *m_series3;
162 163 QLineSeries *m_series4;
163 164 QAreaSeries *m_series5;
164 165 QSplineSeries *m_series6;
165 166 QScatterSeries *m_series7;
166 167 };
167 168
168 169 #endif // MAINWINDOW_H
@@ -1,936 +1,949
1 1 <?xml version="1.0" encoding="UTF-8"?>
2 2 <ui version="4.0">
3 3 <class>MainWindow</class>
4 4 <widget class="QMainWindow" name="MainWindow">
5 5 <property name="geometry">
6 6 <rect>
7 7 <x>0</x>
8 8 <y>0</y>
9 9 <width>1193</width>
10 10 <height>1004</height>
11 11 </rect>
12 12 </property>
13 13 <property name="windowTitle">
14 14 <string>MainWindow</string>
15 15 </property>
16 16 <widget class="QWidget" name="centralWidget">
17 17 <layout class="QHBoxLayout" name="horizontalLayout">
18 18 <item>
19 19 <widget class="ChartView" name="chartView"/>
20 20 </item>
21 21 <item>
22 22 <widget class="QGroupBox" name="settingsBox">
23 23 <property name="sizePolicy">
24 24 <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
25 25 <horstretch>0</horstretch>
26 26 <verstretch>0</verstretch>
27 27 </sizepolicy>
28 28 </property>
29 29 <property name="minimumSize">
30 30 <size>
31 31 <width>200</width>
32 32 <height>0</height>
33 33 </size>
34 34 </property>
35 35 <property name="title">
36 36 <string>Settings</string>
37 37 </property>
38 38 <widget class="QComboBox" name="angularShadesComboBox">
39 39 <property name="geometry">
40 40 <rect>
41 41 <x>10</x>
42 42 <y>313</y>
43 43 <width>187</width>
44 44 <height>20</height>
45 45 </rect>
46 46 </property>
47 47 <item>
48 48 <property name="text">
49 49 <string>No angular shades</string>
50 50 </property>
51 51 </item>
52 52 <item>
53 53 <property name="text">
54 54 <string>Gray angular shades</string>
55 55 </property>
56 56 </item>
57 57 <item>
58 58 <property name="text">
59 59 <string>Yellow ang. shades + custom pen</string>
60 60 </property>
61 61 </item>
62 62 </widget>
63 63 <widget class="QComboBox" name="radialShadesComboBox">
64 64 <property name="geometry">
65 65 <rect>
66 66 <x>10</x>
67 67 <y>339</y>
68 68 <width>175</width>
69 69 <height>20</height>
70 70 </rect>
71 71 </property>
72 72 <item>
73 73 <property name="text">
74 74 <string>No radial shades</string>
75 75 </property>
76 76 </item>
77 77 <item>
78 78 <property name="text">
79 79 <string>Green radial shades</string>
80 80 </property>
81 81 </item>
82 82 <item>
83 83 <property name="text">
84 84 <string>Blue rad. shades + custom pen</string>
85 85 </property>
86 86 </item>
87 87 </widget>
88 88 <widget class="QComboBox" name="animationsComboBox">
89 89 <property name="geometry">
90 90 <rect>
91 91 <x>10</x>
92 92 <y>471</y>
93 93 <width>104</width>
94 94 <height>20</height>
95 95 </rect>
96 96 </property>
97 97 <item>
98 98 <property name="text">
99 99 <string>No animations</string>
100 100 </property>
101 101 </item>
102 102 <item>
103 103 <property name="text">
104 104 <string>Series animation</string>
105 105 </property>
106 106 </item>
107 107 <item>
108 108 <property name="text">
109 109 <string>Grid animation</string>
110 110 </property>
111 111 </item>
112 112 <item>
113 113 <property name="text">
114 114 <string>All animations</string>
115 115 </property>
116 116 </item>
117 117 </widget>
118 118 <widget class="QComboBox" name="labelComboBox">
119 119 <property name="geometry">
120 120 <rect>
121 121 <x>10</x>
122 122 <y>445</y>
123 123 <width>134</width>
124 124 <height>20</height>
125 125 </rect>
126 126 </property>
127 127 <property name="currentIndex">
128 128 <number>1</number>
129 129 </property>
130 130 <item>
131 131 <property name="text">
132 132 <string>No labels</string>
133 133 </property>
134 134 </item>
135 135 <item>
136 136 <property name="text">
137 137 <string>Black label</string>
138 138 </property>
139 139 </item>
140 140 <item>
141 141 <property name="text">
142 142 <string>White label + blue pen</string>
143 143 </property>
144 144 </item>
145 145 </widget>
146 146 <widget class="QComboBox" name="titleComboBox">
147 147 <property name="geometry">
148 148 <rect>
149 149 <x>10</x>
150 150 <y>551</y>
151 151 <width>130</width>
152 152 <height>20</height>
153 153 </rect>
154 154 </property>
155 155 <property name="sizePolicy">
156 156 <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
157 157 <horstretch>0</horstretch>
158 158 <verstretch>0</verstretch>
159 159 </sizepolicy>
160 160 </property>
161 161 <property name="currentIndex">
162 162 <number>3</number>
163 163 </property>
164 164 <item>
165 165 <property name="text">
166 166 <string>Invisible empty title</string>
167 167 </property>
168 168 </item>
169 169 <item>
170 170 <property name="text">
171 171 <string>Visible empty title</string>
172 172 </property>
173 173 </item>
174 174 <item>
175 175 <property name="text">
176 176 <string>Invisible title</string>
177 177 </property>
178 178 </item>
179 179 <item>
180 180 <property name="text">
181 181 <string>Black title</string>
182 182 </property>
183 183 </item>
184 184 <item>
185 185 <property name="text">
186 186 <string>White title + blue pen</string>
187 187 </property>
188 188 </item>
189 189 </widget>
190 190 <widget class="QComboBox" name="gridComboBox">
191 191 <property name="geometry">
192 192 <rect>
193 193 <x>10</x>
194 194 <y>577</y>
195 195 <width>104</width>
196 196 <height>20</height>
197 197 </rect>
198 198 </property>
199 199 <property name="sizePolicy">
200 200 <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
201 201 <horstretch>0</horstretch>
202 202 <verstretch>0</verstretch>
203 203 </sizepolicy>
204 204 </property>
205 205 <property name="currentIndex">
206 206 <number>1</number>
207 207 </property>
208 208 <item>
209 209 <property name="text">
210 210 <string>Invisible grid</string>
211 211 </property>
212 212 </item>
213 213 <item>
214 214 <property name="text">
215 215 <string>Black grid</string>
216 216 </property>
217 217 </item>
218 218 <item>
219 219 <property name="text">
220 220 <string>Custom grid pen</string>
221 221 </property>
222 222 </item>
223 223 </widget>
224 224 <widget class="QComboBox" name="arrowComboBox">
225 225 <property name="geometry">
226 226 <rect>
227 227 <x>10</x>
228 228 <y>603</y>
229 229 <width>114</width>
230 230 <height>20</height>
231 231 </rect>
232 232 </property>
233 233 <property name="sizePolicy">
234 234 <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
235 235 <horstretch>0</horstretch>
236 236 <verstretch>0</verstretch>
237 237 </sizepolicy>
238 238 </property>
239 239 <property name="currentIndex">
240 240 <number>1</number>
241 241 </property>
242 242 <item>
243 243 <property name="text">
244 244 <string>Invisible arrow</string>
245 245 </property>
246 246 </item>
247 247 <item>
248 248 <property name="text">
249 249 <string>Black arrow</string>
250 250 </property>
251 251 </item>
252 252 <item>
253 253 <property name="text">
254 254 <string>Custom arrow pen</string>
255 255 </property>
256 256 </item>
257 257 </widget>
258 258 <widget class="QComboBox" name="angularAxisComboBox">
259 259 <property name="geometry">
260 260 <rect>
261 261 <x>10</x>
262 262 <y>23</y>
263 263 <width>134</width>
264 264 <height>20</height>
265 265 </rect>
266 266 </property>
267 267 <property name="currentIndex">
268 268 <number>1</number>
269 269 </property>
270 270 <item>
271 271 <property name="text">
272 272 <string>No Angular Axis</string>
273 273 </property>
274 274 </item>
275 275 <item>
276 276 <property name="text">
277 277 <string>Angular Value Axis</string>
278 278 </property>
279 279 </item>
280 280 <item>
281 281 <property name="text">
282 282 <string>Angular Log Axis</string>
283 283 </property>
284 284 </item>
285 285 <item>
286 286 <property name="text">
287 287 <string>Angular DateTime Axis</string>
288 288 </property>
289 289 </item>
290 290 <item>
291 291 <property name="text">
292 292 <string>Angular Category Axis</string>
293 293 </property>
294 294 </item>
295 295 </widget>
296 296 <widget class="QComboBox" name="radialAxisComboBox">
297 297 <property name="geometry">
298 298 <rect>
299 299 <x>10</x>
300 300 <y>49</y>
301 301 <width>126</width>
302 302 <height>20</height>
303 303 </rect>
304 304 </property>
305 305 <property name="currentIndex">
306 306 <number>1</number>
307 307 </property>
308 308 <item>
309 309 <property name="text">
310 310 <string>No Radial Axis</string>
311 311 </property>
312 312 </item>
313 313 <item>
314 314 <property name="text">
315 315 <string>Radial Value Axis</string>
316 316 </property>
317 317 </item>
318 318 <item>
319 319 <property name="text">
320 320 <string>Radial Log Axis</string>
321 321 </property>
322 322 </item>
323 323 <item>
324 324 <property name="text">
325 325 <string>Radial DateTime Axis</string>
326 326 </property>
327 327 </item>
328 328 <item>
329 329 <property name="text">
330 330 <string>Radial Category Axis</string>
331 331 </property>
332 332 </item>
333 333 </widget>
334 334 <widget class="QComboBox" name="themeComboBox">
335 335 <property name="geometry">
336 336 <rect>
337 337 <x>10</x>
338 338 <y>814</y>
339 339 <width>131</width>
340 340 <height>20</height>
341 341 </rect>
342 342 </property>
343 343 <property name="sizePolicy">
344 344 <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
345 345 <horstretch>0</horstretch>
346 346 <verstretch>0</verstretch>
347 347 </sizepolicy>
348 348 </property>
349 349 <property name="currentIndex">
350 350 <number>0</number>
351 351 </property>
352 352 <item>
353 353 <property name="text">
354 354 <string>Theme: Light</string>
355 355 </property>
356 356 </item>
357 357 <item>
358 358 <property name="text">
359 359 <string>Theme: Blue Cerulean</string>
360 360 </property>
361 361 </item>
362 362 <item>
363 363 <property name="text">
364 364 <string>Theme: Dark</string>
365 365 </property>
366 366 </item>
367 367 <item>
368 368 <property name="text">
369 369 <string>Theme: Brown Sand</string>
370 370 </property>
371 371 </item>
372 372 <item>
373 373 <property name="text">
374 374 <string>Theme: Blue Ncs</string>
375 375 </property>
376 376 </item>
377 377 <item>
378 378 <property name="text">
379 379 <string>Theme: High Contrast</string>
380 380 </property>
381 381 </item>
382 382 <item>
383 383 <property name="text">
384 384 <string>Theme: Blue Icy</string>
385 385 </property>
386 386 </item>
387 387 <item>
388 388 <property name="text">
389 389 <string>Theme: Qt</string>
390 390 </property>
391 391 </item>
392 392 </widget>
393 393 <widget class="QLabel" name="hoverLabel">
394 394 <property name="geometry">
395 395 <rect>
396 396 <x>10</x>
397 397 <y>840</y>
398 398 <width>117</width>
399 399 <height>16</height>
400 400 </rect>
401 401 </property>
402 402 <property name="text">
403 403 <string>Hover coordinates here!</string>
404 404 </property>
405 405 </widget>
406 406 <widget class="QComboBox" name="backgroundComboBox">
407 407 <property name="geometry">
408 408 <rect>
409 409 <x>10</x>
410 410 <y>877</y>
411 411 <width>195</width>
412 412 <height>20</height>
413 413 </rect>
414 414 </property>
415 415 <property name="sizePolicy">
416 416 <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
417 417 <horstretch>0</horstretch>
418 418 <verstretch>0</verstretch>
419 419 </sizepolicy>
420 420 </property>
421 421 <property name="currentIndex">
422 422 <number>0</number>
423 423 </property>
424 424 <item>
425 425 <property name="text">
426 426 <string>Background: White</string>
427 427 </property>
428 428 </item>
429 429 <item>
430 430 <property name="text">
431 431 <string>Background: Blue</string>
432 432 </property>
433 433 </item>
434 434 <item>
435 435 <property name="text">
436 436 <string>Background: Yellow + Black Border</string>
437 437 </property>
438 438 </item>
439 439 </widget>
440 440 <widget class="QComboBox" name="plotAreaComboBox">
441 441 <property name="geometry">
442 442 <rect>
443 443 <x>10</x>
444 444 <y>903</y>
445 445 <width>165</width>
446 446 <height>20</height>
447 447 </rect>
448 448 </property>
449 449 <property name="sizePolicy">
450 450 <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
451 451 <horstretch>0</horstretch>
452 452 <verstretch>0</verstretch>
453 453 </sizepolicy>
454 454 </property>
455 455 <property name="currentIndex">
456 456 <number>0</number>
457 457 </property>
458 458 <item>
459 459 <property name="text">
460 460 <string>PlotArea: Transparent</string>
461 461 </property>
462 462 </item>
463 463 <item>
464 464 <property name="text">
465 465 <string>PlotArea: Magenta</string>
466 466 </property>
467 467 </item>
468 468 <item>
469 469 <property name="text">
470 470 <string>PlotArea: Gray + Red Border</string>
471 471 </property>
472 472 </item>
473 473 </widget>
474 474 <widget class="QWidget" name="layoutWidget">
475 475 <property name="geometry">
476 476 <rect>
477 477 <x>10</x>
478 478 <y>207</y>
479 479 <width>185</width>
480 480 <height>100</height>
481 481 </rect>
482 482 </property>
483 483 <layout class="QGridLayout" name="gridLayout_2">
484 484 <item row="2" column="1">
485 485 <widget class="QDoubleSpinBox" name="radialMinSpin">
486 486 <property name="decimals">
487 487 <number>5</number>
488 488 </property>
489 489 <property name="minimum">
490 490 <double>-999999999.000000000000000</double>
491 491 </property>
492 492 <property name="maximum">
493 493 <double>999999999.000000000000000</double>
494 494 </property>
495 495 <property name="singleStep">
496 496 <double>10.000000000000000</double>
497 497 </property>
498 498 </widget>
499 499 </item>
500 500 <item row="3" column="0">
501 501 <widget class="QLabel" name="label_11">
502 502 <property name="text">
503 503 <string>Radial max</string>
504 504 </property>
505 505 </widget>
506 506 </item>
507 507 <item row="2" column="0">
508 508 <widget class="QLabel" name="label_12">
509 509 <property name="text">
510 510 <string>Radial min</string>
511 511 </property>
512 512 </widget>
513 513 </item>
514 514 <item row="1" column="0">
515 515 <widget class="QLabel" name="label_5">
516 516 <property name="text">
517 517 <string>Angular max</string>
518 518 </property>
519 519 </widget>
520 520 </item>
521 521 <item row="0" column="1">
522 522 <widget class="QDoubleSpinBox" name="angularMinSpin">
523 523 <property name="decimals">
524 524 <number>5</number>
525 525 </property>
526 526 <property name="minimum">
527 527 <double>-999999999.000000000000000</double>
528 528 </property>
529 529 <property name="maximum">
530 530 <double>999999999.000000000000000</double>
531 531 </property>
532 532 <property name="singleStep">
533 533 <double>10.000000000000000</double>
534 534 </property>
535 535 </widget>
536 536 </item>
537 537 <item row="0" column="0">
538 538 <widget class="QLabel" name="label_4">
539 539 <property name="text">
540 540 <string>Angular min</string>
541 541 </property>
542 542 </widget>
543 543 </item>
544 544 <item row="3" column="1">
545 545 <widget class="QDoubleSpinBox" name="radialMaxSpin">
546 546 <property name="decimals">
547 547 <number>5</number>
548 548 </property>
549 549 <property name="minimum">
550 550 <double>-999999999.000000000000000</double>
551 551 </property>
552 552 <property name="maximum">
553 553 <double>999999999.000000000000000</double>
554 554 </property>
555 555 <property name="singleStep">
556 556 <double>10.000000000000000</double>
557 557 </property>
558 558 </widget>
559 559 </item>
560 560 <item row="1" column="1">
561 561 <widget class="QDoubleSpinBox" name="angularMaxSpin">
562 562 <property name="decimals">
563 563 <number>5</number>
564 564 </property>
565 565 <property name="minimum">
566 566 <double>-999999999.000000000000000</double>
567 567 </property>
568 568 <property name="maximum">
569 569 <double>999999999.000000000000000</double>
570 570 </property>
571 571 <property name="singleStep">
572 572 <double>10.000000000000000</double>
573 573 </property>
574 574 </widget>
575 575 </item>
576 576 </layout>
577 577 </widget>
578 578 <widget class="QWidget" name="layoutWidget">
579 579 <property name="geometry">
580 580 <rect>
581 581 <x>10</x>
582 582 <y>365</y>
583 583 <width>210</width>
584 584 <height>74</height>
585 585 </rect>
586 586 </property>
587 587 <layout class="QGridLayout" name="gridLayout_3">
588 588 <item row="0" column="0">
589 589 <widget class="QLabel" name="label_13">
590 590 <property name="text">
591 591 <string>Label format</string>
592 592 </property>
593 593 </widget>
594 594 </item>
595 595 <item row="0" column="1">
596 596 <widget class="QLineEdit" name="labelFormatEdit"/>
597 597 </item>
598 598 <item row="1" column="0">
599 599 <widget class="QLabel" name="label_14">
600 600 <property name="text">
601 601 <string>Label font size</string>
602 602 </property>
603 603 </widget>
604 604 </item>
605 605 <item row="1" column="1">
606 606 <widget class="QSpinBox" name="labelFontSizeSpin">
607 607 <property name="minimum">
608 608 <number>-100000</number>
609 609 </property>
610 610 <property name="maximum">
611 611 <number>100000</number>
612 612 </property>
613 613 </widget>
614 614 </item>
615 615 <item row="2" column="0" colspan="2">
616 616 <widget class="QFontComboBox" name="labelFontComboBox"/>
617 617 </item>
618 618 </layout>
619 619 </widget>
620 620 <widget class="QWidget" name="layoutWidget">
621 621 <property name="geometry">
622 622 <rect>
623 623 <x>10</x>
624 624 <y>497</y>
625 625 <width>190</width>
626 626 <height>48</height>
627 627 </rect>
628 628 </property>
629 629 <layout class="QGridLayout" name="gridLayout_4">
630 630 <item row="0" column="0">
631 631 <widget class="QLabel" name="label_15">
632 632 <property name="text">
633 633 <string>Title font size</string>
634 634 </property>
635 635 </widget>
636 636 </item>
637 637 <item row="0" column="1">
638 638 <widget class="QSpinBox" name="titleFontSizeSpin">
639 639 <property name="minimum">
640 640 <number>-100000</number>
641 641 </property>
642 642 <property name="maximum">
643 643 <number>100000</number>
644 644 </property>
645 645 </widget>
646 646 </item>
647 647 <item row="1" column="0" colspan="2">
648 648 <widget class="QFontComboBox" name="titleFontComboBox"/>
649 649 </item>
650 650 </layout>
651 651 </widget>
652 652 <widget class="QWidget" name="layoutWidget">
653 653 <property name="geometry">
654 654 <rect>
655 655 <x>10</x>
656 656 <y>655</y>
657 657 <width>168</width>
658 658 <height>22</height>
659 659 </rect>
660 660 </property>
661 661 <layout class="QHBoxLayout" name="horizontalLayout_2">
662 662 <item>
663 663 <widget class="QLabel" name="label_16">
664 664 <property name="text">
665 665 <string>Log Base</string>
666 666 </property>
667 667 </widget>
668 668 </item>
669 669 <item>
670 670 <widget class="QDoubleSpinBox" name="logBaseSpin">
671 671 <property name="decimals">
672 672 <number>5</number>
673 673 </property>
674 674 <property name="minimum">
675 675 <double>-999999999.000000000000000</double>
676 676 </property>
677 677 <property name="maximum">
678 678 <double>999999999.000000000000000</double>
679 679 </property>
680 680 <property name="value">
681 681 <double>8.000000000000000</double>
682 682 </property>
683 683 </widget>
684 684 </item>
685 685 </layout>
686 686 </widget>
687 687 <widget class="QWidget" name="layoutWidget">
688 688 <property name="geometry">
689 689 <rect>
690 690 <x>10</x>
691 <y>692</y>
692 <width>198</width>
693 <height>19</height>
691 <y>680</y>
692 <width>191</width>
693 <height>31</height>
694 694 </rect>
695 695 </property>
696 <layout class="QHBoxLayout" name="horizontalLayout_3">
697 <item>
698 <widget class="QCheckBox" name="niceNumbersCheckBox">
696 <layout class="QGridLayout" name="gridLayout_6">
697 <item row="0" column="1">
698 <widget class="QCheckBox" name="moreCategoriesCheckBox">
699 699 <property name="text">
700 <string>Nice Numbers</string>
700 <string>More Categories</string>
701 701 </property>
702 702 </widget>
703 703 </item>
704 <item>
705 <widget class="QCheckBox" name="moreCategoriesCheckBox">
704 <item row="0" column="0">
705 <widget class="QCheckBox" name="niceNumbersCheckBox">
706 706 <property name="text">
707 <string>More Categories</string>
707 <string>Nice Numbers</string>
708 708 </property>
709 709 </widget>
710 710 </item>
711 711 </layout>
712 712 </widget>
713 713 <widget class="QWidget" name="layoutWidget">
714 714 <property name="geometry">
715 715 <rect>
716 716 <x>10</x>
717 <y>729</y>
717 <y>740</y>
718 718 <width>221</width>
719 719 <height>22</height>
720 720 </rect>
721 721 </property>
722 722 <layout class="QHBoxLayout" name="horizontalLayout_4">
723 723 <item>
724 724 <widget class="QLabel" name="label_17">
725 725 <property name="text">
726 726 <string>DateTime format</string>
727 727 </property>
728 728 </widget>
729 729 </item>
730 730 <item>
731 731 <widget class="QLineEdit" name="dateFormatEdit"/>
732 732 </item>
733 733 </layout>
734 734 </widget>
735 735 <widget class="QWidget" name="layoutWidget">
736 736 <property name="geometry">
737 737 <rect>
738 738 <x>10</x>
739 739 <y>766</y>
740 740 <width>136</width>
741 741 <height>42</height>
742 742 </rect>
743 743 </property>
744 744 <layout class="QGridLayout" name="gridLayout_5">
745 745 <item row="0" column="0">
746 746 <widget class="QCheckBox" name="series1checkBox">
747 747 <property name="text">
748 748 <string>1</string>
749 749 </property>
750 750 </widget>
751 751 </item>
752 752 <item row="0" column="1">
753 753 <widget class="QCheckBox" name="series2checkBox">
754 754 <property name="text">
755 755 <string>2</string>
756 756 </property>
757 757 </widget>
758 758 </item>
759 759 <item row="0" column="2">
760 760 <widget class="QCheckBox" name="series3checkBox">
761 761 <property name="text">
762 762 <string>3</string>
763 763 </property>
764 764 </widget>
765 765 </item>
766 766 <item row="0" column="3" rowspan="2">
767 767 <widget class="QCheckBox" name="series7checkBox">
768 768 <property name="text">
769 769 <string>7</string>
770 770 </property>
771 771 </widget>
772 772 </item>
773 773 <item row="1" column="0">
774 774 <widget class="QCheckBox" name="series4checkBox">
775 775 <property name="text">
776 776 <string>4</string>
777 777 </property>
778 778 </widget>
779 779 </item>
780 780 <item row="1" column="1">
781 781 <widget class="QCheckBox" name="series5checkBox">
782 782 <property name="text">
783 783 <string>5</string>
784 784 </property>
785 785 </widget>
786 786 </item>
787 787 <item row="1" column="2">
788 788 <widget class="QCheckBox" name="series6checkBox">
789 789 <property name="text">
790 790 <string>6</string>
791 791 </property>
792 792 </widget>
793 793 </item>
794 794 </layout>
795 795 </widget>
796 796 <widget class="QWidget" name="layoutWidget">
797 797 <property name="geometry">
798 798 <rect>
799 799 <x>10</x>
800 800 <y>75</y>
801 801 <width>178</width>
802 802 <height>126</height>
803 803 </rect>
804 804 </property>
805 805 <layout class="QGridLayout" name="gridLayout">
806 806 <item row="1" column="0">
807 807 <widget class="QLabel" name="label_2">
808 808 <property name="text">
809 809 <string>Angular Tick count</string>
810 810 </property>
811 811 </widget>
812 812 </item>
813 813 <item row="2" column="1">
814 814 <widget class="QSpinBox" name="anglesSpin">
815 815 <property name="minimum">
816 816 <number>-9999</number>
817 817 </property>
818 818 <property name="maximum">
819 819 <number>9999</number>
820 820 </property>
821 821 <property name="singleStep">
822 822 <number>5</number>
823 823 </property>
824 824 </widget>
825 825 </item>
826 826 <item row="3" column="1">
827 827 <widget class="QSpinBox" name="radialMinorTicksSpin"/>
828 828 </item>
829 829 <item row="0" column="0">
830 830 <widget class="QLabel" name="label">
831 831 <property name="text">
832 832 <string>Radial Tick count</string>
833 833 </property>
834 834 </widget>
835 835 </item>
836 836 <item row="4" column="0">
837 837 <widget class="QLabel" name="label_7">
838 838 <property name="text">
839 839 <string>Angular Minor Tick count</string>
840 840 </property>
841 841 </widget>
842 842 </item>
843 843 <item row="0" column="1">
844 844 <widget class="QSpinBox" name="radialTicksSpin"/>
845 845 </item>
846 846 <item row="4" column="1">
847 847 <widget class="QSpinBox" name="angularMinorTicksSpin"/>
848 848 </item>
849 849 <item row="3" column="0">
850 850 <widget class="QLabel" name="label_6">
851 851 <property name="text">
852 852 <string>Radial Minor Tick count</string>
853 853 </property>
854 854 </widget>
855 855 </item>
856 856 <item row="1" column="1">
857 857 <widget class="QSpinBox" name="angularTicksSpin"/>
858 858 </item>
859 859 <item row="2" column="0">
860 860 <widget class="QLabel" name="label_3">
861 861 <property name="text">
862 862 <string>Label angles</string>
863 863 </property>
864 864 </widget>
865 865 </item>
866 866 </layout>
867 867 </widget>
868 868 <widget class="QComboBox" name="minorGridComboBox">
869 869 <property name="geometry">
870 870 <rect>
871 871 <x>10</x>
872 872 <y>630</y>
873 873 <width>141</width>
874 874 <height>20</height>
875 875 </rect>
876 876 </property>
877 877 <property name="sizePolicy">
878 878 <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
879 879 <horstretch>0</horstretch>
880 880 <verstretch>0</verstretch>
881 881 </sizepolicy>
882 882 </property>
883 883 <property name="currentIndex">
884 884 <number>1</number>
885 885 </property>
886 886 <item>
887 887 <property name="text">
888 888 <string>Invisible minor grid</string>
889 889 </property>
890 890 </item>
891 891 <item>
892 892 <property name="text">
893 893 <string>Black minor grid</string>
894 894 </property>
895 895 </item>
896 896 <item>
897 897 <property name="text">
898 898 <string>Custom minor grid pen</string>
899 899 </property>
900 900 </item>
901 901 </widget>
902 <widget class="QCheckBox" name="categoryLabelLocationCheckBox">
903 <property name="geometry">
904 <rect>
905 <x>10</x>
906 <y>710</y>
907 <width>142</width>
908 <height>17</height>
909 </rect>
910 </property>
911 <property name="text">
912 <string>Category Label On Tick</string>
913 </property>
914 </widget>
902 915 </widget>
903 916 </item>
904 917 </layout>
905 918 </widget>
906 919 <widget class="QMenuBar" name="menuBar">
907 920 <property name="geometry">
908 921 <rect>
909 922 <x>0</x>
910 923 <y>0</y>
911 924 <width>1193</width>
912 925 <height>21</height>
913 926 </rect>
914 927 </property>
915 928 </widget>
916 929 <widget class="QToolBar" name="mainToolBar">
917 930 <attribute name="toolBarArea">
918 931 <enum>TopToolBarArea</enum>
919 932 </attribute>
920 933 <attribute name="toolBarBreak">
921 934 <bool>false</bool>
922 935 </attribute>
923 936 </widget>
924 937 <widget class="QStatusBar" name="statusBar"/>
925 938 </widget>
926 939 <layoutdefault spacing="6" margin="11"/>
927 940 <customwidgets>
928 941 <customwidget>
929 942 <class>ChartView</class>
930 943 <extends>QGraphicsView</extends>
931 944 <header>chartview.h</header>
932 945 </customwidget>
933 946 </customwidgets>
934 947 <resources/>
935 948 <connections/>
936 949 </ui>
General Comments 0
You need to be logged in to leave comments. Login now