##// END OF EJS Templates
Selectable outlines for box...
Selectable outlines for box Change-Id: Ic31fa26f914baaa6c26f52c73ca4328ec7523581 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com>

File last commit:

r2432:53927f716a3d
r2573:3880b19e7795
Show More
barchartitem.cpp
97 lines | 3.8 KiB | text/x-c | CppLexer
Jani Honkonen
Add license headers
r794 /****************************************************************************
**
Miikka Heikkinen
Fixed the copyright year 2012 -> 2013
r2432 ** Copyright (C) 2013 Digia Plc
Jani Honkonen
Add license headers
r794 ** 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
Michal Klocek
Refactors internals...
r2273 BarChartItem::BarChartItem(QAbstractBarSeries *series, QGraphicsItem* item) :
AbstractBarChartItem(series, item)
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
Marek Rosa
Bar animations refactored
r2316 void BarChartItem::initializeLayout()
{
qreal categoryCount = m_series->d_func()->categoryCount();
qreal setCount = m_series->count();
qreal barWidth = m_series->d_func()->barWidth();
m_layout.clear();
for(int category = 0; category < categoryCount; category++) {
for (int set = 0; set < setCount; set++) {
QRectF rect;
QPointF topLeft;
QPointF bottomRight;
if (domain()->type() == AbstractDomain::XLogYDomain || domain()->type() == AbstractDomain::LogXLogYDomain) {
Marek Rosa
Negative values with log axis handled
r2356 topLeft = domain()->calculateGeometryPoint(QPointF(category - barWidth / 2 + set/setCount * barWidth, domain()->minY()), m_validData);
Marek Rosa
Fixed: bar animation when resizing
r2387 bottomRight = domain()->calculateGeometryPoint(QPointF(category - barWidth / 2 + (set + 1)/setCount * barWidth, domain()->minY()), m_validData);
Marek Rosa
Bar animations refactored
r2316 } else {
Marek Rosa
Negative values with log axis handled
r2356 topLeft = domain()->calculateGeometryPoint(QPointF(category - barWidth / 2 + set/setCount * barWidth, 0), m_validData);
bottomRight = domain()->calculateGeometryPoint(QPointF(category - barWidth / 2 + (set + 1)/setCount * barWidth, 0), m_validData);
Marek Rosa
Bar animations refactored
r2316 }
Marek Rosa
Negative values with log axis handled
r2356 if (!m_validData)
return;
Marek Rosa
Bar animations refactored
r2316 rect.setTopLeft(topLeft);
rect.setBottomRight(bottomRight);
m_layout.append(rect.normalized());
}
}
}
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();
Marek Rosa
New bar calculate layout
r2303 qreal barWidth = m_series->d_func()->barWidth();
sauimone
barchart animation mechanics working. still some todo
r681
Marek Rosa
New bar calculate layout
r2303 for(int category = 0; category < categoryCount; category++) {
sauimone
barchart animation mechanics working. still some todo
r681 for (int set = 0; set < setCount; set++) {
Marek Rosa
New bar calculate layout
r2303 qreal value = m_series->barSets().at(set)->at(category);
QRectF rect;
Marek Rosa
Negative values with log axis handled
r2356 QPointF topLeft = domain()->calculateGeometryPoint(QPointF(category - barWidth / 2 + (set)/(setCount) * barWidth, value), m_validData);
Marek Rosa
New bar calculate layout
r2303 QPointF bottomRight;
Marek Rosa
BarChartItems code cleanup
r2305 if (domain()->type() == AbstractDomain::XLogYDomain || domain()->type() == AbstractDomain::LogXLogYDomain)
Marek Rosa
Negative values with log axis handled
r2356 bottomRight = domain()->calculateGeometryPoint(QPointF(category - barWidth / 2 + (set + 1)/(setCount) * barWidth, domain()->minY()), m_validData);
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 else
Marek Rosa
Negative values with log axis handled
r2356 bottomRight = domain()->calculateGeometryPoint(QPointF(category - barWidth / 2 + (set + 1)/(setCount) * barWidth, 0), m_validData);
if (!m_validData)
return QVector<QRectF>();
Marek Rosa
New bar calculate layout
r2303 rect.setTopLeft(topLeft);
rect.setBottomRight(bottomRight);
Marek Rosa
Bar animations refactored
r2316 layout.append(rect.normalized());
sauimone
barchart animation mechanics working. still some todo
r681 }
}
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