##// END OF EJS Templates
Updated donut screen shots
Updated donut screen shots

File last commit:

r1793:e68ebe3dc28d
r1900:5bb5cf100c56
Show More
qhorizontalpercentbarseries.cpp
92 lines | 2.9 KiB | text/x-c | CppLexer
/ src / barchart / horizontal / percent / qhorizontalpercentbarseries.cpp
sauimone
horizontal percent barchart & example
r1688 #include "qhorizontalpercentbarseries.h"
#include "qhorizontalpercentbarseries_p.h"
#include "horizontalpercentbarchartitem_p.h"
#include "horizontalpercentbaranimation_p.h"
#include "chartdataset_p.h"
#include "charttheme_p.h"
QTCOMMERCIALCHART_BEGIN_NAMESPACE
sauimone
horizontal barchart doc update
r1793 /*!
\class QHorizontalPercentBarSeries
\brief Series for creating horizontal percent bar chart
\mainclass
QHorizontalPercentBarSeries 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. QHorizontalPercentBarSeries groups the data
from sets to categories, which are defined by a QStringList.
See the \l {HorizontalPercentBarChart Example} {horizontal percent bar chart example} to learn how to create a horizontal percent bar chart.
\image examples_horizontalpercentbarchart.png
\sa QBarSet, QBarSeries, QPercentBarSeries, QAbstractBarSeries, QStackedBarSeries, QHorizontalStackedBarSeries, QHorizontalBarSeries
*/
/*!
Constructs empty QHorizontalPercentBarSeries.
QHorizontalPercentBarSeries is QObject which is a child of a \a parent.
*/
sauimone
horizontal percent barchart & example
r1688 QHorizontalPercentBarSeries::QHorizontalPercentBarSeries(QObject *parent) :
QAbstractBarSeries(*new QHorizontalPercentBarSeriesPrivate(this), parent)
{
}
sauimone
horizontal barchart doc update
r1793 /*!
Returns QChartSeries::SeriesTypeHorizontalPercentBar.
*/
sauimone
horizontal percent barchart & example
r1688 QAbstractSeries::SeriesType QHorizontalPercentBarSeries::type() const
{
return QAbstractSeries::SeriesTypeHorizontalPercentBar;
}
sauimone
horizontal barchart doc update
r1793 /*!
Destructor
Removes series from chart.
*/
Michal Klocek
Fixes wrong bar destruction by adding destructor for bar*series , note this breaks ABI
r1727 QHorizontalPercentBarSeries::~QHorizontalPercentBarSeries()
{
Q_D(QHorizontalPercentBarSeries);
if(d->m_dataset) {
d->m_dataset->removeSeries(this);
}
}
sauimone
horizontal percent barchart & example
r1688
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
QHorizontalPercentBarSeriesPrivate::QHorizontalPercentBarSeriesPrivate(QHorizontalPercentBarSeries *q) : QAbstractBarSeriesPrivate(q)
{
}
void QHorizontalPercentBarSeriesPrivate::scaleDomain(Domain& domain)
{
qreal minX(domain.minX());
qreal minY(domain.minY());
qreal maxX(domain.maxX());
qreal maxY(domain.maxY());
qreal y = categoryCount();
minX = 0;
maxX = 100;
minY = qMin(minY, - (qreal)0.5);
maxY = qMax(maxY, y - (qreal)0.5);
Michal Klocek
Refactors Domain and Axis...
r1698 domain.setRange(minX,maxX,minY,maxY);
sauimone
horizontal percent barchart & example
r1688 }
Michal Klocek
Refactors Chart to ChartElement
r1736 ChartElement* QHorizontalPercentBarSeriesPrivate::createGraphics(ChartPresenter* presenter)
sauimone
horizontal percent barchart & example
r1688 {
Q_Q(QHorizontalPercentBarSeries);
HorizontalPercentBarChartItem* bar = new HorizontalPercentBarChartItem(q,presenter);
if(presenter->animationOptions().testFlag(QChart::SeriesAnimations)) {
bar->setAnimation(new HorizontalPercentBarAnimation(bar));
}
presenter->chartTheme()->decorate(q, presenter->dataSet()->seriesIndex(q));
return bar;
}
#include "moc_qhorizontalpercentbarseries.cpp"
QTCOMMERCIALCHART_END_NAMESPACE