##// END OF EJS Templates
Fixed bar label visibility...
Fixed bar label visibility Label for bars with zero value is not shown. This is done to avoid overlapping labels. Change-Id: Ife30c04e8ae4d9ac9df1209967cc3cd3ecb76a4f Task-number: QTRD-3695 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@theqtcompany.com>

File last commit:

r2782:5fbd172ba15f
r2814:79dc9c599f41
Show More
qhorizontalbarseries.cpp
123 lines | 3.7 KiB | text/x-c | CppLexer
/ src / charts / barchart / horizontal / bar / qhorizontalbarseries.cpp
Michal Klocek
Refactor barchart...
r1707 /****************************************************************************
**
Titta Heikkala
Copyright header changes...
r2776 ** Copyright (C) 2015 The Qt Company Ltd
Michal Klocek
Refactor barchart...
r1707 ** All rights reserved.
Titta Heikkala
Copyright header changes...
r2776 ** For any questions to The Qt Company, please use contact form at http://qt.io
Michal Klocek
Refactor barchart...
r1707 **
Titta Heikkala
Updated license headers...
r2740 ** This file is part of the Qt Charts module.
Michal Klocek
Refactor barchart...
r1707 **
Titta Heikkala
Updated license headers...
r2740 ** Licensees holding valid commercial license for Qt may use this file in
** accordance with the Qt License Agreement provided with the Software
** or, alternatively, in accordance with the terms contained in a written
Titta Heikkala
Copyright header changes...
r2776 ** agreement between you and The Qt Company.
Michal Klocek
Refactor barchart...
r1707 **
** If you have questions regarding the use of this file, please use
Titta Heikkala
Updated license headers...
r2740 ** contact form at http://qt.io
Michal Klocek
Refactor barchart...
r1707 **
****************************************************************************/
Titta Heikkala
Fix include syntax...
r2714 #include <QtCharts/QHorizontalBarSeries>
#include <private/qhorizontalbarseries_p.h>
#include <private/horizontalbarchartitem_p.h>
#include <QtCharts/QBarCategoryAxis>
sauimone
horizontal barchart & example
r1681
Titta Heikkala
Fix include syntax...
r2714 #include <private/chartdataset_p.h>
#include <private/charttheme_p.h>
sauimone
horizontal barchart & example
r1681
Titta Heikkala
Qt Charts project file structure change...
r2712 QT_CHARTS_BEGIN_NAMESPACE
sauimone
horizontal barchart frame
r1672
sauimone
horizontal barchart doc update
r1709 /*!
\class QHorizontalBarSeries
Titta Heikkala
Fix Charts documentation...
r2639 \inmodule Qt Charts
Miikka Heikkinen
Fix some documentation issues...
r2520 \brief Series for creating horizontal bar chart.
sauimone
horizontal barchart doc update
r1709
QHorizontalBarSeries represents a series of data shown as bars. The purpose of this class is to draw bars
as groups, where bars in same category are grouped next to each other. QHorizontalBarSeries groups the data
from sets to categories, which are defined by a QStringList.
See the \l {HorizontalBarChart Example} {horizontal bar chart example} to learn how to create a horizontal bar chart.
\image examples_horizontalbarchart.png
\sa QBarSet, QBarSeries, QPercentBarSeries, QAbstractBarSeries, QStackedBarSeries, QHorizontalStackedBarSeries, QHorizontalPercentBarSeries
*/
Titta Heikkala
Fix Charts documentation...
r2639 /*!
\qmltype HorizontalBarSeries
\instantiates QHorizontalBarSeries
Titta Heikkala
Qt Charts project file structure change...
r2712 \inqmlmodule QtCharts
Titta Heikkala
Fix Charts documentation...
r2639
Titta Heikkala
Qt Charts project file structure change...
r2712 \inherits AbstractBarSeries
\brief Series type for creating horizontal bar chart.
sauimone
horizontal barchart doc update
r1709
Titta Heikkala
Qt Charts project file structure change...
r2712 The following QML shows how to create a simple horizontal bar chart:
\snippet qmlchart/qml/qmlchart/View9.qml 1
\beginfloatleft
\image examples_qmlchart9.png
\endfloat
\clearfloat
sauimone
horizontal barchart doc update
r1709 */
sauimone
horizontal barchart doc update
r1793 /*!
Constructs empty QHorizontalBarSeries.
QHorizontalBarSeries is QObject which is a child of a \a parent.
*/
Jani Honkonen
more coding style fixes for src-folder...
r2104 QHorizontalBarSeries::QHorizontalBarSeries(QObject *parent)
: QAbstractBarSeries(*new QHorizontalBarSeriesPrivate(this), parent)
sauimone
horizontal barchart frame
r1672 {
}
sauimone
horizontal barchart doc update
r1793 /*!
Miikka Heikkinen
Documentation updates...
r2494 Destructor.
sauimone
horizontal barchart doc update
r1793 Removes series from chart.
*/
Michal Klocek
Fixes wrong bar destruction by adding destructor for bar*series , note this breaks ABI
r1727 QHorizontalBarSeries::~QHorizontalBarSeries()
{
Q_D(QHorizontalBarSeries);
Michal Klocek
Refactors internals...
r2273 if (d->m_chart)
d->m_chart->removeSeries(this);
Michal Klocek
Fixes wrong bar destruction by adding destructor for bar*series , note this breaks ABI
r1727 }
sauimone
horizontal barchart doc update
r1793 /*!
Returns QChartSeries::SeriesTypeHorizontalBar.
*/
sauimone
horizontal barchart frame
r1672 QAbstractSeries::SeriesType QHorizontalBarSeries::type() const
{
return QAbstractSeries::SeriesTypeHorizontalBar;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Jani Honkonen
more coding style fixes for src-folder...
r2104 QHorizontalBarSeriesPrivate::QHorizontalBarSeriesPrivate(QHorizontalBarSeries *q)
: QAbstractBarSeriesPrivate(q)
sauimone
horizontal barchart frame
r1672 {
}
Michal Klocek
Refactors internals...
r2273 void QHorizontalBarSeriesPrivate::initializeDomain()
sauimone
horizontal barchart frame
r1672 {
Michal Klocek
Refactors internals...
r2273 qreal minX(domain()->minX());
qreal minY(domain()->minY());
qreal maxX(domain()->maxX());
qreal maxY(domain()->maxY());
sauimone
horizontal barchart frame
r1672
sauimone
horizontal barchart & example
r1681 qreal y = categoryCount();
sauimone
fixed bug in barseries scaledomain with negative values
r1781 minX = qMin(minX, min());
sauimone
horizontal percent barchart & example
r1688 minY = qMin(minY, - (qreal)0.5);
sauimone
fixed bug in barseries scaledomain with negative values
r1781 maxX = qMax(maxX, max());
sauimone
horizontal percent barchart & example
r1688 maxY = qMax(maxY, y - (qreal)0.5);
sauimone
horizontal barchart frame
r1672
Michal Klocek
Refactors internals...
r2273 domain()->setRange(minX, maxX, minY, maxY);
sauimone
horizontal barchart frame
r1672 }
Michal Klocek
Refactors internals...
r2273 void QHorizontalBarSeriesPrivate::initializeGraphics(QGraphicsItem* parent)
sauimone
horizontal barchart frame
r1672 {
Q_Q(QHorizontalBarSeries);
Michal Klocek
Refactors internals...
r2273 HorizontalBarChartItem *bar = new HorizontalBarChartItem(q,parent);
m_item.reset(bar);
QAbstractSeriesPrivate::initializeGraphics(parent);
}
sauimone
horizontal barchart frame
r1672
#include "moc_qhorizontalbarseries.cpp"
Titta Heikkala
Qt Charts project file structure change...
r2712 QT_CHARTS_END_NAMESPACE