##// END OF EJS Templates
Fixed documentation of qmlchart demo
Fixed documentation of qmlchart demo

File last commit:

r1506:1adeb672d1e0
r1520:a557edf16956
Show More
qbarseries.cpp
688 lines | 18.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
Naming convention change for barcharts. QBarChartSeries is now QBarSeries etc.
r338 #include "qbarseries.h"
Michal Klocek
Adds big fat pimpl to series classes...
r938 #include "qbarseries_p.h"
sauimone
removed barchartseriesbase. functionality is now in model
r172 #include "qbarset.h"
Michal Klocek
Adds big fat pimpl to series classes...
r938 #include "qbarset_p.h"
Michal Klocek
Refactor to use qseries private for implmentation interface...
r943 #include "domain_p.h"
Michal Klocek
Adds qlegend pimpl...
r950 #include "legendmarker_p.h"
Michal Klocek
Refactor to use qseries private for implmentation interface...
r943 #include "chartdataset_p.h"
#include "charttheme_p.h"
#include "chartanimator_p.h"
Michal Klocek
Adds big fat pimpl to series classes...
r938
sauimone
Integrating bar chart. Cleaned up old implementation. TODO: show this in test application. how?
r56 QTCOMMERCIALCHART_BEGIN_NAMESPACE
sauimone
Documentation for bar charts
r313 /*!
sauimone
Naming convention change for barcharts. QBarChartSeries is now QBarSeries etc.
r338 \class QBarSeries
sauimone
better brief descriptions for barcharts
r1502 \brief Series for creating a bar chart
Tero Ahola
Documentation fixes....
r995 \mainclass
sauimone
Documentation for bar charts
r313
sauimone
Fixed category handling of barcharts. Now the categories can be undefined. Updated documentation.
r1208 QBarSeries represents a series of data shown as bars. The purpose of this class is to draw bars to
the position defined by data. Single bar is defined by QPointF, where x value is the x-coordinate of the bar
and y-value is the height of the bar. The category names are ignored with this series and x-axis
shows the x-values.
sauimone
Documentation for bar charts
r313
Tero Ahola
Documentation fixes....
r995 See the \l {BarChart Example} {bar chart example} to learn how to create a simple bar chart.
\image examples_barchart.png
sauimone
Updated barchart documentation
r319
sauimone
replaced qbarcategory with qstringlist
r377 \sa QBarSet, QStackedBarSeries, QPercentBarSeries
sauimone
Documentation for bar charts
r313 */
Tero Ahola
Documenting QML bar series API
r1489 /*!
\qmlclass BarSeries QBarSeries
\beginfloatleft
\image demos_qmlchart6.png
\endfloat
\clearfloat
The following QML shows how to create a simple bar chart:
\snippet ../demos/qmlchart/qml/qmlchart/View6.qml 1
*/
sauimone
Documentation for bar charts
r313
Marek Rosa
Docs update for BarSeries and BarSet
r1361 /*!
sauimone
barmargin replaced with barwidth
r1425 \property QBarSeries::barWidth
Tero Ahola
Documenting QML bar series API
r1489 The width of the bars of the series. The unit of \a width is the unit of x-axis. The minimum width for bars
sauimone
barmargin replaced with barwidth
r1425 is zero and negative values are treated as zero. Setting the width to zero means that width of the bar on screen
is one pixel no matter what the scale of x-axis is. Bars wider than zero are scaled with x-axis.
Tero Ahola
Documenting QML bar series API
r1489 Note that with QGroupedBarSeries this value means the width of one group of bars instead of just one bar.
sauimone
barmargin replaced with barwidth
r1425 \sa QGroupedBarSeries
Marek Rosa
Docs update for BarSeries and BarSet
r1361 */
Tero Ahola
Documenting QML bar series API
r1489 /*!
\qmlproperty real BarSeries::barWidth
The width of the bars of the series. The unit of width is the unit of x-axis. The minimum width for bars
is zero and negative values are treated as zero. Setting the width to zero means that width of the bar on screen
is one pixel no matter what the scale of x-axis is. Bars wider than zero are scaled with x-axis.
Note that with QGroupedBarSeries this value means the width of one group of bars instead of just one bar.
*/
Marek Rosa
Docs update for BarSeries and BarSet
r1361
/*!
\property QBarSeries::count
Tero Ahola
Documenting QML bar series API
r1489 Holds the number of sets in series.
*/
/*!
\qmlproperty int BarSeries::count
Holds the number of sets in series.
Marek Rosa
Docs update for BarSeries and BarSet
r1361 */
/*!
\property QBarSeries::labelsVisible
Tero Ahola
Documenting QML bar series API
r1489 Defines the visibility of the labels in series
*/
/*!
\qmlproperty bool BarSeries::labelsVisible
Defines the visibility of the labels in series
Marek Rosa
Docs update for BarSeries and BarSet
r1361 */
sauimone
Documentation for bar charts
r313 /*!
sauimone
removed categories from barseries. categories are now only on axis
r1321 \fn void QBarSeries::clicked(QBarSet *barset, int index)
Tero Ahola
Updated documentation, warnings from legend and area left
r973
sauimone
removed categories from barseries. categories are now only on axis
r1321 The signal is emitted if the user clicks with a mouse on top of QBarSet \a barset.
Clicked bar inside set is indexed by \a index
Tero Ahola
Updated documentation, warnings from legend and area left
r973 */
Tero Ahola
Documenting QML bar series API
r1489 /*!
\qmlsignal BarSeries::onClicked(BarSet barset, int index)
The signal is emitted if the user clicks with a mouse on top of BarSet.
Clicked bar inside set is indexed by \a index
*/
Tero Ahola
Updated documentation, warnings from legend and area left
r973
sauimone
barchart: doc update for hover signals
r980 /*!
\fn void QBarSeries::hovered(QBarSet* barset, bool status)
The signal is emitted if mouse is hovered on top of series.
Parameter \a barset is the pointer of barset, where hover happened.
Parameter \a status is true, if mouse entered on top of series, false if mouse left from top of series.
*/
Tero Ahola
Documenting QML bar series API
r1489 /*!
\qmlsignal BarSeries::onHovered(BarSet barset, bool status)
The signal is emitted if mouse is hovered on top of series.
Parameter \a barset is the pointer of barset, where hover happened.
Parameter \a status is true, if mouse entered on top of series, false if mouse left from top of series.
*/
sauimone
added missing documentation to barseries
r1460
/*!
Tero Ahola
Minor modifications to properties of abstract, area and bar series
r1462 \fn void QBarSeries::countChanged()
Tero Ahola
Documenting QML bar series API
r1489 This signal is emitted when barset count has been changed, for example by append or remove.
*/
/*!
\qmlsignal BarSeries::countChanged()
sauimone
added missing documentation to barseries
r1460 This signal is emitted when barset count has been changed, for example by append or remove.
*/
sauimone
barchart: doc update for hover signals
r980
Marek Rosa
Docs update for BarSeries and BarSet
r1361 /*!
\fn void QBarSeries::labelsVisibleChanged()
Tero Ahola
Documenting QML bar series API
r1489 This signal is emitted when labels visibility have changed.
Marek Rosa
Added insert method to QBarSeries
r1362 \sa isLabelsVisible(), setLabelsVisible()
Marek Rosa
Docs update for BarSeries and BarSet
r1361 */
/*!
\fn void QBarSeries::barsetsAdded(QList<QBarSet*> sets)
This signal is emitted when \a sets have been added to the series.
\sa append(), insert()
*/
Tero Ahola
QML BarSeries added/removed signals
r1506 /*!
\qmlsignal BarSeries::added(BarSet barset)
Emitted when \a barset has been added to the series.
*/
Marek Rosa
Docs update for BarSeries and BarSet
r1361
/*!
\fn void QBarSeries::barsetsRemoved(QList<QBarSet*> sets)
This signal is emitted when \a sets have been removed from the series.
\sa remove()
*/
Tero Ahola
QML BarSeries added/removed signals
r1506 /*!
\qmlsignal BarSeries::removed(BarSet barset)
Emitted when \a barset has been removed from the series.
*/
Marek Rosa
Docs update for BarSeries and BarSet
r1361
sauimone
Documentation for bar charts
r313 /*!
sauimone
Fixed category handling of barcharts. Now the categories can be undefined. Updated documentation.
r1208 Constructs empty QBarSeries.
sauimone
Naming convention change for barcharts. QBarChartSeries is now QBarSeries etc.
r338 QBarSeries is QObject which is a child of a \a parent.
sauimone
Documentation for bar charts
r313 */
sauimone
Fixed category handling of barcharts. Now the categories can be undefined. Updated documentation.
r1208 QBarSeries::QBarSeries(QObject *parent) :
QAbstractSeries(*new QBarSeriesPrivate(this),parent)
Michal Klocek
Adds big fat pimpl to series classes...
r938 {
}
sauimone
barchart: doc update for hover signals
r980 /*!
Destructs barseries and owned barsets.
*/
QBarSeries::~QBarSeries()
{
sauimone
legend detach example. Bug fixes to legend.
r1263 Q_D(QBarSeries);
if(d->m_dataset){
d->m_dataset->removeSeries(this);
}
sauimone
barchart: doc update for hover signals
r980 }
Tero Ahola
Updated documentation, warnings from legend and area left
r973 /*!
\internal
*/
QBarSeries::QBarSeries(QBarSeriesPrivate &d, QObject *parent) :
Tero Ahola
Renamed QSeries to QAbstractSeries
r988 QAbstractSeries(d,parent)
Michal Klocek
Refactor to use qseries private for implmentation interface...
r943 {
}
sauimone
barchart: doc update for hover signals
r980 /*!
Returns the type of series. Derived classes override this.
*/
Michal Klocek
Fixes to API , QSeriesType -> SeriesType , add missing getters
r1107 QAbstractSeries::SeriesType QBarSeries::type() const
sauimone
Improved bar chart series
r71 {
Tero Ahola
Renamed QSeries to QAbstractSeries
r988 return QAbstractSeries::SeriesTypeBar;
sauimone
Improved bar chart series
r71 }
sauimone
updated documentation for barseries
r1493 /*!
Sets the width of the bars of the series. The unit of \a width is the unit of x-axis. The minimum width for bars
is zero and negative values are treated as zero. Setting the width to zero means that width of the bar on screen
is one pixel no matter what the scale of x-axis is. Bars wider than zero are scaled with x-axis.
Note that with \link QGroupedBarSeries \endlink this value means the width of one group of bars instead of just one bar.
*/
sauimone
barmargin replaced with barwidth
r1425 void QBarSeries::setBarWidth(qreal width)
sauimone
bar margin setter to series
r1283 {
Q_D(QBarSeries);
sauimone
barmargin replaced with barwidth
r1425 d->setBarWidth(width);
sauimone
bar margin setter to series
r1283 }
sauimone
updated documentation for barseries
r1493 /*!
Returns the width of the bars of the series.
\sa setBarWidth()
*/
sauimone
barmargin replaced with barwidth
r1425 qreal QBarSeries::barWidth() const
sauimone
visible property to barseries
r1284 {
Q_D(const QBarSeries);
sauimone
barmargin replaced with barwidth
r1425 return d->barWidth();
sauimone
visible property to barseries
r1284 }
sauimone
Documentation for bar charts
r313 /*!
sauimone
Fixed category handling of barcharts. Now the categories can be undefined. Updated documentation.
r1208 Adds a set of bars to series. Takes ownership of \a set. If the set is null or is already in series, it won't be appended.
Returns true, if appending succeeded.
sauimone
Documentation for bar charts
r313 */
sauimone
Renamed appendBarSet to append, removeBarSet to remove
r1194 bool QBarSeries::append(QBarSet *set)
sauimone
Barset and barcategory implememtation. Updated test application
r171 {
sauimone
barchart pimpl part 1
r934 Q_D(QBarSeries);
sauimone
barchart signals for properties and changes
r1353 bool success = d->append(set);
if (success) {
QList<QBarSet*> sets;
sets.append(set);
emit barsetsAdded(sets);
Tero Ahola
Minor modifications to properties of abstract, area and bar series
r1462 emit countChanged();
sauimone
barchart signals for properties and changes
r1353 }
return success;
sauimone
Barset and barcategory implememtation. Updated test application
r171 }
sauimone
Documentation for bar charts
r313 /*!
Michal Klocek
Krazy reported errors...
r974 Removes a set of bars from series. Releases ownership of \a set. Doesn't delete \a set.
sauimone
Fixed category handling of barcharts. Now the categories can be undefined. Updated documentation.
r1208 Returns true, if set was removed.
sauimone
Documentation for bar charts
r313 */
sauimone
Renamed appendBarSet to append, removeBarSet to remove
r1194 bool QBarSeries::remove(QBarSet *set)
sauimone
Barset and barcategory implememtation. Updated test application
r171 {
sauimone
barchart pimpl part 1
r934 Q_D(QBarSeries);
sauimone
barchart signals for properties and changes
r1353 bool success = d->remove(set);
if (success) {
QList<QBarSet*> sets;
sets.append(set);
emit barsetsRemoved(sets);
Tero Ahola
Minor modifications to properties of abstract, area and bar series
r1462 emit countChanged();
sauimone
barchart signals for properties and changes
r1353 }
return success;
sauimone
percent barchart layout fix. signal fix
r850 }
/*!
Adds a list of barsets to series. Takes ownership of \a sets.
sauimone
Fixed category handling of barcharts. Now the categories can be undefined. Updated documentation.
r1208 Returns true, if all sets were appended succesfully. If any of the sets is null or is already appended to series,
nothing is appended and function returns false. If any of the sets is in list more than once, nothing is appended
and function returns false.
sauimone
percent barchart layout fix. signal fix
r850 */
sauimone
Renamed appendBarSet to append, removeBarSet to remove
r1194 bool QBarSeries::append(QList<QBarSet* > sets)
sauimone
percent barchart layout fix. signal fix
r850 {
sauimone
barchart pimpl part 1
r934 Q_D(QBarSeries);
sauimone
barchart signals for properties and changes
r1353 bool success = d->append(sets);
if (success) {
emit barsetsAdded(sets);
Tero Ahola
Minor modifications to properties of abstract, area and bar series
r1462 emit countChanged();
sauimone
barchart signals for properties and changes
r1353 }
return success;
sauimone
percent barchart layout fix. signal fix
r850 }
Marek Rosa
Added insert method to QBarSeries
r1362 /*!
Insert a set of bars to series at \a index postion. Takes ownership of \a set. If the set is null or is already in series, it won't be appended.
Returns true, if inserting succeeded.
*/
bool QBarSeries::insert(int index, QBarSet *set)
{
Q_D(QBarSeries);
bool success = d->insert(index, set);
if (success) {
QList<QBarSet*> sets;
sets.append(set);
emit barsetsAdded(sets);
Tero Ahola
Minor modifications to properties of abstract, area and bar series
r1462 emit countChanged();
Marek Rosa
Added insert method to QBarSeries
r1362 }
return success;
}
Marek Rosa
Fixes to BarSeries and BarModelMapper
r1356 /*!
Removes all of the bar sets from the series
*/
Marek Rosa
BarModelMapper: implemented model updated slots. Some more work needed with categories
r1295 void QBarSeries::clear()
{
Q_D(QBarSeries);
Marek Rosa
Added some tests for BarModelMapper
r1364 QList<QBarSet *> sets = barSets();
bool success = d->remove(sets);
Marek Rosa
Minor fixes and started changing ReadMe
r1363 if (success) {
emit barsetsRemoved(sets);
Tero Ahola
Minor modifications to properties of abstract, area and bar series
r1462 emit countChanged();
Marek Rosa
Minor fixes and started changing ReadMe
r1363 }
Marek Rosa
BarModelMapper: implemented model updated slots. Some more work needed with categories
r1295 }
sauimone
Documentation for bar charts
r313 /*!
Returns number of sets in series.
*/
Tero Ahola
Minor modifications to properties of abstract, area and bar series
r1462 int QBarSeries::count() const
sauimone
Added pen & brush to QBarSet
r214 {
sauimone
barchart pimpl part 1
r934 Q_D(const QBarSeries);
sauimone
barchart: removed old model
r1005 return d->m_barSets.count();
sauimone
Added pen & brush to QBarSet
r214 }
sauimone
Documentation for bar charts
r313 /*!
sauimone
review fix: Removed iterator from barseries. Remove const from brush and pen. Renamed setters for tooltip, floating values and separators
r357 Returns a list of sets in series. Keeps ownership of sets.
*/
sauimone
const to getters, renamed addBarset to appendBarset
r776 QList<QBarSet*> QBarSeries::barSets() const
sauimone
Added pen & brush to QBarSet
r214 {
sauimone
barchart pimpl part 1
r934 Q_D(const QBarSeries);
sauimone
barchart: removed old model
r1005 return d->m_barSets;
sauimone
Added pen & brush to QBarSet
r214 }
sauimone
fixed clipping in barcharts
r839 /*!
Sets the visibility of labels in series to \a visible
*/
sauimone
renamed barchart floating values with labels to be consistent with piechart
r820 void QBarSeries::setLabelsVisible(bool visible)
sauimone
values visibility handling changed in barchart
r813 {
sauimone
removed barlabel. label visibility control is now per series instead of per set
r1246 Q_D(QBarSeries);
if (d->m_labelsVisible != visible) {
sauimone
barchart signals for properties and changes
r1353 d->setLabelsVisible(visible);
emit labelsVisibleChanged();
sauimone
values visibility handling changed in barchart
r813 }
}
sauimone
minor doc update
r1299 /*!
Returns the visibility of labels
*/
Marek Rosa
Added insert method to QBarSeries
r1362 bool QBarSeries::isLabelsVisible() const
sauimone
removed barlabel. label visibility control is now per series instead of per set
r1246 {
Q_D(const QBarSeries);
return d->m_labelsVisible;
}
Michal Klocek
Adds big fat pimpl to series classes...
r938 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
sauimone
new series: groupedbarseries
r1167 QBarSeriesPrivate::QBarSeriesPrivate(QBarSeries *q) :
Tero Ahola
Renamed QSeries to QAbstractSeries
r988 QAbstractSeriesPrivate(q),
sauimone
barmargin replaced with barwidth
r1425 m_barWidth(0.5), // Default value is 50% of category width
sauimone
visible property to barseries
r1284 m_labelsVisible(false),
m_visible(true)
Michal Klocek
Adds big fat pimpl to series classes...
r938 {
}
sauimone
Fixed category handling of barcharts. Now the categories can be undefined. Updated documentation.
r1208 int QBarSeriesPrivate::categoryCount() const
{
// No categories defined. return count of longest set.
int count = 0;
for (int i=0; i<m_barSets.count(); i++) {
if (m_barSets.at(i)->count() > count) {
count = m_barSets.at(i)->count();
}
}
return count;
}
sauimone
barmargin replaced with barwidth
r1425 void QBarSeriesPrivate::setBarWidth(qreal width)
sauimone
new series: groupedbarseries
r1167 {
sauimone
barmargin replaced with barwidth
r1425 if (width < 0.0) {
width = 0.0;
sauimone
new series: groupedbarseries
r1167 }
sauimone
barmargin replaced with barwidth
r1425 m_barWidth = width;
sauimone
new series: groupedbarseries
r1167 emit updatedBars();
}
sauimone
barmargin replaced with barwidth
r1425 qreal QBarSeriesPrivate::barWidth() const
sauimone
new series: groupedbarseries
r1167 {
sauimone
barmargin replaced with barwidth
r1425 return m_barWidth;
sauimone
new series: groupedbarseries
r1167 }
sauimone
separated categories from barseries constructor
r1112
Michal Klocek
Adds big fat pimpl to series classes...
r938 QBarSet* QBarSeriesPrivate::barsetAt(int index)
{
sauimone
barchart: removed old model
r1005 return m_barSets.at(index);
Michal Klocek
Adds big fat pimpl to series classes...
r938 }
sauimone
visible property to barseries
r1284 void QBarSeriesPrivate::setVisible(bool visible)
{
sauimone
barchart signals for properties and changes
r1353 m_visible = visible;
emit updatedBars();
sauimone
visible property to barseries
r1284 }
sauimone
barchart signals for properties and changes
r1353 void QBarSeriesPrivate::setLabelsVisible(bool visible)
sauimone
visible property to barseries
r1284 {
sauimone
barchart signals for properties and changes
r1353 m_labelsVisible = visible;
emit labelsVisibleChanged(visible);
sauimone
visible property to barseries
r1284 }
Michal Klocek
Adds big fat pimpl to series classes...
r938 qreal QBarSeriesPrivate::min()
{
sauimone
barchart: removed old model
r1005 if (m_barSets.count() <= 0) {
return 0;
}
qreal min = INT_MAX;
for (int i = 0; i < m_barSets.count(); i++) {
int categoryCount = m_barSets.at(i)->count();
for (int j = 0; j < categoryCount; j++) {
sauimone
new series: groupedbarseries
r1167 qreal temp = m_barSets.at(i)->at(j).y();
sauimone
barchart: removed old model
r1005 if (temp < min)
min = temp;
}
}
return min;
Michal Klocek
Adds big fat pimpl to series classes...
r938 }
qreal QBarSeriesPrivate::max()
{
sauimone
barchart: removed old model
r1005 if (m_barSets.count() <= 0) {
return 0;
}
qreal max = INT_MIN;
for (int i = 0; i < m_barSets.count(); i++) {
int categoryCount = m_barSets.at(i)->count();
for (int j = 0; j < categoryCount; j++) {
sauimone
new series: groupedbarseries
r1167 qreal temp = m_barSets.at(i)->at(j).y();
sauimone
barchart: removed old model
r1005 if (temp > max)
max = temp;
}
}
return max;
Michal Klocek
Adds big fat pimpl to series classes...
r938 }
qreal QBarSeriesPrivate::valueAt(int set, int category)
{
sauimone
barchart: removed old model
r1005 if ((set < 0) || (set >= m_barSets.count())) {
// No set, no value.
return 0;
} else if ((category < 0) || (category >= m_barSets.at(set)->count())) {
// No category, no value.
return 0;
}
sauimone
new series: groupedbarseries
r1167 return m_barSets.at(set)->at(category).y();
Michal Klocek
Adds big fat pimpl to series classes...
r938 }
qreal QBarSeriesPrivate::percentageAt(int set, int category)
{
sauimone
barchart: removed old model
r1005 if ((set < 0) || (set >= m_barSets.count())) {
// No set, no value.
return 0;
} else if ((category < 0) || (category >= m_barSets.at(set)->count())) {
// No category, no value.
return 0;
}
sauimone
new series: groupedbarseries
r1167 qreal value = m_barSets.at(set)->at(category).y();
sauimone
barchart: removed old model
r1005 qreal sum = categorySum(category);
if ( qFuzzyIsNull(sum) ) {
return 0;
}
return value / sum;
Michal Klocek
Adds big fat pimpl to series classes...
r938 }
qreal QBarSeriesPrivate::categorySum(int category)
{
sauimone
barchart: removed old model
r1005 qreal sum(0);
int count = m_barSets.count(); // Count sets
for (int set = 0; set < count; set++) {
if (category < m_barSets.at(set)->count())
sauimone
new series: groupedbarseries
r1167 sum += m_barSets.at(set)->at(category).y();
sauimone
barchart: removed old model
r1005 }
return sum;
Michal Klocek
Adds big fat pimpl to series classes...
r938 }
qreal QBarSeriesPrivate::absoluteCategorySum(int category)
{
sauimone
barchart: removed old model
r1005 qreal sum(0);
int count = m_barSets.count(); // Count sets
for (int set = 0; set < count; set++) {
if (category < m_barSets.at(set)->count())
sauimone
new series: groupedbarseries
r1167 sum += qAbs(m_barSets.at(set)->at(category).y());
sauimone
barchart: removed old model
r1005 }
return sum;
Michal Klocek
Adds big fat pimpl to series classes...
r938 }
qreal QBarSeriesPrivate::maxCategorySum()
{
sauimone
barchart: removed old model
r1005 qreal max = INT_MIN;
sauimone
Fixed category handling of barcharts. Now the categories can be undefined. Updated documentation.
r1208 int count = categoryCount();
sauimone
barchart: removed old model
r1005 for (int i = 0; i < count; i++) {
qreal sum = categorySum(i);
if (sum > max)
max = sum;
}
return max;
Michal Klocek
Adds big fat pimpl to series classes...
r938 }
sauimone
scaledomain fix for barchart
r1423 qreal QBarSeriesPrivate::minX()
{
if (m_barSets.count() <= 0) {
return 0;
}
qreal min = INT_MAX;
for (int i = 0; i < m_barSets.count(); i++) {
int categoryCount = m_barSets.at(i)->count();
for (int j = 0; j < categoryCount; j++) {
qreal temp = m_barSets.at(i)->at(j).x();
if (temp < min)
min = temp;
}
}
return min;
}
qreal QBarSeriesPrivate::maxX()
{
if (m_barSets.count() <= 0) {
return 0;
}
qreal max = INT_MIN;
for (int i = 0; i < m_barSets.count(); i++) {
int categoryCount = m_barSets.at(i)->count();
for (int j = 0; j < categoryCount; j++) {
qreal temp = m_barSets.at(i)->at(j).x();
if (temp > max)
max = temp;
}
}
return max;
}
Michal Klocek
Refactor to use qseries private for implmentation interface...
r943 void QBarSeriesPrivate::scaleDomain(Domain& domain)
{
qreal minX(domain.minX());
qreal minY(domain.minY());
qreal maxX(domain.maxX());
qreal maxY(domain.maxY());
int tickXCount(domain.tickXCount());
int tickYCount(domain.tickYCount());
sauimone
scaledomain fix for barchart
r1423 qreal seriesMinX = this->minX();
qreal seriesMaxX = this->maxX();
sauimone
barchart PIMPL part 2. Cleaning up leftovers in public api
r962 qreal y = max();
sauimone
scaledomain fix for barchart
r1423 minX = qMin(minX, seriesMinX - 0.5);
Michal Klocek
Refactor to use qseries private for implmentation interface...
r943 minY = qMin(minY, y);
sauimone
scaledomain fix for barchart
r1423 maxX = qMax(maxX, seriesMaxX + 0.5);
Michal Klocek
Refactor to use qseries private for implmentation interface...
r943 maxY = qMax(maxY, y);
sauimone
scaledomain fix for barchart
r1423 tickXCount = categoryCount()+1;
Michal Klocek
Refactor to use qseries private for implmentation interface...
r943
Michal Klocek
Refactor axis hadnling...
r1078 domain.setRange(minX,maxX,minY,maxY,tickXCount,tickYCount);
Michal Klocek
Refactor to use qseries private for implmentation interface...
r943 }
Chart* QBarSeriesPrivate::createGraphics(ChartPresenter* presenter)
{
Q_Q(QBarSeries);
BarChartItem* bar = new BarChartItem(q,presenter);
if(presenter->animationOptions().testFlag(QChart::SeriesAnimations)) {
presenter->animator()->addAnimation(bar);
}
presenter->chartTheme()->decorate(q, presenter->dataSet()->seriesIndex(q));
return bar;
}
Michal Klocek
Adds qlegend pimpl...
r950 QList<LegendMarker*> QBarSeriesPrivate::createLegendMarker(QLegend* legend)
{
Q_Q(QBarSeries);
QList<LegendMarker*> markers;
foreach(QBarSet* set, q->barSets()) {
BarLegendMarker* marker = new BarLegendMarker(q,set,legend);
markers << marker;
}
return markers;
}
sauimone
legend detach example. Bug fixes to legend.
r1263 bool QBarSeriesPrivate::append(QBarSet *set)
{
Q_Q(QBarSeries);
if ((m_barSets.contains(set)) || (set == 0)) {
// Fail if set is already in list or set is null.
return false;
}
m_barSets.append(set);
sauimone
fixed crash in barseries with empty sets
r1339 QObject::connect(set->d_ptr.data(), SIGNAL(updatedBars()), this, SIGNAL(updatedBars()));
QObject::connect(set->d_ptr.data(), SIGNAL(restructuredBars()), this, SIGNAL(restructuredBars()));
sauimone
bugfix: notifying legend before barchartitem caused crash in some situations
r1437 emit restructuredBars(); // this notifies barchartitem
sauimone
legend detach example. Bug fixes to legend.
r1263 if (m_dataset) {
m_dataset->updateSeries(q); // this notifies legend
}
return true;
}
bool QBarSeriesPrivate::remove(QBarSet *set)
{
Q_Q(QBarSeries);
if (!m_barSets.contains(set)) {
// Fail if set is not in list
return false;
}
m_barSets.removeOne(set);
sauimone
fixed crash in barseries with empty sets
r1339 QObject::disconnect(set->d_ptr.data(), SIGNAL(updatedBars()), this, SIGNAL(updatedBars()));
QObject::disconnect(set->d_ptr.data(), SIGNAL(restructuredBars()), this, SIGNAL(restructuredBars()));
sauimone
bugfix: notifying legend before barchartitem caused crash in some situations
r1437 emit restructuredBars(); // this notifies barchartitem
sauimone
legend detach example. Bug fixes to legend.
r1263 if (m_dataset) {
m_dataset->updateSeries(q); // this notifies legend
}
return true;
}
bool QBarSeriesPrivate::append(QList<QBarSet* > sets)
{
Q_Q(QBarSeries);
foreach (QBarSet* set, sets) {
if ((set == 0) || (m_barSets.contains(set))) {
// Fail if any of the sets is null or is already appended.
return false;
}
if (sets.count(set) != 1) {
// Also fail if same set is more than once in given list.
return false;
}
}
foreach (QBarSet* set, sets) {
m_barSets.append(set);
sauimone
fixed crash in barseries with empty sets
r1339 QObject::connect(set->d_ptr.data(), SIGNAL(updatedBars()), this, SIGNAL(updatedBars()));
QObject::connect(set->d_ptr.data(), SIGNAL(restructuredBars()), this, SIGNAL(restructuredBars()));
sauimone
legend detach example. Bug fixes to legend.
r1263 }
sauimone
bugfix: notifying legend before barchartitem caused crash in some situations
r1437 emit restructuredBars(); // this notifies barchartitem
sauimone
legend detach example. Bug fixes to legend.
r1263 if (m_dataset) {
m_dataset->updateSeries(q); // this notifies legend
}
return true;
}
bool QBarSeriesPrivate::remove(QList<QBarSet* > sets)
{
Q_Q(QBarSeries);
sauimone
fix barseries remove return value with empty list
r1371 if (sets.count() == 0) {
return false;
}
sauimone
legend detach example. Bug fixes to legend.
r1263 foreach (QBarSet* set, sets) {
sauimone
barchart signals for properties and changes
r1353 if ((set == 0) || (!m_barSets.contains(set))) {
// Fail if any of the sets is null or is not in series
return false;
}
if (sets.count(set) != 1) {
// Also fail if same set is more than once in given list.
return false;
sauimone
legend detach example. Bug fixes to legend.
r1263 }
}
sauimone
barchart signals for properties and changes
r1353 foreach (QBarSet* set, sets) {
m_barSets.removeOne(set);
QObject::disconnect(set->d_ptr.data(), SIGNAL(updatedBars()), this, SIGNAL(updatedBars()));
QObject::disconnect(set->d_ptr.data(), SIGNAL(restructuredBars()), this, SIGNAL(restructuredBars()));
sauimone
legend detach example. Bug fixes to legend.
r1263 }
sauimone
barchart signals for properties and changes
r1353
sauimone
bugfix: notifying legend before barchartitem caused crash in some situations
r1437 emit restructuredBars(); // this notifies barchartitem
sauimone
barchart signals for properties and changes
r1353 if (m_dataset) {
m_dataset->updateSeries(q); // this notifies legend
}
return true;
sauimone
legend detach example. Bug fixes to legend.
r1263 }
Marek Rosa
Added insert method to QBarSeries
r1362 bool QBarSeriesPrivate::insert(int index, QBarSet *set)
{
Q_Q(QBarSeries);
if ((m_barSets.contains(set)) || (set == 0)) {
// Fail if set is already in list or set is null.
return false;
}
m_barSets.insert(index, set);
QObject::connect(set->d_ptr.data(), SIGNAL(updatedBars()), this, SIGNAL(updatedBars()));
QObject::connect(set->d_ptr.data(), SIGNAL(restructuredBars()), this, SIGNAL(restructuredBars()));
sauimone
bugfix: notifying legend before barchartitem caused crash in some situations
r1437 emit restructuredBars(); // this notifies barchartitem
Marek Rosa
Added insert method to QBarSeries
r1362 if (m_dataset) {
m_dataset->updateSeries(q); // this notifies legend
}
return true;
}
sauimone
Naming convention change for barcharts. QBarChartSeries is now QBarSeries etc.
r338 #include "moc_qbarseries.cpp"
Michal Klocek
Adds big fat pimpl to series classes...
r938 #include "moc_qbarseries_p.cpp"
sauimone
Improved bar chart series
r71
sauimone
Integrating bar chart. Cleaned up old implementation. TODO: show this in test application. how?
r56 QTCOMMERCIALCHART_END_NAMESPACE