##// END OF EJS Templates
Fixes after merge
Michal Klocek -
r683:ef336a9288eb
parent child
Show More
@@ -19,13 +19,6 BarAnimation::~BarAnimation()
19 19 {
20 20 }
21 21
22 void BarAnimation::updateValues(const QVector<QRectF>& layout)
23 {
24 // TODO?:
25 // qDebug() << "BarAnimation::updateValues" << layout.count();
26 }
27
28
29 22 QVariant BarAnimation::interpolated(const QVariant &from, const QVariant &to, qreal progress) const
30 23 {
31 24 QVector<QRectF> startVector = qVariantValue<QVector<QRectF> > (from);
@@ -18,8 +18,6 public:
18 18 BarAnimation(BarChartItem *item);
19 19 ~BarAnimation();
20 20
21 void updateValues(const QVector<QRectF>& layout);
22
23 21 public: // from QVariantAnimation
24 22 virtual QVariant interpolated (const QVariant & from, const QVariant & to, qreal progress ) const;
25 23 virtual void updateCurrentValue (const QVariant & value );
@@ -188,29 +188,26 QVector<QRectF> BarChartItem::calculateLayout()
188 188 QVector<QRectF> layout;
189 189
190 190 // Use temporary qreals for accurancy (we might get some compiler warnings... :)
191 int categoryCount = mSeries->categoryCount();
192 int setCount = mSeries->barsetCount();
191 qreal categoryCount = mSeries->categoryCount();
192 qreal setCount = mSeries->barsetCount();
193 193
194 // qreal tW = mWidth;
195 // qreal tH = mHeight;
196 194 qreal width = geometry().width();
197 195 qreal height = geometry().height();
198 196
199 qreal tM = mSeries->max();
197 qreal max = mSeries->max();
200 198
201 199 // Domain:
202 if (mDomainMaxY > tM) {
203 tM = mDomainMaxY;
200 if (mDomainMaxY > max) {
201 max = mDomainMaxY;
204 202 }
205 203
206 qreal scale = (height/tM);
207 qreal tC = categoryCount + 1;
208 qreal categoryWidth = width/tC;
204 qreal scale = (height/max);
205 qreal categoryWidth = width/categoryCount;
209 206 qreal barWidth = categoryWidth / (setCount+1);
210 207
211 208 int itemIndex(0);
212 209 for (int category=0; category < categoryCount; category++) {
213 qreal xPos = categoryWidth * category + categoryWidth /2 + barWidth/2;
210 qreal xPos = categoryWidth * category + barWidth/2;
214 211 qreal yPos = height;
215 212 for (int set = 0; set < setCount; set++) {
216 213 qreal barHeight = mSeries->valueAt(set,category) * scale;
@@ -233,7 +230,7 QVector<QRectF> BarChartItem::calculateLayout()
233 230 // Position floating values
234 231 itemIndex = 0;
235 232 for (int category=0; category < mSeries->categoryCount(); category++) {
236 qreal xPos = categoryWidth * category + categoryWidth/2 + barWidth;
233 qreal xPos = categoryWidth * category + barWidth;
237 234 qreal yPos = height;
238 235 for (int set=0; set < mSeries->barsetCount(); set++) {
239 236 qreal barHeight = mSeries->valueAt(set,category) * scale;
@@ -50,8 +50,8 signals:
50 50 void rangeYChanged(qreal min, qreal max, int tickYCount);
51 51
52 52 public slots:
53 void handleAxisXChanged(qreal min,qreal max,int tickXCount,QChartAxis::LabelsSelection mode);
54 void handleAxisYChanged(qreal min,qreal max,int tickYCount,QChartAxis::LabelsSelection mode);
53 void handleAxisXChanged(qreal min,qreal max,int tickXCount = 5,QChartAxis::LabelsSelection mode = QChartAxis::NativeLabelsSelection);
54 void handleAxisYChanged(qreal min,qreal max,int tickYCount = 5,QChartAxis::LabelsSelection mode = QChartAxis::NativeLabelsSelection);
55 55
56 56 private:
57 57 void niceNumbers(qreal &min, qreal &max, int &ticksCount);
@@ -1,5 +1,6
1 1 #include <QtTest/QtTest>
2 2 #include <private/domain_p.h>
3 #include <qchartaxis.h>
3 4
4 5 QTCOMMERCIALCHART_USE_NAMESPACE
5 6
@@ -95,7 +96,7 void tst_Domain::handleAxisRangeXChanged()
95 96 QSignalSpy spy1(&domain, SIGNAL(rangeXChanged(qreal, qreal)));
96 97 QSignalSpy spy2(&domain, SIGNAL(rangeYChanged(qreal, qreal)));
97 98
98 domain.handleAxisRangeXChanged(min, max);
99 domain.handleAxisXChanged(min, max);
99 100
100 101 QList<QVariant> arg0 = spy0.first();
101 102 QVERIFY(arg0.at(0).toReal() == min);
@@ -132,7 +133,7 void tst_Domain::handleAxisRangeYChanged()
132 133 QSignalSpy spy1(&domain, SIGNAL(rangeXChanged(qreal, qreal)));
133 134 QSignalSpy spy2(&domain, SIGNAL(rangeYChanged(qreal, qreal)));
134 135
135 domain.handleAxisRangeYChanged(min, max);
136 domain.handleAxisYChanged(min, max,5);
136 137
137 138 QList<QVariant> arg0 = spy0.first();
138 139 QVERIFY(arg0.at(2).toReal() == min);
General Comments 0
You need to be logged in to leave comments. Login now