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