##// END OF EJS Templates
barchart domain fix
sauimone -
r674:2c12358822ee
parent child
Show More
@@ -110,6 +110,12 void BarChartItem::layoutChanged()
110 qreal tW = mWidth;
110 qreal tW = mWidth;
111 qreal tH = mHeight;
111 qreal tH = mHeight;
112 qreal tM = mSeries->max();
112 qreal tM = mSeries->max();
113
114 // Domain:
115 if (mDomainMaxY > tM) {
116 tM = mDomainMaxY;
117 }
118
113 qreal scale = (tH/tM);
119 qreal scale = (tH/tM);
114 qreal tC = categoryCount + 1;
120 qreal tC = categoryCount + 1;
115 qreal categoryWidth = tW/tC;
121 qreal categoryWidth = tW/tC;
@@ -222,11 +228,11 void BarChartItem::handleModelChanged(int index)
222
228
223 void BarChartItem::handleDomainChanged(qreal minX, qreal maxX, qreal minY, qreal maxY)
229 void BarChartItem::handleDomainChanged(qreal minX, qreal maxX, qreal minY, qreal maxY)
224 {
230 {
225 // TODO:
231 mDomainMinX = minX;
226 Q_UNUSED(minX)
232 mDomainMaxX = maxX;
227 Q_UNUSED(maxX)
233 mDomainMinY = minY;
228 Q_UNUSED(minY)
234 mDomainMaxY = maxY;
229 Q_UNUSED(maxY)
235 layoutChanged();
230
236
231 /*
237 /*
232 int count = mSeries->categoryCount();
238 int count = mSeries->categoryCount();
@@ -57,6 +57,11 protected:
57 int mWidth;
57 int mWidth;
58 qreal mBarWidth;
58 qreal mBarWidth;
59
59
60 qreal mDomainMinX;
61 qreal mDomainMaxX;
62 qreal mDomainMinY;
63 qreal mDomainMaxY;
64
60 bool mLayoutSet; // True, if component has been laid out.
65 bool mLayoutSet; // True, if component has been laid out.
61
66
62 // Not owned.
67 // Not owned.
@@ -39,6 +39,11 void StackedBarChartItem::layoutChanged()
39
39
40 // Use temporary qreals for accurancy (we might get some compiler warnings... :)
40 // Use temporary qreals for accurancy (we might get some compiler warnings... :)
41 qreal maxSum = mSeries->maxCategorySum();
41 qreal maxSum = mSeries->maxCategorySum();
42 // Domain:
43 if (mDomainMaxY > maxSum) {
44 maxSum = mDomainMaxY;
45 }
46
42 qreal h = mHeight;
47 qreal h = mHeight;
43 qreal scale = (h / maxSum);
48 qreal scale = (h / maxSum);
44 qreal tW = mWidth;
49 qreal tW = mWidth;
General Comments 0
You need to be logged in to leave comments. Login now