##// END OF EJS Templates
QCategoryAxis to QIntervalAxis part 1 of 2
Michal Klocek -
r1614:ec094357a3fd
parent child
Show More
@@ -27,16 +27,16
27 27
28 28 QTCOMMERCIALCHART_BEGIN_NAMESPACE
29 29
30 QCategoriesAxis::QCategoriesAxis(QObject *parent):
31 QValuesAxis(*new QCategoriesAxisPrivate(this),parent)
30 QIntervalAxis::QIntervalAxis(QObject *parent):
31 QValuesAxis(*new QIntervalAxisPrivate(this),parent)
32 32 {
33 33 }
34 34
35 QCategoriesAxis::~QCategoriesAxis()
35 QIntervalAxis::~QIntervalAxis()
36 36 {
37 37 }
38 38
39 QCategoriesAxis::QCategoriesAxis(QCategoriesAxisPrivate &d,QObject *parent):QValuesAxis(d,parent)
39 QIntervalAxis::QIntervalAxis(QIntervalAxisPrivate &d,QObject *parent):QValuesAxis(d,parent)
40 40 {
41 41
42 42 }
@@ -44,9 +44,9 QCategoriesAxis::QCategoriesAxis(QCategoriesAxisPrivate &d,QObject *parent):QVal
44 44 /*!
45 45 Appends \a categories to axis
46 46 */
47 void QCategoriesAxis::append(const QString& category, qreal x)
47 void QIntervalAxis::append(const QString& category, qreal x)
48 48 {
49 Q_D(QCategoriesAxis);
49 Q_D(QIntervalAxis);
50 50 if (!d->m_categories.contains(category))
51 51 {
52 52 if(d->m_categories.isEmpty()){
@@ -62,9 +62,9 void QCategoriesAxis::append(const QString& category, qreal x)
62 62 }
63 63 }
64 64
65 void QCategoriesAxis::setFisrtCategoryMinimum(qreal x)
65 void QIntervalAxis::setFisrtCategoryMinimum(qreal x)
66 66 {
67 Q_D(QCategoriesAxis);
67 Q_D(QIntervalAxis);
68 68 if(d->m_categories.isEmpty()){
69 69 d->m_categoryMinimum=x;
70 70 }else{
@@ -77,62 +77,62 void QCategoriesAxis::setFisrtCategoryMinimum(qreal x)
77 77 /*!
78 78 Removes \a category from axis
79 79 */
80 void QCategoriesAxis::remove(const QString &category)
80 void QIntervalAxis::remove(const QString &category)
81 81 {
82 82 Q_UNUSED(category);
83 83 //TODO
84 84 }
85 85
86 QStringList QCategoriesAxis::categories()
86 QStringList QIntervalAxis::categories()
87 87 {
88 Q_D(QCategoriesAxis);
88 Q_D(QIntervalAxis);
89 89 return d->m_categories;
90 90 }
91 91
92 92 /*!
93 93 Returns number of categories.
94 94 */
95 int QCategoriesAxis::count() const
95 int QIntervalAxis::count() const
96 96 {
97 Q_D(const QCategoriesAxis);
97 Q_D(const QIntervalAxis);
98 98 return d->m_categories.count();
99 99 }
100 100
101 101 /*!
102 102 Returns the type of axis.
103 103 */
104 QAbstractAxis::AxisType QCategoriesAxis::type() const
104 QAbstractAxis::AxisType QIntervalAxis::type() const
105 105 {
106 106 return AxisTypeCategories;
107 107 }
108 108
109 109 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
110 110
111 QCategoriesAxisPrivate::QCategoriesAxisPrivate(QCategoriesAxis* q):
111 QIntervalAxisPrivate::QIntervalAxisPrivate(QIntervalAxis* q):
112 112 QValuesAxisPrivate(q),
113 113 m_categoryMinimum(0)
114 114 {
115 115
116 116 }
117 117
118 QCategoriesAxisPrivate::~QCategoriesAxisPrivate()
118 QIntervalAxisPrivate::~QIntervalAxisPrivate()
119 119 {
120 120
121 121 }
122 122
123 int QCategoriesAxisPrivate::ticksCount() const
123 int QIntervalAxisPrivate::ticksCount() const
124 124 {
125 125 return m_categories.count()+1;
126 126 }
127 127
128 void QCategoriesAxisPrivate::handleAxisRangeChanged(qreal min, qreal max,int count)
128 void QIntervalAxisPrivate::handleAxisRangeChanged(qreal min, qreal max,int count)
129 129 {
130 130 m_min = min;
131 131 m_max = max;
132 132 m_ticksCount = count;
133 133 }
134 134
135 ChartAxis* QCategoriesAxisPrivate::createGraphics(ChartPresenter* presenter)
135 ChartAxis* QIntervalAxisPrivate::createGraphics(ChartPresenter* presenter)
136 136 {
137 137 Q_UNUSED(presenter);
138 138 // Q_Q( QCategoriesAxis);
@@ -26,18 +26,18
26 26
27 27 QTCOMMERCIALCHART_BEGIN_NAMESPACE
28 28
29 class QCategoriesAxisPrivate;
29 class QIntervalAxisPrivate;
30 30
31 class QTCOMMERCIALCHART_EXPORT QCategoriesAxis : public QValuesAxis
31 class QTCOMMERCIALCHART_EXPORT QIntervalAxis : public QValuesAxis
32 32 {
33 33 Q_OBJECT
34 34
35 35 public:
36 explicit QCategoriesAxis(QObject *parent = 0);
37 ~QCategoriesAxis();
36 explicit QIntervalAxis(QObject *parent = 0);
37 ~QIntervalAxis();
38 38
39 39 protected:
40 QCategoriesAxis(QCategoriesAxisPrivate &d,QObject *parent = 0);
40 QIntervalAxis(QIntervalAxisPrivate &d,QObject *parent = 0);
41 41
42 42 public:
43 43 AxisType type() const;
@@ -55,8 +55,8 public:
55 55
56 56
57 57 private:
58 Q_DECLARE_PRIVATE(QCategoriesAxis)
59 Q_DISABLE_COPY(QCategoriesAxis)
58 Q_DECLARE_PRIVATE(QIntervalAxis)
59 Q_DISABLE_COPY(QIntervalAxis)
60 60 };
61 61
62 62 QTCOMMERCIALCHART_END_NAMESPACE
@@ -38,13 +38,13 QTCOMMERCIALCHART_BEGIN_NAMESPACE
38 38
39 39 typedef QPair<qreal, qreal> Range;
40 40
41 class QCategoriesAxisPrivate : public QValuesAxisPrivate
41 class QIntervalAxisPrivate : public QValuesAxisPrivate
42 42 {
43 43 Q_OBJECT
44 44
45 45 public:
46 QCategoriesAxisPrivate(QCategoriesAxis *q);
47 ~QCategoriesAxisPrivate();
46 QIntervalAxisPrivate(QIntervalAxis *q);
47 ~QIntervalAxisPrivate();
48 48
49 49
50 50 public:
@@ -63,7 +63,7 private:
63 63 qreal m_categoryMinimum;
64 64
65 65 private:
66 Q_DECLARE_PUBLIC(QCategoriesAxis)
66 Q_DECLARE_PUBLIC(QIntervalAxis)
67 67 };
68 68
69 69 QTCOMMERCIALCHART_END_NAMESPACE
General Comments 0
You need to be logged in to leave comments. Login now