@@ -1,31 +1,31 | |||
|
1 | 1 | INCLUDEPATH += $$PWD |
|
2 | 2 | DEPENDPATH += $$PWD |
|
3 | 3 | |
|
4 | 4 | SOURCES += \ |
|
5 | 5 | $$PWD/chartaxis.cpp \ |
|
6 | $$PWD/chartaxisx.cpp \ | |
|
7 | $$PWD/chartaxisy.cpp \ | |
|
6 | # $$PWD/chartaxisx.cpp \ | |
|
7 | # $$PWD/chartaxisy.cpp \ | |
|
8 | 8 | $$PWD/chartvaluesaxisx.cpp \ |
|
9 | 9 | $$PWD/chartvaluesaxisy.cpp \ |
|
10 | 10 | $$PWD/chartcategoriesaxisx.cpp \ |
|
11 | 11 | $$PWD/chartcategoriesaxisy.cpp \ |
|
12 | 12 | $$PWD/qcategoriesaxis.cpp \ |
|
13 | 13 | $$PWD/qvaluesaxis.cpp \ |
|
14 | 14 | $$PWD/qabstractaxis.cpp |
|
15 | 15 | |
|
16 | 16 | PRIVATE_HEADERS += \ |
|
17 | 17 | $$PWD/chartaxis_p.h \ |
|
18 | $$PWD/chartaxisx_p.h \ | |
|
19 | $$PWD/chartaxisy_p.h \ | |
|
18 | # $$PWD/chartaxisx_p.h \ | |
|
19 | # $$PWD/chartaxisy_p.h \ | |
|
20 | 20 | $$PWD/chartvaluesaxisx_p.h \ |
|
21 | 21 | $$PWD/chartvaluesaxisy_p.h \ |
|
22 | 22 | $$PWD/chartcategoriesaxisx_p.h \ |
|
23 | 23 | $$PWD/chartcategoriesaxisy_p.h \ |
|
24 | 24 | $$PWD/qcategoriesaxis_p.h \ |
|
25 | 25 | $$PWD/qvaluesaxis_p.h \ |
|
26 | 26 | $$PWD/qabstractaxis_p.h |
|
27 | 27 | |
|
28 | 28 | PUBLIC_HEADERS += \ |
|
29 | 29 | $$PWD/qcategoriesaxis.h \ |
|
30 | 30 | $$PWD/qvaluesaxis.h \ |
|
31 | 31 | $$PWD/qabstractaxis.h |
@@ -1,122 +1,123 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2012 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | 21 | #include "chartcategoriesaxisy_p.h" |
|
22 | 22 | #include "qabstractaxis.h" |
|
23 | 23 | #include "chartpresenter_p.h" |
|
24 | 24 | #include "chartanimator_p.h" |
|
25 | 25 | #include <QGraphicsLayout> |
|
26 | 26 | #include <QDebug> |
|
27 | 27 | #include <QFontMetrics> |
|
28 | 28 | |
|
29 | 29 | static int label_padding = 5; |
|
30 | 30 | |
|
31 | 31 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
32 | 32 | |
|
33 | 33 | ChartCategoriesAxisY::ChartCategoriesAxisY(QAbstractAxis *axis,ChartPresenter *presenter) : ChartAxis(axis,presenter) |
|
34 | 34 | { |
|
35 | 35 | } |
|
36 | 36 | |
|
37 | 37 | ChartCategoriesAxisY::~ChartCategoriesAxisY() |
|
38 | 38 | { |
|
39 | 39 | } |
|
40 | 40 | |
|
41 | 41 | QVector<qreal> ChartCategoriesAxisY::calculateLayout() const |
|
42 | 42 | { |
|
43 | 43 | Q_ASSERT(m_ticksCount>=2); |
|
44 | 44 | |
|
45 | 45 | QVector<qreal> points; |
|
46 | 46 | points.resize(m_ticksCount); |
|
47 | 47 | |
|
48 |
const qreal delta |
|
|
48 | const qreal deltaY = m_rect.height()/(m_ticksCount-1); | |
|
49 | 49 | for (int i = 0; i < m_ticksCount; ++i) { |
|
50 |
int |
|
|
51 |
points[i] = |
|
|
50 | int y = i * -deltaY + m_rect.bottom(); | |
|
51 | points[i] = y; | |
|
52 | 52 | } |
|
53 | ||
|
53 | 54 | return points; |
|
54 | 55 | } |
|
55 | 56 | |
|
56 | 57 | void ChartCategoriesAxisY::updateGeometry() |
|
57 | 58 | { |
|
58 | 59 | const QVector<qreal>& layout = ChartAxis::layout(); |
|
59 | 60 | |
|
60 | 61 | m_minWidth = 0; |
|
61 | 62 | m_minHeight = 0; |
|
62 | 63 | |
|
63 | 64 | if(layout.isEmpty()) return; |
|
64 | 65 | |
|
65 | 66 | QStringList ticksList; |
|
66 | 67 | |
|
67 | 68 | bool categories = createLabels(ticksList,m_min,m_max,layout.size()); |
|
68 | 69 | |
|
69 | 70 | QList<QGraphicsItem *> lines = m_grid->childItems(); |
|
70 | 71 | QList<QGraphicsItem *> labels = m_labels->childItems(); |
|
71 | 72 | QList<QGraphicsItem *> shades = m_shades->childItems(); |
|
72 | 73 | QList<QGraphicsItem *> axis = m_axis->childItems(); |
|
73 | 74 | |
|
74 | 75 | Q_ASSERT(labels.size() == ticksList.size()); |
|
75 | 76 | Q_ASSERT(layout.size() == ticksList.size()); |
|
76 | 77 | |
|
77 | 78 | QGraphicsLineItem *lineItem = static_cast<QGraphicsLineItem*>(axis.at(0)); |
|
78 | 79 | lineItem->setLine(m_rect.left(), m_rect.bottom(), m_rect.right(), m_rect.bottom()); |
|
79 | 80 | |
|
80 | 81 | qreal width = 0; |
|
81 | 82 | for (int i = 0; i < layout.size(); ++i) { |
|
82 | 83 | QGraphicsLineItem *lineItem = static_cast<QGraphicsLineItem*>(lines.at(i)); |
|
83 | 84 | lineItem->setLine(layout[i], m_rect.top(), layout[i], m_rect.bottom()); |
|
84 | 85 | QGraphicsSimpleTextItem *labelItem = static_cast<QGraphicsSimpleTextItem*>(labels.at(i)); |
|
85 | 86 | if (!categories || i<1) { |
|
86 | 87 | labelItem->setText(ticksList.at(i)); |
|
87 | 88 | const QRectF& rect = labelItem->boundingRect(); |
|
88 | 89 | QPointF center = rect.center(); |
|
89 | 90 | labelItem->setTransformOriginPoint(center.x(), center.y()); |
|
90 | 91 | labelItem->setPos(layout[i] - center.x(), m_rect.bottom() + label_padding); |
|
91 | 92 | |
|
92 | 93 | if(labelItem->pos().x()<=width){ |
|
93 | 94 | labelItem->setVisible(false); |
|
94 | 95 | lineItem->setVisible(false); |
|
95 | 96 | }else{ |
|
96 | 97 | labelItem->setVisible(true); |
|
97 | 98 | lineItem->setVisible(true); |
|
98 | 99 | width=rect.width()+labelItem->pos().x(); |
|
99 | 100 | } |
|
100 | 101 | m_minWidth+=rect.width(); |
|
101 | 102 | m_minHeight=qMax(rect.height(),m_minHeight); |
|
102 | 103 | } |
|
103 | 104 | else { |
|
104 | 105 | labelItem->setText(ticksList.at(i)); |
|
105 | 106 | const QRectF& rect = labelItem->boundingRect(); |
|
106 | 107 | QPointF center = rect.center(); |
|
107 | 108 | labelItem->setTransformOriginPoint(center.x(), center.y()); |
|
108 | 109 | labelItem->setPos(layout[i] - (layout[i] - layout[i-1])/2 - center.x(), m_rect.bottom() + label_padding); |
|
109 | 110 | m_minWidth+=rect.width(); |
|
110 | 111 | m_minHeight=qMax(rect.height()+label_padding,m_minHeight); |
|
111 | 112 | } |
|
112 | 113 | |
|
113 | 114 | if ((i+1)%2 && i>1) { |
|
114 | 115 | QGraphicsRectItem *rectItem = static_cast<QGraphicsRectItem*>(shades.at(i/2-1)); |
|
115 | 116 | rectItem->setRect(layout[i-1],m_rect.top(),layout[i]-layout[i-1],m_rect.height()); |
|
116 | 117 | } |
|
117 | 118 | lineItem = static_cast<QGraphicsLineItem*>(axis.at(i+1)); |
|
118 | 119 | lineItem->setLine(layout[i],m_rect.bottom(),layout[i],m_rect.bottom()+5); |
|
119 | 120 | } |
|
120 | 121 | } |
|
121 | 122 | |
|
122 | 123 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -1,122 +1,132 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2012 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | 21 | #include "chartvaluesaxisx_p.h" |
|
22 | 22 | #include "qabstractaxis.h" |
|
23 | 23 | #include "chartpresenter_p.h" |
|
24 | 24 | #include "chartanimator_p.h" |
|
25 | 25 | #include <QGraphicsLayout> |
|
26 | 26 | #include <QDebug> |
|
27 | 27 | #include <QFontMetrics> |
|
28 | #include <cmath> | |
|
28 | 29 | |
|
29 | 30 | static int label_padding = 5; |
|
30 | 31 | |
|
31 | 32 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
32 | 33 | |
|
33 | 34 | ChartValuesAxisX::ChartValuesAxisX(QAbstractAxis *axis,ChartPresenter *presenter) : ChartAxis(axis,presenter) |
|
34 | 35 | { |
|
35 | 36 | } |
|
36 | 37 | |
|
37 | 38 | ChartValuesAxisX::~ChartValuesAxisX() |
|
38 | 39 | { |
|
39 | 40 | } |
|
40 | 41 | |
|
41 | 42 | QVector<qreal> ChartValuesAxisX::calculateLayout() const |
|
42 | 43 | { |
|
43 | 44 | Q_ASSERT(m_ticksCount>=2); |
|
44 | 45 | |
|
45 | 46 | QVector<qreal> points; |
|
46 | 47 | points.resize(m_ticksCount); |
|
47 | 48 | |
|
48 | 49 | const qreal deltaX = m_rect.width()/(m_ticksCount-1); |
|
49 | 50 | for (int i = 0; i < m_ticksCount; ++i) { |
|
50 | 51 | int x = i * deltaX + m_rect.left(); |
|
51 | 52 | points[i] = x; |
|
52 | 53 | } |
|
53 | 54 | return points; |
|
54 | 55 | } |
|
55 | 56 | |
|
56 | 57 | void ChartValuesAxisX::updateGeometry() |
|
57 | 58 | { |
|
58 | 59 | const QVector<qreal>& layout = ChartAxis::layout(); |
|
59 | 60 | |
|
60 | 61 | m_minWidth = 0; |
|
61 | 62 | m_minHeight = 0; |
|
62 | 63 | |
|
63 | 64 | if(layout.isEmpty()) return; |
|
64 | 65 | |
|
65 | 66 | QStringList ticksList; |
|
66 | 67 | |
|
67 | bool categories = createLabels(ticksList,m_min,m_max,layout.size()); | |
|
68 | int ticks = layout.size(); | |
|
69 | int n = qMax(int(-floor(log10((m_max-m_min)/(ticks-1)))),0); | |
|
70 | n++; | |
|
71 | for (int i=0; i< ticks; i++) { | |
|
72 | qreal value = m_min + (i * (m_max - m_min)/ (ticks-1)); | |
|
73 | Q_UNUSED(value); | |
|
74 | ticksList << QString::number(value,'f',n); | |
|
75 | } | |
|
76 | ||
|
77 | bool categories = false; //createLabels(ticksList,m_min,m_max,layout.size()); | |
|
68 | 78 | |
|
69 | 79 | QList<QGraphicsItem *> lines = m_grid->childItems(); |
|
70 | 80 | QList<QGraphicsItem *> labels = m_labels->childItems(); |
|
71 | 81 | QList<QGraphicsItem *> shades = m_shades->childItems(); |
|
72 | 82 | QList<QGraphicsItem *> axis = m_axis->childItems(); |
|
73 | 83 | |
|
74 | 84 | Q_ASSERT(labels.size() == ticksList.size()); |
|
75 | 85 | Q_ASSERT(layout.size() == ticksList.size()); |
|
76 | 86 | |
|
77 | 87 | QGraphicsLineItem *lineItem = static_cast<QGraphicsLineItem*>(axis.at(0)); |
|
78 | 88 | lineItem->setLine(m_rect.left(), m_rect.bottom(), m_rect.right(), m_rect.bottom()); |
|
79 | 89 | |
|
80 | 90 | qreal width = 0; |
|
81 | 91 | for (int i = 0; i < layout.size(); ++i) { |
|
82 | 92 | QGraphicsLineItem *lineItem = static_cast<QGraphicsLineItem*>(lines.at(i)); |
|
83 | 93 | lineItem->setLine(layout[i], m_rect.top(), layout[i], m_rect.bottom()); |
|
84 | 94 | QGraphicsSimpleTextItem *labelItem = static_cast<QGraphicsSimpleTextItem*>(labels.at(i)); |
|
85 | 95 | if (!categories || i<1) { |
|
86 | 96 | labelItem->setText(ticksList.at(i)); |
|
87 | 97 | const QRectF& rect = labelItem->boundingRect(); |
|
88 | 98 | QPointF center = rect.center(); |
|
89 | 99 | labelItem->setTransformOriginPoint(center.x(), center.y()); |
|
90 | 100 | labelItem->setPos(layout[i] - center.x(), m_rect.bottom() + label_padding); |
|
91 | 101 | |
|
92 | 102 | if(labelItem->pos().x()<=width){ |
|
93 | 103 | labelItem->setVisible(false); |
|
94 | 104 | lineItem->setVisible(false); |
|
95 | 105 | }else{ |
|
96 | 106 | labelItem->setVisible(true); |
|
97 | 107 | lineItem->setVisible(true); |
|
98 | 108 | width=rect.width()+labelItem->pos().x(); |
|
99 | 109 | } |
|
100 | 110 | m_minWidth+=rect.width(); |
|
101 | 111 | m_minHeight=qMax(rect.height(),m_minHeight); |
|
102 | 112 | } |
|
103 | else { | |
|
104 | labelItem->setText(ticksList.at(i)); | |
|
105 | const QRectF& rect = labelItem->boundingRect(); | |
|
106 | QPointF center = rect.center(); | |
|
107 | labelItem->setTransformOriginPoint(center.x(), center.y()); | |
|
108 | labelItem->setPos(layout[i] - (layout[i] - layout[i-1])/2 - center.x(), m_rect.bottom() + label_padding); | |
|
109 | m_minWidth+=rect.width(); | |
|
110 | m_minHeight=qMax(rect.height()+label_padding,m_minHeight); | |
|
111 | } | |
|
113 | // else { | |
|
114 | // labelItem->setText(ticksList.at(i)); | |
|
115 | // const QRectF& rect = labelItem->boundingRect(); | |
|
116 | // QPointF center = rect.center(); | |
|
117 | // labelItem->setTransformOriginPoint(center.x(), center.y()); | |
|
118 | // labelItem->setPos(layout[i] - (layout[i] - layout[i-1])/2 - center.x(), m_rect.bottom() + label_padding); | |
|
119 | // m_minWidth+=rect.width(); | |
|
120 | // m_minHeight=qMax(rect.height()+label_padding,m_minHeight); | |
|
121 | // } | |
|
112 | 122 | |
|
113 | 123 | if ((i+1)%2 && i>1) { |
|
114 | 124 | QGraphicsRectItem *rectItem = static_cast<QGraphicsRectItem*>(shades.at(i/2-1)); |
|
115 | 125 | rectItem->setRect(layout[i-1],m_rect.top(),layout[i]-layout[i-1],m_rect.height()); |
|
116 | 126 | } |
|
117 | 127 | lineItem = static_cast<QGraphicsLineItem*>(axis.at(i+1)); |
|
118 | 128 | lineItem->setLine(layout[i],m_rect.bottom(),layout[i],m_rect.bottom()+5); |
|
119 | 129 | } |
|
120 | 130 | } |
|
121 | 131 | |
|
122 | 132 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -1,122 +1,139 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2012 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | 21 | #include "chartvaluesaxisy_p.h" |
|
22 | 22 | #include "qabstractaxis.h" |
|
23 | 23 | #include "chartpresenter_p.h" |
|
24 | 24 | #include "chartanimator_p.h" |
|
25 | 25 | #include <QGraphicsLayout> |
|
26 | 26 | #include <QDebug> |
|
27 | 27 | #include <QFontMetrics> |
|
28 | #include <cmath> | |
|
28 | 29 | |
|
29 | 30 | static int label_padding = 5; |
|
30 | 31 | |
|
31 | 32 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
32 | 33 | |
|
33 | 34 | ChartValuesAxisY::ChartValuesAxisY(QAbstractAxis *axis,ChartPresenter *presenter) : ChartAxis(axis,presenter) |
|
34 | 35 | { |
|
35 | 36 | } |
|
36 | 37 | |
|
37 | 38 | ChartValuesAxisY::~ChartValuesAxisY() |
|
38 | 39 | { |
|
39 | 40 | } |
|
40 | 41 | |
|
41 | 42 | QVector<qreal> ChartValuesAxisY::calculateLayout() const |
|
42 | 43 | { |
|
43 | 44 | Q_ASSERT(m_ticksCount>=2); |
|
44 | 45 | |
|
45 | 46 | QVector<qreal> points; |
|
46 | 47 | points.resize(m_ticksCount); |
|
47 | 48 | |
|
48 |
const qreal delta |
|
|
49 | const qreal deltaY = m_rect.height()/(m_ticksCount-1); | |
|
49 | 50 | for (int i = 0; i < m_ticksCount; ++i) { |
|
50 |
int |
|
|
51 |
points[i] = |
|
|
51 | int y = i * -deltaY + m_rect.bottom(); | |
|
52 | points[i] = y; | |
|
52 | 53 | } |
|
54 | ||
|
53 | 55 | return points; |
|
54 | 56 | } |
|
55 | 57 | |
|
56 | 58 | void ChartValuesAxisY::updateGeometry() |
|
57 | 59 | { |
|
58 | 60 |
const QVector<qreal>& |
|
59 | ||
|
60 | 61 | m_minWidth = 0; |
|
61 | 62 | m_minHeight = 0; |
|
62 | 63 | |
|
63 | 64 | if(layout.isEmpty()) return; |
|
64 | 65 | |
|
65 | 66 | QStringList ticksList; |
|
66 | 67 | |
|
67 | bool categories = createLabels(ticksList,m_min,m_max,layout.size()); | |
|
68 | int ticks = layout.size(); | |
|
69 | int n = qMax(int(-floor(log10((m_max-m_min)/(ticks-1)))),0); | |
|
70 | n++; | |
|
71 | for (int i=0; i< ticks; i++) { | |
|
72 | qreal value = m_min + (i * (m_max - m_min)/ (ticks-1)); | |
|
73 | Q_UNUSED(value); | |
|
74 | ticksList << QString::number(value,'f',n); | |
|
75 | } | |
|
76 | ||
|
77 | bool categories = false; | |
|
78 | ||
|
79 | // bool categories = createLabels(ticksList,m_min,m_max,layout.size()); | |
|
68 | 80 | |
|
69 | 81 | QList<QGraphicsItem *> lines = m_grid->childItems(); |
|
70 | 82 | QList<QGraphicsItem *> labels = m_labels->childItems(); |
|
71 | 83 | QList<QGraphicsItem *> shades = m_shades->childItems(); |
|
72 | 84 | QList<QGraphicsItem *> axis = m_axis->childItems(); |
|
73 | 85 | |
|
74 | 86 | Q_ASSERT(labels.size() == ticksList.size()); |
|
75 | 87 | Q_ASSERT(layout.size() == ticksList.size()); |
|
76 | 88 | |
|
89 | qreal height = 2*m_rect.bottom(); | |
|
90 | ||
|
77 | 91 | QGraphicsLineItem *lineItem = static_cast<QGraphicsLineItem*>(axis.at(0)); |
|
78 |
lineItem->setLine(m_rect.left(), m_rect. |
|
|
92 | lineItem->setLine(m_rect.left() , m_rect.top(), m_rect.left(), m_rect.bottom()); | |
|
79 | 93 | |
|
80 | qreal width = 0; | |
|
81 | 94 | for (int i = 0; i < layout.size(); ++i) { |
|
82 | 95 | QGraphicsLineItem *lineItem = static_cast<QGraphicsLineItem*>(lines.at(i)); |
|
83 |
lineItem->setLine( |
|
|
96 | lineItem->setLine(m_rect.left() , layout[i], m_rect.right(), layout[i]); | |
|
84 | 97 | QGraphicsSimpleTextItem *labelItem = static_cast<QGraphicsSimpleTextItem*>(labels.at(i)); |
|
98 | ||
|
85 | 99 | if (!categories || i<1) { |
|
86 | 100 | labelItem->setText(ticksList.at(i)); |
|
87 | 101 | const QRectF& rect = labelItem->boundingRect(); |
|
102 | ||
|
88 | 103 | QPointF center = rect.center(); |
|
89 | 104 | labelItem->setTransformOriginPoint(center.x(), center.y()); |
|
90 |
labelItem->setPos(layout[i] |
|
|
105 | labelItem->setPos(m_rect.left() - rect.width() - label_padding , layout[i]-center.y()); | |
|
91 | 106 | |
|
92 |
if(labelItem->pos(). |
|
|
107 | if(labelItem->pos().y()+rect.height()>height) { | |
|
93 | 108 | labelItem->setVisible(false); |
|
94 | 109 | lineItem->setVisible(false); |
|
95 |
} |
|
|
110 | } | |
|
111 | else { | |
|
96 | 112 | labelItem->setVisible(true); |
|
97 | 113 | lineItem->setVisible(true); |
|
98 |
|
|
|
114 | height=labelItem->pos().y(); | |
|
99 | 115 | } |
|
100 | m_minWidth+=rect.width(); | |
|
101 |
m_min |
|
|
116 | ||
|
117 | m_minWidth=qMax(rect.width()+label_padding,m_minWidth); | |
|
118 | m_minHeight+=rect.height(); | |
|
102 | 119 | } |
|
103 | 120 | else { |
|
104 | 121 | labelItem->setText(ticksList.at(i)); |
|
105 | 122 | const QRectF& rect = labelItem->boundingRect(); |
|
123 | m_minWidth=qMax(rect.width(),m_minWidth); | |
|
124 | m_minHeight+=rect.height(); | |
|
106 | 125 | QPointF center = rect.center(); |
|
107 | 126 | labelItem->setTransformOriginPoint(center.x(), center.y()); |
|
108 |
labelItem->setPos(layout[i] - (layout[i] - layout[i-1])/2 - |
|
|
109 | m_minWidth+=rect.width(); | |
|
110 | m_minHeight=qMax(rect.height()+label_padding,m_minHeight); | |
|
127 | labelItem->setPos(m_rect.left() - rect.width() - label_padding , layout[i] - (layout[i] - layout[i-1])/2 -center.y()); | |
|
111 | 128 | } |
|
112 | 129 | |
|
113 | 130 | if ((i+1)%2 && i>1) { |
|
114 | 131 | QGraphicsRectItem *rectItem = static_cast<QGraphicsRectItem*>(shades.at(i/2-1)); |
|
115 |
rectItem->setRect( |
|
|
132 | rectItem->setRect(m_rect.left(),layout[i],m_rect.width(),layout[i-1]-layout[i]); | |
|
116 | 133 | } |
|
117 | 134 | lineItem = static_cast<QGraphicsLineItem*>(axis.at(i+1)); |
|
118 |
lineItem->setLine( |
|
|
135 | lineItem->setLine(m_rect.left()-5,layout[i],m_rect.left(),layout[i]); | |
|
119 | 136 | } |
|
120 | 137 | } |
|
121 | 138 | |
|
122 | 139 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -1,222 +1,222 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2012 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | 21 | #include "qcategoriesaxis.h" |
|
22 | 22 | #include "qcategoriesaxis_p.h" |
|
23 | #include "chartaxisx_p.h" | |
|
24 | #include "chartaxisy_p.h" | |
|
23 | #include "chartcategoriesaxisx_p.h" | |
|
24 | #include "chartcategoriesaxisy_p.h" | |
|
25 | 25 | |
|
26 | 26 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
27 | 27 | |
|
28 | 28 | QCategoriesAxis::QCategoriesAxis(QObject *parent): |
|
29 | 29 | QAbstractAxis(*new QCategoriesAxisPrivate(this),parent) |
|
30 | 30 | { |
|
31 | 31 | |
|
32 | 32 | } |
|
33 | 33 | |
|
34 | 34 | QCategoriesAxis::~QCategoriesAxis() |
|
35 | 35 | { |
|
36 | 36 | |
|
37 | 37 | } |
|
38 | 38 | |
|
39 | 39 | QCategoriesAxis::QCategoriesAxis(QCategoriesAxisPrivate &d,QObject *parent):QAbstractAxis(d,parent) |
|
40 | 40 | { |
|
41 | 41 | |
|
42 | 42 | } |
|
43 | 43 | |
|
44 | 44 | /*! |
|
45 | 45 | Appends \a categories to axis |
|
46 | 46 | */ |
|
47 | 47 | void QCategoriesAxis::append(const QStringList &categories) |
|
48 | 48 | { |
|
49 | 49 | Q_D(QCategoriesAxis); |
|
50 | 50 | d->m_categories.append(categories); |
|
51 | 51 | emit categoriesChanged(); |
|
52 | 52 | } |
|
53 | 53 | |
|
54 | 54 | /*! |
|
55 | 55 | Appends \a category to axis |
|
56 | 56 | */ |
|
57 | 57 | void QCategoriesAxis::append(const QString &category) |
|
58 | 58 | { |
|
59 | 59 | Q_D(QCategoriesAxis); |
|
60 | 60 | d->m_categories.append(category); |
|
61 | 61 | emit categoriesChanged(); |
|
62 | 62 | } |
|
63 | 63 | |
|
64 | 64 | /*! |
|
65 | 65 | Removes \a category from axis |
|
66 | 66 | */ |
|
67 | 67 | void QCategoriesAxis::remove(const QString &category) |
|
68 | 68 | { |
|
69 | 69 | Q_D(QCategoriesAxis); |
|
70 | 70 | if (d->m_categories.contains(category)) { |
|
71 | 71 | d->m_categories.removeAt(d->m_categories.indexOf(category)); |
|
72 | 72 | emit categoriesChanged(); |
|
73 | 73 | } |
|
74 | 74 | } |
|
75 | 75 | |
|
76 | 76 | /*! |
|
77 | 77 | Inserts \a category to axis at \a index |
|
78 | 78 | */ |
|
79 | 79 | void QCategoriesAxis::insert(int index, const QString &category) |
|
80 | 80 | { |
|
81 | 81 | Q_D(QCategoriesAxis); |
|
82 | 82 | d->m_categories.insert(index,category); |
|
83 | 83 | emit categoriesChanged(); |
|
84 | 84 | } |
|
85 | 85 | |
|
86 | 86 | /*! |
|
87 | 87 | Removes all categories. |
|
88 | 88 | */ |
|
89 | 89 | void QCategoriesAxis::clear() |
|
90 | 90 | { |
|
91 | 91 | Q_D(QCategoriesAxis); |
|
92 | 92 | d->m_categories.clear(); |
|
93 | 93 | emit categoriesChanged(); |
|
94 | 94 | } |
|
95 | 95 | |
|
96 | 96 | void QCategoriesAxis::setCategories(const QStringList &categories) |
|
97 | 97 | { |
|
98 | 98 | Q_D(QCategoriesAxis); |
|
99 | 99 | d->m_categories = categories; |
|
100 | 100 | emit categoriesChanged(); |
|
101 | 101 | } |
|
102 | 102 | |
|
103 | 103 | QStringList QCategoriesAxis::categories() |
|
104 | 104 | { |
|
105 | 105 | Q_D(QCategoriesAxis); |
|
106 | 106 | return d->m_categories; |
|
107 | 107 | } |
|
108 | 108 | |
|
109 | 109 | /*! |
|
110 | 110 | Returns number of categories. |
|
111 | 111 | */ |
|
112 | 112 | int QCategoriesAxis::count() const |
|
113 | 113 | { |
|
114 | 114 | Q_D(const QCategoriesAxis); |
|
115 | 115 | return d->m_categories.count(); |
|
116 | 116 | } |
|
117 | 117 | |
|
118 | 118 | /*! |
|
119 | 119 | Returns category at \a index. Index must be valid. |
|
120 | 120 | */ |
|
121 | 121 | QString QCategoriesAxis::at(int index) const |
|
122 | 122 | { |
|
123 | 123 | Q_D(const QCategoriesAxis); |
|
124 | 124 | return d->m_categories.at(index); |
|
125 | 125 | } |
|
126 | 126 | |
|
127 | 127 | /*! |
|
128 | 128 | Sets minimum category to \a minCategory. |
|
129 | 129 | */ |
|
130 | 130 | void QCategoriesAxis::setMin(const QString& minCategory) |
|
131 | 131 | { |
|
132 | 132 | Q_D(QCategoriesAxis); |
|
133 | 133 | int minIndex = d->m_categories.indexOf(minCategory); |
|
134 | 134 | if (minIndex == -1) |
|
135 | 135 | return; |
|
136 | 136 | // else |
|
137 | 137 | // QAbstractAxis::setMin(minIndex); |
|
138 | 138 | } |
|
139 | 139 | |
|
140 | 140 | /*! |
|
141 | 141 | Sets maximum category to \a maxCategory. |
|
142 | 142 | */ |
|
143 | 143 | void QCategoriesAxis::setMax(const QString& maxCategory) |
|
144 | 144 | { |
|
145 | 145 | Q_D(QCategoriesAxis); |
|
146 | 146 | int maxIndex = d->m_categories.indexOf(maxCategory); |
|
147 | 147 | if (maxIndex == -1) |
|
148 | 148 | return; |
|
149 | 149 | // else |
|
150 | 150 | // QAbstractAxis::setMax(maxIndex); |
|
151 | 151 | } |
|
152 | 152 | |
|
153 | 153 | /*! |
|
154 | 154 | Sets range from \a minCategory to \a maxCategory |
|
155 | 155 | */ |
|
156 | 156 | void QCategoriesAxis::setRange(const QString& minCategory, const QString& maxCategory) |
|
157 | 157 | { |
|
158 | 158 | // TODO: what if maxCategory < minCategory? |
|
159 | 159 | setMin(minCategory); |
|
160 | 160 | setMax(maxCategory); |
|
161 | 161 | } |
|
162 | 162 | |
|
163 | 163 | /*! |
|
164 | 164 | Returns the type of axis. |
|
165 | 165 | */ |
|
166 | 166 | QAbstractAxis::AxisType QCategoriesAxis::type() const |
|
167 | 167 | { |
|
168 | 168 | return AxisTypeCategories; |
|
169 | 169 | } |
|
170 | 170 | |
|
171 | 171 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
172 | 172 | |
|
173 | 173 | QCategoriesAxisPrivate::QCategoriesAxisPrivate(QCategoriesAxis* q): |
|
174 | 174 | QAbstractAxisPrivate(q) |
|
175 | 175 | { |
|
176 | 176 | |
|
177 | 177 | } |
|
178 | 178 | |
|
179 | 179 | QCategoriesAxisPrivate::~QCategoriesAxisPrivate() |
|
180 | 180 | { |
|
181 | 181 | |
|
182 | 182 | } |
|
183 | 183 | |
|
184 | 184 | |
|
185 | 185 | void QCategoriesAxisPrivate::setMin(const QVariant& min) |
|
186 | 186 | { |
|
187 | 187 | Q_Q(QCategoriesAxis); |
|
188 | 188 | q->setMin(min.toString()); |
|
189 | 189 | } |
|
190 | 190 | |
|
191 | 191 | void QCategoriesAxisPrivate::setMax(const QVariant& max) |
|
192 | 192 | { |
|
193 | 193 | Q_Q(QCategoriesAxis); |
|
194 | 194 | q->setMax(max.toString()); |
|
195 | 195 | } |
|
196 | 196 | |
|
197 | 197 | void QCategoriesAxisPrivate::setRange(const QVariant& min, const QVariant& max) |
|
198 | 198 | { |
|
199 | 199 | Q_Q(QCategoriesAxis); |
|
200 | 200 | q->setRange(min.toString(),max.toString()); |
|
201 | 201 | } |
|
202 | 202 | |
|
203 | 203 | int QCategoriesAxisPrivate::ticksCount() const |
|
204 | 204 | { |
|
205 | 205 | return m_categories.count()+1; |
|
206 | 206 | } |
|
207 | 207 | |
|
208 | 208 | ChartAxis* QCategoriesAxisPrivate::createGraphics(ChartPresenter* presenter) |
|
209 | 209 | { |
|
210 | 210 | Q_Q( QCategoriesAxis); |
|
211 | 211 | if(m_orientation == Qt::Vertical){ |
|
212 | return new ChartAxisY(q,presenter); | |
|
212 | return new ChartCategoriesAxisY(q,presenter); | |
|
213 | 213 | }else{ |
|
214 | return new ChartAxisX(q,presenter); | |
|
214 | return new ChartCategoriesAxisX(q,presenter); | |
|
215 | 215 | } |
|
216 | 216 | |
|
217 | 217 | } |
|
218 | 218 | |
|
219 | 219 | #include "moc_qcategoriesaxis.cpp" |
|
220 | 220 | #include "moc_qcategoriesaxis_p.cpp" |
|
221 | 221 | |
|
222 | 222 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -1,265 +1,265 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2012 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | 21 | #include "qvaluesaxis.h" |
|
22 | 22 | #include "qvaluesaxis_p.h" |
|
23 | #include "chartaxisx_p.h" | |
|
24 | #include "chartaxisy_p.h" | |
|
23 | #include "chartvaluesaxisx_p.h" | |
|
24 | #include "chartvaluesaxisy_p.h" | |
|
25 | 25 | #include <QDebug> |
|
26 | 26 | |
|
27 | 27 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
28 | 28 | /*! |
|
29 | 29 | \class QValuesAxis |
|
30 | 30 | \brief The QValuesAxis class is used for manipulating chart's axis. |
|
31 | 31 | \mainclass |
|
32 | 32 | |
|
33 | 33 | Axis can be setup to show axis line with tick marks, grid lines and shades. |
|
34 | 34 | */ |
|
35 | 35 | |
|
36 | 36 | /*! |
|
37 | 37 | \qmlclass Axis QValuesAxis |
|
38 | 38 | \brief The Axis element is used for manipulating chart's axes |
|
39 | 39 | |
|
40 | 40 | Axis can be setup to show axis line with tick marks, grid lines and shades. |
|
41 | 41 | |
|
42 | 42 | To access Axes you can use ChartView API. For example: |
|
43 | 43 | \code |
|
44 | 44 | ChartView { |
|
45 | 45 | axisX.min: 0 |
|
46 | 46 | axisX.max: 3 |
|
47 | 47 | axisX.ticksCount: 4 |
|
48 | 48 | axisY.min: 0 |
|
49 | 49 | axisY.max: 4 |
|
50 | 50 | // Add a few series... |
|
51 | 51 | } |
|
52 | 52 | \endcode |
|
53 | 53 | */ |
|
54 | 54 | |
|
55 | 55 | /*! |
|
56 | 56 | \property QValuesAxis::min |
|
57 | 57 | Defines the minimum value on the axis. |
|
58 | 58 | */ |
|
59 | 59 | /*! |
|
60 | 60 | \qmlproperty real Axis::min |
|
61 | 61 | Defines the minimum value on the axis. |
|
62 | 62 | */ |
|
63 | 63 | |
|
64 | 64 | /*! |
|
65 | 65 | \property QValuesAxis::max |
|
66 | 66 | Defines the maximum value on the axis. |
|
67 | 67 | */ |
|
68 | 68 | /*! |
|
69 | 69 | \qmlproperty real Axis::max |
|
70 | 70 | Defines the maximum value on the axis. |
|
71 | 71 | */ |
|
72 | 72 | |
|
73 | 73 | /*! |
|
74 | 74 | \fn void QValuesAxis::minChanged(qreal min) |
|
75 | 75 | Axis emits signal when \a min of axis has changed. |
|
76 | 76 | */ |
|
77 | 77 | |
|
78 | 78 | /*! |
|
79 | 79 | \fn void QValuesAxis::maxChanged(qreal max) |
|
80 | 80 | Axis emits signal when \a max of axis has changed. |
|
81 | 81 | */ |
|
82 | 82 | |
|
83 | 83 | /*! |
|
84 | 84 | \fn void QValuesAxis::rangeChanged(qreal min, qreal max) |
|
85 | 85 | Axis emits signal when \a min or \a max of axis has changed. |
|
86 | 86 | */ |
|
87 | 87 | |
|
88 | 88 | QValuesAxis::QValuesAxis(QObject *parent) : |
|
89 | 89 | QAbstractAxis(*new QValuesAxisPrivate(this),parent) |
|
90 | 90 | { |
|
91 | 91 | |
|
92 | 92 | } |
|
93 | 93 | |
|
94 | 94 | QValuesAxis::QValuesAxis(QValuesAxisPrivate &d,QObject *parent) : QAbstractAxis(d,parent) |
|
95 | 95 | { |
|
96 | 96 | |
|
97 | 97 | } |
|
98 | 98 | |
|
99 | 99 | QValuesAxis::~QValuesAxis() |
|
100 | 100 | { |
|
101 | 101 | |
|
102 | 102 | } |
|
103 | 103 | |
|
104 | 104 | void QValuesAxis::setMin(qreal min) |
|
105 | 105 | { |
|
106 | 106 | Q_D(QValuesAxis); |
|
107 | 107 | setRange(min,d->m_max); |
|
108 | 108 | } |
|
109 | 109 | |
|
110 | 110 | qreal QValuesAxis::min() const |
|
111 | 111 | { |
|
112 | 112 | Q_D(const QValuesAxis); |
|
113 | 113 | return d->m_min; |
|
114 | 114 | } |
|
115 | 115 | |
|
116 | 116 | void QValuesAxis::setMax(qreal max) |
|
117 | 117 | { |
|
118 | 118 | Q_D(QValuesAxis); |
|
119 | 119 | setRange(d->m_min,max); |
|
120 | 120 | } |
|
121 | 121 | |
|
122 | 122 | qreal QValuesAxis::max() const |
|
123 | 123 | { |
|
124 | 124 | Q_D(const QValuesAxis); |
|
125 | 125 | return d->m_max; |
|
126 | 126 | } |
|
127 | 127 | |
|
128 | 128 | /*! |
|
129 | 129 | Sets range from \a min to \a max on the axis. |
|
130 | 130 | */ |
|
131 | 131 | void QValuesAxis::setRange(qreal min, qreal max) |
|
132 | 132 | { |
|
133 | 133 | Q_D(QValuesAxis); |
|
134 | 134 | bool changed = false; |
|
135 | 135 | if (!qFuzzyIsNull(d->m_min - min)) { |
|
136 | 136 | d->m_min = min; |
|
137 | 137 | changed = true; |
|
138 | 138 | emit minChanged(min); |
|
139 | 139 | } |
|
140 | 140 | |
|
141 | 141 | if (!qFuzzyIsNull(d->m_max - max)) { |
|
142 | 142 | d->m_max = max; |
|
143 | 143 | changed = true; |
|
144 | 144 | emit maxChanged(max); |
|
145 | 145 | } |
|
146 | 146 | |
|
147 | 147 | if (changed) { |
|
148 | 148 | emit rangeChanged(d->m_min,d->m_max); |
|
149 | 149 | emit d->changed(d->m_min, d->m_max, d->m_ticksCount, d->m_niceNumbers); |
|
150 | 150 | } |
|
151 | 151 | } |
|
152 | 152 | |
|
153 | 153 | /*! |
|
154 | 154 | Sets \a count for ticks on the axis. |
|
155 | 155 | */ |
|
156 | 156 | void QValuesAxis::setTicksCount(int count) |
|
157 | 157 | { |
|
158 | 158 | Q_D(QValuesAxis); |
|
159 | 159 | if (d->m_ticksCount != count) { |
|
160 | 160 | d->m_ticksCount = count; |
|
161 | 161 | emit d->changed(d->m_min, d->m_max, d->m_ticksCount, d->m_niceNumbers); |
|
162 | 162 | } |
|
163 | 163 | } |
|
164 | 164 | |
|
165 | 165 | /*! |
|
166 | 166 | \fn int QAbstractAxis::ticksCount() const |
|
167 | 167 | Return number of ticks on the axis |
|
168 | 168 | */ |
|
169 | 169 | int QValuesAxis::ticksCount() const |
|
170 | 170 | { |
|
171 | 171 | Q_D(const QValuesAxis); |
|
172 | 172 | return d->m_ticksCount; |
|
173 | 173 | } |
|
174 | 174 | |
|
175 | 175 | void QValuesAxis::setNiceNumbersEnabled(bool enable) |
|
176 | 176 | { |
|
177 | 177 | Q_D(QValuesAxis); |
|
178 | 178 | if (d->m_niceNumbers != enable){ |
|
179 | 179 | d->m_niceNumbers = enable; |
|
180 | 180 | emit d->changed(d->m_min, d->m_max, d->m_ticksCount, d->m_niceNumbers); |
|
181 | 181 | } |
|
182 | 182 | } |
|
183 | 183 | |
|
184 | 184 | bool QValuesAxis::niceNumbersEnabled() const |
|
185 | 185 | { |
|
186 | 186 | Q_D(const QValuesAxis); |
|
187 | 187 | return d->m_niceNumbers; |
|
188 | 188 | } |
|
189 | 189 | |
|
190 | 190 | QAbstractAxis::AxisType QValuesAxis::type() const |
|
191 | 191 | { |
|
192 | 192 | return AxisTypeValues; |
|
193 | 193 | } |
|
194 | 194 | |
|
195 | 195 | ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
196 | 196 | |
|
197 | 197 | QValuesAxisPrivate::QValuesAxisPrivate(QValuesAxis* q): |
|
198 | 198 | QAbstractAxisPrivate(q), |
|
199 | 199 | m_min(0), |
|
200 | 200 | m_max(0), |
|
201 | 201 | m_niceNumbers(false), |
|
202 | 202 | m_ticksCount(5) |
|
203 | 203 | { |
|
204 | 204 | |
|
205 | 205 | } |
|
206 | 206 | |
|
207 | 207 | QValuesAxisPrivate::~QValuesAxisPrivate() |
|
208 | 208 | { |
|
209 | 209 | |
|
210 | 210 | } |
|
211 | 211 | |
|
212 | 212 | void QValuesAxisPrivate::handleAxisRangeChanged(qreal min, qreal max,int count) |
|
213 | 213 | { |
|
214 | 214 | Q_Q(QValuesAxis); |
|
215 | 215 | q->setRange(min,max); |
|
216 | 216 | q->setTicksCount(count); |
|
217 | 217 | } |
|
218 | 218 | |
|
219 | 219 | |
|
220 | 220 | void QValuesAxisPrivate::setMin(const QVariant& min) |
|
221 | 221 | { |
|
222 | 222 | Q_Q(QValuesAxis); |
|
223 | 223 | bool ok; |
|
224 | 224 | qreal value = min.toReal(&ok); |
|
225 | 225 | if(ok) q->setMin(value); |
|
226 | 226 | } |
|
227 | 227 | |
|
228 | 228 | void QValuesAxisPrivate::setMax(const QVariant& max) |
|
229 | 229 | { |
|
230 | 230 | Q_Q(QValuesAxis); |
|
231 | 231 | bool ok; |
|
232 | 232 | qreal value = max.toReal(&ok); |
|
233 | 233 | if(ok) q->setMax(value); |
|
234 | 234 | } |
|
235 | 235 | |
|
236 | 236 | void QValuesAxisPrivate::setRange(const QVariant& min, const QVariant& max) |
|
237 | 237 | { |
|
238 | 238 | Q_Q(QValuesAxis); |
|
239 | 239 | bool ok1; |
|
240 | 240 | bool ok2; |
|
241 | 241 | qreal value1 = min.toReal(&ok1); |
|
242 | 242 | qreal value2 = max.toReal(&ok2); |
|
243 | 243 | if(ok1&&ok2) q->setRange(value1,value2); |
|
244 | 244 | } |
|
245 | 245 | |
|
246 | 246 | int QValuesAxisPrivate::ticksCount() const |
|
247 | 247 | { |
|
248 | 248 | return m_ticksCount; |
|
249 | 249 | } |
|
250 | 250 | |
|
251 | 251 | ChartAxis* QValuesAxisPrivate::createGraphics(ChartPresenter* presenter) |
|
252 | 252 | { |
|
253 | 253 | Q_Q(QValuesAxis); |
|
254 | 254 | if(m_orientation == Qt::Vertical){ |
|
255 | return new ChartAxisY(q,presenter); | |
|
255 | return new ChartValuesAxisY(q,presenter); | |
|
256 | 256 | }else{ |
|
257 | return new ChartAxisX(q,presenter); | |
|
257 | return new ChartValuesAxisX(q,presenter); | |
|
258 | 258 | } |
|
259 | 259 | |
|
260 | 260 | } |
|
261 | 261 | |
|
262 | 262 | #include "moc_qvaluesaxis.cpp" |
|
263 | 263 | #include "moc_qvaluesaxis_p.cpp" |
|
264 | 264 | |
|
265 | 265 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -1,420 +1,420 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2012 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | #include "chartpresenter_p.h" |
|
21 | 21 | #include "qchart.h" |
|
22 | 22 | #include "qchart_p.h" |
|
23 | 23 | #include "qabstractaxis.h" |
|
24 | 24 | #include "qabstractaxis_p.h" |
|
25 | 25 | #include "chartdataset_p.h" |
|
26 | 26 | #include "charttheme_p.h" |
|
27 | 27 | #include "chartanimator_p.h" |
|
28 | 28 | #include "chartanimation_p.h" |
|
29 | 29 | #include "qabstractseries_p.h" |
|
30 | 30 | #include "qareaseries.h" |
|
31 | 31 | #include "chartaxis_p.h" |
|
32 | #include "chartaxisx_p.h" | |
|
33 | #include "chartaxisy_p.h" | |
|
32 | //#include "chartaxisx_p.h" | |
|
33 | //#include "chartaxisy_p.h" | |
|
34 | 34 | #include "areachartitem_p.h" |
|
35 | 35 | #include "chartbackground_p.h" |
|
36 | 36 | #include "chartlayout_p.h" |
|
37 | 37 | #include <QTimer> |
|
38 | 38 | |
|
39 | 39 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
40 | 40 | |
|
41 | 41 | ChartPresenter::ChartPresenter(QChart* chart,ChartDataSet* dataset):QObject(chart), |
|
42 | 42 | m_chart(chart), |
|
43 | 43 | m_animator(0), |
|
44 | 44 | m_dataset(dataset), |
|
45 | 45 | m_chartTheme(0), |
|
46 | 46 | m_options(QChart::NoAnimation), |
|
47 | 47 | m_state(ShowState), |
|
48 | 48 | m_layout(new ChartLayout(this)), |
|
49 | 49 | m_backgroundItem(0), |
|
50 | 50 | m_titleItem(0) |
|
51 | 51 | { |
|
52 | 52 | |
|
53 | 53 | } |
|
54 | 54 | |
|
55 | 55 | ChartPresenter::~ChartPresenter() |
|
56 | 56 | { |
|
57 | 57 | delete m_chartTheme; |
|
58 | 58 | } |
|
59 | 59 | |
|
60 | 60 | void ChartPresenter::setGeometry(const QRectF& rect) |
|
61 | 61 | { |
|
62 | 62 | |
|
63 | 63 | Q_ASSERT(rect.isValid()); |
|
64 | 64 | |
|
65 | 65 | if(m_rect!=rect) { |
|
66 | 66 | m_rect=rect; |
|
67 | 67 | emit geometryChanged(m_rect); |
|
68 | 68 | } |
|
69 | 69 | } |
|
70 | 70 | |
|
71 | 71 | void ChartPresenter::handleAxisAdded(QAbstractAxis* axis,Domain* domain) |
|
72 | 72 | { |
|
73 | 73 | ChartAxis* item = axis->d_ptr->createGraphics(this); |
|
74 | 74 | item->setDomain(domain); |
|
75 | 75 | |
|
76 | 76 | if(m_options.testFlag(QChart::GridAxisAnimations)){ |
|
77 | 77 | item->setAnimator(m_animator); |
|
78 | 78 | item->setAnimation(new AxisAnimation(item)); |
|
79 | 79 | } |
|
80 | 80 | |
|
81 | 81 | if(item->axisType()==ChartAxis::X_AXIS){ |
|
82 | 82 | m_chartTheme->decorate(axis,true); |
|
83 | 83 | QObject::connect(domain,SIGNAL(rangeXChanged(qreal,qreal,int)),item,SLOT(handleRangeChanged(qreal,qreal,int))); |
|
84 | 84 | //initialize |
|
85 | 85 | item->handleRangeChanged(domain->minX(),domain->maxX(),domain->tickXCount()); |
|
86 | 86 | |
|
87 | 87 | } |
|
88 | 88 | else{ |
|
89 | 89 | m_chartTheme->decorate(axis,false); |
|
90 | 90 | QObject::connect(domain,SIGNAL(rangeYChanged(qreal,qreal,int)),item,SLOT(handleRangeChanged(qreal,qreal,int))); |
|
91 | 91 | //initialize |
|
92 | 92 | item->handleRangeChanged(domain->minY(),domain->maxY(),domain->tickYCount()); |
|
93 | 93 | } |
|
94 | 94 | |
|
95 | 95 | QObject::connect(this,SIGNAL(geometryChanged(QRectF)),item,SLOT(handleGeometryChanged(QRectF))); |
|
96 | 96 | //initialize |
|
97 | 97 | if(m_rect.isValid()) item->handleGeometryChanged(m_rect); |
|
98 | 98 | m_axisItems.insert(axis, item); |
|
99 | 99 | } |
|
100 | 100 | |
|
101 | 101 | void ChartPresenter::handleAxisRemoved(QAbstractAxis* axis) |
|
102 | 102 | { |
|
103 | 103 | ChartAxis* item = m_axisItems.take(axis); |
|
104 | 104 | Q_ASSERT(item); |
|
105 | 105 | if(m_animator) m_animator->removeAnimation(item); |
|
106 | 106 | delete item; |
|
107 | 107 | } |
|
108 | 108 | |
|
109 | 109 | |
|
110 | 110 | void ChartPresenter::handleSeriesAdded(QAbstractSeries* series,Domain* domain) |
|
111 | 111 | { |
|
112 | 112 | Chart *item = series->d_ptr->createGraphics(this); |
|
113 | 113 | Q_ASSERT(item); |
|
114 | 114 | item->setDomain(domain); |
|
115 | 115 | |
|
116 | 116 | QObject::connect(this,SIGNAL(geometryChanged(QRectF)),item,SLOT(handleGeometryChanged(QRectF))); |
|
117 | 117 | QObject::connect(domain,SIGNAL(domainChanged(qreal,qreal,qreal,qreal)),item,SLOT(handleDomainChanged(qreal,qreal,qreal,qreal))); |
|
118 | 118 | //initialize |
|
119 | 119 | item->handleDomainChanged(domain->minX(),domain->maxX(),domain->minY(),domain->maxY()); |
|
120 | 120 | if(m_rect.isValid()) item->handleGeometryChanged(m_rect); |
|
121 | 121 | m_chartItems.insert(series,item); |
|
122 | 122 | } |
|
123 | 123 | |
|
124 | 124 | void ChartPresenter::handleSeriesRemoved(QAbstractSeries* series) |
|
125 | 125 | { |
|
126 | 126 | Chart* item = m_chartItems.take(series); |
|
127 | 127 | Q_ASSERT(item); |
|
128 | 128 | if(m_animator) { |
|
129 | 129 | //small hack to handle area animations |
|
130 | 130 | if(series->type() == QAbstractSeries::SeriesTypeArea){ |
|
131 | 131 | QAreaSeries* areaSeries = static_cast<QAreaSeries*>(series); |
|
132 | 132 | AreaChartItem* area = static_cast<AreaChartItem*>(item); |
|
133 | 133 | m_animator->removeAnimation(area->upperLineItem()); |
|
134 | 134 | if(areaSeries->lowerSeries()) m_animator->removeAnimation(area->lowerLineItem()); |
|
135 | 135 | }else |
|
136 | 136 | m_animator->removeAnimation(item); |
|
137 | 137 | } |
|
138 | 138 | delete item; |
|
139 | 139 | } |
|
140 | 140 | |
|
141 | 141 | void ChartPresenter::setTheme(QChart::ChartTheme theme,bool force) |
|
142 | 142 | { |
|
143 | 143 | if(m_chartTheme && m_chartTheme->id() == theme) return; |
|
144 | 144 | delete m_chartTheme; |
|
145 | 145 | m_chartTheme = ChartTheme::createTheme(theme); |
|
146 | 146 | m_chartTheme->setForced(force); |
|
147 | 147 | m_chartTheme->decorate(m_chart); |
|
148 | 148 | m_chartTheme->decorate(m_chart->legend()); |
|
149 | 149 | resetAllElements(); |
|
150 | 150 | |
|
151 | 151 | // We do not want "force" to stay on. |
|
152 | 152 | // Bar/pie are calling decorate when adding/removing slices/bars which means |
|
153 | 153 | // that to preserve users colors "force" must not be on. |
|
154 | 154 | m_chartTheme->setForced(false); |
|
155 | 155 | } |
|
156 | 156 | |
|
157 | 157 | QChart::ChartTheme ChartPresenter::theme() |
|
158 | 158 | { |
|
159 | 159 | return m_chartTheme->id(); |
|
160 | 160 | } |
|
161 | 161 | |
|
162 | 162 | void ChartPresenter::setAnimationOptions(QChart::AnimationOptions options) |
|
163 | 163 | { |
|
164 | 164 | if(m_options!=options) { |
|
165 | 165 | |
|
166 | 166 | m_options=options; |
|
167 | 167 | |
|
168 | 168 | if(m_options!=QChart::NoAnimation && !m_animator) { |
|
169 | 169 | m_animator= new ChartAnimator(this); |
|
170 | 170 | } |
|
171 | 171 | resetAllElements(); |
|
172 | 172 | } |
|
173 | 173 | |
|
174 | 174 | } |
|
175 | 175 | |
|
176 | 176 | void ChartPresenter::resetAllElements() |
|
177 | 177 | { |
|
178 | 178 | QMapIterator<QAbstractAxis*, ChartAxis*> i(m_axisItems); |
|
179 | 179 | while (i.hasNext()) { |
|
180 | 180 | i.next(); |
|
181 | 181 | Domain* domain = i.value()->domain(); |
|
182 | 182 | QAbstractAxis* axis = i.key(); |
|
183 | 183 | handleAxisRemoved(axis); |
|
184 | 184 | handleAxisAdded(axis,domain); |
|
185 | 185 | } |
|
186 | 186 | |
|
187 | 187 | QMapIterator<QAbstractSeries*, Chart*> j(m_chartItems); |
|
188 | 188 | while (j.hasNext()) { |
|
189 | 189 | j.next(); |
|
190 | 190 | Domain* domain = j.value()->domain(); |
|
191 | 191 | QAbstractSeries* series = j.key(); |
|
192 | 192 | handleSeriesRemoved(series); |
|
193 | 193 | handleSeriesAdded(series,domain); |
|
194 | 194 | } |
|
195 | 195 | } |
|
196 | 196 | |
|
197 | 197 | void ChartPresenter::zoomIn(qreal factor) |
|
198 | 198 | { |
|
199 | 199 | QRectF rect = geometry(); |
|
200 | 200 | rect.setWidth(rect.width()/factor); |
|
201 | 201 | rect.setHeight(rect.height()/factor); |
|
202 | 202 | rect.moveCenter(geometry().center()); |
|
203 | 203 | zoomIn(rect); |
|
204 | 204 | } |
|
205 | 205 | |
|
206 | 206 | void ChartPresenter::zoomIn(const QRectF& rect) |
|
207 | 207 | { |
|
208 | 208 | QRectF r = rect.normalized(); |
|
209 | 209 | r.translate(-geometry().topLeft()); |
|
210 | 210 | if (!r.isValid()) |
|
211 | 211 | return; |
|
212 | 212 | |
|
213 | 213 | m_state = ZoomInState; |
|
214 | 214 | m_statePoint = QPointF(r.center().x()/geometry().width(),r.center().y()/geometry().height()); |
|
215 | 215 | m_dataset->zoomInDomain(r,geometry().size()); |
|
216 | 216 | m_state = ShowState; |
|
217 | 217 | } |
|
218 | 218 | |
|
219 | 219 | void ChartPresenter::zoomOut(qreal factor) |
|
220 | 220 | { |
|
221 | 221 | m_state = ZoomOutState; |
|
222 | 222 | |
|
223 | 223 | QRectF chartRect; |
|
224 | 224 | chartRect.setSize(geometry().size()); |
|
225 | 225 | |
|
226 | 226 | QRectF rect; |
|
227 | 227 | rect.setSize(chartRect.size()/factor); |
|
228 | 228 | rect.moveCenter(chartRect.center()); |
|
229 | 229 | if (!rect.isValid()) |
|
230 | 230 | return; |
|
231 | 231 | m_statePoint = QPointF(rect.center().x()/geometry().width(),rect.center().y()/geometry().height()); |
|
232 | 232 | m_dataset->zoomOutDomain(rect, chartRect.size()); |
|
233 | 233 | m_state = ShowState; |
|
234 | 234 | } |
|
235 | 235 | |
|
236 | 236 | void ChartPresenter::scroll(qreal dx,qreal dy) |
|
237 | 237 | { |
|
238 | 238 | if(dx<0) m_state=ScrollLeftState; |
|
239 | 239 | if(dx>0) m_state=ScrollRightState; |
|
240 | 240 | if(dy<0) m_state=ScrollUpState; |
|
241 | 241 | if(dy>0) m_state=ScrollDownState; |
|
242 | 242 | |
|
243 | 243 | m_dataset->scrollDomain(dx,dy,geometry().size()); |
|
244 | 244 | m_state = ShowState; |
|
245 | 245 | } |
|
246 | 246 | |
|
247 | 247 | QChart::AnimationOptions ChartPresenter::animationOptions() const |
|
248 | 248 | { |
|
249 | 249 | return m_options; |
|
250 | 250 | } |
|
251 | 251 | |
|
252 | 252 | void ChartPresenter::createBackgroundItem() |
|
253 | 253 | { |
|
254 | 254 | if (!m_backgroundItem) { |
|
255 | 255 | m_backgroundItem = new ChartBackground(rootItem()); |
|
256 | 256 | m_backgroundItem->setPen(Qt::NoPen); |
|
257 | 257 | m_backgroundItem->setZValue(ChartPresenter::BackgroundZValue); |
|
258 | 258 | } |
|
259 | 259 | } |
|
260 | 260 | |
|
261 | 261 | void ChartPresenter::createTitleItem() |
|
262 | 262 | { |
|
263 | 263 | if (!m_titleItem) { |
|
264 | 264 | m_titleItem = new QGraphicsSimpleTextItem(rootItem()); |
|
265 | 265 | m_titleItem->setZValue(ChartPresenter::BackgroundZValue); |
|
266 | 266 | } |
|
267 | 267 | } |
|
268 | 268 | |
|
269 | 269 | |
|
270 | 270 | void ChartPresenter::handleAnimationFinished() |
|
271 | 271 | { |
|
272 | 272 | m_animations.removeAll(qobject_cast<ChartAnimation*>(sender())); |
|
273 | 273 | if(m_animations.empty()) emit animationsFinished(); |
|
274 | 274 | } |
|
275 | 275 | |
|
276 | 276 | void ChartPresenter::startAnimation(ChartAnimation* animation) |
|
277 | 277 | { |
|
278 | 278 | if (animation->state() != QAbstractAnimation::Stopped) animation->stop(); |
|
279 | 279 | QObject::connect(animation, SIGNAL(finished()),this,SLOT(handleAnimationFinished()),Qt::UniqueConnection); |
|
280 | 280 | if(!m_animations.isEmpty()){ |
|
281 | 281 | m_animations.append(animation); |
|
282 | 282 | } |
|
283 | 283 | QTimer::singleShot(0, animation, SLOT(start())); |
|
284 | 284 | } |
|
285 | 285 | |
|
286 | 286 | QGraphicsRectItem* ChartPresenter::backgroundItem() |
|
287 | 287 | { |
|
288 | 288 | return m_backgroundItem; |
|
289 | 289 | } |
|
290 | 290 | |
|
291 | 291 | void ChartPresenter::setBackgroundBrush(const QBrush& brush) |
|
292 | 292 | { |
|
293 | 293 | createBackgroundItem(); |
|
294 | 294 | m_backgroundItem->setBrush(brush); |
|
295 | 295 | m_layout->invalidate(); |
|
296 | 296 | } |
|
297 | 297 | |
|
298 | 298 | QBrush ChartPresenter::backgroundBrush() const |
|
299 | 299 | { |
|
300 | 300 | if (!m_backgroundItem) return QBrush(); |
|
301 | 301 | return m_backgroundItem->brush(); |
|
302 | 302 | } |
|
303 | 303 | |
|
304 | 304 | void ChartPresenter::setBackgroundPen(const QPen& pen) |
|
305 | 305 | { |
|
306 | 306 | createBackgroundItem(); |
|
307 | 307 | m_backgroundItem->setPen(pen); |
|
308 | 308 | m_layout->invalidate(); |
|
309 | 309 | } |
|
310 | 310 | |
|
311 | 311 | QPen ChartPresenter::backgroundPen() const |
|
312 | 312 | { |
|
313 | 313 | if (!m_backgroundItem) return QPen(); |
|
314 | 314 | return m_backgroundItem->pen(); |
|
315 | 315 | } |
|
316 | 316 | |
|
317 | 317 | QGraphicsItem* ChartPresenter::titleItem() |
|
318 | 318 | { |
|
319 | 319 | return m_titleItem; |
|
320 | 320 | } |
|
321 | 321 | |
|
322 | 322 | void ChartPresenter::setTitle(const QString& title) |
|
323 | 323 | { |
|
324 | 324 | createTitleItem(); |
|
325 | 325 | m_titleItem->setText(title); |
|
326 | 326 | m_layout->invalidate(); |
|
327 | 327 | } |
|
328 | 328 | |
|
329 | 329 | QString ChartPresenter::title() const |
|
330 | 330 | { |
|
331 | 331 | if (!m_titleItem) return QString(); |
|
332 | 332 | return m_titleItem->text(); |
|
333 | 333 | } |
|
334 | 334 | |
|
335 | 335 | void ChartPresenter::setTitleFont(const QFont& font) |
|
336 | 336 | { |
|
337 | 337 | createTitleItem(); |
|
338 | 338 | m_titleItem->setFont(font); |
|
339 | 339 | m_layout->invalidate(); |
|
340 | 340 | } |
|
341 | 341 | |
|
342 | 342 | QFont ChartPresenter::titleFont() const |
|
343 | 343 | { |
|
344 | 344 | if (!m_titleItem) return QFont(); |
|
345 | 345 | return m_titleItem->font(); |
|
346 | 346 | } |
|
347 | 347 | |
|
348 | 348 | void ChartPresenter::setTitleBrush(const QBrush &brush) |
|
349 | 349 | { |
|
350 | 350 | createTitleItem(); |
|
351 | 351 | m_titleItem->setBrush(brush); |
|
352 | 352 | m_layout->invalidate(); |
|
353 | 353 | } |
|
354 | 354 | |
|
355 | 355 | QBrush ChartPresenter::titleBrush() const |
|
356 | 356 | { |
|
357 | 357 | if (!m_titleItem) return QBrush(); |
|
358 | 358 | return m_titleItem->brush(); |
|
359 | 359 | } |
|
360 | 360 | |
|
361 | 361 | void ChartPresenter::setBackgroundVisible(bool visible) |
|
362 | 362 | { |
|
363 | 363 | createBackgroundItem(); |
|
364 | 364 | m_backgroundItem->setVisible(visible); |
|
365 | 365 | } |
|
366 | 366 | |
|
367 | 367 | |
|
368 | 368 | bool ChartPresenter::isBackgroundVisible() const |
|
369 | 369 | { |
|
370 | 370 | if (!m_backgroundItem) return false; |
|
371 | 371 | return m_backgroundItem->isVisible(); |
|
372 | 372 | } |
|
373 | 373 | |
|
374 | 374 | void ChartPresenter::setBackgroundDropShadowEnabled(bool enabled) |
|
375 | 375 | { |
|
376 | 376 | createBackgroundItem(); |
|
377 | 377 | m_backgroundItem->setDropShadowEnabled(enabled); |
|
378 | 378 | } |
|
379 | 379 | |
|
380 | 380 | bool ChartPresenter::isBackgroundDropShadowEnabled() const |
|
381 | 381 | { |
|
382 | 382 | if (!m_backgroundItem) return false; |
|
383 | 383 | return m_backgroundItem->isDropShadowEnabled(); |
|
384 | 384 | } |
|
385 | 385 | |
|
386 | 386 | |
|
387 | 387 | QGraphicsLayout* ChartPresenter::layout() |
|
388 | 388 | { |
|
389 | 389 | return m_layout; |
|
390 | 390 | } |
|
391 | 391 | |
|
392 | 392 | void ChartPresenter::setMarginsMinimum(const QRectF& margins) |
|
393 | 393 | { |
|
394 | 394 | Q_UNUSED(margins); |
|
395 | 395 | // m_layout->setMarginsMinimum(margins); |
|
396 | 396 | } |
|
397 | 397 | |
|
398 | 398 | QRectF ChartPresenter::margins() const |
|
399 | 399 | { |
|
400 | 400 | return QRectF();//m_layout->margins(); |
|
401 | 401 | } |
|
402 | 402 | |
|
403 | 403 | QLegend* ChartPresenter::legend() |
|
404 | 404 | { |
|
405 | 405 | return m_chart->legend(); |
|
406 | 406 | } |
|
407 | 407 | |
|
408 | 408 | QList<ChartAxis*> ChartPresenter::axisItems() const |
|
409 | 409 | { |
|
410 | 410 | return m_axisItems.values(); |
|
411 | 411 | } |
|
412 | 412 | |
|
413 | 413 | void ChartPresenter::setVisible(bool visible) |
|
414 | 414 | { |
|
415 | 415 | m_chart->setVisible(visible); |
|
416 | 416 | } |
|
417 | 417 | |
|
418 | 418 | #include "moc_chartpresenter_p.cpp" |
|
419 | 419 | |
|
420 | 420 | QTCOMMERCIALCHART_END_NAMESPACE |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now