##// END OF EJS Templates
Updated customchart example. Now it uses QIntervalsAxis
Updated customchart example. Now it uses QIntervalsAxis

File last commit:

r1698:da7242791c36
r1702:f2951e50a7b8
Show More
qhorizontalstackedbarseries.cpp
73 lines | 2.1 KiB | text/x-c | CppLexer
/ src / barchart / qhorizontalstackedbarseries.cpp
#include "qhorizontalstackedbarseries.h"
#include "qhorizontalstackedbarseries_p.h"
#include "horizontalstackedbarchartitem_p.h"
#include "horizontalstackedbaranimation_p.h"
#include "chartdataset_p.h"
#include "charttheme_p.h"
QTCOMMERCIALCHART_BEGIN_NAMESPACE
QHorizontalStackedBarSeries::QHorizontalStackedBarSeries(QObject *parent) :
QAbstractBarSeries(*new QHorizontalStackedBarSeriesPrivate(this), parent)
{
}
QAbstractSeries::SeriesType QHorizontalStackedBarSeries::type() const
{
return QAbstractSeries::SeriesTypeHorizontalStackedBar;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
QHorizontalStackedBarSeriesPrivate::QHorizontalStackedBarSeriesPrivate(QHorizontalStackedBarSeries *q) : QAbstractBarSeriesPrivate(q)
{
}
void QHorizontalStackedBarSeriesPrivate::scaleDomain(Domain& domain)
{
qreal minX(domain.minX());
qreal minY(domain.minY());
qreal maxX(domain.maxX());
qreal maxY(domain.maxY());
qreal y = categoryCount();
qreal x = maxCategorySum();
minX = qMin(minX, x);
minY = qMin(minY, - (qreal)0.5);
maxX = qMax(maxX, x);
maxY = qMax(maxY, y - (qreal)0.5);
domain.setRange(minX,maxX,minY,maxY);
}
Chart* QHorizontalStackedBarSeriesPrivate::createGraphics(ChartPresenter* presenter)
{
Q_Q(QHorizontalStackedBarSeries);
HorizontalStackedBarChartItem* bar = new HorizontalStackedBarChartItem(q,presenter);
if(presenter->animationOptions().testFlag(QChart::SeriesAnimations)) {
bar->setAnimator(presenter->animator());
bar->setAnimation(new HorizontalStackedBarAnimation(bar));
}
presenter->chartTheme()->decorate(q, presenter->dataSet()->seriesIndex(q));
return bar;
}
QAbstractAxis::AxisType QHorizontalStackedBarSeriesPrivate::defaultAxisXType() const
{
return QAbstractAxis::AxisTypeValues;
}
QAbstractAxis::AxisType QHorizontalStackedBarSeriesPrivate::defaultAxisYType() const
{
return QAbstractAxis::AxisTypeCategories;
}
#include "moc_qhorizontalstackedbarseries.cpp"
QTCOMMERCIALCHART_END_NAMESPACE