##// END OF EJS Templates
Now using percent bar series in theme demo
Now using percent bar series in theme demo

File last commit:

r512:db1a02a52a65
r521:1e41568aab09
Show More
stackedbarpresenter.cpp
106 lines | 3.0 KiB | text/x-c | CppLexer
/ src / barchart / stackedbarpresenter.cpp
sauimone
added _p to private class headers
r381 #include "stackedbarpresenter_p.h"
sauimone
renamed bar.h to bar_p.h
r118 #include "bar_p.h"
sauimone
Floating values to bar charts
r263 #include "barvalue_p.h"
sauimone
refactored barcharts. layout to derived classess other funtionality to base class
r126 #include "separator_p.h"
sauimone
Added pen & brush to QBarSet
r214 #include "qbarset.h"
sauimone
added missing example files :)
r96 #include <QDebug>
QTCOMMERCIALCHART_BEGIN_NAMESPACE
sauimone
Labels for barchart to axis
r487 StackedBarPresenter::StackedBarPresenter(QBarSeries *series, QChart *parent) :
sauimone
moved tooltip to presenter
r288 BarPresenterBase(series,parent)
sauimone
added missing example files :)
r96 {
}
sauimone
updating drilldown example. Needs some more thinking
r438 StackedBarPresenter::~StackedBarPresenter()
{
}
sauimone
Common naming convention for barcharts
r216 void StackedBarPresenter::layoutChanged()
sauimone
added missing example files :)
r96 {
// Scale bars to new layout
// Layout for bars:
sauimone
review fixes. countCategories() -> categoryCount(). countSets -> barsetCount()
r366 if (mSeries->barsetCount() <= 0) {
sauimone
fixed bug in category implementation. model now owns the category and sets
r173 qDebug() << "No sets in model!";
sauimone
added missing example files :)
r96 // Nothing to do.
return;
}
sauimone
review fixes. countCategories() -> categoryCount(). countSets -> barsetCount()
r366 if (mSeries->categoryCount() == 0) {
sauimone
fixed bug in category implementation. model now owns the category and sets
r173 qDebug() << "No categories in model!";
sauimone
prototyping separators with stacked bars
r119 // Nothing to do
return;
}
sauimone
bug fix in bar charts. Crashed, if layout was set before data. Also integrated to test app.
r165 if (childItems().count() == 0) {
sauimone
Bug fix for bar presenters. It appears that order of childItems may change. Relying on order caused crash
r256 qDebug() << "WARNING: StackedBarPresenter::layoutChanged called before graphics items are created!";
sauimone
bug fix in bar charts. Crashed, if layout was set before data. Also integrated to test app.
r165 return;
}
sauimone
Fixed layout for barcharts
r473 // Use temporary qreals for accurancy (we might get some compiler warnings... :)
sauimone
moved tooltip to presenter
r288 qreal maxSum = mSeries->maxCategorySum();
sauimone
fixed naming mixup with percent and stacked groups
r105 qreal h = mHeight;
qreal scale = (h / maxSum);
sauimone
fixing layout bug on stacked bar chart
r98 qreal tW = mWidth;
sauimone
review fixes. countCategories() -> categoryCount(). countSets -> barsetCount()
r366 qreal tC = mSeries->categoryCount() + 1;
sauimone
Fixed layout for barcharts
r473 qreal cC = mSeries->categoryCount() * 2 + 1;
mBarWidth = tW / cC;
sauimone
fixing layout bug on stacked bar chart
r98 qreal xStep = (tW/tC);
sauimone
Fixed layout for barcharts
r473 qreal xPos = ((tW/tC) - mBarWidth / 2);
sauimone
fixing layout bug on stacked bar chart
r98
sauimone
Fixed layout for barcharts
r473 int itemIndex(0);
sauimone
review fixes. countCategories() -> categoryCount(). countSets -> barsetCount()
r366 for (int category = 0; category < mSeries->categoryCount(); category++) {
sauimone
fixing layout bug on stacked bar chart
r98 qreal yPos = h;
sauimone
review fixes. countCategories() -> categoryCount(). countSets -> barsetCount()
r366 for (int set=0; set < mSeries->barsetCount(); set++) {
sauimone
moved tooltip to presenter
r288 qreal barHeight = mSeries->valueAt(set, category) * scale;
sauimone
Bug fix for bar presenters. It appears that order of childItems may change. Relying on order caused crash
r256 Bar* bar = mBars.at(itemIndex);
sauimone
added missing example files :)
r96
sauimone
Fixed layout for barcharts
r473 bar->resize(mBarWidth, barHeight);
sauimone
review fix: Removed iterator from barseries. Remove const from brush and pen. Renamed setters for tooltip, floating values and separators
r357 bar->setBrush(mSeries->barsetAt(set)->brush());
sauimone
theme interface to barcharts. some minor fixes
r113 bar->setPos(xPos, yPos-barHeight);
sauimone
added missing example files :)
r96 itemIndex++;
sauimone
Some fixes to bar charts. Now bars draw almost correctly
r97 yPos -= barHeight;
sauimone
added missing example files :)
r96 }
sauimone
fixing layout bug on stacked bar chart
r98 xPos += xStep;
sauimone
added missing example files :)
r96 }
sauimone
added labels to barcharts
r114
sauimone
prototyping separators with stacked bars
r119 // Position separators
sauimone
Bug fix for bar presenters. It appears that order of childItems may change. Relying on order caused crash
r256 xPos = xStep + xStep/2;
sauimone
review fixes. countCategories() -> categoryCount(). countSets -> barsetCount()
r366 for (int s=0; s < mSeries->categoryCount() - 1; s++) {
sauimone
Floating values to bar charts
r263 Separator* sep = mSeparators.at(s);
sauimone
refactored barcharts. layout to derived classess other funtionality to base class
r126 sep->setPos(xPos,0);
sep->setSize(QSizeF(1,mHeight));
sauimone
prototyping separators with stacked bars
r119 xPos += xStep;
sauimone
Floating values to bar charts
r263 }
// Position floating values
itemIndex = 0;
sauimone
floating value layout fix for barchart
r474 xPos = (tW/tC);
sauimone
review fixes. countCategories() -> categoryCount(). countSets -> barsetCount()
r366 for (int category=0; category < mSeries->categoryCount(); category++) {
sauimone
Floating values to bar charts
r263 qreal yPos = h;
sauimone
review fixes. countCategories() -> categoryCount(). countSets -> barsetCount()
r366 for (int set=0; set < mSeries->barsetCount(); set++) {
sauimone
moved tooltip to presenter
r288 qreal barHeight = mSeries->valueAt(set,category) * scale;
sauimone
Floating values to bar charts
r263 BarValue* value = mFloatingValues.at(itemIndex);
sauimone
better use of gradients in barcharts
r512 QBarSet* barSet = mSeries->barsetAt(set);
value->resize(100,50); // TODO: proper layout for this.
sauimone
updated barchart examples. minor fixes
r276 value->setPos(xPos, yPos-barHeight/2);
sauimone
better use of gradients in barcharts
r512 value->setPen(barSet->floatingValuePen());
sauimone
Floating values to bar charts
r263
sauimone
moved tooltip to presenter
r288 if (mSeries->valueAt(set,category) != 0) {
value->setValueString(QString::number(mSeries->valueAt(set,category)));
sauimone
updated barchart examples. minor fixes
r276 } else {
value->setValueString(QString(""));
}
sauimone
Floating values to bar charts
r263
itemIndex++;
yPos -= barHeight;
}
xPos += xStep;
sauimone
prototyping separators with stacked bars
r119 }
sauimone
added missing example files :)
r96 }
sauimone
added _p to private class headers
r381 #include "moc_stackedbarpresenter_p.cpp"
sauimone
moved tooltip to presenter
r288
sauimone
added missing example files :)
r96 QTCOMMERCIALCHART_END_NAMESPACE