##// END OF EJS Templates
build error fix after merge
sauimone -
r682:137b7097b510
parent child
Show More
@@ -191,8 +191,11 QVector<QRectF> BarChartItem::calculateLayout()
191 191 int categoryCount = mSeries->categoryCount();
192 192 int setCount = mSeries->barsetCount();
193 193
194 qreal tW = mWidth;
195 qreal tH = mHeight;
194 // qreal tW = mWidth;
195 // qreal tH = mHeight;
196 qreal width = geometry().width();
197 qreal height = geometry().height();
198
196 199 qreal tM = mSeries->max();
197 200
198 201 // Domain:
@@ -200,20 +203,20 QVector<QRectF> BarChartItem::calculateLayout()
200 203 tM = mDomainMaxY;
201 204 }
202 205
203 qreal scale = (tH/tM);
206 qreal scale = (height/tM);
204 207 qreal tC = categoryCount + 1;
205 qreal categoryWidth = tW/tC;
206 mBarWidth = categoryWidth / (setCount+1);
208 qreal categoryWidth = width/tC;
209 qreal barWidth = categoryWidth / (setCount+1);
207 210
208 211 int itemIndex(0);
209 212 for (int category=0; category < categoryCount; category++) {
210 qreal xPos = categoryWidth * category + categoryWidth /2 + mBarWidth/2;
211 qreal yPos = mHeight;
213 qreal xPos = categoryWidth * category + categoryWidth /2 + barWidth/2;
214 qreal yPos = height;
212 215 for (int set = 0; set < setCount; set++) {
213 216 qreal barHeight = mSeries->valueAt(set,category) * scale;
214 217 Bar* bar = mBars.at(itemIndex);
215 218
216 QRectF rect(xPos,yPos-barHeight,mBarWidth,barHeight);
219 QRectF rect(xPos,yPos-barHeight,barWidth,barHeight);
217 220 //layout.insert(bar,rect);
218 221 layout.append(rect);
219 222 // TODO: width settable per bar?
@@ -223,15 +226,15 QVector<QRectF> BarChartItem::calculateLayout()
223 226 bar->setBrush(mSeries->barsetAt(set)->brush());
224 227 // bar->setPos(xPos, yPos-barHeight);
225 228 itemIndex++;
226 xPos += mBarWidth;
229 xPos += barWidth;
227 230 }
228 231 }
229 232
230 233 // Position floating values
231 234 itemIndex = 0;
232 235 for (int category=0; category < mSeries->categoryCount(); category++) {
233 qreal xPos = categoryWidth * category + categoryWidth/2 + mBarWidth;
234 qreal yPos = mHeight;
236 qreal xPos = categoryWidth * category + categoryWidth/2 + barWidth;
237 qreal yPos = height;
235 238 for (int set=0; set < mSeries->barsetCount(); set++) {
236 239 qreal barHeight = mSeries->valueAt(set,category) * scale;
237 240 BarValue* value = mFloatingValues.at(itemIndex);
@@ -248,7 +251,7 QVector<QRectF> BarChartItem::calculateLayout()
248 251 }
249 252
250 253 itemIndex++;
251 xPos += mBarWidth;
254 xPos += barWidth;
252 255 }
253 256 }
254 257
@@ -329,7 +332,7 void BarChartItem::handleDomainChanged(qreal minX, qreal maxX, qreal minY, qreal
329 332 void BarChartItem::handleGeometryChanged(const QRectF& rect)
330 333 {
331 334 m_rect=rect;
332 layoutChanged();
335 handleLayoutChanged();
333 336 mLayoutSet = true;
334 337 setPos(rect.topLeft());
335 338 }
@@ -3,6 +3,7
3 3
4 4 #include "qchartglobal.h"
5 5 #include <QObject>
6 #include <QRect>
6 7
7 8 QTCOMMERCIALCHART_BEGIN_NAMESPACE
8 9
General Comments 0
You need to be logged in to leave comments. Login now