##// END OF EJS Templates
bugfix: pie does not disconnect signals when a slice is taken (not deleted)
bugfix: pie does not disconnect signals when a slice is taken (not deleted)

File last commit:

r2073:9c07511ab7b2
r2084:8911fa47051b
Show More
barchartitem.cpp
96 lines | 3.2 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
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
bar test update. Tests now calculate expected layout from charts plot area and use that instead of precalculated QPointF magic numbers
r2073 qreal rectWidth = (scaleX / setCount) * 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
bar test update. Tests now calculate expected layout from charts plot area and use that instead of precalculated QPointF magic numbers
r2073 qreal yPos = height + scaleY * m_domainMinY + geometry().top();
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
bar test update. Tests now calculate expected layout from charts plot area and use that instead of precalculated QPointF magic numbers
r2073 qreal xPos = (barSet->pos(category) - m_domainMinX) * scaleX + geometry().left();
xPos -= setCount*rectWidth/2;
xPos += set*rectWidth;
sauimone
population pyramid example. Added grouping option to barseries to give some control over layout
r1794
sauimone
bar test update. Tests now calculate expected layout from charts plot area and use that instead of precalculated QPointF magic numbers
r2073 qreal rectHeight = barSet->value(category) * scaleY;
sauimone
minor code review fixes, part n
r763 Bar* bar = m_bars.at(itemIndex);
sauimone
new series: groupedbarseries
r1167
sauimone
bar test update. Tests now calculate expected layout from charts plot area and use that instead of precalculated QPointF magic numbers
r2073 QRectF rect(xPos, yPos - rectHeight, rectWidth, rectHeight);
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
bar test update. Tests now calculate expected layout from charts plot area and use that instead of precalculated QPointF magic numbers
r2073 if (qFuzzyIsNull(rectHeight)) {
sauimone
fixed crash in barchartitem after refactoring
r1603 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)
sauimone
bar test update. Tests now calculate expected layout from charts plot area and use that instead of precalculated QPointF magic numbers
r2073 ,yPos - rectHeight/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