##// END OF EJS Templates
Revert "Fixes line uder grid issue"...
Revert "Fixes line uder grid issue" This reverts commit 3ea3ba4a33950ea7420e16913d228ed53fe566c3.

File last commit:

r183:45734e367adb
r191:0b54368f72bb
Show More
bargroup.cpp
73 lines | 2.2 KiB | text/x-c | CppLexer
sauimone
Integrating bar chart. Cleaned up old implementation. TODO: show this in test application. how?
r56 #include "bargroup.h"
sauimone
renamed bar.h to bar_p.h
r118 #include "bar_p.h"
sauimone
added labels to barcharts
r114 #include "barlabel_p.h"
sauimone
Integrating bar chart. Cleaned up old implementation. TODO: show this in test application. how?
r56 #include <QDebug>
QTCOMMERCIALCHART_BEGIN_NAMESPACE
sauimone
removed barchartseriesbase. functionality is now in model
r172 BarGroup::BarGroup(BarChartModel& model, QGraphicsItem *parent) :
BarGroupBase(model,parent)
sauimone
Integrating bar chart. Cleaned up old implementation. TODO: show this in test application. how?
r56 {
sauimone
fixed bug in category implementation. model now owns the category and sets
r173 mBarDefaultWidth = 5;
sauimone
Integrating bar chart. Cleaned up old implementation. TODO: show this in test application. how?
r56 }
void BarGroup::layoutChanged()
{
sauimone
proof of concept implementation for barset and barcategory
r169 // qDebug() << "BarGroup::layoutChanged";
sauimone
Integrating bar chart. Cleaned up old implementation. TODO: show this in test application. how?
r56 // Scale bars to new layout
// Layout for bars:
sauimone
Barset and barcategory implememtation. Updated test application
r171 if (mModel.countSets() <= 0) {
sauimone
fixed bug in category implementation. model now owns the category and sets
r173 qDebug() << "No sets in model!";
sauimone
model prototyping for bar chart
r159 return;
}
sauimone
Integrating bar chart. Cleaned up old implementation. TODO: show this in test application. how?
r56
sauimone
bug fix in bar charts. Crashed, if layout was set before data. Also integrated to test app.
r165 if (childItems().count() == 0) {
qDebug() << "WARNING: BarGroup::layoutChanged called before graphics items are created!";
return;
}
sauimone
percent bar chart
r101 // TODO: better way to auto-layout?
sauimone
bar chart layout fixing
r99 // Use reals for accurancy (we might get some compiler warnings... :)
sauimone
Barset and barcategory implememtation. Updated test application
r171 int itemCount = mModel.countCategories();
sauimone
brush support for bargroups
r183 int setCount = mModel.countSets();
sauimone
Integrating bar chart. Cleaned up old implementation. TODO: show this in test application. how?
r56
sauimone
bar chart layout fixing
r99 qreal tW = mWidth;
qreal tH = mHeight;
sauimone
added labels to series, intergrated with test app. minor hack to test app
r167 qreal tM = mModel.max();
sauimone
bar chart layout fixing
r99 qreal scale = (tH/tM);
sauimone
model prototyping for bar chart
r159 qreal tC = itemCount+1;
sauimone
brush support for bargroups
r183 qreal xStepPerSet = (tW/tC);
sauimone
bar chart layout fixing
r99
sauimone
correct drawing for barchart
r82 // Scaling.
sauimone
Improved bar chart series
r71 int itemIndex(0);
sauimone
brush support for bargroups
r183 int labelIndex = itemCount * setCount;
sauimone
added labels to barcharts
r114
sauimone
model prototyping for bar chart
r159 for (int item=0; item < itemCount; item++) {
sauimone
brush support for bargroups
r183 qreal xPos = xStepPerSet * item + ((tW + mBarDefaultWidth*setCount)/(itemCount*2));
sauimone
theme interface to barcharts. some minor fixes
r113 qreal yPos = mHeight;
sauimone
brush support for bargroups
r183 for (int set = 0; set < setCount; set++) {
qreal barHeight = mModel.valueAt(set, item) * scale;
sauimone
bar chart layout fixing
r99 Bar* bar = reinterpret_cast<Bar*> (childItems().at(itemIndex));
// TODO: width settable per bar?
bar->resize(mBarDefaultWidth, barHeight);
sauimone
brush support for bargroups
r183 bar->setBrush(mBrushes.at(set));
// bar->setPen(mModel.barSet(set).pen());
// bar->setColor(mColors.at(set));
// bar->setPen();
bar->setPos(xPos, yPos-barHeight); // item*posStep+startPos + set * mBarDefaultWidth, mHeight);
sauimone
bar chart layout fixing
r99 itemIndex++;
xPos += mBarDefaultWidth;
}
sauimone
added labels to barcharts
r114
// TODO: Layout for labels, remove magic number
sauimone
brush support for bargroups
r183 xPos = xStepPerSet * item + ((tW + mBarDefaultWidth*setCount)/(itemCount*2));
sauimone
added labels to barcharts
r114 BarLabel* label = reinterpret_cast<BarLabel*> (childItems().at(labelIndex));
label->setPos(xPos, mHeight + 20);
labelIndex++;
sauimone
bar chart layout fixing
r99 }
sauimone
Integrating bar chart. Cleaned up old implementation. TODO: show this in test application. how?
r56 mLayoutDirty = true;
}
QTCOMMERCIALCHART_END_NAMESPACE