@@ -1,106 +1,109 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | #include "chartcategoriesaxisx_p.h" |
|
21 | #include "chartcategoriesaxisx_p.h" | |
22 | #include "qabstractaxis.h" |
|
22 | #include "qabstractaxis.h" | |
23 | #include "chartpresenter_p.h" |
|
23 | #include "chartpresenter_p.h" | |
24 | #include "chartanimator_p.h" |
|
24 | #include "chartanimator_p.h" | |
25 | #include <QGraphicsLayout> |
|
25 | #include <QGraphicsLayout> | |
26 | #include <QDebug> |
|
26 | #include <QDebug> | |
27 | #include <QFontMetrics> |
|
27 | #include <QFontMetrics> | |
28 | #include <QBarCategoriesAxis> |
|
28 | #include <QBarCategoriesAxis> | |
29 |
|
29 | |||
30 | static int label_padding = 5; |
|
30 | static int label_padding = 5; | |
31 |
|
31 | |||
32 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
32 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
33 |
|
33 | |||
34 | ChartCategoriesAxisX::ChartCategoriesAxisX(QBarCategoriesAxis *axis,ChartPresenter *presenter) : ChartAxis(axis,presenter), |
|
34 | ChartCategoriesAxisX::ChartCategoriesAxisX(QBarCategoriesAxis *axis,ChartPresenter *presenter) : ChartAxis(axis,presenter), | |
35 | m_categoriesAxis(axis) |
|
35 | m_categoriesAxis(axis) | |
36 | { |
|
36 | { | |
37 |
|
37 | |||
38 | } |
|
38 | } | |
39 |
|
39 | |||
40 | ChartCategoriesAxisX::~ChartCategoriesAxisX() |
|
40 | ChartCategoriesAxisX::~ChartCategoriesAxisX() | |
41 | { |
|
41 | { | |
42 | } |
|
42 | } | |
43 |
|
43 | |||
44 | QVector<qreal> ChartCategoriesAxisX::calculateLayout() const |
|
44 | QVector<qreal> ChartCategoriesAxisX::calculateLayout() const | |
45 | { |
|
45 | { | |
46 | Q_ASSERT(m_ticksCount>=2); |
|
46 | Q_ASSERT(m_ticksCount>=2); | |
47 |
|
47 | |||
48 | QVector<qreal> points; |
|
48 | QVector<qreal> points; | |
49 | points.resize(m_ticksCount); |
|
49 | points.resize(m_ticksCount); | |
50 |
|
50 | |||
51 | // TODO: shift logic |
|
51 | // TODO: shift logic | |
52 | const qreal deltaX = m_rect.width()/(m_ticksCount-1); |
|
52 | const qreal deltaX = m_rect.width()/(m_ticksCount-1); | |
53 | for (int i = 0; i < m_ticksCount; ++i) { |
|
53 | for (int i = 0; i < m_ticksCount; ++i) { | |
54 | int x = i * deltaX + m_rect.left(); |
|
54 | int x = i * deltaX + m_rect.left(); | |
55 | points[i] = x; |
|
55 | points[i] = x; | |
56 | } |
|
56 | } | |
57 | return points; |
|
57 | return points; | |
58 | } |
|
58 | } | |
59 |
|
59 | |||
60 | void ChartCategoriesAxisX::updateGeometry() |
|
60 | void ChartCategoriesAxisX::updateGeometry() | |
61 | { |
|
61 | { | |
62 | const QVector<qreal>& layout = ChartAxis::layout(); |
|
62 | const QVector<qreal>& layout = ChartAxis::layout(); | |
63 |
|
63 | |||
64 | m_minWidth = 0; |
|
64 | m_minWidth = 0; | |
65 | m_minHeight = 0; |
|
65 | m_minHeight = 0; | |
66 |
|
66 | |||
67 | if(layout.isEmpty()) return; |
|
67 | if(layout.isEmpty()) return; | |
68 |
|
68 | |||
69 | QStringList ticksList; |
|
69 | QStringList ticksList; | |
70 |
|
70 | |||
71 | createCategoryLabels(ticksList,m_min,m_max,m_categoriesAxis->categories()); |
|
71 | createCategoryLabels(ticksList,m_min,m_max,m_categoriesAxis->categories()); | |
72 |
|
72 | |||
73 | QList<QGraphicsItem *> lines = m_grid->childItems(); |
|
73 | QList<QGraphicsItem *> lines = m_grid->childItems(); | |
74 | QList<QGraphicsItem *> labels = m_labels->childItems(); |
|
74 | QList<QGraphicsItem *> labels = m_labels->childItems(); | |
75 | QList<QGraphicsItem *> shades = m_shades->childItems(); |
|
75 | QList<QGraphicsItem *> shades = m_shades->childItems(); | |
76 | QList<QGraphicsItem *> axis = m_axis->childItems(); |
|
76 | QList<QGraphicsItem *> axis = m_axis->childItems(); | |
77 |
|
77 | |||
78 | Q_ASSERT(labels.size() == ticksList.size()); |
|
78 | Q_ASSERT(labels.size() == ticksList.size()); | |
79 | Q_ASSERT(layout.size() == ticksList.size()); |
|
79 | Q_ASSERT(layout.size() == ticksList.size()); | |
80 |
|
80 | |||
81 | QGraphicsLineItem *lineItem = static_cast<QGraphicsLineItem*>(axis.at(0)); |
|
81 | QGraphicsLineItem *lineItem = static_cast<QGraphicsLineItem*>(axis.at(0)); | |
82 | lineItem->setLine(m_rect.left(), m_rect.bottom(), m_rect.right(), m_rect.bottom()); |
|
82 | lineItem->setLine(m_rect.left(), m_rect.bottom(), m_rect.right(), m_rect.bottom()); | |
83 |
|
83 | |||
84 |
for (int i = |
|
84 | for (int i = 0; i < layout.size(); ++i) { | |
85 | QGraphicsLineItem *lineItem = static_cast<QGraphicsLineItem*>(lines.at(i)); |
|
85 | QGraphicsLineItem *lineItem = static_cast<QGraphicsLineItem*>(lines.at(i)); | |
86 | lineItem->setLine(layout[i], m_rect.top(), layout[i], m_rect.bottom()); |
|
86 | lineItem->setLine(layout[i], m_rect.top(), layout[i], m_rect.bottom()); | |
87 |
QGraphicsSimpleTextItem *labelItem = static_cast<QGraphicsSimpleTextItem*>(labels.at(i |
|
87 | QGraphicsSimpleTextItem *labelItem = static_cast<QGraphicsSimpleTextItem*>(labels.at(i)); | |
88 |
|
88 | if (i>=1) { | ||
89 | labelItem->setText(ticksList.at(i-1)); |
|
89 | labelItem->setText(ticksList.at(i-1)); | |
90 | const QRectF& rect = labelItem->boundingRect(); |
|
90 | const QRectF& rect = labelItem->boundingRect(); | |
91 | QPointF center = rect.center(); |
|
91 | QPointF center = rect.center(); | |
92 | labelItem->setTransformOriginPoint(center.x(), center.y()); |
|
92 | labelItem->setTransformOriginPoint(center.x(), center.y()); | |
93 | labelItem->setPos(layout[i] - (layout[i] - layout[i-1])/2 - center.x(), m_rect.bottom() + label_padding); |
|
93 | labelItem->setPos(layout[i] - (layout[i] - layout[i-1])/2 - center.x(), m_rect.bottom() + label_padding); | |
94 | m_minWidth+=rect.width(); |
|
94 | m_minWidth+=rect.width(); | |
95 | m_minHeight=qMax(rect.height()+label_padding,m_minHeight); |
|
95 | m_minHeight=qMax(rect.height()+label_padding,m_minHeight); | |
|
96 | }else{ | |||
|
97 | labelItem->setVisible(false); | |||
|
98 | } | |||
96 |
|
99 | |||
97 | if ((i+1)%2 && i>1) { |
|
100 | if ((i+1)%2 && i>1) { | |
98 | QGraphicsRectItem *rectItem = static_cast<QGraphicsRectItem*>(shades.at(i/2-1)); |
|
101 | QGraphicsRectItem *rectItem = static_cast<QGraphicsRectItem*>(shades.at(i/2-1)); | |
99 | rectItem->setRect(layout[i-1],m_rect.top(),layout[i]-layout[i-1],m_rect.height()); |
|
102 | rectItem->setRect(layout[i-1],m_rect.top(),layout[i]-layout[i-1],m_rect.height()); | |
100 | } |
|
103 | } | |
101 | lineItem = static_cast<QGraphicsLineItem*>(axis.at(i+1)); |
|
104 | lineItem = static_cast<QGraphicsLineItem*>(axis.at(i+1)); | |
102 | lineItem->setLine(layout[i],m_rect.bottom(),layout[i],m_rect.bottom()+5); |
|
105 | lineItem->setLine(layout[i],m_rect.bottom(),layout[i],m_rect.bottom()+5); | |
103 | } |
|
106 | } | |
104 | } |
|
107 | } | |
105 |
|
108 | |||
106 | QTCOMMERCIALCHART_END_NAMESPACE |
|
109 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -1,104 +1,108 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | #include "chartcategoriesaxisy_p.h" |
|
21 | #include "chartcategoriesaxisy_p.h" | |
22 | #include "qabstractaxis.h" |
|
22 | #include "qabstractaxis.h" | |
23 | #include "chartpresenter_p.h" |
|
23 | #include "chartpresenter_p.h" | |
24 | #include "chartanimator_p.h" |
|
24 | #include "chartanimator_p.h" | |
25 | #include <QGraphicsLayout> |
|
25 | #include <QGraphicsLayout> | |
26 | #include <QDebug> |
|
26 | #include <QDebug> | |
27 | #include <QFontMetrics> |
|
27 | #include <QFontMetrics> | |
28 | #include <QBarCategoriesAxis> |
|
28 | #include <QBarCategoriesAxis> | |
29 |
|
29 | |||
30 | static int label_padding = 5; |
|
30 | static int label_padding = 5; | |
31 |
|
31 | |||
32 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
32 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
33 |
|
33 | |||
34 | ChartCategoriesAxisY::ChartCategoriesAxisY(QAbstractAxis *axis,ChartPresenter *presenter) : ChartAxis(axis,presenter) |
|
34 | ChartCategoriesAxisY::ChartCategoriesAxisY(QAbstractAxis *axis,ChartPresenter *presenter) : ChartAxis(axis,presenter) | |
35 | { |
|
35 | { | |
36 | } |
|
36 | } | |
37 |
|
37 | |||
38 | ChartCategoriesAxisY::~ChartCategoriesAxisY() |
|
38 | ChartCategoriesAxisY::~ChartCategoriesAxisY() | |
39 | { |
|
39 | { | |
40 | } |
|
40 | } | |
41 |
|
41 | |||
42 | QVector<qreal> ChartCategoriesAxisY::calculateLayout() const |
|
42 | QVector<qreal> ChartCategoriesAxisY::calculateLayout() const | |
43 | { |
|
43 | { | |
44 | Q_ASSERT(m_ticksCount>=2); |
|
44 | Q_ASSERT(m_ticksCount>=2); | |
45 |
|
45 | |||
46 | QVector<qreal> points; |
|
46 | QVector<qreal> points; | |
47 | points.resize(m_ticksCount); |
|
47 | points.resize(m_ticksCount); | |
48 |
|
48 | |||
49 | const qreal deltaY = m_rect.height()/(m_ticksCount-1); |
|
49 | const qreal deltaY = m_rect.height()/(m_ticksCount-1); | |
50 | for (int i = 0; i < m_ticksCount; ++i) { |
|
50 | for (int i = 0; i < m_ticksCount; ++i) { | |
51 | int y = i * -deltaY + m_rect.bottom(); |
|
51 | int y = i * -deltaY + m_rect.bottom(); | |
52 | points[i] = y; |
|
52 | points[i] = y; | |
53 | } |
|
53 | } | |
54 |
|
54 | |||
55 | return points; |
|
55 | return points; | |
56 | } |
|
56 | } | |
57 |
|
57 | |||
58 | void ChartCategoriesAxisY::updateGeometry() |
|
58 | void ChartCategoriesAxisY::updateGeometry() | |
59 | { |
|
59 | { | |
60 | const QVector<qreal>& layout = ChartAxis::layout(); |
|
60 | const QVector<qreal>& layout = ChartAxis::layout(); | |
61 |
|
61 | |||
62 | m_minWidth = 0; |
|
62 | m_minWidth = 0; | |
63 | m_minHeight = 0; |
|
63 | m_minHeight = 0; | |
64 |
|
64 | |||
65 | if(layout.isEmpty()) return; |
|
65 | if(layout.isEmpty()) return; | |
66 |
|
66 | |||
67 | QStringList ticksList; |
|
67 | QStringList ticksList; | |
68 |
|
68 | |||
69 | createCategoryLabels(ticksList,m_min,m_max,m_categoriesAxis->categories()); |
|
69 | createCategoryLabels(ticksList,m_min,m_max,m_categoriesAxis->categories()); | |
70 |
|
70 | |||
71 | QList<QGraphicsItem *> lines = m_grid->childItems(); |
|
71 | QList<QGraphicsItem *> lines = m_grid->childItems(); | |
72 | QList<QGraphicsItem *> labels = m_labels->childItems(); |
|
72 | QList<QGraphicsItem *> labels = m_labels->childItems(); | |
73 | QList<QGraphicsItem *> shades = m_shades->childItems(); |
|
73 | QList<QGraphicsItem *> shades = m_shades->childItems(); | |
74 | QList<QGraphicsItem *> axis = m_axis->childItems(); |
|
74 | QList<QGraphicsItem *> axis = m_axis->childItems(); | |
75 |
|
75 | |||
76 | Q_ASSERT(labels.size() == ticksList.size()); |
|
76 | Q_ASSERT(labels.size() == ticksList.size()); | |
77 | Q_ASSERT(layout.size() == ticksList.size()); |
|
77 | Q_ASSERT(layout.size() == ticksList.size()); | |
78 |
|
78 | |||
79 | QGraphicsLineItem *lineItem = static_cast<QGraphicsLineItem*>(axis.at(0)); |
|
79 | QGraphicsLineItem *lineItem = static_cast<QGraphicsLineItem*>(axis.at(0)); | |
80 | lineItem->setLine(m_rect.left(), m_rect.bottom(), m_rect.right(), m_rect.bottom()); |
|
80 | lineItem->setLine(m_rect.left(), m_rect.bottom(), m_rect.right(), m_rect.bottom()); | |
81 |
|
81 | |||
82 |
for (int i = |
|
82 | for (int i = 0; i < layout.size(); ++i) { | |
83 | QGraphicsLineItem *lineItem = static_cast<QGraphicsLineItem*>(lines.at(i)); |
|
83 | QGraphicsLineItem *lineItem = static_cast<QGraphicsLineItem*>(lines.at(i)); | |
84 | lineItem->setLine(layout[i], m_rect.top(), layout[i], m_rect.bottom()); |
|
84 | lineItem->setLine(layout[i], m_rect.top(), layout[i], m_rect.bottom()); | |
85 | QGraphicsSimpleTextItem *labelItem = static_cast<QGraphicsSimpleTextItem*>(labels.at(i)); |
|
85 | QGraphicsSimpleTextItem *labelItem = static_cast<QGraphicsSimpleTextItem*>(labels.at(i)); | |
86 |
|
86 | if(i>=1){ | ||
87 | labelItem->setText(ticksList.at(i)); |
|
87 | labelItem->setText(ticksList.at(i-1)); | |
88 | const QRectF& rect = labelItem->boundingRect(); |
|
88 | const QRectF& rect = labelItem->boundingRect(); | |
89 | QPointF center = rect.center(); |
|
89 | QPointF center = rect.center(); | |
90 | labelItem->setTransformOriginPoint(center.x(), center.y()); |
|
90 | labelItem->setTransformOriginPoint(center.x(), center.y()); | |
91 | labelItem->setPos(layout[i] - (layout[i] - layout[i-1])/2 - center.x(), m_rect.bottom() + label_padding); |
|
91 | labelItem->setPos(layout[i] - (layout[i] - layout[i-1])/2 - center.x(), m_rect.bottom() + label_padding); | |
92 | m_minWidth+=rect.width(); |
|
92 | m_minWidth+=rect.width(); | |
93 | m_minHeight=qMax(rect.height()+label_padding,m_minHeight); |
|
93 | m_minHeight=qMax(rect.height()+label_padding,m_minHeight); | |
|
94 | }else{ | |||
|
95 | labelItem->setVisible(false); | |||
|
96 | } | |||
|
97 | ||||
94 |
|
98 | |||
95 | if ((i+1)%2 && i>1) { |
|
99 | if ((i+1)%2 && i>1) { | |
96 | QGraphicsRectItem *rectItem = static_cast<QGraphicsRectItem*>(shades.at(i/2-1)); |
|
100 | QGraphicsRectItem *rectItem = static_cast<QGraphicsRectItem*>(shades.at(i/2-1)); | |
97 | rectItem->setRect(layout[i-1],m_rect.top(),layout[i]-layout[i-1],m_rect.height()); |
|
101 | rectItem->setRect(layout[i-1],m_rect.top(),layout[i]-layout[i-1],m_rect.height()); | |
98 | } |
|
102 | } | |
99 | lineItem = static_cast<QGraphicsLineItem*>(axis.at(i+1)); |
|
103 | lineItem = static_cast<QGraphicsLineItem*>(axis.at(i+1)); | |
100 | lineItem->setLine(layout[i],m_rect.bottom(),layout[i],m_rect.bottom()+5); |
|
104 | lineItem->setLine(layout[i],m_rect.bottom(),layout[i],m_rect.bottom()+5); | |
101 | } |
|
105 | } | |
102 | } |
|
106 | } | |
103 |
|
107 | |||
104 | QTCOMMERCIALCHART_END_NAMESPACE |
|
108 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -1,377 +1,379 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | #include "qbarcategoriesaxis.h" |
|
21 | #include "qbarcategoriesaxis.h" | |
22 | #include "qbarcategoriesaxis_p.h" |
|
22 | #include "qbarcategoriesaxis_p.h" | |
23 | #include "chartcategoriesaxisx_p.h" |
|
23 | #include "chartcategoriesaxisx_p.h" | |
24 | #include "chartcategoriesaxisy_p.h" |
|
24 | #include "chartcategoriesaxisy_p.h" | |
25 | #include <qmath.h> |
|
25 | #include <qmath.h> | |
26 | #include <QDebug> |
|
26 | #include <QDebug> | |
27 |
|
27 | |||
28 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
28 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
29 | /*! |
|
29 | /*! | |
30 | \class QBarCategoriesAxis |
|
30 | \class QBarCategoriesAxis | |
31 | \brief The QBarCategoriesAxis class is used for manipulating chart's axis. |
|
31 | \brief The QBarCategoriesAxis class is used for manipulating chart's axis. | |
32 | \mainclass |
|
32 | \mainclass | |
33 |
|
33 | |||
34 | BarCategoriesAxis can be setup to show axis line with tick marks, grid lines and shades. |
|
34 | BarCategoriesAxis can be setup to show axis line with tick marks, grid lines and shades. | |
35 | Categories are drawn between ticks. |
|
35 | Categories are drawn between ticks. | |
36 | */ |
|
36 | */ | |
37 |
|
37 | |||
38 | /*! |
|
38 | /*! | |
39 | \qmlclass BarCategoriesAxis QBarCategoriesAxis |
|
39 | \qmlclass BarCategoriesAxis QBarCategoriesAxis | |
40 | \brief The Axis element is used for manipulating chart's axes. |
|
40 | \brief The Axis element is used for manipulating chart's axes. | |
41 |
|
41 | |||
42 | Axis can be setup to show axis line with tick marks, grid lines and shades. |
|
42 | Axis can be setup to show axis line with tick marks, grid lines and shades. | |
43 | Categories are drawn between ticks. |
|
43 | Categories are drawn between ticks. | |
44 |
|
44 | |||
45 | To access BarCategoriesAxis you can use ChartView API. For example: |
|
45 | To access BarCategoriesAxis you can use ChartView API. For example: | |
46 | \code |
|
46 | \code | |
47 | ChartView { |
|
47 | ChartView { | |
48 | BarCategoriesAxis { |
|
48 | BarCategoriesAxis { | |
49 | id: categoryAxis |
|
49 | id: categoryAxis | |
50 | categories: ["Jan", "Feb", "Mar", "Apr", "May", "Jun" ] |
|
50 | categories: ["Jan", "Feb", "Mar", "Apr", "May", "Jun" ] | |
51 | } |
|
51 | } | |
52 | // Add a few series... |
|
52 | // Add a few series... | |
53 | } |
|
53 | } | |
54 | \endcode |
|
54 | \endcode | |
55 | */ |
|
55 | */ | |
56 |
|
56 | |||
57 | /*! |
|
57 | /*! | |
58 | \property QBarCategoriesAxis::categories |
|
58 | \property QBarCategoriesAxis::categories | |
59 | Defines the categories of axis |
|
59 | Defines the categories of axis | |
60 | */ |
|
60 | */ | |
61 | /*! |
|
61 | /*! | |
62 | \qmlproperty QStringList BarCategoriesAxis::categories |
|
62 | \qmlproperty QStringList BarCategoriesAxis::categories | |
63 | Defines the categories of axis |
|
63 | Defines the categories of axis | |
64 | */ |
|
64 | */ | |
65 |
|
65 | |||
66 | /*! |
|
66 | /*! | |
67 | \property QBarCategoriesAxis::min |
|
67 | \property QBarCategoriesAxis::min | |
68 | Defines the minimum value on the axis. |
|
68 | Defines the minimum value on the axis. | |
69 | */ |
|
69 | */ | |
70 | /*! |
|
70 | /*! | |
71 | \qmlproperty real BarCategoriesAxis::min |
|
71 | \qmlproperty real BarCategoriesAxis::min | |
72 | Defines the minimum value on the axis. |
|
72 | Defines the minimum value on the axis. | |
73 | */ |
|
73 | */ | |
74 |
|
74 | |||
75 | /*! |
|
75 | /*! | |
76 | \property QBarCategoriesAxis::max |
|
76 | \property QBarCategoriesAxis::max | |
77 | Defines the maximum value on the axis. |
|
77 | Defines the maximum value on the axis. | |
78 | */ |
|
78 | */ | |
79 | /*! |
|
79 | /*! | |
80 | \qmlproperty real BarCategoriesAxis::max |
|
80 | \qmlproperty real BarCategoriesAxis::max | |
81 | Defines the maximum value on the axis. |
|
81 | Defines the maximum value on the axis. | |
82 | */ |
|
82 | */ | |
83 |
|
83 | |||
84 | /*! |
|
84 | /*! | |
85 | \fn void QBarCategoriesAxis::minChanged(const QString &min) |
|
85 | \fn void QBarCategoriesAxis::minChanged(const QString &min) | |
86 | Axis emits signal when \a min of axis has changed. |
|
86 | Axis emits signal when \a min of axis has changed. | |
87 | */ |
|
87 | */ | |
88 |
|
88 | |||
89 | /*! |
|
89 | /*! | |
90 | \fn void QBarCategoriesAxis::maxChanged(const QString &max) |
|
90 | \fn void QBarCategoriesAxis::maxChanged(const QString &max) | |
91 | Axis emits signal when \a max of axis has changed. |
|
91 | Axis emits signal when \a max of axis has changed. | |
92 | */ |
|
92 | */ | |
93 |
|
93 | |||
94 | /*! |
|
94 | /*! | |
95 | \fn void QBarCategoriesAxis::rangeChanged(const QString &min, const QString &max) |
|
95 | \fn void QBarCategoriesAxis::rangeChanged(const QString &min, const QString &max) | |
96 | Axis emits signal when \a min or \a max of axis has changed. |
|
96 | Axis emits signal when \a min or \a max of axis has changed. | |
97 | */ |
|
97 | */ | |
98 |
|
98 | |||
99 | /*! |
|
99 | /*! | |
100 | Constructs an axis object which is a child of \a parent. |
|
100 | Constructs an axis object which is a child of \a parent. | |
101 | */ |
|
101 | */ | |
102 | QBarCategoriesAxis::QBarCategoriesAxis(QObject *parent): |
|
102 | QBarCategoriesAxis::QBarCategoriesAxis(QObject *parent): | |
103 | QAbstractAxis(*new QBarCategoriesAxisPrivate(this),parent) |
|
103 | QAbstractAxis(*new QBarCategoriesAxisPrivate(this),parent) | |
104 | { |
|
104 | { | |
105 | } |
|
105 | } | |
106 |
|
106 | |||
107 | /*! |
|
107 | /*! | |
108 | Destroys the object |
|
108 | Destroys the object | |
109 | */ |
|
109 | */ | |
110 | QBarCategoriesAxis::~QBarCategoriesAxis() |
|
110 | QBarCategoriesAxis::~QBarCategoriesAxis() | |
111 | { |
|
111 | { | |
112 | } |
|
112 | } | |
113 |
|
113 | |||
114 | /*! |
|
114 | /*! | |
115 | \internal |
|
115 | \internal | |
116 | */ |
|
116 | */ | |
117 | QBarCategoriesAxis::QBarCategoriesAxis(QBarCategoriesAxisPrivate &d,QObject *parent):QAbstractAxis(d,parent) |
|
117 | QBarCategoriesAxis::QBarCategoriesAxis(QBarCategoriesAxisPrivate &d,QObject *parent):QAbstractAxis(d,parent) | |
118 | { |
|
118 | { | |
119 |
|
119 | |||
120 | } |
|
120 | } | |
121 |
|
121 | |||
122 | /*! |
|
122 | /*! | |
123 | Appends \a categories to axis |
|
123 | Appends \a categories to axis | |
124 | */ |
|
124 | */ | |
125 | void QBarCategoriesAxis::append(const QStringList &categories) |
|
125 | void QBarCategoriesAxis::append(const QStringList &categories) | |
126 | { |
|
126 | { | |
|
127 | if(categories.isEmpty()) return; | |||
|
128 | ||||
127 | Q_D(QBarCategoriesAxis); |
|
129 | Q_D(QBarCategoriesAxis); | |
128 | if (d->m_categories.isEmpty()) { |
|
130 | if (d->m_categories.isEmpty()) { | |
129 | d->m_categories.append(categories); |
|
131 | d->m_categories.append(categories); | |
130 | setRange(categories.first(),categories.last()); |
|
132 | setRange(categories.first(),categories.last()); | |
131 | }else{ |
|
133 | }else{ | |
132 | d->m_categories.append(categories); |
|
134 | d->m_categories.append(categories); | |
133 | } |
|
135 | } | |
134 |
|
136 | |||
135 | emit categoriesChanged(); |
|
137 | emit categoriesChanged(); | |
136 | } |
|
138 | } | |
137 |
|
139 | |||
138 | /*! |
|
140 | /*! | |
139 | Appends \a category to axis |
|
141 | Appends \a category to axis | |
140 | */ |
|
142 | */ | |
141 | void QBarCategoriesAxis::append(const QString &category) |
|
143 | void QBarCategoriesAxis::append(const QString &category) | |
142 | { |
|
144 | { | |
143 | Q_D(QBarCategoriesAxis); |
|
145 | Q_D(QBarCategoriesAxis); | |
144 | if (d->m_categories.isEmpty()) { |
|
146 | if (d->m_categories.isEmpty()) { | |
145 | d->m_categories.append(category); |
|
147 | d->m_categories.append(category); | |
146 | setRange(category,category); |
|
148 | setRange(category,category); | |
147 | }else{ |
|
149 | }else{ | |
148 | d->m_categories.append(category); |
|
150 | d->m_categories.append(category); | |
149 | } |
|
151 | } | |
150 | emit categoriesChanged(); |
|
152 | emit categoriesChanged(); | |
151 | } |
|
153 | } | |
152 |
|
154 | |||
153 | /*! |
|
155 | /*! | |
154 | Removes \a category from axis |
|
156 | Removes \a category from axis | |
155 | */ |
|
157 | */ | |
156 | void QBarCategoriesAxis::remove(const QString &category) |
|
158 | void QBarCategoriesAxis::remove(const QString &category) | |
157 | { |
|
159 | { | |
158 | Q_D(QBarCategoriesAxis); |
|
160 | Q_D(QBarCategoriesAxis); | |
159 | if (d->m_categories.contains(category)) { |
|
161 | if (d->m_categories.contains(category)) { | |
160 | d->m_categories.removeAt(d->m_categories.indexOf(category)); |
|
162 | d->m_categories.removeAt(d->m_categories.indexOf(category)); | |
161 | setRange(d->m_categories.first(),d->m_categories.last()); |
|
163 | setRange(d->m_categories.first(),d->m_categories.last()); | |
162 | emit categoriesChanged(); |
|
164 | emit categoriesChanged(); | |
163 | } |
|
165 | } | |
164 | } |
|
166 | } | |
165 |
|
167 | |||
166 | /*! |
|
168 | /*! | |
167 | Inserts \a category to axis at \a index |
|
169 | Inserts \a category to axis at \a index | |
168 | */ |
|
170 | */ | |
169 | void QBarCategoriesAxis::insert(int index, const QString &category) |
|
171 | void QBarCategoriesAxis::insert(int index, const QString &category) | |
170 | { |
|
172 | { | |
171 | Q_D(QBarCategoriesAxis); |
|
173 | Q_D(QBarCategoriesAxis); | |
172 | if (d->m_categories.isEmpty()) { |
|
174 | if (d->m_categories.isEmpty()) { | |
173 | d->m_categories.insert(index,category); |
|
175 | d->m_categories.insert(index,category); | |
174 | setRange(category,category); |
|
176 | setRange(category,category); | |
175 | }else{ |
|
177 | }else{ | |
176 |
|
178 | d->m_categories.insert(index,category); | ||
177 | } |
|
179 | } | |
178 | emit categoriesChanged(); |
|
180 | emit categoriesChanged(); | |
179 | } |
|
181 | } | |
180 |
|
182 | |||
181 | /*! |
|
183 | /*! | |
182 | Removes all categories. |
|
184 | Removes all categories. | |
183 | */ |
|
185 | */ | |
184 | void QBarCategoriesAxis::clear() |
|
186 | void QBarCategoriesAxis::clear() | |
185 | { |
|
187 | { | |
186 | Q_D(QBarCategoriesAxis); |
|
188 | Q_D(QBarCategoriesAxis); | |
187 | d->m_categories.clear(); |
|
189 | d->m_categories.clear(); | |
188 | setRange(QString::null,QString::null); |
|
190 | setRange(QString::null,QString::null); | |
189 | emit categoriesChanged(); |
|
191 | emit categoriesChanged(); | |
190 | } |
|
192 | } | |
191 |
|
193 | |||
192 | void QBarCategoriesAxis::setCategories(const QStringList &categories) |
|
194 | void QBarCategoriesAxis::setCategories(const QStringList &categories) | |
193 | { |
|
195 | { | |
194 | Q_D(QBarCategoriesAxis); |
|
196 | Q_D(QBarCategoriesAxis); | |
195 | if(d->m_categories!=categories){ |
|
197 | if(d->m_categories!=categories){ | |
196 | d->m_categories = categories; |
|
198 | d->m_categories = categories; | |
197 | setRange(categories.first(),categories.last()); |
|
199 | setRange(categories.first(),categories.last()); | |
198 | emit categoriesChanged(); |
|
200 | emit categoriesChanged(); | |
199 | } |
|
201 | } | |
200 | } |
|
202 | } | |
201 |
|
203 | |||
202 | QStringList QBarCategoriesAxis::categories() |
|
204 | QStringList QBarCategoriesAxis::categories() | |
203 | { |
|
205 | { | |
204 | Q_D(QBarCategoriesAxis); |
|
206 | Q_D(QBarCategoriesAxis); | |
205 | return d->m_categories; |
|
207 | return d->m_categories; | |
206 | } |
|
208 | } | |
207 |
|
209 | |||
208 | /*! |
|
210 | /*! | |
209 | Returns number of categories. |
|
211 | Returns number of categories. | |
210 | */ |
|
212 | */ | |
211 | int QBarCategoriesAxis::count() const |
|
213 | int QBarCategoriesAxis::count() const | |
212 | { |
|
214 | { | |
213 | Q_D(const QBarCategoriesAxis); |
|
215 | Q_D(const QBarCategoriesAxis); | |
214 | return d->m_categories.count(); |
|
216 | return d->m_categories.count(); | |
215 | } |
|
217 | } | |
216 |
|
218 | |||
217 | /*! |
|
219 | /*! | |
218 | Returns category at \a index. Index must be valid. |
|
220 | Returns category at \a index. Index must be valid. | |
219 | */ |
|
221 | */ | |
220 | QString QBarCategoriesAxis::at(int index) const |
|
222 | QString QBarCategoriesAxis::at(int index) const | |
221 | { |
|
223 | { | |
222 | Q_D(const QBarCategoriesAxis); |
|
224 | Q_D(const QBarCategoriesAxis); | |
223 | return d->m_categories.at(index); |
|
225 | return d->m_categories.at(index); | |
224 | } |
|
226 | } | |
225 |
|
227 | |||
226 | /*! |
|
228 | /*! | |
227 | Sets minimum category to \a min. |
|
229 | Sets minimum category to \a min. | |
228 | */ |
|
230 | */ | |
229 | void QBarCategoriesAxis::setMin(const QString& min) |
|
231 | void QBarCategoriesAxis::setMin(const QString& min) | |
230 | { |
|
232 | { | |
231 | Q_D(QBarCategoriesAxis); |
|
233 | Q_D(QBarCategoriesAxis); | |
232 | setRange(min,d->m_maxCategory); |
|
234 | setRange(min,d->m_maxCategory); | |
233 | } |
|
235 | } | |
234 |
|
236 | |||
235 | /*! |
|
237 | /*! | |
236 | Returns minimum category. |
|
238 | Returns minimum category. | |
237 | */ |
|
239 | */ | |
238 | QString QBarCategoriesAxis::min() const |
|
240 | QString QBarCategoriesAxis::min() const | |
239 | { |
|
241 | { | |
240 | Q_D(const QBarCategoriesAxis); |
|
242 | Q_D(const QBarCategoriesAxis); | |
241 | return d->m_minCategory; |
|
243 | return d->m_minCategory; | |
242 | } |
|
244 | } | |
243 |
|
245 | |||
244 | /*! |
|
246 | /*! | |
245 | Sets maximum category to \a max. |
|
247 | Sets maximum category to \a max. | |
246 | */ |
|
248 | */ | |
247 | void QBarCategoriesAxis::setMax(const QString& max) |
|
249 | void QBarCategoriesAxis::setMax(const QString& max) | |
248 | { |
|
250 | { | |
249 | Q_D(QBarCategoriesAxis); |
|
251 | Q_D(QBarCategoriesAxis); | |
250 | setRange(d->m_minCategory,max); |
|
252 | setRange(d->m_minCategory,max); | |
251 | } |
|
253 | } | |
252 |
|
254 | |||
253 | /*! |
|
255 | /*! | |
254 | Returns maximum category |
|
256 | Returns maximum category | |
255 | */ |
|
257 | */ | |
256 | QString QBarCategoriesAxis::max() const |
|
258 | QString QBarCategoriesAxis::max() const | |
257 | { |
|
259 | { | |
258 | Q_D(const QBarCategoriesAxis); |
|
260 | Q_D(const QBarCategoriesAxis); | |
259 | return d->m_maxCategory; |
|
261 | return d->m_maxCategory; | |
260 | } |
|
262 | } | |
261 |
|
263 | |||
262 | /*! |
|
264 | /*! | |
263 | Sets range from \a minCategory to \a maxCategory |
|
265 | Sets range from \a minCategory to \a maxCategory | |
264 | */ |
|
266 | */ | |
265 | void QBarCategoriesAxis::setRange(const QString& minCategory, const QString& maxCategory) |
|
267 | void QBarCategoriesAxis::setRange(const QString& minCategory, const QString& maxCategory) | |
266 | { |
|
268 | { | |
267 | Q_D(QBarCategoriesAxis); |
|
269 | Q_D(QBarCategoriesAxis); | |
268 |
|
270 | |||
269 | int minIndex = d->m_categories.indexOf(minCategory); |
|
271 | int minIndex = d->m_categories.indexOf(minCategory); | |
270 | if (minIndex == -1) { |
|
272 | if (minIndex == -1) { | |
271 | return; |
|
273 | return; | |
272 | } |
|
274 | } | |
273 | int maxIndex = d->m_categories.indexOf(maxCategory); |
|
275 | int maxIndex = d->m_categories.indexOf(maxCategory); | |
274 | if (maxIndex == -1) { |
|
276 | if (maxIndex == -1) { | |
275 | return; |
|
277 | return; | |
276 | } |
|
278 | } | |
277 |
|
279 | |||
278 | if (maxIndex <= minIndex) { |
|
280 | if (maxIndex <= minIndex) { | |
279 | // max must be greater than min |
|
281 | // max must be greater than min | |
280 | return; |
|
282 | return; | |
281 | } |
|
283 | } | |
282 |
|
284 | |||
283 | bool changed = false; |
|
285 | bool changed = false; | |
284 | if (!qFuzzyIsNull(d->m_min - (minIndex))) { |
|
286 | if (!qFuzzyIsNull(d->m_min - (minIndex))) { | |
285 | d->m_minCategory = minCategory; |
|
287 | d->m_minCategory = minCategory; | |
286 | d->m_min = minIndex; |
|
288 | d->m_min = minIndex; | |
287 | emit minChanged(minCategory); |
|
289 | emit minChanged(minCategory); | |
288 | changed = true; |
|
290 | changed = true; | |
289 | } |
|
291 | } | |
290 |
|
292 | |||
291 | if (!qFuzzyIsNull(d->m_max - (maxIndex))) { |
|
293 | if (!qFuzzyIsNull(d->m_max - (maxIndex))) { | |
292 | d->m_max = maxIndex; |
|
294 | d->m_max = maxIndex; | |
293 | d->m_maxCategory = maxCategory; |
|
295 | d->m_maxCategory = maxCategory; | |
294 | emit maxChanged(maxCategory); |
|
296 | emit maxChanged(maxCategory); | |
295 | changed = true; |
|
297 | changed = true; | |
296 | } |
|
298 | } | |
297 |
|
299 | |||
298 |
if ( |
|
300 | if (changed) { | |
299 | d->emitRange(); |
|
301 | d->emitRange(); | |
300 | emit categoriesChanged(); |
|
302 | emit categoriesChanged(); | |
301 | } |
|
303 | } | |
302 | } |
|
304 | } | |
303 |
|
305 | |||
304 | /*! |
|
306 | /*! | |
305 | Returns the type of the axis |
|
307 | Returns the type of the axis | |
306 | */ |
|
308 | */ | |
307 | QAbstractAxis::AxisType QBarCategoriesAxis::type() const |
|
309 | QAbstractAxis::AxisType QBarCategoriesAxis::type() const | |
308 | { |
|
310 | { | |
309 | return AxisTypeCategories; |
|
311 | return AxisTypeCategories; | |
310 | } |
|
312 | } | |
311 |
|
313 | |||
312 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
314 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
313 |
|
315 | |||
314 | QBarCategoriesAxisPrivate::QBarCategoriesAxisPrivate(QBarCategoriesAxis* q): |
|
316 | QBarCategoriesAxisPrivate::QBarCategoriesAxisPrivate(QBarCategoriesAxis* q): | |
315 | QAbstractAxisPrivate(q) |
|
317 | QAbstractAxisPrivate(q) | |
316 | { |
|
318 | { | |
317 |
|
319 | |||
318 | } |
|
320 | } | |
319 |
|
321 | |||
320 | QBarCategoriesAxisPrivate::~QBarCategoriesAxisPrivate() |
|
322 | QBarCategoriesAxisPrivate::~QBarCategoriesAxisPrivate() | |
321 | { |
|
323 | { | |
322 |
|
324 | |||
323 | } |
|
325 | } | |
324 |
|
326 | |||
325 | void QBarCategoriesAxisPrivate::setMin(const QVariant &min) |
|
327 | void QBarCategoriesAxisPrivate::setMin(const QVariant &min) | |
326 | { |
|
328 | { | |
327 | setRange(min,m_maxCategory); |
|
329 | setRange(min,m_maxCategory); | |
328 | } |
|
330 | } | |
329 |
|
331 | |||
330 | void QBarCategoriesAxisPrivate::setMax(const QVariant &max) |
|
332 | void QBarCategoriesAxisPrivate::setMax(const QVariant &max) | |
331 | { |
|
333 | { | |
332 | setRange(m_minCategory,max); |
|
334 | setRange(m_minCategory,max); | |
333 | } |
|
335 | } | |
334 |
|
336 | |||
335 | void QBarCategoriesAxisPrivate::setRange(const QVariant &min, const QVariant &max) |
|
337 | void QBarCategoriesAxisPrivate::setRange(const QVariant &min, const QVariant &max) | |
336 | { |
|
338 | { | |
337 | Q_Q(QBarCategoriesAxis); |
|
339 | Q_Q(QBarCategoriesAxis); | |
338 | QString value1 = min.toString(); |
|
340 | QString value1 = min.toString(); | |
339 | QString value2 = max.toString(); |
|
341 | QString value2 = max.toString(); | |
340 | q->setRange(value1,value2); |
|
342 | q->setRange(value1,value2); | |
341 | } |
|
343 | } | |
342 |
|
344 | |||
343 | int QBarCategoriesAxisPrivate::ticksCount() const |
|
345 | int QBarCategoriesAxisPrivate::ticksCount() const | |
344 | { |
|
346 | { | |
345 | return m_categories.count()+1; |
|
347 | return m_categories.count()+1; | |
346 | } |
|
348 | } | |
347 |
|
349 | |||
348 | void QBarCategoriesAxisPrivate::handleAxisRangeChanged(qreal min, qreal max,int count) |
|
350 | void QBarCategoriesAxisPrivate::handleAxisRangeChanged(qreal min, qreal max,int count) | |
349 | { |
|
351 | { | |
350 | m_min = min; |
|
352 | m_min = min; | |
351 | m_max = max; |
|
353 | m_max = max; | |
352 | m_ticksCount = count; |
|
354 | m_ticksCount = count; | |
353 | } |
|
355 | } | |
354 |
|
356 | |||
355 | ChartAxis* QBarCategoriesAxisPrivate::createGraphics(ChartPresenter* presenter) |
|
357 | ChartAxis* QBarCategoriesAxisPrivate::createGraphics(ChartPresenter* presenter) | |
356 | { |
|
358 | { | |
357 | Q_Q( QBarCategoriesAxis); |
|
359 | Q_Q( QBarCategoriesAxis); | |
358 | if(m_orientation == Qt::Vertical){ |
|
360 | if(m_orientation == Qt::Vertical){ | |
359 | return new ChartCategoriesAxisY(q,presenter); |
|
361 | return new ChartCategoriesAxisY(q,presenter); | |
360 | }else{ |
|
362 | }else{ | |
361 | return new ChartCategoriesAxisX(q,presenter); |
|
363 | return new ChartCategoriesAxisX(q,presenter); | |
362 | } |
|
364 | } | |
363 | } |
|
365 | } | |
364 |
|
366 | |||
365 | void QBarCategoriesAxisPrivate::emitRange() |
|
367 | void QBarCategoriesAxisPrivate::emitRange() | |
366 | { |
|
368 | { | |
367 | Q_Q( QBarCategoriesAxis); |
|
369 | Q_Q( QBarCategoriesAxis); | |
368 | if(!q->signalsBlocked()) { |
|
370 | if(!q->signalsBlocked()) { | |
369 | emit changed(m_min -0.5, m_max +0.5, qCeil(m_max + 0.5) -qCeil(m_min - 0.5) +1, false); |
|
371 | emit changed(m_min -0.5, m_max +0.5, qCeil(m_max + 0.5) -qCeil(m_min - 0.5) +1, false); | |
370 | } |
|
372 | } | |
371 | } |
|
373 | } | |
372 |
|
374 | |||
373 |
|
375 | |||
374 | #include "moc_qbarcategoriesaxis.cpp" |
|
376 | #include "moc_qbarcategoriesaxis.cpp" | |
375 | #include "moc_qbarcategoriesaxis_p.cpp" |
|
377 | #include "moc_qbarcategoriesaxis_p.cpp" | |
376 |
|
378 | |||
377 | QTCOMMERCIALCHART_END_NAMESPACE |
|
379 | QTCOMMERCIALCHART_END_NAMESPACE |
General Comments 0
You need to be logged in to leave comments.
Login now