##// END OF EJS Templates
Added parametric zoom on QChart....
Added parametric zoom on QChart. Signed-off-by: jeandet <alexis.jeandet@member.fsf.org>

File last commit:

r2854:46147b040d06
r2900:7532b52dd10c
Show More
qabstractbarseries.cpp
1104 lines | 33.6 KiB | text/x-c | CppLexer
/ src / charts / barchart / qabstractbarseries.cpp
Miikka Heikkinen
Updated license...
r2854 /****************************************************************************
Jani Honkonen
Add license headers
r794 **
Miikka Heikkinen
Updated license...
r2854 ** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
Jani Honkonen
Add license headers
r794 **
Miikka Heikkinen
Updated license...
r2854 ** This file is part of the Qt Charts module of the Qt Toolkit.
Jani Honkonen
Add license headers
r794 **
Miikka Heikkinen
Updated license...
r2854 ** $QT_BEGIN_LICENSE:GPL$
Titta Heikkala
Updated license headers...
r2845 ** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
Miikka Heikkinen
Updated license...
r2854 ** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 or (at your option) any later version
** approved by the KDE Free Qt Foundation. The licenses are as published by
** the Free Software Foundation and appearing in the file LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
Jani Honkonen
Add license headers
r794 **
Titta Heikkala
Updated license headers...
r2845 ** $QT_END_LICENSE$
**
Miikka Heikkinen
Updated license...
r2854 ****************************************************************************/
Jani Honkonen
Add license headers
r794
Titta Heikkala
Fix include syntax...
r2714 #include <QtCharts/QAbstractBarSeries>
#include <private/qabstractbarseries_p.h>
#include <QtCharts/QBarSet>
#include <private/qbarset_p.h>
#include <private/abstractdomain_p.h>
#include <private/chartdataset_p.h>
#include <private/charttheme_p.h>
#include <QtCharts/QValueAxis>
#include <QtCharts/QBarCategoryAxis>
#include <QtCharts/QBarLegendMarker>
#include <private/baranimation_p.h>
#include <private/abstractbarchartitem_p.h>
#include <private/qchart_p.h>
sauimone
tidying up legend marker code. Added QBarLegendMarker
r2174
Titta Heikkala
Qt Charts project file structure change...
r2712 QT_CHARTS_BEGIN_NAMESPACE
sauimone
Integrating bar chart. Cleaned up old implementation. TODO: show this in test application. how?
r56
sauimone
Documentation for bar charts
r313 /*!
sauimone
renamed barseries files to abstractbarseries
r1586 \class QAbstractBarSeries
Titta Heikkala
Fix Charts documentation...
r2639 \inmodule Qt Charts
Miikka Heikkinen
Fix some documentation issues...
r2520 \brief Series for creating a bar chart.
sauimone
Documentation for bar charts
r313
sauimone
renamed barseries files to abstractbarseries
r1586 QAbstractBarSeries represents a series of data shown as bars. The purpose of this class is to draw bars to
sauimone
Fixed category handling of barcharts. Now the categories can be undefined. Updated documentation.
r1208 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 /*!
Titta Heikkala
Fix Charts documentation...
r2639 \qmltype AbstractBarSeries
\instantiates QAbstractBarSeries
Titta Heikkala
Qt Charts project file structure change...
r2712 \inqmlmodule QtCharts
Tero Ahola
QML methods of series: several fixes and documentation
r1521
Titta Heikkala
Qt Charts project file structure change...
r2712 \inherits AbstractSeries
\brief Series type for creating a bar chart.
The following QML shows how to create a simple bar chart:
\snippet qmlchart/qml/qmlchart/View6.qml 1
Tero Ahola
Documenting QML bar series API
r1489
Titta Heikkala
Qt Charts project file structure change...
r2712 \beginfloatleft
\image examples_qmlchart6.png
\endfloat
\clearfloat
Tero Ahola
Documenting QML bar series API
r1489 */
sauimone
Documentation for bar charts
r313
Tero Ahola
Fixed documentation issues in QML API
r2331 /*!
\qmlproperty AbstractAxis AbstractBarSeries::axisX
The x axis used for the series. If you leave both axisX and axisXTop undefined, a BarCategoriesAxis is created for
the series.
\sa axisXTop
*/
/*!
\qmlproperty AbstractAxis AbstractBarSeries::axisY
The y axis used for the series. If you leave both axisY and axisYRight undefined, a ValueAxis is created for
the series.
\sa axisYRight
*/
/*!
\qmlproperty AbstractAxis AbstractBarSeries::axisXTop
The x axis used for the series, drawn on top of the chart view. Note that you can only provide either axisX or
axisXTop, but not both.
\sa axisX
*/
/*!
\qmlproperty AbstractAxis AbstractBarSeries::axisYRight
The y axis used for the series, drawn to the right on the chart view. Note that you can only provide either axisY
or axisYRight, but not both.
\sa axisY
*/
Marek Rosa
Docs update for BarSeries and BarSet
r1361 /*!
sauimone
renamed barseries files to abstractbarseries
r1586 \property QAbstractBarSeries::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.
sauimone
GroupedBarSeries to BarSeries
r1594 Note that with QBarSeries this value means the width of one group of bars instead of just one bar.
\sa QBarSeries
Marek Rosa
Docs update for BarSeries and BarSet
r1361 */
Tero Ahola
Documenting QML bar series API
r1489 /*!
sauimone
changed barseries to abstractbarseries in documentation
r1590 \qmlproperty real AbstractBarSeries::barWidth
Tero Ahola
Documenting QML bar series API
r1489 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.
sauimone
GroupedBarSeries to BarSeries
r1594 Note that with QBarSeries this value means the width of one group of bars instead of just one bar.
Tero Ahola
Documenting QML bar series API
r1489 */
Marek Rosa
Docs update for BarSeries and BarSet
r1361
/*!
sauimone
renamed barseries files to abstractbarseries
r1586 \property QAbstractBarSeries::count
Tero Ahola
Documenting QML bar series API
r1489 Holds the number of sets in series.
*/
/*!
sauimone
changed barseries to abstractbarseries in documentation
r1590 \qmlproperty int AbstractBarSeries::count
Tero Ahola
Documenting QML bar series API
r1489 Holds the number of sets in series.
Marek Rosa
Docs update for BarSeries and BarSet
r1361 */
/*!
sauimone
renamed barseries files to abstractbarseries
r1586 \property QAbstractBarSeries::labelsVisible
Tero Ahola
Documenting QML bar series API
r1489 Defines the visibility of the labels in series
*/
/*!
sauimone
changed barseries to abstractbarseries in documentation
r1590 \qmlproperty bool AbstractBarSeries::labelsVisible
Tero Ahola
Documenting QML bar series API
r1489 Defines the visibility of the labels in series
Marek Rosa
Docs update for BarSeries and BarSet
r1361 */
Titta Heikkala
Added possibility to show series value...
r2689 /*!
\property QAbstractBarSeries::labelsFormat
The \a format used for showing labels in series.
QAbstractBarSeries supports the following format tag:
\table
\row
\li @value \li The value of the bar
\endtable
For example, the following usage of the format tags would produce labels that show the value
followed by unit ('u'):
\code
series->setLabelsFormat("@value u");
\endcode
By default, the labels shows the value of the bar. For percent bar series '%' is added after
the value. The labels are shown on the plot area, labels on the edge of the plot area are cut.
If the bars are close to each other the labels may overlap.
\sa QAbstractBarSeries::labelsVisible, QAbstractBarSeries::labelsPosition
*/
/*!
\qmlproperty string AbstractBarSeries::labelsFormat
The format used for showing labels in series.
\sa QAbstractBarSeries::labelsFormat, labelsVisible, labelsPosition
*/
/*!
\fn void QAbstractBarSeries::labelsFormatChanged(const QString &format)
Signal is emitted when the \a format of data value labels is changed.
*/
/*!
\qmlsignal XYSeries::onLabelsFormatChanged(string format)
Signal is emitted when the \a format of data value labels is changed.
*/
/*!
\enum QAbstractBarSeries::LabelsPosition
This enum describes the position of the data value labels.
\value LabelsCenter Label is in the center of the bar.
\value LabelsInsideEnd Label is inside the bar at the high end of it.
\value LabelsInsideBase Label is inside the bar at the low end of it.
\value LabelsOutsideEnd Label is outside the bar at the high end of it.
*/
/*!
\property QAbstractBarSeries::labelsPosition
Defines the \a position of value labels.
\sa QAbstractBarSeries::labelsVisible, QAbstractBarSeries::labelsFormat
*/
/*!
\qmlproperty string AbstractBarSeries::labelsPosition
Defines the \a position of value labels.
\sa labelsVisible, labelsFormat
*/
/*!
\fn void QAbstractBarSeries::labelsPositionChanged(QAbstractBarSeries::LabelsPosition position)
Signal is emitted when the \a position of value labels is changed.
*/
/*!
\qmlsignal AbstractBarSeries::onLabelsPositionChanged(LabelsPosition position)
Signal is emitted when the \a position of value labels is changed.
*/
Miikka Heikkinen
Added support for bar series value label angle...
r2802 /*!
\property QAbstractBarSeries::labelsAngle
The angle of the value labels in degrees.
*/
/*!
\qmlproperty qreal QAbstractBarSeries::labelsAngle
The angle of the value labels in degrees.
*/
/*!
\fn void QAbstractBarSeries::labelsAngleChanged(qreal angle)
Signal is emitted when the \a angle of the value labels is changed.
*/
/*!
\qmlsignal AbstractBarSeries::onLabelsAngleChanged(qreal angle)
Signal is emitted when the \a angle of the value labels is changed.
*/
sauimone
Documentation for bar charts
r313 /*!
sauimone
renamed barseries files to abstractbarseries
r1586 \fn void QAbstractBarSeries::clicked(int index, QBarSet *barset)
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 /*!
sauimone
changed barseries to abstractbarseries in documentation
r1590 \qmlsignal AbstractBarSeries::onClicked(int index, BarSet barset)
Tero Ahola
Documenting QML bar series API
r1489 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
Titta Heikkala
Add pressed, released and doubleClicked signals...
r2739 /*!
\fn void QAbstractBarSeries::pressed(int index, QBarSet *barset)
The signal is emitted if the user presses with a mouse on top of QBarSet \a barset.
Pressed bar inside set is indexed by \a index
*/
/*!
\qmlsignal AbstractBarSeries::onPressed(int index, BarSet barset)
The signal is emitted if the user presses with a mouse on top of BarSet.
Pressed bar inside set is indexed by \a index
*/
/*!
\fn void QAbstractBarSeries::released(int index, QBarSet *barset)
The signal is emitted if the user releases with a mouse on top of QBarSet \a barset.
Released bar inside set is indexed by \a index
*/
/*!
\qmlsignal AbstractBarSeries::onReleased(int index, BarSet barset)
The signal is emitted if the user releases with a mouse on top of BarSet.
Released bar inside set is indexed by \a index
*/
/*!
\fn void QAbstractBarSeries::doubleClicked(int index, QBarSet *barset)
The signal is emitted if the user doubleclicks with a mouse on top of QBarSet \a barset.
DoubleClicked bar inside set is indexed by \a index
*/
/*!
\qmlsignal AbstractBarSeries::onDoubleClicked(int index, BarSet barset)
The signal is emitted if the user doubleclicks with a mouse on top of BarSet.
Doubleclicked bar inside set is indexed by \a index
*/
Titta Heikkala
Add hovered signal with index for bar charts...
r2600 /*!
\fn void QAbstractBarSeries::hovered(bool status, int index, QBarSet* barset)
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.
Hovered bar inside the set is indexed by \a index.
*/
Tero Ahola
Documenting QML bar series API
r1489 /*!
Titta Heikkala
Add hovered signal with index for bar charts...
r2600 \qmlsignal AbstractBarSeries::onHovered(bool status, int index, BarSet barset)
Tero Ahola
Documenting QML bar series API
r1489
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.
Titta Heikkala
Add hovered signal with index for bar charts...
r2600 Hovered bar inside the set is indexed by \a index.
Tero Ahola
Documenting QML bar series API
r1489 */
sauimone
added missing documentation to barseries
r1460
/*!
sauimone
renamed barseries files to abstractbarseries
r1586 \fn void QAbstractBarSeries::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.
*/
/*!
sauimone
changed barseries to abstractbarseries in documentation
r1590 \qmlsignal AbstractBarSeries::onCountChanged()
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 /*!
sauimone
renamed barseries files to abstractbarseries
r1586 \fn void QAbstractBarSeries::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 */
/*!
sauimone
renamed barseries files to abstractbarseries
r1586 \fn void QAbstractBarSeries::barsetsAdded(QList<QBarSet*> sets)
Marek Rosa
Docs update for BarSeries and BarSet
r1361 This signal is emitted when \a sets have been added to the series.
\sa append(), insert()
*/
Tero Ahola
QML BarSeries added/removed signals
r1506 /*!
Tero Ahola
Documentation fixes to QML ScatterSeries and AbstractBarSeries
r2115 \qmlsignal AbstractBarSeries::onBarsetsAdded(BarSet barset)
Tero Ahola
QML BarSeries added/removed signals
r1506 Emitted when \a barset has been added to the series.
*/
Marek Rosa
Docs update for BarSeries and BarSet
r1361
/*!
sauimone
renamed barseries files to abstractbarseries
r1586 \fn void QAbstractBarSeries::barsetsRemoved(QList<QBarSet*> sets)
Marek Rosa
Docs update for BarSeries and BarSet
r1361 This signal is emitted when \a sets have been removed from the series.
\sa remove()
*/
Tero Ahola
QML BarSeries added/removed signals
r1506 /*!
Tero Ahola
Documentation fixes to QML ScatterSeries and AbstractBarSeries
r2115 \qmlsignal AbstractBarSeries::onBarsetsRemoved(BarSet barset)
Tero Ahola
QML BarSeries added/removed signals
r1506 Emitted when \a barset has been removed from the series.
*/
Marek Rosa
Docs update for BarSeries and BarSet
r1361
Tero Ahola
QML methods of series: several fixes and documentation
r1521 /*!
sauimone
changed barseries to abstractbarseries in documentation
r1590 \qmlmethod BarSet AbstractBarSeries::at(int index)
Tero Ahola
QML methods of series: several fixes and documentation
r1521 Returns bar set at \a index. Returns null if the index is not valid.
*/
/*!
sauimone
changed barseries to abstractbarseries in documentation
r1590 \qmlmethod BarSet AbstractBarSeries::append(string label, VariantList values)
Tero Ahola
Documentation fixes to QML ScatterSeries and AbstractBarSeries
r2115 Adds a new bar set with \a label and \a values to \a index. Values is a list of reals.
Tero Ahola
QML methods of series: several fixes and documentation
r1521 For example:
\code
myBarSeries.append("set 1", [0, 0.2, 0.2, 0.5, 0.4, 1.5, 0.9]);
\endcode
*/
/*!
sauimone
changed barseries to abstractbarseries in documentation
r1590 \qmlmethod BarSet AbstractBarSeries::insert(int index, string label, VariantList values)
Tero Ahola
Renamed XyPoint to XYPoint
r1532 Inserts a new bar set with \a label and \a values to \a index. Values can be a list of reals or a list of XYPoints.
Tero Ahola
QML methods of series: several fixes and documentation
r1521 If index is zero or smaller, the new barset is prepended. If the index is count or bigger, the new barset is
appended.
sauimone
changed barseries to abstractbarseries in documentation
r1590 \sa AbstractBarSeries::append()
Tero Ahola
QML methods of series: several fixes and documentation
r1521 */
/*!
sauimone
changed barseries to abstractbarseries in documentation
r1590 \qmlmethod bool AbstractBarSeries::remove(BarSet barset)
Jani Honkonen
Fix some spelling errors
r1932 Removes the barset from the series. Returns true if successful, false otherwise.
Tero Ahola
QML methods of series: several fixes and documentation
r1521 */
/*!
sauimone
changed barseries to abstractbarseries in documentation
r1590 \qmlmethod AbstractBarSeries::clear()
Tero Ahola
QML methods of series: several fixes and documentation
r1521 Removes all barsets from the series.
*/
sauimone
barchart: doc update for hover signals
r980 /*!
sauimone
changed barseries to abstractbarseries in documentation
r1590 Destructs abstractbarseries and owned barsets.
sauimone
barchart: doc update for hover signals
r980 */
sauimone
QBarSeries to QAbstractBarSeries
r1584 QAbstractBarSeries::~QAbstractBarSeries()
sauimone
barchart: doc update for hover signals
r980 {
Michal Klocek
Implements qbarcategoriesaxis logic...
r1725
sauimone
barchart: doc update for hover signals
r980 }
Tero Ahola
Updated documentation, warnings from legend and area left
r973 /*!
\internal
*/
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 QAbstractBarSeries::QAbstractBarSeries(QAbstractBarSeriesPrivate &o, QObject *parent)
: QAbstractSeries(o, parent)
Michal Klocek
Refactor to use qseries private for implmentation interface...
r943 {
Michal Klocek
Fixes legend markers updates
r2085 Q_D(QAbstractSeries);
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 QObject::connect(this, SIGNAL(countChanged()), d, SIGNAL(countChanged()));
Michal Klocek
Refactor to use qseries private for implmentation interface...
r943 }
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.
sauimone
GroupedBarSeries to BarSeries
r1594 Note that with \link QBarSeries \endlink this value means the width of one group of bars instead of just one bar.
sauimone
updated documentation for barseries
r1493 */
sauimone
QBarSeries to QAbstractBarSeries
r1584 void QAbstractBarSeries::setBarWidth(qreal width)
sauimone
bar margin setter to series
r1283 {
sauimone
QBarSeries to QAbstractBarSeries
r1584 Q_D(QAbstractBarSeries);
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
QBarSeries to QAbstractBarSeries
r1584 qreal QAbstractBarSeries::barWidth() const
sauimone
visible property to barseries
r1284 {
sauimone
QBarSeries to QAbstractBarSeries
r1584 Q_D(const QAbstractBarSeries);
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
QBarSeries to QAbstractBarSeries
r1584 bool QAbstractBarSeries::append(QBarSet *set)
sauimone
Barset and barcategory implememtation. Updated test application
r171 {
sauimone
QBarSeries to QAbstractBarSeries
r1584 Q_D(QAbstractBarSeries);
sauimone
barchart signals for properties and changes
r1353 bool success = d->append(set);
if (success) {
Jani Honkonen
more coding style fixes for src-folder...
r2104 QList<QBarSet *> sets;
sauimone
barchart signals for properties and changes
r1353 sets.append(set);
sauimone
fixed barset ownership when adding/removing sets
r1787 set->setParent(this);
sauimone
barchart signals for properties and changes
r1353 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 /*!
sauimone
Implemented QBarSeries::take(), updated tests
r1802 Removes barset from series. Releases ownership of \a set. Deletes the set, if remove
was successful.
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
QBarSeries to QAbstractBarSeries
r1584 bool QAbstractBarSeries::remove(QBarSet *set)
sauimone
Barset and barcategory implememtation. Updated test application
r171 {
sauimone
QBarSeries to QAbstractBarSeries
r1584 Q_D(QAbstractBarSeries);
sauimone
barchart signals for properties and changes
r1353 bool success = d->remove(set);
if (success) {
Jani Honkonen
more coding style fixes for src-folder...
r2104 QList<QBarSet *> sets;
sauimone
barchart signals for properties and changes
r1353 sets.append(set);
sauimone
fixed barset ownership when adding/removing sets
r1787 set->setParent(0);
sauimone
barchart signals for properties and changes
r1353 emit barsetsRemoved(sets);
Tero Ahola
Minor modifications to properties of abstract, area and bar series
r1462 emit countChanged();
sauimone
Implemented QBarSeries::take(), updated tests
r1802 delete set;
set = 0;
}
return success;
}
/*!
Takes a single \a set from the series. Does not delete the barset object.
NOTE: The series remains as the barset's parent object. You must set the
parent object to take full ownership.
Jani Honkonen
Fix some spelling errors
r1932 Returns true if take was successful.
sauimone
Implemented QBarSeries::take(), updated tests
r1802 */
bool QAbstractBarSeries::take(QBarSet *set)
{
Q_D(QAbstractBarSeries);
bool success = d->remove(set);
if (success) {
Jani Honkonen
more coding style fixes for src-folder...
r2104 QList<QBarSet *> sets;
sauimone
Implemented QBarSeries::take(), updated tests
r1802 sets.append(set);
emit barsetsRemoved(sets);
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.
Jani Honkonen
Fix Krazy issues
r1935 Returns true, if all sets were appended successfully. If any of the sets is null or is already appended to series,
sauimone
Fixed category handling of barcharts. Now the categories can be undefined. Updated documentation.
r1208 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 */
Jani Honkonen
more coding style fixes for src-folder...
r2104 bool QAbstractBarSeries::append(QList<QBarSet *> sets)
sauimone
percent barchart layout fix. signal fix
r850 {
sauimone
QBarSeries to QAbstractBarSeries
r1584 Q_D(QAbstractBarSeries);
sauimone
barchart signals for properties and changes
r1353 bool success = d->append(sets);
if (success) {
Miikka Heikkinen
Plugged some memory leaks....
r2733 foreach (QBarSet *set, sets)
set->setParent(this);
sauimone
barchart signals for properties and changes
r1353 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.
*/
sauimone
QBarSeries to QAbstractBarSeries
r1584 bool QAbstractBarSeries::insert(int index, QBarSet *set)
Marek Rosa
Added insert method to QBarSeries
r1362 {
sauimone
QBarSeries to QAbstractBarSeries
r1584 Q_D(QAbstractBarSeries);
Marek Rosa
Added insert method to QBarSeries
r1362 bool success = d->insert(index, set);
if (success) {
Jani Honkonen
more coding style fixes for src-folder...
r2104 QList<QBarSet *> sets;
Marek Rosa
Added insert method to QBarSeries
r1362 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 /*!
sauimone
Implemented QBarSeries::take(), updated tests
r1802 Removes all barsets from the series. Deletes removed sets.
Marek Rosa
Fixes to BarSeries and BarModelMapper
r1356 */
sauimone
QBarSeries to QAbstractBarSeries
r1584 void QAbstractBarSeries::clear()
Marek Rosa
BarModelMapper: implemented model updated slots. Some more work needed with categories
r1295 {
sauimone
QBarSeries to QAbstractBarSeries
r1584 Q_D(QAbstractBarSeries);
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();
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 foreach (QBarSet *set, sets)
sauimone
Implemented QBarSeries::take(), updated tests
r1802 delete set;
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.
*/
sauimone
QBarSeries to QAbstractBarSeries
r1584 int QAbstractBarSeries::count() const
sauimone
Added pen & brush to QBarSet
r214 {
sauimone
QBarSeries to QAbstractBarSeries
r1584 Q_D(const QAbstractBarSeries);
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.
*/
Jani Honkonen
more coding style fixes for src-folder...
r2104 QList<QBarSet *> QAbstractBarSeries::barSets() const
sauimone
Added pen & brush to QBarSet
r214 {
sauimone
QBarSeries to QAbstractBarSeries
r1584 Q_D(const QAbstractBarSeries);
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
QBarSeries to QAbstractBarSeries
r1584 void QAbstractBarSeries::setLabelsVisible(bool visible)
sauimone
values visibility handling changed in barchart
r813 {
sauimone
QBarSeries to QAbstractBarSeries
r1584 Q_D(QAbstractBarSeries);
sauimone
removed barlabel. label visibility control is now per series instead of per set
r1246 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
*/
sauimone
QBarSeries to QAbstractBarSeries
r1584 bool QAbstractBarSeries::isLabelsVisible() const
sauimone
removed barlabel. label visibility control is now per series instead of per set
r1246 {
sauimone
QBarSeries to QAbstractBarSeries
r1584 Q_D(const QAbstractBarSeries);
sauimone
removed barlabel. label visibility control is now per series instead of per set
r1246 return d->m_labelsVisible;
}
Titta Heikkala
Added possibility to show series value...
r2689 void QAbstractBarSeries::setLabelsFormat(const QString &format)
{
Q_D(QAbstractBarSeries);
if (d->m_labelsFormat != format) {
d->m_labelsFormat = format;
emit labelsFormatChanged(format);
}
}
QString QAbstractBarSeries::labelsFormat() const
{
Q_D(const QAbstractBarSeries);
return d->m_labelsFormat;
}
Miikka Heikkinen
Added support for bar series value label angle...
r2802 void QAbstractBarSeries::setLabelsAngle(qreal angle)
{
Q_D(QAbstractBarSeries);
if (d->m_labelsAngle != angle) {
d->m_labelsAngle = angle;
emit labelsAngleChanged(angle);
}
}
qreal QAbstractBarSeries::labelsAngle() const
{
Q_D(const QAbstractBarSeries);
return d->m_labelsAngle;
}
Titta Heikkala
Added possibility to show series value...
r2689 void QAbstractBarSeries::setLabelsPosition(QAbstractBarSeries::LabelsPosition position)
{
Q_D(QAbstractBarSeries);
if (d->m_labelsPosition != position) {
d->m_labelsPosition = position;
emit labelsPositionChanged(position);
}
}
QAbstractBarSeries::LabelsPosition QAbstractBarSeries::labelsPosition() const
{
Q_D(const QAbstractBarSeries);
return d->m_labelsPosition;
}
Michal Klocek
Adds big fat pimpl to series classes...
r938 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
sauimone
QBarSeries to QAbstractBarSeries
r1584 QAbstractBarSeriesPrivate::QAbstractBarSeriesPrivate(QAbstractBarSeries *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),
Titta Heikkala
Improve theme initialization performance for bar series...
r2598 m_visible(true),
Titta Heikkala
Added possibility to show series value...
r2689 m_blockBarUpdate(false),
m_labelsFormat(),
Miikka Heikkinen
Added support for bar series value label angle...
r2802 m_labelsPosition(QAbstractBarSeries::LabelsCenter),
m_labelsAngle(0)
Michal Klocek
Adds big fat pimpl to series classes...
r938 {
}
sauimone
QBarSeries to QAbstractBarSeries
r1584 int QAbstractBarSeriesPrivate::categoryCount() const
sauimone
Fixed category handling of barcharts. Now the categories can be undefined. Updated documentation.
r1208 {
// No categories defined. return count of longest set.
int count = 0;
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 for (int i = 0; i < m_barSets.count(); i++) {
if (m_barSets.at(i)->count() > count)
sauimone
Fixed category handling of barcharts. Now the categories can be undefined. Updated documentation.
r1208 count = m_barSets.at(i)->count();
}
return count;
}
sauimone
QBarSeries to QAbstractBarSeries
r1584 void QAbstractBarSeriesPrivate::setBarWidth(qreal width)
sauimone
new series: groupedbarseries
r1167 {
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 if (width < 0.0)
sauimone
barmargin replaced with barwidth
r1425 width = 0.0;
m_barWidth = width;
sauimone
fix: changing barset colors no more triggers layout calculations
r1917 emit updatedLayout();
sauimone
new series: groupedbarseries
r1167 }
sauimone
QBarSeries to QAbstractBarSeries
r1584 qreal QAbstractBarSeriesPrivate::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
Jani Honkonen
more coding style fixes for src-folder...
r2104 QBarSet *QAbstractBarSeriesPrivate::barsetAt(int index)
Michal Klocek
Adds big fat pimpl to series classes...
r938 {
sauimone
barchart: removed old model
r1005 return m_barSets.at(index);
Michal Klocek
Adds big fat pimpl to series classes...
r938 }
sauimone
QBarSeries to QAbstractBarSeries
r1584 void QAbstractBarSeriesPrivate::setVisible(bool visible)
sauimone
visible property to barseries
r1284 {
sauimone
barchart signals for properties and changes
r1353 m_visible = visible;
sauimone
fix: changing barset colors no more triggers layout calculations
r1917 emit visibleChanged();
sauimone
visible property to barseries
r1284 }
sauimone
QBarSeries to QAbstractBarSeries
r1584 void QAbstractBarSeriesPrivate::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 }
sauimone
QBarSeries to QAbstractBarSeries
r1584 qreal QAbstractBarSeriesPrivate::min()
Michal Klocek
Adds big fat pimpl to series classes...
r938 {
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 if (m_barSets.count() <= 0)
sauimone
barchart: removed old model
r1005 return 0;
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097
sauimone
barchart: removed old model
r1005 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
Removed QPointF from QBarSet
r1580 qreal temp = m_barSets.at(i)->at(j);
sauimone
barchart: removed old model
r1005 if (temp < min)
min = temp;
}
}
return min;
Michal Klocek
Adds big fat pimpl to series classes...
r938 }
sauimone
QBarSeries to QAbstractBarSeries
r1584 qreal QAbstractBarSeriesPrivate::max()
Michal Klocek
Adds big fat pimpl to series classes...
r938 {
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 if (m_barSets.count() <= 0)
sauimone
barchart: removed old model
r1005 return 0;
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097
sauimone
barchart: removed old model
r1005 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
Removed QPointF from QBarSet
r1580 qreal temp = m_barSets.at(i)->at(j);
sauimone
barchart: removed old model
r1005 if (temp > max)
max = temp;
}
}
return max;
Michal Klocek
Adds big fat pimpl to series classes...
r938 }
sauimone
QBarSeries to QAbstractBarSeries
r1584 qreal QAbstractBarSeriesPrivate::valueAt(int set, int category)
Michal Klocek
Adds big fat pimpl to series classes...
r938 {
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 if ((set < 0) || (set >= m_barSets.count()))
return 0; // No set, no value.
else if ((category < 0) || (category >= m_barSets.at(set)->count()))
return 0; // No category, no value.
sauimone
barchart: removed old model
r1005
sauimone
Removed QPointF from QBarSet
r1580 return m_barSets.at(set)->at(category);
Michal Klocek
Adds big fat pimpl to series classes...
r938 }
sauimone
QBarSeries to QAbstractBarSeries
r1584 qreal QAbstractBarSeriesPrivate::percentageAt(int set, int category)
Michal Klocek
Adds big fat pimpl to series classes...
r938 {
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 if ((set < 0) || (set >= m_barSets.count()))
return 0; // No set, no value.
else if ((category < 0) || (category >= m_barSets.at(set)->count()))
return 0; // No category, no value.
sauimone
barchart: removed old model
r1005
sauimone
Removed QPointF from QBarSet
r1580 qreal value = m_barSets.at(set)->at(category);
sauimone
barchart: removed old model
r1005 qreal sum = categorySum(category);
Marek Rosa
Replaced qFuzzyIsNull with qFuzzyCompare. Once qchart test case still uses qFuzzyIsNull becasue it started failing when qFuzzyCompare was used
r2242 if (qFuzzyCompare(sum, 0))
sauimone
barchart: removed old model
r1005 return 0;
return value / sum;
Michal Klocek
Adds big fat pimpl to series classes...
r938 }
sauimone
QBarSeries to QAbstractBarSeries
r1584 qreal QAbstractBarSeriesPrivate::categorySum(int category)
Michal Klocek
Adds big fat pimpl to series classes...
r938 {
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
Removed QPointF from QBarSet
r1580 sum += m_barSets.at(set)->at(category);
sauimone
barchart: removed old model
r1005 }
return sum;
Michal Klocek
Adds big fat pimpl to series classes...
r938 }
sauimone
QBarSeries to QAbstractBarSeries
r1584 qreal QAbstractBarSeriesPrivate::absoluteCategorySum(int category)
Michal Klocek
Adds big fat pimpl to series classes...
r938 {
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
Removed QPointF from QBarSet
r1580 sum += qAbs(m_barSets.at(set)->at(category));
sauimone
barchart: removed old model
r1005 }
return sum;
Michal Klocek
Adds big fat pimpl to series classes...
r938 }
sauimone
QBarSeries to QAbstractBarSeries
r1584 qreal QAbstractBarSeriesPrivate::maxCategorySum()
Michal Klocek
Adds big fat pimpl to series classes...
r938 {
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
QBarSeries to QAbstractBarSeries
r1584 qreal QAbstractBarSeriesPrivate::minX()
sauimone
scaledomain fix for barchart
r1423 {
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 if (m_barSets.count() <= 0)
sauimone
scaledomain fix for barchart
r1423 return 0;
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097
sauimone
scaledomain fix for barchart
r1423 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
Removed QPointF from QBarSet
r1580 qreal temp = m_barSets.at(i)->d_ptr.data()->m_values.at(j).x();
sauimone
scaledomain fix for barchart
r1423 if (temp < min)
min = temp;
}
}
return min;
}
sauimone
QBarSeries to QAbstractBarSeries
r1584 qreal QAbstractBarSeriesPrivate::maxX()
sauimone
scaledomain fix for barchart
r1423 {
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 if (m_barSets.count() <= 0)
sauimone
scaledomain fix for barchart
r1423 return 0;
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097
sauimone
scaledomain fix for barchart
r1423 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
Removed QPointF from QBarSet
r1580 qreal temp = m_barSets.at(i)->d_ptr.data()->m_values.at(j).x();
sauimone
scaledomain fix for barchart
r1423 if (temp > max)
max = temp;
}
}
return max;
}
sauimone
Better support for negative values in stacked barcharts. Negative values are stacked from zero to negative direction. Positive values are stacked from zero to positive direction.
r1897 qreal QAbstractBarSeriesPrivate::categoryTop(int category)
{
// Returns top (sum of all positive values) of category.
// Returns 0, if all values are negative
qreal top(0);
int count = m_barSets.count();
for (int set = 0; set < count; set++) {
if (category < m_barSets.at(set)->count()) {
qreal temp = m_barSets.at(set)->at(category);
if (temp > 0) {
top += temp;
}
}
}
return top;
}
qreal QAbstractBarSeriesPrivate::categoryBottom(int category)
{
// Returns bottom (sum of all negative values) of category
// Returns 0, if all values are positive
qreal bottom(0);
int count = m_barSets.count();
for (int set = 0; set < count; set++) {
if (category < m_barSets.at(set)->count()) {
qreal temp = m_barSets.at(set)->at(category);
if (temp < 0) {
bottom += temp;
}
}
}
return bottom;
}
qreal QAbstractBarSeriesPrivate::top()
{
// Returns top of all categories
qreal top(0);
int count = categoryCount();
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 for (int i = 0; i < count; i++) {
sauimone
Better support for negative values in stacked barcharts. Negative values are stacked from zero to negative direction. Positive values are stacked from zero to positive direction.
r1897 qreal temp = categoryTop(i);
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 if (temp > top)
sauimone
Better support for negative values in stacked barcharts. Negative values are stacked from zero to negative direction. Positive values are stacked from zero to positive direction.
r1897 top = temp;
}
return top;
}
qreal QAbstractBarSeriesPrivate::bottom()
{
// Returns bottom of all categories
qreal bottom(0);
int count = categoryCount();
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 for (int i = 0; i < count; i++) {
sauimone
Better support for negative values in stacked barcharts. Negative values are stacked from zero to negative direction. Positive values are stacked from zero to positive direction.
r1897 qreal temp = categoryBottom(i);
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 if (temp < bottom)
sauimone
Better support for negative values in stacked barcharts. Negative values are stacked from zero to negative direction. Positive values are stacked from zero to positive direction.
r1897 bottom = temp;
}
return bottom;
}
Titta Heikkala
Improve theme initialization performance for bar series...
r2598 bool QAbstractBarSeriesPrivate::blockBarUpdate()
{
return m_blockBarUpdate;
}
sauimone
scaledomain fix for barchart
r1423
Miikka Heikkinen
Added support for bar series value label angle...
r2802 qreal QAbstractBarSeriesPrivate::labelsAngle() const
{
return m_labelsAngle;
}
Michal Klocek
Refactors internals...
r2273 void QAbstractBarSeriesPrivate::initializeDomain()
Michal Klocek
Refactor to use qseries private for implmentation interface...
r943 {
Michal Klocek
Refactors internals...
r2273 qreal minX(domain()->minX());
qreal minY(domain()->minY());
qreal maxX(domain()->maxX());
qreal maxY(domain()->maxY());
Michal Klocek
Refactor to use qseries private for implmentation interface...
r943
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();
Marek Rosa
Added casting to qreal in qMin, qFuzzyCompare calls to fix build on arm
r1679 minX = qMin(minX, seriesMinX - (qreal)0.5);
Michal Klocek
Refactor to use qseries private for implmentation interface...
r943 minY = qMin(minY, y);
Marek Rosa
Added casting to qreal in qMin, qFuzzyCompare calls to fix build on arm
r1679 maxX = qMax(maxX, seriesMaxX + (qreal)0.5);
Michal Klocek
Refactor to use qseries private for implmentation interface...
r943 maxY = qMax(maxY, y);
Michal Klocek
Refactors internals...
r2273 domain()->setRange(minX, maxX, minY, maxY);
Michal Klocek
Refactor to use qseries private for implmentation interface...
r943 }
sauimone
Added createLegendMarkers to private series. This will replace old createLegendMarker method. Notice the s in new method name. PIMPL for QLegendMarker. Newlegend example updated a bit
r2163 QList<QLegendMarker*> QAbstractBarSeriesPrivate::createLegendMarkers(QLegend* legend)
{
sauimone
tidying up legend marker code. Added QBarLegendMarker
r2174 Q_Q(QAbstractBarSeries);
sauimone
Added createLegendMarkers to private series. This will replace old createLegendMarker method. Notice the s in new method name. PIMPL for QLegendMarker. Newlegend example updated a bit
r2163 QList<QLegendMarker*> markers;
sauimone
tidying up legend marker code. Added QBarLegendMarker
r2174
sauimone
Added createLegendMarkers to private series. This will replace old createLegendMarker method. Notice the s in new method name. PIMPL for QLegendMarker. Newlegend example updated a bit
r2163 foreach(QBarSet* set, q->barSets()) {
sauimone
tidying up legend marker code. Added QBarLegendMarker
r2174 QBarLegendMarker* marker = new QBarLegendMarker(q,set,legend);
sauimone
Added createLegendMarkers to private series. This will replace old createLegendMarker method. Notice the s in new method name. PIMPL for QLegendMarker. Newlegend example updated a bit
r2163 markers << marker;
}
return markers;
}
sauimone
QBarSeries to QAbstractBarSeries
r1584 bool QAbstractBarSeriesPrivate::append(QBarSet *set)
sauimone
legend detach example. Bug fixes to legend.
r1263 {
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 if ((m_barSets.contains(set)) || (set == 0))
return false; // Fail if set is already in list or set is null.
sauimone
legend private implemantation modified.
r2081
sauimone
legend detach example. Bug fixes to legend.
r1263 m_barSets.append(set);
sauimone
fix: changing barset colors no more triggers layout calculations
r1917 QObject::connect(set->d_ptr.data(), SIGNAL(updatedLayout()), this, SIGNAL(updatedLayout()));
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 private implemantation modified.
r2081
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 emit restructuredBars(); // this notifies barchartitem
sauimone
legend detach example. Bug fixes to legend.
r1263 return true;
}
sauimone
QBarSeries to QAbstractBarSeries
r1584 bool QAbstractBarSeriesPrivate::remove(QBarSet *set)
sauimone
legend detach example. Bug fixes to legend.
r1263 {
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 if (!m_barSets.contains(set))
return false; // Fail if set is not in list
sauimone
legend private implemantation modified.
r2081
sauimone
legend detach example. Bug fixes to legend.
r1263 m_barSets.removeOne(set);
sauimone
fix: changing barset colors no more triggers layout calculations
r1917 QObject::disconnect(set->d_ptr.data(), SIGNAL(updatedLayout()), this, SIGNAL(updatedLayout()));
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
legend private implemantation modified.
r2081
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 emit restructuredBars(); // this notifies barchartitem
sauimone
legend detach example. Bug fixes to legend.
r1263 return true;
}
Jani Honkonen
more coding style fixes for src-folder...
r2104 bool QAbstractBarSeriesPrivate::append(QList<QBarSet * > sets)
sauimone
legend detach example. Bug fixes to legend.
r1263 {
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 foreach (QBarSet *set, sets) {
if ((set == 0) || (m_barSets.contains(set)))
return false; // Fail if any of the sets is null or is already appended.
if (sets.count(set) != 1)
return false; // Also fail if same set is more than once in given list.
sauimone
legend detach example. Bug fixes to legend.
r1263 }
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 foreach (QBarSet *set, sets) {
sauimone
legend detach example. Bug fixes to legend.
r1263 m_barSets.append(set);
sauimone
fix: changing barset colors no more triggers layout calculations
r1917 QObject::connect(set->d_ptr.data(), SIGNAL(updatedLayout()), this, SIGNAL(updatedLayout()));
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
legend private implemantation modified.
r2081
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 emit restructuredBars(); // this notifies barchartitem
sauimone
legend detach example. Bug fixes to legend.
r1263 return true;
}
Jani Honkonen
more coding style fixes for src-folder...
r2104 bool QAbstractBarSeriesPrivate::remove(QList<QBarSet * > sets)
sauimone
legend detach example. Bug fixes to legend.
r1263 {
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 if (sets.count() == 0)
sauimone
fix barseries remove return value with empty list
r1371 return false;
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097
foreach (QBarSet *set, sets) {
if ((set == 0) || (!m_barSets.contains(set)))
return false; // Fail if any of the sets is null or is not in series
if (sets.count(set) != 1)
return false; // Also fail if same set is more than once in given list.
sauimone
legend detach example. Bug fixes to legend.
r1263 }
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 foreach (QBarSet *set, sets) {
sauimone
barchart signals for properties and changes
r1353 m_barSets.removeOne(set);
sauimone
fix: changing barset colors no more triggers layout calculations
r1917 QObject::disconnect(set->d_ptr.data(), SIGNAL(updatedLayout()), this, SIGNAL(updatedLayout()));
sauimone
barchart signals for properties and changes
r1353 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
some cleanup on legend and pie. No need for pie to know too much about legend
r2173
sauimone
barchart signals for properties and changes
r1353 return true;
sauimone
legend detach example. Bug fixes to legend.
r1263 }
sauimone
QBarSeries to QAbstractBarSeries
r1584 bool QAbstractBarSeriesPrivate::insert(int index, QBarSet *set)
Marek Rosa
Added insert method to QBarSeries
r1362 {
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 if ((m_barSets.contains(set)) || (set == 0))
return false; // Fail if set is already in list or set is null.
sauimone
legend private implemantation modified.
r2081
Marek Rosa
Added insert method to QBarSeries
r1362 m_barSets.insert(index, set);
sauimone
fix: changing barset colors no more triggers layout calculations
r1917 QObject::connect(set->d_ptr.data(), SIGNAL(updatedLayout()), this, SIGNAL(updatedLayout()));
Marek Rosa
Added insert method to QBarSeries
r1362 QObject::connect(set->d_ptr.data(), SIGNAL(updatedBars()), this, SIGNAL(updatedBars()));
QObject::connect(set->d_ptr.data(), SIGNAL(restructuredBars()), this, SIGNAL(restructuredBars()));
sauimone
legend private implemantation modified.
r2081
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 return true;
}
Michal Klocek
Refactors internals...
r2273 void QAbstractBarSeriesPrivate::initializeAxes()
Michal Klocek
Adds createDefaultAxes logic
r1588 {
Michal Klocek
Refactor barchart...
r1707 Q_Q(QAbstractBarSeries);
Michal Klocek
Refactors internals...
r2273 foreach(QAbstractAxis* axis, m_axes) {
if (axis->type() == QAbstractAxis::AxisTypeBarCategory) {
switch (q->type()) {
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548 case QAbstractSeries::SeriesTypeHorizontalBar:
case QAbstractSeries::SeriesTypeHorizontalPercentBar:
case QAbstractSeries::SeriesTypeHorizontalStackedBar:
Michal Klocek
Refactors internals...
r2273 if (axis->orientation() == Qt::Vertical)
Jani Honkonen
more coding style fixes for src-folder...
r2104 populateCategories(qobject_cast<QBarCategoryAxis *>(axis));
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548 break;
case QAbstractSeries::SeriesTypeBar:
case QAbstractSeries::SeriesTypePercentBar:
case QAbstractSeries::SeriesTypeStackedBar:
case QAbstractSeries::SeriesTypeBoxPlot:
Michal Klocek
Refactors internals...
r2273 if (axis->orientation() == Qt::Horizontal)
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548 populateCategories(qobject_cast<QBarCategoryAxis *>(axis));
break;
default:
Michal Klocek
Refactors internals...
r2273 qWarning() << "Unexpected series type";
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548 break;
Michal Klocek
Refactors internals...
r2273 }
Michal Klocek
Fixes categories wrong labeling issue for *barseries
r1706 }
Michal Klocek
Default numbering for empty categories in barseries
r1595 }
Michal Klocek
Adds createDefaultAxes logic
r1588 }
Michal Klocek
Adds axis domain intialization
r1695 QAbstractAxis::AxisType QAbstractBarSeriesPrivate::defaultAxisType(Qt::Orientation orientation) const
Michal Klocek
Adds createDefaultAxes logic
r1588 {
Michal Klocek
Refactor barchart...
r1707 Q_Q(const QAbstractBarSeries);
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 switch (q->type()) {
case QAbstractSeries::SeriesTypeHorizontalBar:
case QAbstractSeries::SeriesTypeHorizontalPercentBar:
case QAbstractSeries::SeriesTypeHorizontalStackedBar:
if (orientation == Qt::Vertical)
return QAbstractAxis::AxisTypeBarCategory;
break;
case QAbstractSeries::SeriesTypeBar:
case QAbstractSeries::SeriesTypePercentBar:
case QAbstractSeries::SeriesTypeStackedBar:
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548 case QAbstractSeries::SeriesTypeBoxPlot:
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 if (orientation == Qt::Horizontal)
return QAbstractAxis::AxisTypeBarCategory;
break;
default:
qWarning() << "Unexpected series type";
Michal Klocek
Refactor barchart...
r1707 break;
}
Marek Rosa
updated AxisType names
r1818 return QAbstractAxis::AxisTypeValue;
Michal Klocek
Refactor barchart...
r1707
Michal Klocek
Adds createDefaultAxes logic
r1588 }
Jani Honkonen
more coding style fixes for src-folder...
r2104 void QAbstractBarSeriesPrivate::populateCategories(QBarCategoryAxis *axis)
Michal Klocek
Refactor barchart...
r1707 {
QStringList categories;
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 if (axis->categories().isEmpty()) {
for (int i(1); i < categoryCount() + 1; i++)
Miikka Heikkinen
Additional fixes to label localization...
r2709 categories << presenter()->numberToString(i);
Michal Klocek
Refactor barchart...
r1707 axis->append(categories);
}
}
Michal Klocek
Adds createDefaultAxes logic
r1588
Michal Klocek
Refactors internals...
r2273 QAbstractAxis* QAbstractBarSeriesPrivate::createDefaultAxis(Qt::Orientation orientation) const
{
Titta Heikkala
Fix default axes creation...
r2614 if (defaultAxisType(orientation) == QAbstractAxis::AxisTypeBarCategory)
return new QBarCategoryAxis;
else
return new QValueAxis;
Michal Klocek
Refactors internals...
r2273 }
void QAbstractBarSeriesPrivate::initializeTheme(int index, ChartTheme* theme, bool forced)
{
Titta Heikkala
Improve theme initialization performance for bar series...
r2598 m_blockBarUpdate = true; // Ensures that the bars are not updated before the theme is ready
Michal Klocek
Refactors internals...
r2273 const QList<QGradient> gradients = theme->seriesGradients();
qreal takeAtPos = 0.5;
qreal step = 0.2;
if (m_barSets.count() > 1) {
step = 1.0 / (qreal) m_barSets.count();
if (m_barSets.count() % gradients.count())
step *= gradients.count();
else
step *= (gradients.count() - 1);
}
for (int i(0); i < m_barSets.count(); i++) {
int colorIndex = (index + i) % gradients.count();
if (i > 0 && i %gradients.count() == 0) {
// There is no dedicated base color for each sets, generate more colors
takeAtPos += step;
if (takeAtPos == 1.0)
takeAtPos += step;
takeAtPos -= (int) takeAtPos;
}
Miikka Heikkinen
Return empty brush/pen/font via API rather than the weird default one...
r2519 if (forced || QChartPrivate::defaultBrush() == m_barSets.at(i)->d_ptr->m_brush)
Michal Klocek
Refactors internals...
r2273 m_barSets.at(i)->setBrush(ChartThemeManager::colorAt(gradients.at(colorIndex), takeAtPos));
// Pick label color from the opposite end of the gradient.
// 0.3 as a boundary seems to work well.
Miikka Heikkinen
Return empty brush/pen/font via API rather than the weird default one...
r2519 if (forced || QChartPrivate::defaultBrush() == m_barSets.at(i)->d_ptr->m_labelBrush) {
Michal Klocek
Refactors internals...
r2273 if (takeAtPos < 0.3)
m_barSets.at(i)->setLabelBrush(ChartThemeManager::colorAt(gradients.at(index % gradients.size()), 1));
else
m_barSets.at(i)->setLabelBrush(ChartThemeManager::colorAt(gradients.at(index % gradients.size()), 0));
}
Miikka Heikkinen
Return empty brush/pen/font via API rather than the weird default one...
r2519 if (forced || QChartPrivate::defaultPen() == m_barSets.at(i)->d_ptr->m_pen) {
Michal Klocek
Refactors internals...
r2273 QColor c = ChartThemeManager::colorAt(gradients.at(index % gradients.size()), 0.0);
m_barSets.at(i)->setPen(c);
}
}
Titta Heikkala
Improve theme initialization performance for bar series...
r2598 m_blockBarUpdate = false;
emit updatedBars();
Michal Klocek
Refactors internals...
r2273 }
Titta Heikkala
Added possibility to set duration and easing curve for chart animation...
r2804 void QAbstractBarSeriesPrivate::initializeAnimations(QChart::AnimationOptions options, int duration,
QEasingCurve &curve)
Marek Rosa
Bar animations refactored
r2316 {
AbstractBarChartItem *bar = static_cast<AbstractBarChartItem *>(m_item.data());
Q_ASSERT(bar);
Miikka Heikkinen
Fix resetting animation options mid-animation....
r2555 if (bar->animation())
bar->animation()->stopAndDestroyLater();
if (options.testFlag(QChart::SeriesAnimations))
Titta Heikkala
Added possibility to set duration and easing curve for chart animation...
r2804 bar->setAnimation(new BarAnimation(bar, duration, curve));
Miikka Heikkinen
Fix resetting animation options mid-animation....
r2555 else
Marek Rosa
Bar animations refactored
r2316 bar->setAnimation(0);
Titta Heikkala
Added possibility to set duration and easing curve for chart animation...
r2804 QAbstractSeriesPrivate::initializeAnimations(options, duration, curve);
Marek Rosa
Bar animations refactored
r2316 }
sauimone
renamed barseries files to abstractbarseries
r1586 #include "moc_qabstractbarseries.cpp"
#include "moc_qabstractbarseries_p.cpp"
sauimone
Improved bar chart series
r71
Titta Heikkala
Qt Charts project file structure change...
r2712 QT_CHARTS_END_NAMESPACE