##// END OF EJS Templates
Added minor ticks to value axis...
Titta Heikkala -
r2795:dab4dfead39d
parent child
Show More
@@ -89,6 +89,35 void CartesianChartAxis::createItems(int count)
89 89 }
90 90 }
91 91
92 void CartesianChartAxis::updateMinorTickItems()
93 {
94 QValueAxis *valueAxis = qobject_cast<QValueAxis *>(this->axis());
95 if (valueAxis) {
96 int currentCount = minorArrowItems().size();
97 int expectedCount = valueAxis->minorTickCount() * (valueAxis->tickCount() - 1);
98 int diff = expectedCount - currentCount;
99 if (diff > 0) {
100 for (int i = 0; i < diff; i++) {
101 QGraphicsLineItem *minorArrow = new QGraphicsLineItem(this);
102 QGraphicsLineItem *minorGrid = new QGraphicsLineItem(this);
103 minorArrow->setPen(valueAxis->linePen());
104 minorGrid->setPen(valueAxis->minorGridLinePen());
105 minorArrowGroup()->addToGroup(minorArrow);
106 minorGridGroup()->addToGroup(minorGrid);
107 }
108 } else {
109 QList<QGraphicsItem *> minorGridLines = minorGridItems();
110 QList<QGraphicsItem *> minorArrows = minorArrowItems();
111 for (int i = 0; i > diff; i--) {
112 if (!minorGridLines.isEmpty())
113 delete(minorGridLines.takeLast());
114 if (!minorArrows.isEmpty())
115 delete(minorArrows.takeLast());
116 }
117 }
118 }
119 }
120
92 121 void CartesianChartAxis::deleteItems(int count)
93 122 {
94 123 QList<QGraphicsItem *> lines = gridItems();
@@ -114,6 +143,8 void CartesianChartAxis::updateLayout(QVector<qreal> &layout)
114 143 else if (diff < 0)
115 144 createItems(-diff);
116 145
146 updateMinorTickItems();
147
117 148 if (animation()) {
118 149 switch (presenter()->state()) {
119 150 case ChartPresenter::ZoomInState:
@@ -182,6 +213,18 void CartesianChartAxis::handleGridPenChanged(const QPen &pen)
182 213 static_cast<QGraphicsLineItem *>(item)->setPen(pen);
183 214 }
184 215
216 void CartesianChartAxis::handleMinorArrowPenChanged(const QPen &pen)
217 {
218 foreach (QGraphicsItem *item, minorArrowItems())
219 static_cast<QGraphicsLineItem *>(item)->setPen(pen);
220 }
221
222 void CartesianChartAxis::handleMinorGridPenChanged(const QPen &pen)
223 {
224 foreach (QGraphicsItem *item, minorGridItems())
225 static_cast<QGraphicsLineItem *>(item)->setPen(pen);
226 }
227
185 228 void CartesianChartAxis::handleShadesBrushChanged(const QBrush &brush)
186 229 {
187 230 foreach (QGraphicsItem *item, shadeItems())
@@ -60,10 +60,13 public Q_SLOTS:
60 60 virtual void handleGridPenChanged(const QPen &pen);
61 61 virtual void handleShadesBrushChanged(const QBrush &brush);
62 62 virtual void handleShadesPenChanged(const QPen &pen);
63 virtual void handleMinorArrowPenChanged(const QPen &pen);
64 virtual void handleMinorGridPenChanged(const QPen &pen);
63 65
64 66 private:
65 67 void createItems(int count);
66 68 void deleteItems(int count);
69 void updateMinorTickItems();
67 70
68 71 private:
69 72 QRectF m_gridRect;
@@ -48,6 +48,8 ChartAxisElement::ChartAxisElement(QAbstractAxis *axis, QGraphicsItem *item, boo
48 48 m_animation(0),
49 49 m_grid(new QGraphicsItemGroup(item)),
50 50 m_arrow(new QGraphicsItemGroup(item)),
51 m_minorGrid(new QGraphicsItemGroup(item)),
52 m_minorArrow(new QGraphicsItemGroup(item)),
51 53 m_shades(new QGraphicsItemGroup(item)),
52 54 m_labels(new QGraphicsItemGroup(item)),
53 55 m_title(new QGraphicsTextItem(item)),
@@ -57,9 +59,12 ChartAxisElement::ChartAxisElement(QAbstractAxis *axis, QGraphicsItem *item, boo
57 59 //initial initialization
58 60 m_arrow->setHandlesChildEvents(false);
59 61 m_arrow->setZValue(ChartPresenter::AxisZValue);
62 m_minorArrow->setHandlesChildEvents(false);
63 m_minorArrow->setZValue(ChartPresenter::AxisZValue);
60 64 m_labels->setZValue(ChartPresenter::AxisZValue);
61 65 m_shades->setZValue(ChartPresenter::ShadesZValue);
62 66 m_grid->setZValue(ChartPresenter::GridZValue);
67 m_minorGrid->setZValue(ChartPresenter::GridZValue);
63 68 m_title->setZValue(ChartPresenter::GridZValue);
64 69 m_title->document()->setDocumentMargin(ChartPresenter::textMargin());
65 70 handleVisibleChanged(axis->isVisible());
@@ -92,6 +97,14 void ChartAxisElement::connectSlots()
92 97 QObject::connect(axis(), SIGNAL(titleVisibleChanged(bool)), this, SLOT(handleTitleVisibleChanged(bool)));
93 98 QObject::connect(axis()->d_ptr.data(), SIGNAL(rangeChanged(qreal, qreal)), this, SLOT(handleRangeChanged(qreal, qreal)));
94 99 QObject::connect(axis(), SIGNAL(reverseChanged(bool)), this, SLOT(handleReverseChanged(bool)));
100 QObject::connect(axis(), SIGNAL(lineVisibleChanged(bool)),
101 this, SLOT(handleMinorArrowVisibleChanged(bool)));
102 QObject::connect(axis(), SIGNAL(linePenChanged(const QPen&)), this,
103 SLOT(handleMinorArrowPenChanged(const QPen&)));
104 QObject::connect(axis(), SIGNAL(minorGridVisibleChanged(bool)),
105 this, SLOT(handleMinorGridVisibleChanged(bool)));
106 QObject::connect(axis(), SIGNAL(minorGridLinePenChanged(const QPen&)),
107 this, SLOT(handleMinorGridPenChanged(const QPen&)));
95 108 }
96 109
97 110 void ChartAxisElement::handleArrowVisibleChanged(bool visible)
@@ -99,11 +112,21 void ChartAxisElement::handleArrowVisibleChanged(bool visible)
99 112 m_arrow->setVisible(visible);
100 113 }
101 114
115 void ChartAxisElement::handleMinorArrowVisibleChanged(bool visible)
116 {
117 m_minorArrow->setVisible(visible);
118 }
119
102 120 void ChartAxisElement::handleGridVisibleChanged(bool visible)
103 121 {
104 122 m_grid->setVisible(visible);
105 123 }
106 124
125 void ChartAxisElement::handleMinorGridVisibleChanged(bool visible)
126 {
127 m_minorGrid->setVisible(visible);
128 }
129
107 130 void ChartAxisElement::handleLabelsVisibleChanged(bool visible)
108 131 {
109 132 QGraphicsLayoutItem::updateGeometry();
@@ -174,12 +197,16 void ChartAxisElement::handleVisibleChanged(bool visible)
174 197 if (!visible) {
175 198 m_grid->setVisible(visible);
176 199 m_arrow->setVisible(visible);
200 m_minorGrid->setVisible(visible);
201 m_minorArrow->setVisible(visible);
177 202 m_shades->setVisible(visible);
178 203 m_labels->setVisible(visible);
179 204 m_title->setVisible(visible);
180 205 } else {
181 206 m_grid->setVisible(axis()->isGridLineVisible());
182 207 m_arrow->setVisible(axis()->isLineVisible());
208 m_minorGrid->setVisible(axis()->isMinorGridLineVisible());
209 m_minorArrow->setVisible(axis()->isLineVisible());
183 210 m_shades->setVisible(axis()->shadesVisible());
184 211 m_labels->setVisible(axis()->labelsVisible());
185 212 m_title->setVisible(axis()->isTitleVisible());
@@ -96,14 +96,18 protected:
96 96 virtual void updateLayout(QVector<qreal> &layout) = 0;
97 97
98 98 QList<QGraphicsItem *> gridItems() { return m_grid->childItems(); }
99 QList<QGraphicsItem *> minorGridItems() { return m_minorGrid->childItems(); }
99 100 QList<QGraphicsItem *> labelItems() { return m_labels->childItems(); }
100 101 QList<QGraphicsItem *> shadeItems() { return m_shades->childItems(); }
101 102 QList<QGraphicsItem *> arrowItems() { return m_arrow->childItems(); }
103 QList<QGraphicsItem *> minorArrowItems() { return m_minorArrow->childItems(); }
102 104 QGraphicsTextItem *titleItem() const { return m_title.data(); }
103 105 QGraphicsItemGroup *gridGroup() { return m_grid.data(); }
106 QGraphicsItemGroup *minorGridGroup() { return m_minorGrid.data(); }
104 107 QGraphicsItemGroup *labelGroup() { return m_labels.data(); }
105 108 QGraphicsItemGroup *shadeGroup() { return m_shades.data(); }
106 109 QGraphicsItemGroup *arrowGroup() { return m_arrow.data(); }
110 QGraphicsItemGroup *minorArrowGroup() { return m_minorArrow.data(); }
107 111
108 112 public Q_SLOTS:
109 113 void handleVisibleChanged(bool visible);
@@ -116,6 +120,8 public Q_SLOTS:
116 120 virtual void handleShadesPenChanged(const QPen &pen) = 0;
117 121 virtual void handleArrowPenChanged(const QPen &pen) = 0;
118 122 virtual void handleGridPenChanged(const QPen &pen) = 0;
123 virtual void handleMinorArrowPenChanged(const QPen &pen) = 0;
124 virtual void handleMinorGridPenChanged(const QPen &pen) = 0;
119 125 void handleLabelsBrushChanged(const QBrush &brush);
120 126 void handleLabelsFontChanged(const QFont &font);
121 127 void handleTitleBrushChanged(const QBrush &brush);
@@ -124,6 +130,9 public Q_SLOTS:
124 130 void handleTitleVisibleChanged(bool visible);
125 131 void handleRangeChanged(qreal min, qreal max);
126 132 void handleReverseChanged(bool reverse);
133 void handleMinorArrowVisibleChanged(bool visible);
134 void handleMinorGridVisibleChanged(bool visible);
135
127 136
128 137 Q_SIGNALS:
129 138 void clicked();
@@ -141,6 +150,8 private:
141 150 QRectF m_axisRect;
142 151 QScopedPointer<QGraphicsItemGroup> m_grid;
143 152 QScopedPointer<QGraphicsItemGroup> m_arrow;
153 QScopedPointer<QGraphicsItemGroup> m_minorGrid;
154 QScopedPointer<QGraphicsItemGroup> m_minorArrow;
144 155 QScopedPointer<QGraphicsItemGroup> m_shades;
145 156 QScopedPointer<QGraphicsItemGroup> m_labels;
146 157 QScopedPointer<QGraphicsTextItem> m_title;
@@ -94,6 +94,8 void HorizontalAxis::updateGeometry()
94 94
95 95 QList<QGraphicsItem *> lines = gridItems();
96 96 QList<QGraphicsItem *> shades = shadeItems();
97 QList<QGraphicsItem *> minorLines = minorGridItems();
98 QList<QGraphicsItem *> minorArrows = minorArrowItems();
97 99
98 100 for (int i = 0; i < layout.size(); ++i) {
99 101 //items
@@ -279,6 +281,54 void HorizontalAxis::updateGeometry()
279 281 tickItem->setVisible(true);
280 282 }
281 283
284 // add minor ticks
285 QValueAxis *valueAxis = qobject_cast<QValueAxis *>(axis());
286 if ((i + 1) != layout.size() && valueAxis) {
287 int minorTickCount = valueAxis->minorTickCount();
288 if (minorTickCount != 0) {
289 qreal minorTickDistance = (layout[i] - layout[i + 1]) / qreal(minorTickCount + 1);
290 for (int j = 0; j < minorTickCount; j++) {
291 QGraphicsLineItem *minorGridItem =
292 static_cast<QGraphicsLineItem *>(minorLines.at(i * minorTickCount + j));
293 QGraphicsLineItem *minorArrowItem =
294 static_cast<QGraphicsLineItem *>(minorArrows.at(i * minorTickCount + j));
295 if (i == 0) {
296 minorGridItem->setLine(gridRect.left() - minorTickDistance * qreal(j + 1),
297 gridRect.top(),
298 gridRect.left() - minorTickDistance * qreal(j + 1),
299 gridRect.bottom());
300 } else {
301 minorGridItem->setLine(gridItem->line().p1().x()
302 - minorTickDistance * qreal(j + 1),
303 gridRect.top(),
304 gridItem->line().p1().x()
305 - minorTickDistance * qreal(j + 1),
306 gridRect.bottom());
307 }
308 if (axis()->alignment() == Qt::AlignTop) {
309 minorArrowItem->setLine(minorGridItem->line().p1().x(),
310 axisRect.bottom(),
311 minorGridItem->line().p1().x(),
312 axisRect.bottom() - labelPadding() / 2);
313 } else if (axis()->alignment() == Qt::AlignBottom){
314 minorArrowItem->setLine(minorGridItem->line().p1().x(),
315 axisRect.top(),
316 minorGridItem->line().p1().x(),
317 axisRect.top() + labelPadding() / 2);
318 }
319
320 // check if the minor grid line and the axis tick should be shown
321 qreal minorXPos = minorGridItem->line().p1().x();
322 if (minorXPos < gridRect.left() || minorXPos > gridRect.right()) {
323 minorGridItem->setVisible(false);
324 minorArrowItem->setVisible(false);
325 } else {
326 minorGridItem->setVisible(true);
327 minorArrowItem->setVisible(true);
328 }
329 }
330 }
331 }
282 332 }
283 333
284 334 //begin/end grid line in case labels between
@@ -19,6 +19,7
19 19 #include <private/polarchartaxis_p.h>
20 20 #include <private/qabstractaxis_p.h>
21 21 #include <private/chartpresenter_p.h>
22 #include <QtCharts/QValueAxis>
22 23
23 24 QT_CHARTS_BEGIN_NAMESPACE
24 25
@@ -77,6 +78,8 void PolarChartAxis::updateLayout(QVector<qreal> &layout)
77 78 else if (diff < 0)
78 79 createItems(-diff);
79 80
81 updateMinorTickItems();
82
80 83 if (animation()) {
81 84 animation()->setValues(ChartAxisElement::layout(), layout);
82 85 presenter()->startAnimation(animation());
@@ -54,6 +54,7 protected:
54 54 protected: // virtual functions
55 55 virtual void createItems(int count) = 0;
56 56 virtual void createAxisLabels(const QVector<qreal> &layout) = 0;
57 virtual void updateMinorTickItems() = 0;
57 58
58 59 public Q_SLOTS:
59 60 virtual void handleShadesBrushChanged(const QBrush &brush);
@@ -51,6 +51,8 void PolarChartAxisAngular::updateGeometry()
51 51 QList<QGraphicsItem *> gridItemList = gridItems();
52 52 QList<QGraphicsItem *> labelItemList = labelItems();
53 53 QList<QGraphicsItem *> shadeItemList = shadeItems();
54 QList<QGraphicsItem *> minorGridItemList = minorGridItems();
55 QList<QGraphicsItem *> minorArrowItemList = minorArrowItems();
54 56 QGraphicsTextItem *title = titleItem();
55 57
56 58 QGraphicsEllipseItem *axisLine = static_cast<QGraphicsEllipseItem *>(arrowItemList.at(0));
@@ -217,6 +219,36 void PolarChartAxisAngular::updateGeometry()
217 219 shadeItem->setVisible(true);
218 220 firstShade = false;
219 221 }
222
223 // Minor ticks
224 QValueAxis *valueAxis = qobject_cast<QValueAxis *>(axis());
225 if ((i + 1) != layout.size() && valueAxis) {
226 int minorTickCount = valueAxis->minorTickCount();
227 if (minorTickCount != 0) {
228 qreal minorAngularCoordinate = (layout[i + 1] - layout[i])
229 / qreal(minorTickCount + 1);
230 for (int j = 0; j < minorTickCount; j++) {
231 QGraphicsLineItem *minorGridItem =
232 static_cast<QGraphicsLineItem *>(minorGridItemList.at(i * minorTickCount + j));
233 QGraphicsLineItem *minorTickItem =
234 static_cast<QGraphicsLineItem *>(minorArrowItemList.at(i * minorTickCount + j));
235 qreal minorAngle = 90.0 - angularCoordinate
236 - minorAngularCoordinate * qreal(j + 1);
237 QLineF minorGridLine = QLineF::fromPolar(radius, minorAngle);
238 minorGridLine.translate(center);
239 minorGridItem->setLine(minorGridLine);
240 minorGridItem->setVisible(true);
241
242 QLineF minorTickLine(QLineF::fromPolar(radius - tickWidth() + 1,
243 minorAngle).p2(),
244 QLineF::fromPolar(radius + tickWidth() - 1,
245 minorAngle).p2());
246 minorTickLine.translate(center);
247 minorTickItem->setLine(minorTickLine);
248 minorTickItem->setVisible(true);
249 }
250 }
251 }
220 252 }
221 253
222 254 // Title, centered above the chart
@@ -299,6 +331,19 void PolarChartAxisAngular::handleGridPenChanged(const QPen &pen)
299 331 static_cast<QGraphicsLineItem *>(item)->setPen(pen);
300 332 }
301 333
334 void PolarChartAxisAngular::handleMinorArrowPenChanged(const QPen &pen)
335 {
336 foreach (QGraphicsItem *item, minorArrowItems()) {
337 static_cast<QGraphicsLineItem *>(item)->setPen(pen);
338 }
339 }
340
341 void PolarChartAxisAngular::handleMinorGridPenChanged(const QPen &pen)
342 {
343 foreach (QGraphicsItem *item, minorGridItems())
344 static_cast<QGraphicsLineItem *>(item)->setPen(pen);
345 }
346
302 347 QSizeF PolarChartAxisAngular::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
303 348 {
304 349 Q_UNUSED(which);
@@ -426,6 +471,36 QRectF PolarChartAxisAngular::moveLabelToPosition(qreal angularCoordinate, QPoin
426 471 return labelRect;
427 472 }
428 473
474 void PolarChartAxisAngular::updateMinorTickItems()
475 {
476 QValueAxis *valueAxis = qobject_cast<QValueAxis *>(this->axis());
477 if (valueAxis) {
478 int currentCount = minorArrowItems().size();
479 int expectedCount = valueAxis->minorTickCount() * (valueAxis->tickCount() - 1);
480 int diff = expectedCount - currentCount;
481 if (diff > 0) {
482 for (int i = 0; i < diff; i++) {
483 QGraphicsLineItem *minorArrow = new QGraphicsLineItem(presenter()->rootItem());
484 QGraphicsLineItem *minorGrid = new QGraphicsLineItem(presenter()->rootItem());
485 minorArrow->setPen(valueAxis->linePen());
486 minorGrid->setPen(valueAxis->minorGridLinePen());
487 minorArrowGroup()->addToGroup(minorArrow);
488 minorGridGroup()->addToGroup(minorGrid);
489 }
490 } else {
491 QList<QGraphicsItem *> minorGridLines = minorGridItems();
492 QList<QGraphicsItem *> minorArrows = minorArrowItems();
493 for (int i = 0; i > diff; i--) {
494 if (!minorGridLines.isEmpty())
495 delete(minorGridLines.takeLast());
496 if (!minorArrows.isEmpty())
497 delete(minorArrows.takeLast());
498 }
499 }
500 }
501 }
502
503
429 504 #include "moc_polarchartaxisangular_p.cpp"
430 505
431 506 QT_CHARTS_END_NAMESPACE
@@ -45,12 +45,15 public:
45 45
46 46 virtual void updateGeometry();
47 47 virtual void createItems(int count);
48 virtual void updateMinorTickItems();
48 49
49 50 qreal preferredAxisRadius(const QSizeF &maxSize);
50 51
51 52 public Q_SLOTS:
52 53 virtual void handleArrowPenChanged(const QPen &pen);
53 54 virtual void handleGridPenChanged(const QPen &pen);
55 virtual void handleMinorArrowPenChanged(const QPen &pen);
56 virtual void handleMinorGridPenChanged(const QPen &pen);
54 57
55 58 private:
56 59 QRectF moveLabelToPosition(qreal angularCoordinate, QPointF labelPoint, QRectF labelRect) const;
@@ -47,6 +47,8 void PolarChartAxisRadial::updateGeometry()
47 47 QList<QGraphicsItem *> gridItemList = gridItems();
48 48 QList<QGraphicsItem *> labelItemList = labelItems();
49 49 QList<QGraphicsItem *> shadeItemList = shadeItems();
50 QList<QGraphicsItem *> minorGridItemList = minorGridItems();
51 QList<QGraphicsItem *> minorArrowItemList = minorArrowItems();
50 52 QGraphicsTextItem* title = titleItem();
51 53 qreal radius = axisGeometry().height() / 2.0;
52 54
@@ -200,6 +202,37 void PolarChartAxisRadial::updateGeometry()
200 202 shadeItem->setVisible(true);
201 203 firstShade = false;
202 204 }
205
206 // Minor ticks
207 QValueAxis *valueAxis = qobject_cast<QValueAxis *>(axis());
208 if ((i + 1) != layout.size() && valueAxis) {
209 int minorTickCount = valueAxis->minorTickCount();
210 if (minorTickCount != 0) {
211 qreal minorRadialCoordinate = (layout[i + 1] - layout[i])
212 / qreal(minorTickCount + 1) * 2.0;
213 for (int j = 0; j < minorTickCount; j++) {
214 QGraphicsEllipseItem *minorGridItem =
215 static_cast<QGraphicsEllipseItem *>(minorGridItemList.at(i * minorTickCount + j));
216 QGraphicsLineItem *minorTickItem =
217 static_cast<QGraphicsLineItem *>(minorArrowItemList.at(i * minorTickCount + j));
218
219 QRectF minorGridRect;
220 minorGridRect.setWidth(minorRadialCoordinate * qreal(i + 1)
221 + minorRadialCoordinate * qreal(i * minorTickCount + j));
222 minorGridRect.setHeight(minorRadialCoordinate * qreal(i + 1)
223 + minorRadialCoordinate
224 * qreal(i * minorTickCount + j));
225 minorGridRect.moveCenter(center);
226 minorGridItem->setRect(minorGridRect);
227 minorGridItem->setVisible(true);
228
229 QLineF minorTickLine(-tickWidth() + 1, 0.0, tickWidth() - 1, 0.0);
230 tickLine.translate(center.rx(), minorGridRect.top());
231 minorTickItem->setLine(minorTickLine);
232 minorTickItem->setVisible(true);
233 }
234 }
235 }
203 236 }
204 237
205 238 // Title, along the 0 axis
@@ -275,6 +308,18 void PolarChartAxisRadial::handleGridPenChanged(const QPen &pen)
275 308 static_cast<QGraphicsEllipseItem *>(item)->setPen(pen);
276 309 }
277 310
311 void PolarChartAxisRadial::handleMinorArrowPenChanged(const QPen &pen)
312 {
313 foreach (QGraphicsItem *item, minorArrowItems())
314 static_cast<QGraphicsLineItem *>(item)->setPen(pen);
315 }
316
317 void PolarChartAxisRadial::handleMinorGridPenChanged(const QPen &pen)
318 {
319 foreach (QGraphicsItem *item, minorGridItems())
320 static_cast<QGraphicsEllipseItem *>(item)->setPen(pen);
321 }
322
278 323 QSizeF PolarChartAxisRadial::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
279 324 {
280 325 Q_UNUSED(which);
@@ -290,6 +335,35 qreal PolarChartAxisRadial::preferredAxisRadius(const QSizeF &maxSize)
290 335 return radius;
291 336 }
292 337
338 void PolarChartAxisRadial::updateMinorTickItems()
339 {
340 QValueAxis *valueAxis = qobject_cast<QValueAxis *>(this->axis());
341 if (valueAxis) {
342 int currentCount = minorArrowItems().size();
343 int expectedCount = valueAxis->minorTickCount() * (valueAxis->tickCount() - 1);
344 int diff = expectedCount - currentCount;
345 if (diff > 0) {
346 for (int i = 0; i < diff; i++) {
347 QGraphicsLineItem *minorArrow = new QGraphicsLineItem(presenter()->rootItem());
348 QGraphicsEllipseItem *minorGrid = new QGraphicsEllipseItem(presenter()->rootItem());
349 minorArrow->setPen(valueAxis->linePen());
350 minorGrid->setPen(valueAxis->minorGridLinePen());
351 minorArrowGroup()->addToGroup(minorArrow);
352 minorGridGroup()->addToGroup(minorGrid);
353 }
354 } else {
355 QList<QGraphicsItem *> minorGridLines = minorGridItems();
356 QList<QGraphicsItem *> minorArrows = minorArrowItems();
357 for (int i = 0; i > diff; i--) {
358 if (!minorGridLines.isEmpty())
359 delete(minorGridLines.takeLast());
360 if (!minorArrows.isEmpty())
361 delete(minorArrows.takeLast());
362 }
363 }
364 }
365 }
366
293 367 #include "moc_polarchartaxisradial_p.cpp"
294 368
295 369 QT_CHARTS_END_NAMESPACE
@@ -45,12 +45,15 public:
45 45
46 46 virtual void updateGeometry();
47 47 virtual void createItems(int count);
48 virtual void updateMinorTickItems();
48 49
49 50 qreal preferredAxisRadius(const QSizeF &maxSize);
50 51
51 52 public Q_SLOTS:
52 53 virtual void handleArrowPenChanged(const QPen &pen);
53 54 virtual void handleGridPenChanged(const QPen &pen);
55 virtual void handleMinorArrowPenChanged(const QPen &pen);
56 virtual void handleMinorGridPenChanged(const QPen &pen);
54 57 };
55 58
56 59 QT_CHARTS_END_NAMESPACE
@@ -114,6 +114,15 QT_CHARTS_BEGIN_NAMESPACE
114 114 */
115 115
116 116 /*!
117 \property QAbstractAxis::minorGridVisible
118 The visibility of the minor grid lines. Applies only to QValueAxis.
119 */
120 /*!
121 \qmlproperty bool AbstractAxis::minorGridVisible
122 The visibility of the minor grid lines. Applies only to QValueAxis.
123 */
124
125 /*!
117 126 \property QAbstractAxis::color
118 127 The color of the axis and ticks.
119 128 */
@@ -128,6 +137,11 QT_CHARTS_BEGIN_NAMESPACE
128 137 */
129 138
130 139 /*!
140 \property QAbstractAxis::minorGridLinePen
141 The pen of the minor grid line. Applies only to QValueAxis.
142 */
143
144 /*!
131 145 \property QAbstractAxis::labelsFont
132 146 The font of the axis labels.
133 147 */
@@ -326,11 +340,25 QT_CHARTS_BEGIN_NAMESPACE
326 340 */
327 341
328 342 /*!
343 \fn void QAbstractAxis::minorGridVisibleChanged(bool visible)
344 Visibility of the minor grid lines of the axis has changed to \a visible.
345 */
346 /*!
347 \qmlsignal AbstractAxis::onMinorGridVisibleChanged(bool visible)
348 Visibility of the minor grid lines of the axis has changed to \a visible.
349 */
350
351 /*!
329 352 \fn void QAbstractAxis::gridLinePenChanged(const QPen& pen)
330 353 The pen of the grid line has changed to \a pen.
331 354 */
332 355
333 356 /*!
357 \fn void QAbstractAxis::minorGridLinePenChanged(const QPen& pen)
358 The pen of the minor grid line has changed to \a pen.
359 */
360
361 /*!
334 362 \fn void QAbstractAxis::colorChanged(QColor color)
335 363 Emitted if the \a color of the axis is changed.
336 364 */
@@ -505,6 +533,19 bool QAbstractAxis::isGridLineVisible() const
505 533 return d_ptr->m_gridLineVisible;
506 534 }
507 535
536 void QAbstractAxis::setMinorGridLineVisible(bool visible)
537 {
538 if (d_ptr->m_minorGridLineVisible != visible) {
539 d_ptr->m_minorGridLineVisible = visible;
540 emit minorGridVisibleChanged(visible);
541 }
542 }
543
544 bool QAbstractAxis::isMinorGridLineVisible() const
545 {
546 return d_ptr->m_minorGridLineVisible;
547 }
548
508 549 /*!
509 550 Sets \a pen used to draw grid line.
510 551 */
@@ -527,6 +568,22 QPen QAbstractAxis::gridLinePen() const
527 568 return d_ptr->m_gridLinePen;
528 569 }
529 570
571 void QAbstractAxis::setMinorGridLinePen(const QPen &pen)
572 {
573 if (d_ptr->m_minorGridLinePen != pen) {
574 d_ptr->m_minorGridLinePen = pen;
575 emit minorGridLinePenChanged(pen);
576 }
577 }
578
579 QPen QAbstractAxis::minorGridLinePen() const
580 {
581 if (d_ptr->m_minorGridLinePen == QChartPrivate::defaultPen())
582 return QPen();
583 else
584 return d_ptr->m_minorGridLinePen;
585 }
586
530 587 void QAbstractAxis::setLabelsVisible(bool visible)
531 588 {
532 589 if (d_ptr->m_labelsVisible != visible) {
@@ -873,6 +930,8 QAbstractAxisPrivate::QAbstractAxisPrivate(QAbstractAxis *q)
873 930 m_axisBrush(QChartPrivate::defaultBrush()),
874 931 m_gridLineVisible(true),
875 932 m_gridLinePen(QChartPrivate::defaultPen()),
933 m_minorGridLineVisible(true),
934 m_minorGridLinePen(QChartPrivate::defaultPen()),
876 935 m_labelsVisible(true),
877 936 m_labelsBrush(QChartPrivate::defaultBrush()),
878 937 m_labelsFont(QChartPrivate::defaultFont()),
@@ -918,6 +977,8 void QAbstractAxisPrivate::initializeTheme(ChartTheme* theme, bool forced)
918 977
919 978 if (forced || QChartPrivate::defaultPen() == m_gridLinePen)
920 979 q_ptr->setGridLinePen(theme->girdLinePen());
980 if (forced || QChartPrivate::defaultPen() == m_minorGridLinePen)
981 q_ptr->setMinorGridLinePen(theme->minorGridLinePen());
921 982
922 983 if (forced || QChartPrivate::defaultBrush() == m_labelsBrush)
923 984 q_ptr->setLabelsBrush(theme->labelBrush());
@@ -46,6 +46,8 class QT_CHARTS_EXPORT QAbstractAxis : public QObject
46 46 //grid
47 47 Q_PROPERTY(bool gridVisible READ isGridLineVisible WRITE setGridLineVisible NOTIFY gridVisibleChanged)
48 48 Q_PROPERTY(QPen gridLinePen READ gridLinePen WRITE setGridLinePen NOTIFY gridLinePenChanged)
49 Q_PROPERTY(bool minorGridVisible READ isMinorGridLineVisible WRITE setMinorGridLineVisible NOTIFY minorGridVisibleChanged)
50 Q_PROPERTY(QPen minorGridLinePen READ minorGridLinePen WRITE setMinorGridLinePen NOTIFY minorGridLinePenChanged)
49 51 //shades
50 52 Q_PROPERTY(bool shadesVisible READ shadesVisible WRITE setShadesVisible NOTIFY shadesVisibleChanged)
51 53 Q_PROPERTY(QColor shadesColor READ shadesColor WRITE setShadesColor NOTIFY shadesColorChanged)
@@ -103,6 +105,10 public:
103 105 void setGridLineVisible(bool visible = true);
104 106 void setGridLinePen(const QPen &pen);
105 107 QPen gridLinePen() const;
108 bool isMinorGridLineVisible() const;
109 void setMinorGridLineVisible(bool visible = true);
110 void setMinorGridLinePen(const QPen &pen);
111 QPen minorGridLinePen() const;
106 112
107 113 //labels handling
108 114 bool labelsVisible() const;
@@ -160,6 +166,8 Q_SIGNALS:
160 166 void labelsAngleChanged(int angle);
161 167 void gridLinePenChanged(const QPen &pen);
162 168 void gridVisibleChanged(bool visible);
169 void minorGridVisibleChanged(bool visible);
170 void minorGridLinePenChanged(const QPen &pen);
163 171 void colorChanged(QColor color);
164 172 void labelsColorChanged(QColor color);
165 173 void titleTextChanged(const QString &title);
@@ -100,6 +100,8 private:
100 100
101 101 bool m_gridLineVisible;
102 102 QPen m_gridLinePen;
103 bool m_minorGridLineVisible;
104 QPen m_minorGridLinePen;
103 105
104 106 bool m_labelsVisible;
105 107 QBrush m_labelsBrush;
@@ -33,6 +33,8 ChartValueAxisX::ChartValueAxisX(QValueAxis *axis, QGraphicsItem *item )
33 33 m_axis(axis)
34 34 {
35 35 QObject::connect(m_axis, SIGNAL(tickCountChanged(int)), this, SLOT(handleTickCountChanged(int)));
36 QObject::connect(m_axis, SIGNAL(minorTickCountChanged(int)),
37 this, SLOT(handleMinorTickCountChanged(int)));
36 38 QObject::connect(m_axis, SIGNAL(labelFormatChanged(QString)), this, SLOT(handleLabelFormatChanged(QString)));
37 39 }
38 40
@@ -72,6 +74,14 void ChartValueAxisX::handleTickCountChanged(int tick)
72 74 if(presenter()) presenter()->layout()->invalidate();
73 75 }
74 76
77 void ChartValueAxisX::handleMinorTickCountChanged(int tick)
78 {
79 Q_UNUSED(tick);
80 QGraphicsLayoutItem::updateGeometry();
81 if (presenter())
82 presenter()->layout()->invalidate();
83 }
84
75 85 void ChartValueAxisX::handleLabelFormatChanged(const QString &format)
76 86 {
77 87 Q_UNUSED(format);
@@ -47,6 +47,7 protected:
47 47 void updateGeometry();
48 48 private Q_SLOTS:
49 49 void handleTickCountChanged(int tick);
50 void handleMinorTickCountChanged(int tick);
50 51 void handleLabelFormatChanged(const QString &format);
51 52
52 53 private:
@@ -32,6 +32,8 ChartValueAxisY::ChartValueAxisY(QValueAxis *axis, QGraphicsItem *item)
32 32 m_axis(axis)
33 33 {
34 34 QObject::connect(m_axis, SIGNAL(tickCountChanged(int)), this, SLOT(handleTickCountChanged(int)));
35 QObject::connect(m_axis, SIGNAL(minorTickCountChanged(int)),
36 this, SLOT(handleMinorTickCountChanged(int)));
35 37 QObject::connect(m_axis, SIGNAL(labelFormatChanged(QString)), this, SLOT(handleLabelFormatChanged(QString)));
36 38 }
37 39
@@ -73,6 +75,14 void ChartValueAxisY::handleTickCountChanged(int tick)
73 75 if (presenter()) presenter()->layout()->invalidate();
74 76 }
75 77
78 void ChartValueAxisY::handleMinorTickCountChanged(int tick)
79 {
80 Q_UNUSED(tick);
81 QGraphicsLayoutItem::updateGeometry();
82 if (presenter())
83 presenter()->layout()->invalidate();
84 }
85
76 86 void ChartValueAxisY::handleLabelFormatChanged(const QString &format)
77 87 {
78 88 Q_UNUSED(format);
@@ -47,6 +47,7 protected:
47 47 void updateGeometry();
48 48 private Q_SLOTS:
49 49 void handleTickCountChanged(int tick);
50 void handleMinorTickCountChanged(int tick);
50 51 void handleLabelFormatChanged(const QString &format);
51 52
52 53 private:
@@ -26,6 +26,8 PolarChartValueAxisAngular::PolarChartValueAxisAngular(QValueAxis *axis, QGraphi
26 26 : PolarChartAxisAngular(axis, item)
27 27 {
28 28 QObject::connect(axis, SIGNAL(tickCountChanged(int)), this, SLOT(handleTickCountChanged(int)));
29 QObject::connect(axis, SIGNAL(minorTickCountChanged(int)),
30 this, SLOT(handleMinorTickCountChanged(int)));
29 31 QObject::connect(axis, SIGNAL(labelFormatChanged(QString)), this, SLOT(handleLabelFormatChanged(QString)));
30 32 }
31 33
@@ -65,6 +67,14 void PolarChartValueAxisAngular::handleTickCountChanged(int tick)
65 67 presenter()->layout()->invalidate();
66 68 }
67 69
70 void PolarChartValueAxisAngular::handleMinorTickCountChanged(int tick)
71 {
72 Q_UNUSED(tick);
73 QGraphicsLayoutItem::updateGeometry();
74 if (presenter())
75 presenter()->layout()->invalidate();
76 }
77
68 78 void PolarChartValueAxisAngular::handleLabelFormatChanged(const QString &format)
69 79 {
70 80 Q_UNUSED(format);
@@ -29,6 +29,7
29 29 #define POLARCHARTVALUEAXISANGULAR_P_H
30 30
31 31 #include <private/polarchartaxisangular_p.h>
32 #include <QtCharts/QValueAxis>
32 33
33 34 QT_CHARTS_BEGIN_NAMESPACE
34 35
@@ -46,6 +47,7 public:
46 47
47 48 private Q_SLOTS:
48 49 void handleTickCountChanged(int tick);
50 void handleMinorTickCountChanged(int tick);
49 51 void handleLabelFormatChanged(const QString &format);
50 52 };
51 53
@@ -26,6 +26,8 PolarChartValueAxisRadial::PolarChartValueAxisRadial(QValueAxis *axis, QGraphics
26 26 : PolarChartAxisRadial(axis, item)
27 27 {
28 28 QObject::connect(axis, SIGNAL(tickCountChanged(int)), this, SLOT(handleTickCountChanged(int)));
29 QObject::connect(axis, SIGNAL(minorTickCountChanged(int)),
30 this, SLOT(handleMinorTickCountChanged(int)));
29 31 QObject::connect(axis, SIGNAL(labelFormatChanged(QString)), this, SLOT(handleLabelFormatChanged(QString)));
30 32 }
31 33
@@ -64,6 +66,14 void PolarChartValueAxisRadial::handleTickCountChanged(int tick)
64 66 presenter()->layout()->invalidate();
65 67 }
66 68
69 void PolarChartValueAxisRadial::handleMinorTickCountChanged(int tick)
70 {
71 Q_UNUSED(tick);
72 QGraphicsLayoutItem::updateGeometry();
73 if (presenter())
74 presenter()->layout()->invalidate();
75 }
76
67 77 void PolarChartValueAxisRadial::handleLabelFormatChanged(const QString &format)
68 78 {
69 79 Q_UNUSED(format);
@@ -46,6 +46,7 public:
46 46
47 47 private Q_SLOTS:
48 48 void handleTickCountChanged(int tick);
49 void handleMinorTickCountChanged(int tick);
49 50 void handleLabelFormatChanged(const QString &format);
50 51 };
51 52
@@ -99,13 +99,24 QT_CHARTS_BEGIN_NAMESPACE
99 99
100 100 /*!
101 101 \property QValueAxis::tickCount
102 Defines the number of ticks on the axis. This indicates how many grid lines are draw on the chart.
103 The default value is 5, and it can not be below 2.
102 Defines the number of ticks on the axis. This indicates how many grid lines are drawn on the
103 chart. The default value is 5, and it can not be below 2.
104 104 */
105 105 /*!
106 \qmlproperty real ValueAxis::tickCount
107 Defines the number of ticks on the axis. This indicates how many grid lines are draw on the chart.
108 The default value is 5, and it can not be below 2.
106 \qmlproperty int ValueAxis::tickCount
107 Defines the number of ticks on the axis. This indicates how many grid lines are drawn on the
108 chart. The default value is 5, and it can not be below 2.
109 */
110
111 /*!
112 \property QValueAxis::minorTickCount
113 Defines the number of minor ticks on the axis. This indicates how many grid lines are drawn
114 between major ticks on the chart. Labels are not drawn for minor ticks. The default value is 0.
115 */
116 /*!
117 \qmlproperty int ValueAxis::minorTickCount
118 Defines the number of minor ticks on the axis. This indicates how many grid lines are drawn
119 between major ticks on the chart. Labels are not drawn for minor ticks. The default value is 0.
109 120 */
110 121
111 122 /*!
@@ -157,6 +168,15 QT_CHARTS_BEGIN_NAMESPACE
157 168 */
158 169
159 170 /*!
171 \fn void QValueAxis::minorTickCountChanged(int minorTickCount)
172 Axis emits signal when \a minorTickCount of axis has changed.
173 */
174 /*!
175 \qmlsignal ValueAxis::minorTickCountChanged(int minorTickCount)
176 Axis emits signal when \a minorTickCount of axis has changed.
177 */
178
179 /*!
160 180 \fn void QValueAxis::rangeChanged(qreal min, qreal max)
161 181 Axis emits signal when \a min or \a max of axis has changed.
162 182 */
@@ -247,6 +267,21 int QValueAxis::tickCount() const
247 267 return d->m_tickCount;
248 268 }
249 269
270 void QValueAxis::setMinorTickCount(int count)
271 {
272 Q_D(QValueAxis);
273 if (d->m_minorTickCount != count && count >= 0) {
274 d->m_minorTickCount = count;
275 emit minorTickCountChanged(count);
276 }
277 }
278
279 int QValueAxis::minorTickCount() const
280 {
281 Q_D(const QValueAxis);
282 return d->m_minorTickCount;
283 }
284
250 285 void QValueAxis::setLabelFormat(const QString &format)
251 286 {
252 287 Q_D(QValueAxis);
@@ -295,6 +330,7 QValueAxisPrivate::QValueAxisPrivate(QValueAxis *q)
295 330 m_min(0),
296 331 m_max(0),
297 332 m_tickCount(5),
333 m_minorTickCount(0),
298 334 m_format(QString::null),
299 335 m_applying(false)
300 336 {
@@ -32,6 +32,7 class QT_CHARTS_EXPORT QValueAxis : public QAbstractAxis
32 32 Q_PROPERTY(qreal min READ min WRITE setMin NOTIFY minChanged)
33 33 Q_PROPERTY(qreal max READ max WRITE setMax NOTIFY maxChanged)
34 34 Q_PROPERTY(QString labelFormat READ labelFormat WRITE setLabelFormat NOTIFY labelFormatChanged)
35 Q_PROPERTY(int minorTickCount READ minorTickCount WRITE setMinorTickCount NOTIFY minorTickCountChanged)
35 36
36 37 public:
37 38 explicit QValueAxis(QObject *parent = 0);
@@ -53,6 +54,8 public:
53 54 //ticks handling
54 55 void setTickCount(int count);
55 56 int tickCount() const;
57 void setMinorTickCount(int count);
58 int minorTickCount() const;
56 59
57 60 void setLabelFormat(const QString &format);
58 61 QString labelFormat() const;
@@ -65,6 +68,7 Q_SIGNALS:
65 68 void maxChanged(qreal max);
66 69 void rangeChanged(qreal min, qreal max);
67 70 void tickCountChanged(int tickCount);
71 void minorTickCountChanged(int tickCount);
68 72 void labelFormatChanged(const QString &format);
69 73
70 74 private:
@@ -57,6 +57,7 private:
57 57 qreal m_min;
58 58 qreal m_max;
59 59 int m_tickCount;
60 int m_minorTickCount;
60 61 QString m_format;
61 62 bool m_applying;
62 63 Q_DECLARE_PUBLIC(QValueAxis)
@@ -96,6 +96,8 void VerticalAxis::updateGeometry()
96 96
97 97 QList<QGraphicsItem *> lines = gridItems();
98 98 QList<QGraphicsItem *> shades = shadeItems();
99 QList<QGraphicsItem *> minorLines = minorGridItems();
100 QList<QGraphicsItem *> minorArrows = minorArrowItems();
99 101
100 102 for (int i = 0; i < layout.size(); ++i) {
101 103 //items
@@ -296,6 +298,54 void VerticalAxis::updateGeometry()
296 298 tickItem->setVisible(true);
297 299 }
298 300
301 // add minor ticks
302 QValueAxis *valueAxis = qobject_cast<QValueAxis *>(axis());
303 if ((i + 1) != layout.size() && valueAxis) {
304 int minorTickCount = valueAxis->minorTickCount();
305 if (minorTickCount != 0) {
306 qreal minorTickDistance = (layout[i] - layout[i + 1]) / qreal(minorTickCount + 1);
307 for (int j = 0; j < minorTickCount; j++) {
308 QGraphicsLineItem *minorGridItem =
309 static_cast<QGraphicsLineItem *>(minorLines.at(i * minorTickCount + j));
310 QGraphicsLineItem *minorArrowItem =
311 static_cast<QGraphicsLineItem *>(minorArrows.at(i * minorTickCount + j));
312 if (i == 0) {
313 minorGridItem->setLine(gridRect.left(),
314 gridRect.bottom() - minorTickDistance * qreal(j + 1),
315 gridRect.right(),
316 gridRect.bottom() - minorTickDistance * qreal(j + 1));
317 } else {
318 minorGridItem->setLine(gridRect.left(),
319 gridItem->line().p1().y()
320 - minorTickDistance * qreal(j + 1),
321 gridRect.right(),
322 gridItem->line().p1().y()
323 - minorTickDistance * qreal(j + 1));
324 }
325 if (axis()->alignment() == Qt::AlignLeft) {
326 minorArrowItem->setLine(gridRect.left() - labelPadding() / 2,
327 minorGridItem->line().p1().y(),
328 gridRect.left(),
329 minorGridItem->line().p1().y());
330 } else if (axis()->alignment() == Qt::AlignRight){
331 minorArrowItem->setLine(gridRect.right(),
332 minorGridItem->line().p1().y(),
333 gridRect.right() + labelPadding() / 2,
334 minorGridItem->line().p1().y());
335 }
336
337 // check if the minor grid line and the axis tick should be shown
338 qreal minorYPos = minorGridItem->line().p1().y();
339 if (minorYPos < gridRect.top() || minorYPos > gridRect.bottom()) {
340 minorGridItem->setVisible(false);
341 minorArrowItem->setVisible(false);
342 } else {
343 minorGridItem->setVisible(true);
344 minorArrowItem->setVisible(true);
345 }
346 }
347 }
348 }
299 349 }
300 350 //begin/end grid line in case labels between
301 351 if (intervalAxis()) {
@@ -66,6 +66,7 public:
66 66 BackgroundShadesMode backgroundShades() const { return m_backgroundShades; }
67 67 bool isBackgroundDropShadowEnabled() const { return m_backgroundDropShadowEnabled; }
68 68 QPen girdLinePen() const { return m_gridLinePen; }
69 QPen minorGridLinePen() const { return m_minorGridLinePen; }
69 70
70 71 protected:
71 72 QChart::ChartTheme m_id;
@@ -83,6 +84,7 protected:
83 84 BackgroundShadesMode m_backgroundShades;
84 85 bool m_backgroundDropShadowEnabled;
85 86 QPen m_gridLinePen;
87 QPen m_minorGridLinePen;
86 88
87 89 };
88 90
@@ -57,6 +57,9 public:
57 57 m_axisLinePen.setWidth(2);
58 58 m_gridLinePen = QPen(QRgb(0x84a2b0));
59 59 m_gridLinePen.setWidth(1);
60 m_minorGridLinePen = QPen(QRgb(0x84a2b0));
61 m_minorGridLinePen.setWidth(1);
62 m_minorGridLinePen.setStyle(Qt::DashLine);
60 63 m_backgroundShades = BackgroundShadesNone;
61 64 m_outlinePen = QPen(QRgb(0xebebeb));
62 65 m_outlinePen.setWidthF(2.0);
@@ -59,6 +59,9 public:
59 59 m_axisLinePen.setWidth(2);
60 60 m_gridLinePen = QPen(QRgb(0xe2e2e2));
61 61 m_gridLinePen.setWidth(1);
62 m_minorGridLinePen = QPen(QRgb(0xe2e2e2));
63 m_minorGridLinePen.setWidth(1);
64 m_minorGridLinePen.setStyle(Qt::DashLine);
62 65 m_backgroundShades = BackgroundShadesNone;
63 66 m_outlinePen = QPen(QRgb(0x474747));
64 67 m_outlinePen.setWidthF(2.0);
@@ -58,6 +58,9 public:
58 58 m_axisLinePen.setWidth(2);
59 59 m_gridLinePen = QPen(QRgb(0xe2e2e2));
60 60 m_gridLinePen.setWidth(1);
61 m_minorGridLinePen = QPen(QRgb(0xe2e2e2));
62 m_minorGridLinePen.setWidth(1);
63 m_minorGridLinePen.setStyle(Qt::DashLine);
61 64 m_backgroundShades = BackgroundShadesNone;
62 65 m_outlinePen = QPen(QRgb(0x474747));
63 66 m_outlinePen.setWidthF(2.0);
@@ -58,6 +58,9 public:
58 58 m_axisLinePen.setWidth(2);
59 59 m_gridLinePen = QPen(QRgb(0xd4cec3));
60 60 m_gridLinePen.setWidth(1);
61 m_minorGridLinePen = QPen(QRgb(0xd4cec3));
62 m_minorGridLinePen.setWidth(1);
63 m_minorGridLinePen.setStyle(Qt::DashLine);
61 64 m_backgroundShades = BackgroundShadesNone;
62 65 m_outlinePen = QPen(QRgb(0x222222));
63 66 m_outlinePen.setWidthF(2.0);
@@ -58,6 +58,9 public:
58 58 m_axisLinePen.setWidth(2);
59 59 m_gridLinePen = QPen(QRgb(0x86878c));
60 60 m_gridLinePen.setWidth(1);
61 m_minorGridLinePen = QPen(QRgb(0x86878c));
62 m_minorGridLinePen.setWidth(1);
63 m_minorGridLinePen.setStyle(Qt::DashLine);
61 64 m_backgroundShades = BackgroundShadesNone;
62 65 m_outlinePen = QPen(QRgb(0xd6d6d6));
63 66 m_outlinePen.setWidthF(2.0);
@@ -59,6 +59,9 public:
59 59 m_axisLinePen.setWidth(2);
60 60 m_gridLinePen = QPen(QRgb(0x8c8c8c));
61 61 m_gridLinePen.setWidth(1);
62 m_minorGridLinePen = QPen(QRgb(0x8c8c8c));
63 m_minorGridLinePen.setWidth(1);
64 m_minorGridLinePen.setStyle(Qt::DashLine);
62 65 m_backgroundShadesBrush = QBrush(QRgb(0xffeecd));
63 66 m_backgroundShades = BackgroundShadesHorizontal;
64 67 m_outlinePen = QPen(QColor(Qt::black));
@@ -60,6 +60,9 public:
60 60 m_labelBrush = QBrush(QRgb(0x404044));
61 61 m_gridLinePen = QPen(QRgb(0xe2e2e2));
62 62 m_gridLinePen.setWidth(1);
63 m_minorGridLinePen = QPen(QRgb(0xe2e2e2));
64 m_minorGridLinePen.setWidth(1);
65 m_minorGridLinePen.setStyle(Qt::DashLine);
63 66 m_backgroundShades = BackgroundShadesNone;
64 67 m_outlinePen = QPen(0x4d4d4d);
65 68 m_outlinePen.setWidthF(2.0);
@@ -61,6 +61,9 public:
61 61 m_axisLinePen.setWidth(1);
62 62 m_gridLinePen = QPen(QRgb(0xd7d6d5));
63 63 m_gridLinePen.setWidth(1);
64 m_minorGridLinePen = QPen(QRgb(0xd7d6d5));
65 m_minorGridLinePen.setWidth(1);
66 m_minorGridLinePen.setStyle(Qt::DashLine);
64 67 m_backgroundShades = BackgroundShadesNone;
65 68 m_outlinePen = QPen(QRgb(0x35322f));
66 69 m_outlinePen.setWidthF(2.0);
@@ -96,6 +96,9 public:
96 96 m_labelBrush = QBrush(QRgb(0x404044));
97 97 m_gridLinePen = QPen(QRgb(0xe2e2e2));
98 98 m_gridLinePen.setWidth(1);
99 m_minorGridLinePen = QPen(QRgb(0xe2e2e2));
100 m_minorGridLinePen.setWidth(1);
101 m_minorGridLinePen.setStyle(Qt::DashLine);
99 102 m_backgroundShades = BackgroundShadesNone;
100 103
101 104 #elif defined(Q_OS_LINUX)
@@ -119,6 +122,9 public:
119 122 m_labelBrush = QBrush(QRgb(0x404044));
120 123 m_gridLinePen = QPen(QRgb(0xe2e2e2));
121 124 m_gridLinePen.setWidth(1);
125 m_minorGridLinePen = QBrush(QRgb(0x404044));
126 m_minorGridLinePen.setWidth(1);
127 m_minorGridLinePen.setStyle(Qt::DashLine);
122 128 m_backgroundShades = BackgroundShadesNone;
123 129
124 130 #elif defined(Q_OS_MAC)
@@ -142,6 +148,9 public:
142 148 m_labelBrush = QBrush(QRgb(0x404044));
143 149 m_gridLinePen = QPen(QRgb(0xe2e2e2));
144 150 m_gridLinePen.setWidth(1);
151 m_minorGridLinePen = QPen(QRgb(0xe2e2e2));
152 m_minorGridLinePen.setWidth(1);
153 m_minorGridLinePen.setStyle(Qt::DashLine);
145 154 m_backgroundShades = BackgroundShadesNone;
146 155
147 156 #else
@@ -165,6 +174,9 public:
165 174 m_labelBrush = QBrush(QRgb(0x404044));
166 175 m_gridLinePen = QPen(QRgb(0xe2e2e2));
167 176 m_gridLinePen.setWidth(1);
177 m_minorGridLinePen = QPen(QRgb(0xe2e2e2));
178 m_minorGridLinePen.setWidth(1);
179 m_minorGridLinePen.setStyle(Qt::DashLine);
168 180 m_backgroundShades = BackgroundShadesNone;
169 181 #endif
170 182 }
@@ -58,6 +58,8 void tst_QAbstractAxis::qabstractaxis()
58 58 QCOMPARE(m_axis->labelsFont(), QFont());
59 59 QCOMPARE(m_axis->labelsVisible(), true);
60 60 QCOMPARE(m_axis->orientation(), Qt::Orientation(0));
61 QCOMPARE(m_axis->minorGridLinePen(), QPen());
62 QCOMPARE(m_axis->isMinorGridLineVisible(), true);
61 63 m_axis->setLineVisible(false);
62 64 m_axis->setLinePen(QPen());
63 65 m_axis->setLinePenColor(QColor());
@@ -77,6 +79,8 void tst_QAbstractAxis::qabstractaxis()
77 79 m_axis->setShadesPen(QPen());
78 80 m_axis->setShadesVisible(false);
79 81 m_axis->setVisible(false);
82 m_axis->setMinorGridLinePen(QPen());
83 m_axis->setMinorGridLineVisible(false);
80 84 //TODO QCOMPARE(m_axis->shadesBrush(), QBrush());
81 85 QCOMPARE(m_axis->shadesPen(), QPen());
82 86 QCOMPARE(m_axis->shadesVisible(), false);
@@ -106,6 +110,7 void tst_QAbstractAxis::axisPen()
106 110 QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor)));
107 111 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
108 112 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
113 QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool)));
109 114
110 115 m_axis->setLinePen(axisPen);
111 116 QCOMPARE(m_axis->linePen(), axisPen);
@@ -119,6 +124,7 void tst_QAbstractAxis::axisPen()
119 124 QCOMPARE(spy6.count(), 0);
120 125 QCOMPARE(spy7.count(), 0);
121 126 QCOMPARE(spy8.count(), 0);
127 QCOMPARE(spy9.count(), 0);
122 128
123 129 m_chart->setAxisX(m_axis, m_series);
124 130 m_view->show();
@@ -179,6 +185,52 void tst_QAbstractAxis::gridLinePen()
179 185 //TODO QCOMPARE(m_axis->gridLinePen(), gridLinePen);
180 186 }
181 187
188 void tst_QAbstractAxis::minorGridLinePen_data()
189 {
190
191 QTest::addColumn<QPen>("minorGridLinePen");
192 QTest::newRow("null") << QPen();
193 QTest::newRow("blue") << QPen(Qt::blue);
194 QTest::newRow("black") << QPen(Qt::black);
195 QTest::newRow("red") << QPen(Qt::red);
196
197 }
198
199 void tst_QAbstractAxis::minorGridLinePen()
200 {
201 QFETCH(QPen, minorGridLinePen);
202
203 QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool)));
204 QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor)));
205 QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool)));
206 QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor)));
207 QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool)));
208 QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor)));
209 QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor)));
210 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
211 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
212 QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool)));
213
214 m_axis->setMinorGridLinePen(minorGridLinePen);
215 QCOMPARE(m_axis->minorGridLinePen(), minorGridLinePen);
216
217 QCOMPARE(spy0.count(), 0);
218 QCOMPARE(spy1.count(), 0);
219 QCOMPARE(spy2.count(), 0);
220 QCOMPARE(spy3.count(), 0);
221 QCOMPARE(spy4.count(), 0);
222 QCOMPARE(spy5.count(), 0);
223 QCOMPARE(spy6.count(), 0);
224 QCOMPARE(spy7.count(), 0);
225 QCOMPARE(spy8.count(), 0);
226 QCOMPARE(spy9.count(), 0);
227
228 m_chart->setAxisX(m_axis, m_series);
229 m_view->show();
230 QTest::qWaitForWindowShown(m_view);
231
232 }
233
182 234 void tst_QAbstractAxis::lineVisible_data()
183 235 {
184 236 QTest::addColumn<bool>("lineVisible");
@@ -201,6 +253,7 void tst_QAbstractAxis::lineVisible()
201 253 QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor)));
202 254 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
203 255 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
256 QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool)));
204 257
205 258 m_axis->setLineVisible(lineVisible);
206 259 QCOMPARE(m_axis->isLineVisible(), lineVisible);
@@ -214,6 +267,7 void tst_QAbstractAxis::lineVisible()
214 267 QCOMPARE(spy6.count(), 0);
215 268 QCOMPARE(spy7.count(), 0);
216 269 QCOMPARE(spy8.count(), 0);
270 QCOMPARE(spy9.count(), 0);
217 271
218 272 m_chart->setAxisX(m_axis, m_series);
219 273 m_view->show();
@@ -264,6 +318,51 void tst_QAbstractAxis::gridLineVisible()
264 318
265 319 }
266 320
321 void tst_QAbstractAxis::minorGridLineVisible_data()
322 {
323 QTest::addColumn<bool>("minorGridLineVisible");
324 QTest::newRow("true") << true;
325 QTest::newRow("false") << false;
326 }
327
328 void tst_QAbstractAxis::minorGridLineVisible()
329 {
330 QFETCH(bool, minorGridLineVisible);
331
332 m_axis->setMinorGridLineVisible(!minorGridLineVisible);
333
334 QSignalSpy spy0(m_axis, SIGNAL(lineVisibleChanged(bool)));
335 QSignalSpy spy1(m_axis, SIGNAL(colorChanged(QColor)));
336 QSignalSpy spy2(m_axis, SIGNAL(gridVisibleChanged(bool)));
337 QSignalSpy spy3(m_axis, SIGNAL(labelsColorChanged(QColor)));
338 QSignalSpy spy4(m_axis, SIGNAL(labelsVisibleChanged(bool)));
339 QSignalSpy spy5(m_axis, SIGNAL(shadesBorderColorChanged(QColor)));
340 QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor)));
341 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
342 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
343 QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool)));
344
345 m_axis->setMinorGridLineVisible(minorGridLineVisible);
346 QCOMPARE(m_axis->isMinorGridLineVisible(), minorGridLineVisible);
347
348 QCOMPARE(spy0.count(), 0);
349 QCOMPARE(spy1.count(), 0);
350 QCOMPARE(spy2.count(), 0);
351 QCOMPARE(spy3.count(), 0);
352 QCOMPARE(spy4.count(), 0);
353 QCOMPARE(spy5.count(), 0);
354 QCOMPARE(spy6.count(), 0);
355 QCOMPARE(spy7.count(), 0);
356 QCOMPARE(spy8.count(), 0);
357 QCOMPARE(spy9.count(), 1);
358
359 m_chart->setAxisX(m_axis, m_series);
360 m_view->show();
361 QTest::qWaitForWindowShown(m_view);
362 QCOMPARE(m_axis->isMinorGridLineVisible(), minorGridLineVisible);
363
364 }
365
267 366 void tst_QAbstractAxis::visible_data()
268 367 {
269 368 QTest::addColumn<bool>("visible");
@@ -286,6 +385,7 void tst_QAbstractAxis::visible()
286 385 QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor)));
287 386 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
288 387 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
388 QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool)));
289 389
290 390 m_axis->setVisible(visible);
291 391 QCOMPARE(m_axis->isVisible(), visible);
@@ -299,6 +399,7 void tst_QAbstractAxis::visible()
299 399 QCOMPARE(spy6.count(), 0);
300 400 QCOMPARE(spy7.count(), 0);
301 401 QCOMPARE(spy8.count(), 1);
402 QCOMPARE(spy9.count(), 0);
302 403
303 404 m_chart->setAxisX(m_axis, m_series);
304 405 m_view->show();
@@ -327,6 +428,7 void tst_QAbstractAxis::labelsAngle()
327 428 QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor)));
328 429 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
329 430 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
431 QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool)));
330 432
331 433 m_axis->setLabelsAngle(labelsAngle);
332 434 QCOMPARE(m_axis->labelsAngle(), labelsAngle);
@@ -340,6 +442,7 void tst_QAbstractAxis::labelsAngle()
340 442 QCOMPARE(spy6.count(), 0);
341 443 QCOMPARE(spy7.count(), 0);
342 444 QCOMPARE(spy8.count(), 0);
445 QCOMPARE(spy9.count(), 0);
343 446
344 447 m_chart->setAxisX(m_axis, m_series);
345 448 m_view->show();
@@ -370,6 +473,7 void tst_QAbstractAxis::labelsBrush()
370 473 QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor)));
371 474 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
372 475 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
476 QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool)));
373 477
374 478 m_axis->setLabelsBrush(labelsBrush);
375 479 QCOMPARE(m_axis->labelsBrush(), labelsBrush);
@@ -383,6 +487,7 void tst_QAbstractAxis::labelsBrush()
383 487 //TODO QCOMPARE(spy6.count(), 0);
384 488 QCOMPARE(spy7.count(), 0);
385 489 QCOMPARE(spy8.count(), 0);
490 QCOMPARE(spy9.count(), 0);
386 491
387 492 m_view->show();
388 493 QTest::qWaitForWindowShown(m_view);
@@ -421,6 +526,7 void tst_QAbstractAxis::labelsFont()
421 526 QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor)));
422 527 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
423 528 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
529 QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool)));
424 530
425 531 m_axis->setLabelsFont(labelsFont);
426 532 QCOMPARE(m_axis->labelsFont(), labelsFont);
@@ -434,6 +540,7 void tst_QAbstractAxis::labelsFont()
434 540 QCOMPARE(spy6.count(), 0);
435 541 QCOMPARE(spy7.count(), 0);
436 542 QCOMPARE(spy8.count(), 0);
543 QCOMPARE(spy9.count(), 0);
437 544
438 545 m_view->show();
439 546 QTest::qWaitForWindowShown(m_view);
@@ -463,6 +570,7 void tst_QAbstractAxis::labelsVisible()
463 570 QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor)));
464 571 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
465 572 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
573 QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool)));
466 574
467 575 m_axis->setLabelsVisible(labelsVisible);
468 576 QCOMPARE(m_axis->labelsVisible(), labelsVisible);
@@ -476,6 +584,7 void tst_QAbstractAxis::labelsVisible()
476 584 QCOMPARE(spy6.count(), 0);
477 585 QCOMPARE(spy7.count(), 0);
478 586 QCOMPARE(spy8.count(), 0);
587 QCOMPARE(spy9.count(), 0);
479 588
480 589 m_chart->setAxisX(m_axis, m_series);
481 590 m_view->show();
@@ -503,6 +612,7 void tst_QAbstractAxis::orientation()
503 612 QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor)));
504 613 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
505 614 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
615 QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool)));
506 616
507 617 if(orientation==Qt::Vertical){
508 618 m_chart->setAxisY(m_axis,m_series);
@@ -520,6 +630,7 void tst_QAbstractAxis::orientation()
520 630 QCOMPARE(spy6.count(), 0);
521 631 QCOMPARE(spy7.count(), 0);
522 632 QCOMPARE(spy8.count(), 0);
633 QCOMPARE(spy9.count(), 0);
523 634
524 635 m_view->show();
525 636 QTest::qWaitForWindowShown(m_view);
@@ -604,6 +715,7 void tst_QAbstractAxis::shadesBrush()
604 715 QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor)));
605 716 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
606 717 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
718 QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool)));
607 719
608 720 m_axis->setShadesBrush(shadesBrush);
609 721 QCOMPARE(m_axis->shadesBrush(), shadesBrush);
@@ -617,6 +729,7 void tst_QAbstractAxis::shadesBrush()
617 729 //TODO QCOMPARE(spy6.count(), 0);
618 730 QCOMPARE(spy7.count(), 0);
619 731 QCOMPARE(spy8.count(), 0);
732 QCOMPARE(spy9.count(), 0);
620 733
621 734 m_view->show();
622 735 QTest::qWaitForWindowShown(m_view);
@@ -655,6 +768,7 void tst_QAbstractAxis::shadesPen()
655 768 QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor)));
656 769 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
657 770 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
771 QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool)));
658 772
659 773 m_axis->setShadesPen(shadesPen);
660 774 QCOMPARE(m_axis->shadesPen(), shadesPen);
@@ -668,6 +782,7 void tst_QAbstractAxis::shadesPen()
668 782 QCOMPARE(spy6.count(), 0);
669 783 QCOMPARE(spy7.count(), 0);
670 784 QCOMPARE(spy8.count(), 0);
785 QCOMPARE(spy9.count(), 0);
671 786
672 787 m_chart->setAxisX(m_axis, m_series);
673 788 m_view->show();
@@ -697,6 +812,7 void tst_QAbstractAxis::shadesVisible()
697 812 QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor)));
698 813 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
699 814 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
815 QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool)));
700 816
701 817 m_axis->setShadesVisible(shadesVisible);
702 818 QCOMPARE(m_axis->shadesVisible(), shadesVisible);
@@ -710,6 +826,7 void tst_QAbstractAxis::shadesVisible()
710 826 QCOMPARE(spy6.count(), 0);
711 827 QCOMPARE(spy7.count(), 1);
712 828 QCOMPARE(spy8.count(), 0);
829 QCOMPARE(spy9.count(), 0);
713 830
714 831 m_chart->setAxisX(m_axis, m_series);
715 832 m_view->show();
@@ -736,6 +853,7 void tst_QAbstractAxis::show()
736 853 QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor)));
737 854 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
738 855 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
856 QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool)));
739 857
740 858 m_axis->show();
741 859
@@ -748,6 +866,7 void tst_QAbstractAxis::show()
748 866 QCOMPARE(spy6.count(), 0);
749 867 QCOMPARE(spy7.count(), 0);
750 868 QCOMPARE(spy8.count(), 1);
869 QCOMPARE(spy9.count(), 0);
751 870 QCOMPARE(m_axis->isVisible(), true);
752 871 }
753 872
@@ -770,6 +889,7 void tst_QAbstractAxis::hide()
770 889 QSignalSpy spy6(m_axis, SIGNAL(shadesColorChanged(QColor)));
771 890 QSignalSpy spy7(m_axis, SIGNAL(shadesVisibleChanged(bool)));
772 891 QSignalSpy spy8(m_axis, SIGNAL(visibleChanged(bool)));
892 QSignalSpy spy9(m_axis, SIGNAL(minorGridVisibleChanged(bool)));
773 893
774 894 m_axis->hide();
775 895
@@ -782,6 +902,7 void tst_QAbstractAxis::hide()
782 902 QCOMPARE(spy6.count(), 0);
783 903 QCOMPARE(spy7.count(), 0);
784 904 QCOMPARE(spy8.count(), 1);
905 QCOMPARE(spy9.count(), 0);
785 906 QCOMPARE(m_axis->isVisible(),false);
786 907 }
787 908
@@ -43,10 +43,14 private slots:
43 43 void axisPenColor();
44 44 void gridLinePen_data();
45 45 void gridLinePen();
46 void minorGridLinePen_data();
47 void minorGridLinePen();
46 48 void lineVisible_data();
47 49 void lineVisible();
48 50 void gridLineVisible_data();
49 51 void gridLineVisible();
52 void minorGridLineVisible_data();
53 void minorGridLineVisible();
50 54 void visible_data();
51 55 void visible();
52 56 void labelsAngle_data();
@@ -23,6 +23,7
23 23 #include <QtCharts/QChartView>
24 24 #include <QtCharts/QAreaSeries>
25 25 #include <QtCharts/QLegend>
26 #include <QtCharts/QValueAxis>
26 27 #include <QtWidgets/QGridLayout>
27 28 #include <QtWidgets/QFormLayout>
28 29 #include <QtWidgets/QComboBox>
@@ -50,6 +51,10 Window::Window(const QVariantHash &parameters, QWidget *parent)
50 51 m_legendComboBox(0),
51 52 m_templateComboBox(0),
52 53 m_viewComboBox(0),
54 m_xTickSpinBox(0),
55 m_yTickSpinBox(0),
56 m_minorXTickSpinBox(0),
57 m_minorYTickSpinBox(0),
53 58 m_openGLCheckBox(0),
54 59 m_zoomCheckBox(0),
55 60 m_scrollCheckBox(0),
@@ -78,6 +83,14 Window::Window(const QVariantHash &parameters, QWidget *parent)
78 83 settingsLayout->addItem(m_widgetHash["templateComboBox"]);
79 84 settingsLayout->addItem(m_widgetHash["scrollCheckBox"]);
80 85 settingsLayout->addItem(m_widgetHash["zoomCheckBox"]);
86 settingsLayout->addItem(m_widgetHash["xTickLabel"]);
87 settingsLayout->addItem(m_widgetHash["xTickSpinBox"]);
88 settingsLayout->addItem(m_widgetHash["yTickLabel"]);
89 settingsLayout->addItem(m_widgetHash["yTickSpinBox"]);
90 settingsLayout->addItem(m_widgetHash["minorXTickLabel"]);
91 settingsLayout->addItem(m_widgetHash["minorXTickSpinBox"]);
92 settingsLayout->addItem(m_widgetHash["minorYTickLabel"]);
93 settingsLayout->addItem(m_widgetHash["minorYTickSpinBox"]);
81 94 settingsLayout->addStretch();
82 95
83 96 m_baseLayout->setOrientation(Qt::Horizontal);
@@ -114,6 +127,10 void Window::connectSignals()
114 127 QObject::connect(m_form, SIGNAL(geometryChanged()), this , SLOT(handleGeometryChanged()));
115 128 QObject::connect(m_viewComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(updateUI()));
116 129 QObject::connect(m_themeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(updateUI()));
130 QObject::connect(m_xTickSpinBox, SIGNAL(valueChanged(int)), this, SLOT(updateUI()));
131 QObject::connect(m_yTickSpinBox, SIGNAL(valueChanged(int)), this, SLOT(updateUI()));
132 QObject::connect(m_minorXTickSpinBox, SIGNAL(valueChanged(int)), this, SLOT(updateUI()));
133 QObject::connect(m_minorYTickSpinBox, SIGNAL(valueChanged(int)), this, SLOT(updateUI()));
117 134 QObject::connect(m_antialiasCheckBox, SIGNAL(toggled(bool)), this, SLOT(updateUI()));
118 135 QObject::connect(m_openGLCheckBox, SIGNAL(toggled(bool)), this, SLOT(updateUI()));
119 136 QObject::connect(m_zoomCheckBox, SIGNAL(toggled(bool)), this, SLOT(updateUI()));
@@ -128,6 +145,14 void Window::createProxyWidgets()
128 145 {
129 146 m_themeComboBox = createThemeBox();
130 147 m_viewComboBox = createViewBox();
148 m_xTickSpinBox = new QSpinBox();
149 m_xTickSpinBox->setMinimum(2);
150 m_xTickSpinBox->setValue(5);
151 m_yTickSpinBox = new QSpinBox();
152 m_yTickSpinBox->setMinimum(2);
153 m_yTickSpinBox->setValue(5);
154 m_minorXTickSpinBox = new QSpinBox();
155 m_minorYTickSpinBox = new QSpinBox();
131 156 m_antialiasCheckBox = new QCheckBox(tr("Anti-aliasing"));
132 157 m_animatedComboBox = createAnimationBox();
133 158 m_legendComboBox = createLegendBox();
@@ -141,6 +166,14 void Window::createProxyWidgets()
141 166 m_widgetHash["antialiasCheckBox"] = m_scene->addWidget(m_antialiasCheckBox);
142 167 m_widgetHash["animatedComboBox"] = m_scene->addWidget(m_animatedComboBox);
143 168 m_widgetHash["legendComboBox"] = m_scene->addWidget(m_legendComboBox);
169 m_widgetHash["xTickLabel"] = m_scene->addWidget(new QLabel("X Tick"));
170 m_widgetHash["xTickSpinBox"] = m_scene->addWidget(m_xTickSpinBox);
171 m_widgetHash["yTickLabel"] = m_scene->addWidget(new QLabel("Y Tick"));
172 m_widgetHash["yTickSpinBox"] = m_scene->addWidget(m_yTickSpinBox);
173 m_widgetHash["minorXTickLabel"] = m_scene->addWidget(new QLabel("Minor X Tick"));
174 m_widgetHash["minorXTickSpinBox"] = m_scene->addWidget(m_minorXTickSpinBox);
175 m_widgetHash["minorYTickLabel"] = m_scene->addWidget(new QLabel("Minor Y Tick"));
176 m_widgetHash["minorYTickSpinBox"] = m_scene->addWidget(m_minorYTickSpinBox);
144 177 m_widgetHash["openGLCheckBox"] = m_scene->addWidget(m_openGLCheckBox);
145 178 m_widgetHash["themeLabel"] = m_scene->addWidget(new QLabel("Theme"));
146 179 m_widgetHash["animationsLabel"] = m_scene->addWidget(new QLabel("Animations"));
@@ -288,6 +321,10 void Window::updateUI()
288 321 checkAnimationOptions();
289 322 checkLegend();
290 323 checkState();
324 checkXTick();
325 checkYTick();
326 checkMinorXTick();
327 checkMinorYTick();
291 328 }
292 329
293 330 void Window::checkView()
@@ -299,6 +336,50 void Window::checkView()
299 336 }
300 337 }
301 338
339 void Window::checkXTick()
340 {
341 foreach (QChart *chart, m_grid->charts()) {
342 if (qobject_cast<QValueAxis *>(chart->axisX())) {
343 QValueAxis *valueAxis = qobject_cast<QValueAxis *>(chart->axisX());
344 valueAxis->setGridLineVisible();
345 valueAxis->setTickCount(m_xTickSpinBox->value());
346 }
347 }
348 }
349
350 void Window::checkYTick()
351 {
352 foreach (QChart *chart, m_grid->charts()) {
353 if (qobject_cast<QValueAxis *>(chart->axisY())) {
354 QValueAxis *valueAxis = qobject_cast<QValueAxis *>(chart->axisY());
355 valueAxis->setGridLineVisible();
356 valueAxis->setTickCount(m_yTickSpinBox->value());
357 }
358 }
359 }
360
361 void Window::checkMinorXTick()
362 {
363 foreach (QChart *chart, m_grid->charts()) {
364 if (qobject_cast<QValueAxis *>(chart->axisX())) {
365 QValueAxis *valueAxis = qobject_cast<QValueAxis *>(chart->axisX());
366 valueAxis->setMinorGridLineVisible();
367 valueAxis->setMinorTickCount(m_minorXTickSpinBox->value());
368 }
369 }
370 }
371
372 void Window::checkMinorYTick()
373 {
374 foreach (QChart *chart, m_grid->charts()) {
375 if (qobject_cast<QValueAxis *>(chart->axisY())) {
376 QValueAxis *valueAxis = qobject_cast<QValueAxis *>(chart->axisY());
377 valueAxis->setMinorGridLineVisible();
378 valueAxis->setMinorTickCount(m_minorYTickSpinBox->value());
379 }
380 }
381 }
382
302 383 void Window::checkLegend()
303 384 {
304 385 Qt::Alignment alignment(m_legendComboBox->itemData(m_legendComboBox->currentIndex()).toInt());
@@ -22,6 +22,7
22 22 #include <QtCharts/QChartGlobal>
23 23 #include <QtCore/QHash>
24 24 #include <QtWidgets/QComboBox>
25 #include <QtWidgets/QSpinBox>
25 26
26 27 QT_BEGIN_NAMESPACE
27 28 class QCheckBox;
@@ -69,6 +70,10 private:
69 70 inline void checkTheme();
70 71 inline void checkState();
71 72 inline void checkTemplate();
73 inline void checkXTick();
74 inline void checkYTick();
75 inline void checkMinorXTick();
76 inline void checkMinorYTick();
72 77 QMenu *createMenu();
73 78 QAction *createMenuAction(QMenu *menu, const QIcon &icon, const QString &text, const QVariant &data);
74 79 void initializeFromParamaters(const QVariantHash &parameters);
@@ -80,6 +85,10 private:
80 85
81 86 QGraphicsWidget *m_form;
82 87 QComboBox *m_themeComboBox;
88 QSpinBox *m_xTickSpinBox;
89 QSpinBox *m_yTickSpinBox;
90 QSpinBox *m_minorXTickSpinBox;
91 QSpinBox *m_minorYTickSpinBox;
83 92 QCheckBox *m_antialiasCheckBox;
84 93 QComboBox *m_animatedComboBox;
85 94 QComboBox *m_legendComboBox;
@@ -52,6 +52,8 MainWindow::MainWindow(QWidget *parent) :
52 52 m_titleVisible(true),
53 53 m_gridVisible(true),
54 54 m_arrowVisible(true),
55 m_minorGridVisible(true),
56 m_minorArrowVisible(true),
55 57 m_angularShadesBrush(new QBrush(Qt::NoBrush)),
56 58 m_radialShadesBrush(new QBrush(Qt::NoBrush)),
57 59 m_labelBrush(new QBrush(Qt::black)),
@@ -62,6 +64,7 MainWindow::MainWindow(QWidget *parent) :
62 64 m_radialShadesPen(new QPen(Qt::NoPen)),
63 65 m_gridPen(new QPen(QRgb(0x010101))), // Note: Pure black is default color, so it gets overridden by
64 66 m_arrowPen(new QPen(QRgb(0x010101))), // default theme if set to that initially. This is an example of workaround.
67 m_minorGridPen(new QPen(QBrush(QRgb(0x010101)), 1, Qt::DashLine)),
65 68 m_backgroundPen(new QPen(Qt::NoPen)),
66 69 m_plotAreaBackgroundPen(new QPen(Qt::NoPen)),
67 70 m_labelFormat(QString("%.2f")),
@@ -126,6 +129,8 MainWindow::MainWindow(QWidget *parent) :
126 129
127 130 connect(ui->angularTicksSpin, SIGNAL(valueChanged(int)), this, SLOT(angularTicksChanged(int)));
128 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)));
129 134 connect(ui->anglesSpin, SIGNAL(valueChanged(int)), this, SLOT(anglesChanged(int)));
130 135 connect(ui->radialMinSpin, SIGNAL(valueChanged(double)), this, SLOT(radialMinChanged(double)));
131 136 connect(ui->radialMaxSpin, SIGNAL(valueChanged(double)), this, SLOT(radialMaxChanged(double)));
@@ -142,6 +147,7 MainWindow::MainWindow(QWidget *parent) :
142 147 connect(ui->titleFontSizeSpin, SIGNAL(valueChanged(int)), this, SLOT(titleFontSizeChanged(int)));
143 148 connect(ui->titleComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(titleIndexChanged(int)));
144 149 connect(ui->gridComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(gridIndexChanged(int)));
150 connect(ui->minorGridComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(minorGridIndexChanged(int)));
145 151 connect(ui->arrowComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(arrowIndexChanged(int)));
146 152 connect(ui->logBaseSpin, SIGNAL(valueChanged(double)), this, SLOT(logBaseChanged(double)));
147 153 connect(ui->angularAxisComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(angularAxisIndexChanged(int)));
@@ -439,6 +445,8 void MainWindow::setAngularAxis(MainWindow::AxisMode mode)
439 445 m_angularAxis->setGridLineVisible(m_gridVisible);
440 446 m_angularAxis->setLinePen(*m_arrowPen);
441 447 m_angularAxis->setLineVisible(m_arrowVisible);
448 m_angularAxis->setMinorGridLinePen(*m_minorGridPen);
449 m_angularAxis->setMinorGridLineVisible(m_minorGridVisible);
442 450
443 451 m_chart->addAxis(m_angularAxis, QPolarChart::PolarOrientationAngular);
444 452
@@ -507,6 +515,8 void MainWindow::setRadialAxis(MainWindow::AxisMode mode)
507 515 m_radialAxis->setGridLineVisible(m_gridVisible);
508 516 m_radialAxis->setLinePen(*m_arrowPen);
509 517 m_radialAxis->setLineVisible(m_arrowVisible);
518 m_radialAxis->setMinorGridLinePen(*m_minorGridPen);
519 m_radialAxis->setMinorGridLineVisible(m_minorGridVisible);
510 520
511 521 m_chart->addAxis(m_radialAxis, QPolarChart::PolarOrientationRadial);
512 522
@@ -572,6 +582,22 void MainWindow::radialTicksChanged(int value)
572 582 static_cast<QDateTimeAxis *>(m_radialAxis)->setTickCount(m_radialTickCount);
573 583 }
574 584
585 void MainWindow::angularMinorTicksChanged(int value)
586 {
587 // Minor tick valid only for QValueAxis
588 m_angularMinorTickCount = value;
589 if (m_angularAxisMode == AxisModeValue)
590 static_cast<QValueAxis *>(m_angularAxis)->setMinorTickCount(m_angularMinorTickCount);
591 }
592
593 void MainWindow::radialMinorTicksChanged(int value)
594 {
595 // Minor tick valid only for QValueAxis
596 m_radialMinorTickCount = value;
597 if (m_radialAxisMode == AxisModeValue)
598 static_cast<QValueAxis *>(m_radialAxis)->setMinorTickCount(m_radialMinorTickCount);
599 }
600
575 601 void MainWindow::anglesChanged(int value)
576 602 {
577 603 m_labelsAngle = value;
@@ -860,6 +886,36 void MainWindow::gridIndexChanged(int index)
860 886 m_radialAxis->setGridLineVisible(m_gridVisible);
861 887 }
862 888
889 void MainWindow::minorGridIndexChanged(int index)
890 {
891 delete m_minorGridPen;
892
893 switch (index) {
894 case 0:
895 m_minorGridPen = new QPen(Qt::NoPen);
896 m_minorGridVisible = false;
897 break;
898 case 1:
899 m_minorGridPen = new QPen(Qt::black);
900 m_minorGridPen->setStyle(Qt::DashLine);
901 m_minorGridVisible = true;
902 break;
903 case 2:
904 m_minorGridPen = new QPen(Qt::green);
905 m_minorGridPen->setStyle(Qt::DotLine);
906 m_minorGridPen->setWidth(1);
907 m_minorGridVisible = true;
908 break;
909 default:
910 break;
911 }
912
913 m_angularAxis->setMinorGridLinePen(*m_minorGridPen);
914 m_angularAxis->setMinorGridLineVisible(m_minorGridVisible);
915 m_radialAxis->setMinorGridLinePen(*m_minorGridPen);
916 m_radialAxis->setMinorGridLineVisible(m_minorGridVisible);
917 }
918
863 919 void MainWindow::arrowIndexChanged(int index)
864 920 {
865 921 delete m_arrowPen;
@@ -913,6 +969,7 void MainWindow::angularAxisIndexChanged(int index)
913 969 break;
914 970 case 1:
915 971 setAngularAxis(AxisModeValue);
972 angularMinorTicksChanged(ui->angularMinorTicksSpin->value());
916 973 break;
917 974 case 2:
918 975 setAngularAxis(AxisModeLogValue);
@@ -936,6 +993,7 void MainWindow::radialAxisIndexChanged(int index)
936 993 break;
937 994 case 1:
938 995 setRadialAxis(AxisModeValue);
996 radialMinorTicksChanged(ui->radialMinorTicksSpin->value());
939 997 break;
940 998 case 2:
941 999 setRadialAxis(AxisModeLogValue);
@@ -51,6 +51,8 public:
51 51 public slots:
52 52 void angularTicksChanged(int value);
53 53 void radialTicksChanged(int value);
54 void angularMinorTicksChanged(int value);
55 void radialMinorTicksChanged(int value);
54 56 void anglesChanged(int value);
55 57 void angularMinChanged(double value);
56 58 void angularMaxChanged(double value);
@@ -67,6 +69,7 public slots:
67 69 void titleFontChanged(const QFont &font);
68 70 void titleFontSizeChanged(int value);
69 71 void gridIndexChanged(int index);
72 void minorGridIndexChanged(int index);
70 73 void arrowIndexChanged(int index);
71 74 void angularRangeChanged(qreal min, qreal max);
72 75 void radialRangeChanged(qreal min, qreal max);
@@ -109,6 +112,8 private:
109 112
110 113 int m_angularTickCount;
111 114 int m_radialTickCount;
115 int m_angularMinorTickCount;
116 int m_radialMinorTickCount;
112 117 qreal m_labelsAngle;
113 118 qreal m_angularMin;
114 119 qreal m_angularMax;
@@ -120,6 +125,8 private:
120 125 bool m_titleVisible;
121 126 bool m_gridVisible;
122 127 bool m_arrowVisible;
128 bool m_minorGridVisible;
129 bool m_minorArrowVisible;
123 130 QBrush *m_angularShadesBrush;
124 131 QBrush *m_radialShadesBrush;
125 132 QBrush *m_labelBrush;
@@ -130,6 +137,7 private:
130 137 QPen *m_radialShadesPen;
131 138 QPen *m_gridPen;
132 139 QPen *m_arrowPen;
140 QPen *m_minorGridPen;
133 141 QPen *m_backgroundPen;
134 142 QPen *m_plotAreaBackgroundPen;
135 143 QString m_labelFormat;
This diff has been collapsed as it changes many lines, (1000 lines changed) Show them Hide them
@@ -7,7 +7,7
7 7 <x>0</x>
8 8 <y>0</y>
9 9 <width>1193</width>
10 <height>956</height>
10 <height>1004</height>
11 11 </rect>
12 12 </property>
13 13 <property name="windowTitle">
@@ -35,231 +35,13
35 35 <property name="title">
36 36 <string>Settings</string>
37 37 </property>
38 <widget class="QSpinBox" name="radialTicksSpin">
39 <property name="geometry">
40 <rect>
41 <x>110</x>
42 <y>90</y>
43 <width>71</width>
44 <height>22</height>
45 </rect>
46 </property>
47 </widget>
48 <widget class="QLabel" name="label">
49 <property name="geometry">
50 <rect>
51 <x>10</x>
52 <y>90</y>
53 <width>101</width>
54 <height>16</height>
55 </rect>
56 </property>
57 <property name="text">
58 <string>Radial Tick count</string>
59 </property>
60 </widget>
61 <widget class="QLabel" name="label_2">
62 <property name="geometry">
63 <rect>
64 <x>10</x>
65 <y>120</y>
66 <width>101</width>
67 <height>16</height>
68 </rect>
69 </property>
70 <property name="text">
71 <string>Angular Tick count</string>
72 </property>
73 </widget>
74 <widget class="QSpinBox" name="angularTicksSpin">
75 <property name="geometry">
76 <rect>
77 <x>110</x>
78 <y>120</y>
79 <width>71</width>
80 <height>22</height>
81 </rect>
82 </property>
83 </widget>
84 <widget class="QSpinBox" name="anglesSpin">
85 <property name="geometry">
86 <rect>
87 <x>110</x>
88 <y>150</y>
89 <width>71</width>
90 <height>22</height>
91 </rect>
92 </property>
93 <property name="minimum">
94 <number>-9999</number>
95 </property>
96 <property name="maximum">
97 <number>9999</number>
98 </property>
99 <property name="singleStep">
100 <number>5</number>
101 </property>
102 </widget>
103 <widget class="QLabel" name="label_3">
104 <property name="geometry">
105 <rect>
106 <x>10</x>
107 <y>150</y>
108 <width>101</width>
109 <height>16</height>
110 </rect>
111 </property>
112 <property name="text">
113 <string>Label angles</string>
114 </property>
115 </widget>
116 <widget class="QLabel" name="label_4">
117 <property name="geometry">
118 <rect>
119 <x>10</x>
120 <y>180</y>
121 <width>101</width>
122 <height>16</height>
123 </rect>
124 </property>
125 <property name="text">
126 <string>Angular min</string>
127 </property>
128 </widget>
129 <widget class="QLabel" name="label_5">
130 <property name="geometry">
131 <rect>
132 <x>10</x>
133 <y>210</y>
134 <width>101</width>
135 <height>16</height>
136 </rect>
137 </property>
138 <property name="text">
139 <string>Angular max</string>
140 </property>
141 </widget>
142 <widget class="QDoubleSpinBox" name="angularMinSpin">
143 <property name="geometry">
144 <rect>
145 <x>90</x>
146 <y>180</y>
147 <width>91</width>
148 <height>22</height>
149 </rect>
150 </property>
151 <property name="decimals">
152 <number>5</number>
153 </property>
154 <property name="minimum">
155 <double>-999999999.000000000000000</double>
156 </property>
157 <property name="maximum">
158 <double>999999999.000000000000000</double>
159 </property>
160 <property name="singleStep">
161 <double>10.000000000000000</double>
162 </property>
163 </widget>
164 <widget class="QDoubleSpinBox" name="angularMaxSpin">
165 <property name="geometry">
166 <rect>
167 <x>90</x>
168 <y>210</y>
169 <width>91</width>
170 <height>22</height>
171 </rect>
172 </property>
173 <property name="decimals">
174 <number>5</number>
175 </property>
176 <property name="minimum">
177 <double>-999999999.000000000000000</double>
178 </property>
179 <property name="maximum">
180 <double>999999999.000000000000000</double>
181 </property>
182 <property name="singleStep">
183 <double>10.000000000000000</double>
184 </property>
185 </widget>
186 <widget class="QDoubleSpinBox" name="radialMaxSpin">
187 <property name="geometry">
188 <rect>
189 <x>90</x>
190 <y>270</y>
191 <width>91</width>
192 <height>22</height>
193 </rect>
194 </property>
195 <property name="decimals">
196 <number>5</number>
197 </property>
198 <property name="minimum">
199 <double>-999999999.000000000000000</double>
200 </property>
201 <property name="maximum">
202 <double>999999999.000000000000000</double>
203 </property>
204 <property name="singleStep">
205 <double>10.000000000000000</double>
206 </property>
207 </widget>
208 <widget class="QDoubleSpinBox" name="radialMinSpin">
209 <property name="geometry">
210 <rect>
211 <x>90</x>
212 <y>240</y>
213 <width>91</width>
214 <height>22</height>
215 </rect>
216 </property>
217 <property name="decimals">
218 <number>5</number>
219 </property>
220 <property name="minimum">
221 <double>-999999999.000000000000000</double>
222 </property>
223 <property name="maximum">
224 <double>999999999.000000000000000</double>
225 </property>
226 <property name="singleStep">
227 <double>10.000000000000000</double>
228 </property>
229 </widget>
230 <widget class="QLabel" name="label_11">
231 <property name="geometry">
232 <rect>
233 <x>10</x>
234 <y>270</y>
235 <width>101</width>
236 <height>16</height>
237 </rect>
238 </property>
239 <property name="text">
240 <string>Radial max</string>
241 </property>
242 </widget>
243 <widget class="QLabel" name="label_12">
244 <property name="geometry">
245 <rect>
246 <x>10</x>
247 <y>240</y>
248 <width>101</width>
249 <height>16</height>
250 </rect>
251 </property>
252 <property name="text">
253 <string>Radial min</string>
254 </property>
255 </widget>
256 38 <widget class="QComboBox" name="angularShadesComboBox">
257 39 <property name="geometry">
258 40 <rect>
259 41 <x>10</x>
260 <y>300</y>
261 <width>171</width>
262 <height>22</height>
42 <y>313</y>
43 <width>187</width>
44 <height>20</height>
263 45 </rect>
264 46 </property>
265 47 <item>
@@ -282,9 +64,9
282 64 <property name="geometry">
283 65 <rect>
284 66 <x>10</x>
285 <y>330</y>
286 <width>171</width>
287 <height>22</height>
67 <y>339</y>
68 <width>175</width>
69 <height>20</height>
288 70 </rect>
289 71 </property>
290 72 <item>
@@ -303,75 +85,13
303 85 </property>
304 86 </item>
305 87 </widget>
306 <widget class="QLabel" name="label_13">
307 <property name="geometry">
308 <rect>
309 <x>10</x>
310 <y>360</y>
311 <width>101</width>
312 <height>16</height>
313 </rect>
314 </property>
315 <property name="text">
316 <string>Label format</string>
317 </property>
318 </widget>
319 <widget class="QLineEdit" name="labelFormatEdit">
320 <property name="geometry">
321 <rect>
322 <x>100</x>
323 <y>360</y>
324 <width>81</width>
325 <height>20</height>
326 </rect>
327 </property>
328 </widget>
329 <widget class="QLabel" name="label_14">
330 <property name="geometry">
331 <rect>
332 <x>10</x>
333 <y>390</y>
334 <width>101</width>
335 <height>16</height>
336 </rect>
337 </property>
338 <property name="text">
339 <string>Label font size</string>
340 </property>
341 </widget>
342 <widget class="QFontComboBox" name="labelFontComboBox">
343 <property name="geometry">
344 <rect>
345 <x>10</x>
346 <y>420</y>
347 <width>171</width>
348 <height>22</height>
349 </rect>
350 </property>
351 </widget>
352 <widget class="QSpinBox" name="labelFontSizeSpin">
353 <property name="geometry">
354 <rect>
355 <x>100</x>
356 <y>390</y>
357 <width>81</width>
358 <height>22</height>
359 </rect>
360 </property>
361 <property name="minimum">
362 <number>-100000</number>
363 </property>
364 <property name="maximum">
365 <number>100000</number>
366 </property>
367 </widget>
368 88 <widget class="QComboBox" name="animationsComboBox">
369 89 <property name="geometry">
370 90 <rect>
371 91 <x>10</x>
372 <y>480</y>
373 <width>171</width>
374 <height>22</height>
92 <y>471</y>
93 <width>104</width>
94 <height>20</height>
375 95 </rect>
376 96 </property>
377 97 <item>
@@ -399,9 +119,9
399 119 <property name="geometry">
400 120 <rect>
401 121 <x>10</x>
402 <y>450</y>
403 <width>171</width>
404 <height>22</height>
122 <y>445</y>
123 <width>134</width>
124 <height>20</height>
405 125 </rect>
406 126 </property>
407 127 <property name="currentIndex">
@@ -423,29 +143,13
423 143 </property>
424 144 </item>
425 145 </widget>
426 <widget class="QSpinBox" name="titleFontSizeSpin">
427 <property name="geometry">
428 <rect>
429 <x>100</x>
430 <y>510</y>
431 <width>81</width>
432 <height>22</height>
433 </rect>
434 </property>
435 <property name="minimum">
436 <number>-100000</number>
437 </property>
438 <property name="maximum">
439 <number>100000</number>
440 </property>
441 </widget>
442 146 <widget class="QComboBox" name="titleComboBox">
443 147 <property name="geometry">
444 148 <rect>
445 149 <x>10</x>
446 <y>570</y>
447 <width>171</width>
448 <height>22</height>
150 <y>551</y>
151 <width>130</width>
152 <height>20</height>
449 153 </rect>
450 154 </property>
451 155 <property name="sizePolicy">
@@ -483,36 +187,13
483 187 </property>
484 188 </item>
485 189 </widget>
486 <widget class="QFontComboBox" name="titleFontComboBox">
487 <property name="geometry">
488 <rect>
489 <x>10</x>
490 <y>540</y>
491 <width>171</width>
492 <height>22</height>
493 </rect>
494 </property>
495 </widget>
496 <widget class="QLabel" name="label_15">
497 <property name="geometry">
498 <rect>
499 <x>10</x>
500 <y>510</y>
501 <width>101</width>
502 <height>16</height>
503 </rect>
504 </property>
505 <property name="text">
506 <string>Title font size</string>
507 </property>
508 </widget>
509 190 <widget class="QComboBox" name="gridComboBox">
510 191 <property name="geometry">
511 192 <rect>
512 193 <x>10</x>
513 <y>600</y>
514 <width>171</width>
515 <height>22</height>
194 <y>577</y>
195 <width>104</width>
196 <height>20</height>
516 197 </rect>
517 198 </property>
518 199 <property name="sizePolicy">
@@ -544,9 +225,9
544 225 <property name="geometry">
545 226 <rect>
546 227 <x>10</x>
547 <y>630</y>
548 <width>171</width>
549 <height>22</height>
228 <y>603</y>
229 <width>114</width>
230 <height>20</height>
550 231 </rect>
551 232 </property>
552 233 <property name="sizePolicy">
@@ -578,9 +259,9
578 259 <property name="geometry">
579 260 <rect>
580 261 <x>10</x>
581 <y>20</y>
582 <width>171</width>
583 <height>22</height>
262 <y>23</y>
263 <width>134</width>
264 <height>20</height>
584 265 </rect>
585 266 </property>
586 267 <property name="currentIndex">
@@ -616,9 +297,9
616 297 <property name="geometry">
617 298 <rect>
618 299 <x>10</x>
619 <y>50</y>
620 <width>171</width>
621 <height>22</height>
300 <y>49</y>
301 <width>126</width>
302 <height>20</height>
622 303 </rect>
623 304 </property>
624 305 <property name="currentIndex">
@@ -650,188 +331,13
650 331 </property>
651 332 </item>
652 333 </widget>
653 <widget class="QLabel" name="label_16">
654 <property name="geometry">
655 <rect>
656 <x>10</x>
657 <y>660</y>
658 <width>101</width>
659 <height>16</height>
660 </rect>
661 </property>
662 <property name="text">
663 <string>Log Base</string>
664 </property>
665 </widget>
666 <widget class="QDoubleSpinBox" name="logBaseSpin">
667 <property name="geometry">
668 <rect>
669 <x>90</x>
670 <y>660</y>
671 <width>91</width>
672 <height>22</height>
673 </rect>
674 </property>
675 <property name="decimals">
676 <number>5</number>
677 </property>
678 <property name="minimum">
679 <double>-999999999.000000000000000</double>
680 </property>
681 <property name="maximum">
682 <double>999999999.000000000000000</double>
683 </property>
684 <property name="value">
685 <double>8.000000000000000</double>
686 </property>
687 </widget>
688 <widget class="QCheckBox" name="niceNumbersCheckBox">
689 <property name="geometry">
690 <rect>
691 <x>10</x>
692 <y>690</y>
693 <width>91</width>
694 <height>16</height>
695 </rect>
696 </property>
697 <property name="text">
698 <string>Nice Numbers</string>
699 </property>
700 </widget>
701 <widget class="QLineEdit" name="dateFormatEdit">
702 <property name="geometry">
703 <rect>
704 <x>100</x>
705 <y>710</y>
706 <width>81</width>
707 <height>20</height>
708 </rect>
709 </property>
710 </widget>
711 <widget class="QLabel" name="label_17">
712 <property name="geometry">
713 <rect>
714 <x>10</x>
715 <y>710</y>
716 <width>101</width>
717 <height>16</height>
718 </rect>
719 </property>
720 <property name="text">
721 <string>DateTime format</string>
722 </property>
723 </widget>
724 <widget class="QCheckBox" name="moreCategoriesCheckBox">
725 <property name="geometry">
726 <rect>
727 <x>100</x>
728 <y>690</y>
729 <width>141</width>
730 <height>16</height>
731 </rect>
732 </property>
733 <property name="text">
734 <string>More Categories</string>
735 </property>
736 </widget>
737 <widget class="QCheckBox" name="series1checkBox">
738 <property name="geometry">
739 <rect>
740 <x>10</x>
741 <y>730</y>
742 <width>31</width>
743 <height>16</height>
744 </rect>
745 </property>
746 <property name="text">
747 <string>1</string>
748 </property>
749 </widget>
750 <widget class="QCheckBox" name="series2checkBox">
751 <property name="geometry">
752 <rect>
753 <x>40</x>
754 <y>730</y>
755 <width>31</width>
756 <height>16</height>
757 </rect>
758 </property>
759 <property name="text">
760 <string>2</string>
761 </property>
762 </widget>
763 <widget class="QCheckBox" name="series3checkBox">
764 <property name="geometry">
765 <rect>
766 <x>70</x>
767 <y>730</y>
768 <width>31</width>
769 <height>16</height>
770 </rect>
771 </property>
772 <property name="text">
773 <string>3</string>
774 </property>
775 </widget>
776 <widget class="QCheckBox" name="series4checkBox">
777 <property name="geometry">
778 <rect>
779 <x>10</x>
780 <y>750</y>
781 <width>31</width>
782 <height>16</height>
783 </rect>
784 </property>
785 <property name="text">
786 <string>4</string>
787 </property>
788 </widget>
789 <widget class="QCheckBox" name="series5checkBox">
790 <property name="geometry">
791 <rect>
792 <x>40</x>
793 <y>750</y>
794 <width>31</width>
795 <height>16</height>
796 </rect>
797 </property>
798 <property name="text">
799 <string>5</string>
800 </property>
801 </widget>
802 <widget class="QCheckBox" name="series6checkBox">
803 <property name="geometry">
804 <rect>
805 <x>70</x>
806 <y>750</y>
807 <width>31</width>
808 <height>16</height>
809 </rect>
810 </property>
811 <property name="text">
812 <string>6</string>
813 </property>
814 </widget>
815 <widget class="QCheckBox" name="series7checkBox">
816 <property name="geometry">
817 <rect>
818 <x>100</x>
819 <y>740</y>
820 <width>31</width>
821 <height>16</height>
822 </rect>
823 </property>
824 <property name="text">
825 <string>7</string>
826 </property>
827 </widget>
828 334 <widget class="QComboBox" name="themeComboBox">
829 335 <property name="geometry">
830 336 <rect>
831 337 <x>10</x>
832 <y>770</y>
833 <width>171</width>
834 <height>22</height>
338 <y>814</y>
339 <width>131</width>
340 <height>20</height>
835 341 </rect>
836 342 </property>
837 343 <property name="sizePolicy">
@@ -888,8 +394,8
888 394 <property name="geometry">
889 395 <rect>
890 396 <x>10</x>
891 <y>800</y>
892 <width>171</width>
397 <y>840</y>
398 <width>117</width>
893 399 <height>16</height>
894 400 </rect>
895 401 </property>
@@ -901,9 +407,9
901 407 <property name="geometry">
902 408 <rect>
903 409 <x>10</x>
904 <y>820</y>
905 <width>171</width>
906 <height>22</height>
410 <y>877</y>
411 <width>195</width>
412 <height>20</height>
907 413 </rect>
908 414 </property>
909 415 <property name="sizePolicy">
@@ -935,9 +441,9
935 441 <property name="geometry">
936 442 <rect>
937 443 <x>10</x>
938 <y>850</y>
939 <width>171</width>
940 <height>22</height>
444 <y>903</y>
445 <width>165</width>
446 <height>20</height>
941 447 </rect>
942 448 </property>
943 449 <property name="sizePolicy">
@@ -965,6 +471,434
965 471 </property>
966 472 </item>
967 473 </widget>
474 <widget class="QWidget" name="layoutWidget">
475 <property name="geometry">
476 <rect>
477 <x>10</x>
478 <y>207</y>
479 <width>185</width>
480 <height>100</height>
481 </rect>
482 </property>
483 <layout class="QGridLayout" name="gridLayout_2">
484 <item row="2" column="1">
485 <widget class="QDoubleSpinBox" name="radialMinSpin">
486 <property name="decimals">
487 <number>5</number>
488 </property>
489 <property name="minimum">
490 <double>-999999999.000000000000000</double>
491 </property>
492 <property name="maximum">
493 <double>999999999.000000000000000</double>
494 </property>
495 <property name="singleStep">
496 <double>10.000000000000000</double>
497 </property>
498 </widget>
499 </item>
500 <item row="3" column="0">
501 <widget class="QLabel" name="label_11">
502 <property name="text">
503 <string>Radial max</string>
504 </property>
505 </widget>
506 </item>
507 <item row="2" column="0">
508 <widget class="QLabel" name="label_12">
509 <property name="text">
510 <string>Radial min</string>
511 </property>
512 </widget>
513 </item>
514 <item row="1" column="0">
515 <widget class="QLabel" name="label_5">
516 <property name="text">
517 <string>Angular max</string>
518 </property>
519 </widget>
520 </item>
521 <item row="0" column="1">
522 <widget class="QDoubleSpinBox" name="angularMinSpin">
523 <property name="decimals">
524 <number>5</number>
525 </property>
526 <property name="minimum">
527 <double>-999999999.000000000000000</double>
528 </property>
529 <property name="maximum">
530 <double>999999999.000000000000000</double>
531 </property>
532 <property name="singleStep">
533 <double>10.000000000000000</double>
534 </property>
535 </widget>
536 </item>
537 <item row="0" column="0">
538 <widget class="QLabel" name="label_4">
539 <property name="text">
540 <string>Angular min</string>
541 </property>
542 </widget>
543 </item>
544 <item row="3" column="1">
545 <widget class="QDoubleSpinBox" name="radialMaxSpin">
546 <property name="decimals">
547 <number>5</number>
548 </property>
549 <property name="minimum">
550 <double>-999999999.000000000000000</double>
551 </property>
552 <property name="maximum">
553 <double>999999999.000000000000000</double>
554 </property>
555 <property name="singleStep">
556 <double>10.000000000000000</double>
557 </property>
558 </widget>
559 </item>
560 <item row="1" column="1">
561 <widget class="QDoubleSpinBox" name="angularMaxSpin">
562 <property name="decimals">
563 <number>5</number>
564 </property>
565 <property name="minimum">
566 <double>-999999999.000000000000000</double>
567 </property>
568 <property name="maximum">
569 <double>999999999.000000000000000</double>
570 </property>
571 <property name="singleStep">
572 <double>10.000000000000000</double>
573 </property>
574 </widget>
575 </item>
576 </layout>
577 </widget>
578 <widget class="QWidget" name="layoutWidget">
579 <property name="geometry">
580 <rect>
581 <x>10</x>
582 <y>365</y>
583 <width>210</width>
584 <height>74</height>
585 </rect>
586 </property>
587 <layout class="QGridLayout" name="gridLayout_3">
588 <item row="0" column="0">
589 <widget class="QLabel" name="label_13">
590 <property name="text">
591 <string>Label format</string>
592 </property>
593 </widget>
594 </item>
595 <item row="0" column="1">
596 <widget class="QLineEdit" name="labelFormatEdit"/>
597 </item>
598 <item row="1" column="0">
599 <widget class="QLabel" name="label_14">
600 <property name="text">
601 <string>Label font size</string>
602 </property>
603 </widget>
604 </item>
605 <item row="1" column="1">
606 <widget class="QSpinBox" name="labelFontSizeSpin">
607 <property name="minimum">
608 <number>-100000</number>
609 </property>
610 <property name="maximum">
611 <number>100000</number>
612 </property>
613 </widget>
614 </item>
615 <item row="2" column="0" colspan="2">
616 <widget class="QFontComboBox" name="labelFontComboBox"/>
617 </item>
618 </layout>
619 </widget>
620 <widget class="QWidget" name="layoutWidget">
621 <property name="geometry">
622 <rect>
623 <x>10</x>
624 <y>497</y>
625 <width>190</width>
626 <height>48</height>
627 </rect>
628 </property>
629 <layout class="QGridLayout" name="gridLayout_4">
630 <item row="0" column="0">
631 <widget class="QLabel" name="label_15">
632 <property name="text">
633 <string>Title font size</string>
634 </property>
635 </widget>
636 </item>
637 <item row="0" column="1">
638 <widget class="QSpinBox" name="titleFontSizeSpin">
639 <property name="minimum">
640 <number>-100000</number>
641 </property>
642 <property name="maximum">
643 <number>100000</number>
644 </property>
645 </widget>
646 </item>
647 <item row="1" column="0" colspan="2">
648 <widget class="QFontComboBox" name="titleFontComboBox"/>
649 </item>
650 </layout>
651 </widget>
652 <widget class="QWidget" name="layoutWidget">
653 <property name="geometry">
654 <rect>
655 <x>10</x>
656 <y>655</y>
657 <width>168</width>
658 <height>22</height>
659 </rect>
660 </property>
661 <layout class="QHBoxLayout" name="horizontalLayout_2">
662 <item>
663 <widget class="QLabel" name="label_16">
664 <property name="text">
665 <string>Log Base</string>
666 </property>
667 </widget>
668 </item>
669 <item>
670 <widget class="QDoubleSpinBox" name="logBaseSpin">
671 <property name="decimals">
672 <number>5</number>
673 </property>
674 <property name="minimum">
675 <double>-999999999.000000000000000</double>
676 </property>
677 <property name="maximum">
678 <double>999999999.000000000000000</double>
679 </property>
680 <property name="value">
681 <double>8.000000000000000</double>
682 </property>
683 </widget>
684 </item>
685 </layout>
686 </widget>
687 <widget class="QWidget" name="layoutWidget">
688 <property name="geometry">
689 <rect>
690 <x>10</x>
691 <y>692</y>
692 <width>198</width>
693 <height>19</height>
694 </rect>
695 </property>
696 <layout class="QHBoxLayout" name="horizontalLayout_3">
697 <item>
698 <widget class="QCheckBox" name="niceNumbersCheckBox">
699 <property name="text">
700 <string>Nice Numbers</string>
701 </property>
702 </widget>
703 </item>
704 <item>
705 <widget class="QCheckBox" name="moreCategoriesCheckBox">
706 <property name="text">
707 <string>More Categories</string>
708 </property>
709 </widget>
710 </item>
711 </layout>
712 </widget>
713 <widget class="QWidget" name="layoutWidget">
714 <property name="geometry">
715 <rect>
716 <x>10</x>
717 <y>729</y>
718 <width>221</width>
719 <height>22</height>
720 </rect>
721 </property>
722 <layout class="QHBoxLayout" name="horizontalLayout_4">
723 <item>
724 <widget class="QLabel" name="label_17">
725 <property name="text">
726 <string>DateTime format</string>
727 </property>
728 </widget>
729 </item>
730 <item>
731 <widget class="QLineEdit" name="dateFormatEdit"/>
732 </item>
733 </layout>
734 </widget>
735 <widget class="QWidget" name="layoutWidget">
736 <property name="geometry">
737 <rect>
738 <x>10</x>
739 <y>766</y>
740 <width>136</width>
741 <height>42</height>
742 </rect>
743 </property>
744 <layout class="QGridLayout" name="gridLayout_5">
745 <item row="0" column="0">
746 <widget class="QCheckBox" name="series1checkBox">
747 <property name="text">
748 <string>1</string>
749 </property>
750 </widget>
751 </item>
752 <item row="0" column="1">
753 <widget class="QCheckBox" name="series2checkBox">
754 <property name="text">
755 <string>2</string>
756 </property>
757 </widget>
758 </item>
759 <item row="0" column="2">
760 <widget class="QCheckBox" name="series3checkBox">
761 <property name="text">
762 <string>3</string>
763 </property>
764 </widget>
765 </item>
766 <item row="0" column="3" rowspan="2">
767 <widget class="QCheckBox" name="series7checkBox">
768 <property name="text">
769 <string>7</string>
770 </property>
771 </widget>
772 </item>
773 <item row="1" column="0">
774 <widget class="QCheckBox" name="series4checkBox">
775 <property name="text">
776 <string>4</string>
777 </property>
778 </widget>
779 </item>
780 <item row="1" column="1">
781 <widget class="QCheckBox" name="series5checkBox">
782 <property name="text">
783 <string>5</string>
784 </property>
785 </widget>
786 </item>
787 <item row="1" column="2">
788 <widget class="QCheckBox" name="series6checkBox">
789 <property name="text">
790 <string>6</string>
791 </property>
792 </widget>
793 </item>
794 </layout>
795 </widget>
796 <widget class="QWidget" name="layoutWidget">
797 <property name="geometry">
798 <rect>
799 <x>10</x>
800 <y>75</y>
801 <width>178</width>
802 <height>126</height>
803 </rect>
804 </property>
805 <layout class="QGridLayout" name="gridLayout">
806 <item row="1" column="0">
807 <widget class="QLabel" name="label_2">
808 <property name="text">
809 <string>Angular Tick count</string>
810 </property>
811 </widget>
812 </item>
813 <item row="2" column="1">
814 <widget class="QSpinBox" name="anglesSpin">
815 <property name="minimum">
816 <number>-9999</number>
817 </property>
818 <property name="maximum">
819 <number>9999</number>
820 </property>
821 <property name="singleStep">
822 <number>5</number>
823 </property>
824 </widget>
825 </item>
826 <item row="3" column="1">
827 <widget class="QSpinBox" name="radialMinorTicksSpin"/>
828 </item>
829 <item row="0" column="0">
830 <widget class="QLabel" name="label">
831 <property name="text">
832 <string>Radial Tick count</string>
833 </property>
834 </widget>
835 </item>
836 <item row="4" column="0">
837 <widget class="QLabel" name="label_7">
838 <property name="text">
839 <string>Angular Minor Tick count</string>
840 </property>
841 </widget>
842 </item>
843 <item row="0" column="1">
844 <widget class="QSpinBox" name="radialTicksSpin"/>
845 </item>
846 <item row="4" column="1">
847 <widget class="QSpinBox" name="angularMinorTicksSpin"/>
848 </item>
849 <item row="3" column="0">
850 <widget class="QLabel" name="label_6">
851 <property name="text">
852 <string>Radial Minor Tick count</string>
853 </property>
854 </widget>
855 </item>
856 <item row="1" column="1">
857 <widget class="QSpinBox" name="angularTicksSpin"/>
858 </item>
859 <item row="2" column="0">
860 <widget class="QLabel" name="label_3">
861 <property name="text">
862 <string>Label angles</string>
863 </property>
864 </widget>
865 </item>
866 </layout>
867 </widget>
868 <widget class="QComboBox" name="minorGridComboBox">
869 <property name="geometry">
870 <rect>
871 <x>10</x>
872 <y>630</y>
873 <width>141</width>
874 <height>20</height>
875 </rect>
876 </property>
877 <property name="sizePolicy">
878 <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
879 <horstretch>0</horstretch>
880 <verstretch>0</verstretch>
881 </sizepolicy>
882 </property>
883 <property name="currentIndex">
884 <number>1</number>
885 </property>
886 <item>
887 <property name="text">
888 <string>Invisible minor grid</string>
889 </property>
890 </item>
891 <item>
892 <property name="text">
893 <string>Black minor grid</string>
894 </property>
895 </item>
896 <item>
897 <property name="text">
898 <string>Custom minor grid pen</string>
899 </property>
900 </item>
901 </widget>
968 902 </widget>
969 903 </item>
970 904 </layout>
@@ -61,6 +61,10 Row {
61 61 onClicked: axis.gridVisible = !axis.gridVisible;
62 62 }
63 63 Button {
64 text: "axis minor grid visible"
65 onClicked: axis.minorGridVisible = !axis.minorGridVisible;
66 }
67 Button {
64 68 text: "axis shades visible"
65 69 onClicked: axis.shadesVisible = !axis.shadesVisible;
66 70 }
@@ -102,10 +106,17 Row {
102 106 }
103 107 Button {
104 108 text: "axis tick count -"
105
106 109 onClicked: axis.tickCount--;
107 110 }
108 111 Button {
112 text: "axis minor tick count +"
113 onClicked: axis.minorTickCount++;
114 }
115 Button {
116 text: "axis minor tick count -"
117 onClicked: axis.minorTickCount--;
118 }
119 Button {
109 120 text: "axis reverse"
110 121 onClicked: axis.reverse = !axis.reverse;
111 122 }
General Comments 0
You need to be logged in to leave comments. Login now