##// END OF EJS Templates
Adds donut and precent charts to chartviewer
Adds donut and precent charts to chartviewer

File last commit:

r1794:efd4a5fe5972
r1865:27e7b2d61433
Show More
barchartitem.cpp
109 lines | 3.6 KiB | text/x-c | CppLexer
Jani Honkonen
Add license headers
r794 /****************************************************************************
**
** Copyright (C) 2012 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
** This file is part of the Qt Commercial Charts Add-on.
**
** $QT_BEGIN_LICENSE$
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia.
**
** If you have questions regarding the use of this file, please use
** contact form at http://qt.digia.com
** $QT_END_LICENSE$
**
****************************************************************************/
sauimone
combined barpresenterbase and barpresenter. renamed barchartpresenters to barchartitems
r666 #include "barchartitem_p.h"
sauimone
refactored barcharts. layout to derived classess other funtionality to base class
r126 #include "bar_p.h"
sauimone
barchart PIMPL part 2. Cleaning up leftovers in public api
r962 #include "qbarset_p.h"
sauimone
renamed barseries files to abstractbarseries
r1586 #include "qabstractbarseries_p.h"
sauimone
refactoring internal barchart items
r1674 #include "qbarset.h"
#include "qbarset_p.h"
sauimone
refactored barcharts. layout to derived classess other funtionality to base class
r126
QTCOMMERCIALCHART_BEGIN_NAMESPACE
sauimone
QBarSeries to QAbstractBarSeries
r1584 BarChartItem::BarChartItem(QAbstractBarSeries *series, ChartPresenter *presenter) :
sauimone
refactoring internal barchart items
r1674 AbstractBarChartItem(series, presenter)
sauimone
refactored barcharts. layout to derived classess other funtionality to base class
r126 {
}
sauimone
bug fix in bar charts. Crashed, if layout was set before data. Also integrated to test app.
r165
sauimone
barchart animation mechanics working. still some todo
r681 QVector<QRectF> BarChartItem::calculateLayout()
sauimone
Animation framework for barchart.
r671 {
sauimone
barchart animation mechanics working. still some todo
r681 QVector<QRectF> layout;
sauimone
removed categories from barseries. categories are now only on axis
r1321 // Use temporary qreals for accuracy
qreal categoryCount = m_series->d_func()->categoryCount();
Tero Ahola
Minor modifications to properties of abstract, area and bar series
r1462 qreal setCount = m_series->count();
sauimone
visible property to barseries
r1284 bool barsVisible = m_series->isVisible();
sauimone
barchart animation mechanics working. still some todo
r681
sauimone
percent barchart layout fix. signal fix
r850 // Domain:
sauimone
build error fix after merge
r682 qreal width = geometry().width();
qreal height = geometry().height();
sauimone
new series: groupedbarseries
r1167 qreal rangeY = m_domainMaxY - m_domainMinY;
qreal rangeX = m_domainMaxX - m_domainMinX;
qreal scaleY = (height / rangeY);
qreal scaleX = (width / rangeX);
sauimone
population pyramid example. Added grouping option to barseries to give some control over layout
r1794 qreal barWidth;
if (m_series->d_func()->m_grouping) {
barWidth = (scaleX / setCount) * m_series->d_func()->barWidth();
} else {
barWidth = scaleX * m_series->d_func()->barWidth();
}
sauimone
barchart animation mechanics working. still some todo
r681
int itemIndex(0);
Tero Ahola
Code review: Fixed simple issues in Bar and Legend
r737 for (int category = 0; category < categoryCount; category++) {
sauimone
new series: groupedbarseries
r1167 qreal yPos = height + scaleY * m_domainMinY + geometry().topLeft().y();
sauimone
barchart animation mechanics working. still some todo
r681 for (int set = 0; set < setCount; set++) {
sauimone
Removed QPointF from QBarSet
r1580 QBarSetPrivate* barSet = m_series->d_func()->barsetAt(set)->d_ptr.data();
sauimone
Barchart value layout fix
r817
sauimone
population pyramid example. Added grouping option to barseries to give some control over layout
r1794 qreal xPos;
if (m_series->d_func()->m_grouping) {
xPos = (barSet->pos(category) - m_domainMinX) * scaleX + m_rect.left();
xPos -= setCount*barWidth/2;
xPos += set*barWidth;
} else {
xPos = (barSet->pos(category) - m_domainMinX) * scaleX + m_rect.left() - barWidth/2;
}
sauimone
horizontal barchart & example
r1681 qreal barHeight = barSet->value(category) * scaleY;
sauimone
minor code review fixes, part n
r763 Bar* bar = m_bars.at(itemIndex);
sauimone
new series: groupedbarseries
r1167
sauimone
refactoring internal barchart items
r1674 QRectF rect(xPos, yPos - barHeight, barWidth, barHeight);
sauimone
barchart animation mechanics working. still some todo
r681 layout.append(rect);
sauimone
Removed QPointF from QBarSet
r1580 bar->setPen(barSet->m_pen);
bar->setBrush(barSet->m_brush);
sauimone
fixed crash in barchartitem after refactoring
r1603 if (qFuzzyIsNull(barHeight)) {
bar->setVisible(false);
} else {
bar->setVisible(barsVisible);
}
sauimone
barchart animation mechanics working. still some todo
r681
sauimone
removed barlabel. label visibility control is now per series instead of per set
r1246 QGraphicsSimpleTextItem* label = m_labels.at(itemIndex);
sauimone
barchart animation mechanics working. still some todo
r681
sauimone
horizontal barchart & example
r1681 if (!qFuzzyIsNull(barSet->value(category))) {
label->setText(QString::number(barSet->value(category)));
sauimone
barchart animation mechanics working. still some todo
r681 } else {
sauimone
renamed barchart floating values with labels to be consistent with piechart
r820 label->setText(QString(""));
sauimone
barchart animation mechanics working. still some todo
r681 }
sauimone
renamed barchart floating values with labels to be consistent with piechart
r820 label->setPos(xPos + (rect.width()/2 - label->boundingRect().width()/2)
,yPos - barHeight/2 - label->boundingRect().height()/2);
sauimone
Removed QPointF from QBarSet
r1580 label->setFont(barSet->m_labelFont);
label->setBrush(barSet->m_labelBrush);
sauimone
simple text item for barvalue
r811
sauimone
barchart animation mechanics working. still some todo
r681 itemIndex++;
}
}
sauimone
Animation framework for barchart.
r671 return layout;
}
sauimone
combined barpresenterbase and barpresenter. renamed barchartpresenters to barchartitems
r666 #include "moc_barchartitem_p.cpp"
Michal Klocek
Refactored for MVP...
r139
sauimone
refactored barcharts. layout to derived classess other funtionality to base class
r126 QTCOMMERCIALCHART_END_NAMESPACE