##// END OF EJS Templates
horizontal percent barchart & example
sauimone -
r1688:daa1eadf0e06
parent child
Show More
@@ -0,0 +1,6
1 !include( ../examples.pri ) {
2 error( "Couldn't find the examples.pri file!" )
3 }
4
5 TARGET = horizontalpercentbarchart
6 SOURCES += main.cpp
@@ -0,0 +1,95
1 /****************************************************************************
2 **
3 ** Copyright (C) 2012 Digia Plc
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 **
7 ** This file is part of the Qt Commercial Charts Add-on.
8 **
9 ** $QT_BEGIN_LICENSE$
10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 ** accordance with the Qt Commercial License Agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia.
14 **
15 ** If you have questions regarding the use of this file, please use
16 ** contact form at http://qt.digia.com
17 ** $QT_END_LICENSE$
18 **
19 ****************************************************************************/
20
21 #include <QApplication>
22 #include <QMainWindow>
23 #include <QChartView>
24 #include <QBarSeries>
25 #include <QBarSet>
26 #include <QLegend>
27 #include <QBarCategoriesAxis>
28 #include <QHorizontalPercentBarSeries>
29
30 QTCOMMERCIALCHART_USE_NAMESPACE
31
32 int main(int argc, char *argv[])
33 {
34 QApplication a(argc, argv);
35
36 //![1]
37 QBarSet *set0 = new QBarSet("Jane");
38 QBarSet *set1 = new QBarSet("John");
39 QBarSet *set2 = new QBarSet("Axel");
40 QBarSet *set3 = new QBarSet("Mary");
41 QBarSet *set4 = new QBarSet("Samantha");
42
43 *set0 << 1 << 2 << 3 << 4 << 5 << 6;
44 *set1 << 5 << 0 << 0 << 4 << 0 << 7;
45 *set2 << 3 << 5 << 8 << 13 << 8 << 5;
46 *set3 << 5 << 6 << 7 << 3 << 4 << 5;
47 *set4 << 9 << 7 << 5 << 3 << 1 << 2;
48 //![1]
49
50 //![2]
51 QHorizontalPercentBarSeries *series = new QHorizontalPercentBarSeries();
52 series->append(set0);
53 series->append(set1);
54 series->append(set2);
55 series->append(set3);
56 series->append(set4);
57
58 //![2]
59
60 //![3]
61 QChart* chart = new QChart();
62 chart->addSeries(series);
63 chart->setTitle("Simple horizontal stacked barchart example");
64 chart->createDefaultAxes();
65 chart->setAnimationOptions(QChart::SeriesAnimations);
66 //![3]
67
68 //![4]
69 QStringList categories;
70 categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun";
71 QBarCategoriesAxis* axis = new QBarCategoriesAxis();
72 axis->append(categories);
73 chart->createDefaultAxes();
74 chart->setAxisY(axis,series);
75 //![4]
76
77 //![5]
78 chart->legend()->setVisible(true);
79 chart->legend()->setAlignment(Qt::AlignBottom);
80 //![5]
81
82 //![6]
83 QChartView* chartView = new QChartView(chart);
84 chartView->setRenderHint(QPainter::Antialiasing);
85 //![6]
86
87 //![7]
88 QMainWindow window;
89 window.setCentralWidget(chartView);
90 window.resize(400, 300);
91 window.show();
92 //![7]
93
94 return a.exec();
95 }
@@ -0,0 +1,64
1 /****************************************************************************
2 **
3 ** Copyright (C) 2012 Digia Plc
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 **
7 ** This file is part of the Qt Commercial Charts Add-on.
8 **
9 ** $QT_BEGIN_LICENSE$
10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 ** accordance with the Qt Commercial License Agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia.
14 **
15 ** If you have questions regarding the use of this file, please use
16 ** contact form at http://qt.digia.com
17 ** $QT_END_LICENSE$
18 **
19 ****************************************************************************/
20
21 #include "horizontalpercentbaranimation_p.h"
22 #include "abstractbarchartitem_p.h"
23 #include <QTimer>
24
25 Q_DECLARE_METATYPE(QVector<QRectF>)
26
27 QTCOMMERCIALCHART_BEGIN_NAMESPACE
28
29 HorizontalPercentBarAnimation::HorizontalPercentBarAnimation(AbstractBarChartItem *item) :
30 AbstractBarAnimation(item)
31 {
32 }
33
34 HorizontalPercentBarAnimation::~HorizontalPercentBarAnimation()
35 {
36
37 }
38
39
40 QVariant HorizontalPercentBarAnimation::interpolated(const QVariant &from, const QVariant &to, qreal progress) const
41 {
42 QVector<QRectF> startVector = qVariantValue<QVector<QRectF> >(from);
43 QVector<QRectF> endVector = qVariantValue<QVector<QRectF> >(to);
44 QVector<QRectF> result;
45
46 Q_ASSERT(startVector.count() == endVector.count());
47
48 qreal xAxis = m_item->geometry().x();
49
50 for(int i = 0; i < startVector.count(); i++) {
51 qreal h = endVector[i].height();
52 qreal w = endVector[i].width() * progress;
53 qreal x = xAxis + ((endVector[i].left() - xAxis) * progress);
54 qreal y = endVector[i].top();
55
56 QRectF value(x,y,w,h);
57 result << value;
58 }
59 return qVariantFromValue(result);
60 }
61
62 #include "moc_horizontalpercentbaranimation_p.cpp"
63
64 QTCOMMERCIALCHART_END_NAMESPACE
@@ -0,0 +1,52
1 /****************************************************************************
2 **
3 ** Copyright (C) 2012 Digia Plc
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 **
7 ** This file is part of the Qt Commercial Charts Add-on.
8 **
9 ** $QT_BEGIN_LICENSE$
10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 ** accordance with the Qt Commercial License Agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia.
14 **
15 ** If you have questions regarding the use of this file, please use
16 ** contact form at http://qt.digia.com
17 ** $QT_END_LICENSE$
18 **
19 ****************************************************************************/
20
21 // W A R N I N G
22 // -------------
23 //
24 // This file is not part of the QtCommercial Chart API. It exists purely as an
25 // implementation detail. This header file may change from version to
26 // version without notice, or even be removed.
27 //
28 // We mean it.
29
30 #ifndef HORIZONTALPERCENTBARANIMATION_P_H
31 #define HORIZONTALPERCENTBARANIMATION_P_H
32
33 #include "abstractbaranimation_p.h"
34 #include "chartanimation_p.h"
35 #include "abstractbarchartitem_p.h"
36
37 QTCOMMERCIALCHART_BEGIN_NAMESPACE
38
39 class HorizontalPercentBarAnimation : public AbstractBarAnimation
40 {
41 Q_OBJECT
42 public:
43 explicit HorizontalPercentBarAnimation(AbstractBarChartItem *item);
44 ~HorizontalPercentBarAnimation();
45
46 virtual QVariant interpolated(const QVariant &from, const QVariant &to, qreal progress) const;
47
48 };
49
50 QTCOMMERCIALCHART_END_NAMESPACE
51
52 #endif // HORIZONTALPERCENTBARANIMATION_P_H
@@ -0,0 +1,102
1 /****************************************************************************
2 **
3 ** Copyright (C) 2012 Digia Plc
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 **
7 ** This file is part of the Qt Commercial Charts Add-on.
8 **
9 ** $QT_BEGIN_LICENSE$
10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 ** accordance with the Qt Commercial License Agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia.
14 **
15 ** If you have questions regarding the use of this file, please use
16 ** contact form at http://qt.digia.com
17 ** $QT_END_LICENSE$
18 **
19 ****************************************************************************/
20
21 #include "horizontalpercentbarchartitem_p.h"
22 #include "qabstractbarseries_p.h"
23 #include "qbarset_p.h"
24 #include "bar_p.h"
25 #include <QDebug>
26
27 QTCOMMERCIALCHART_BEGIN_NAMESPACE
28
29 HorizontalPercentBarChartItem::HorizontalPercentBarChartItem(QAbstractBarSeries *series, ChartPresenter *presenter) :
30 AbstractBarChartItem(series, presenter)
31 {
32 }
33
34 QVector<QRectF> HorizontalPercentBarChartItem::calculateLayout()
35 {
36 QVector<QRectF> layout;
37
38 // Use temporary qreals for accuracy
39 qreal categoryCount = m_series->d_func()->categoryCount();
40 qreal setCount = m_series->count();
41 bool barsVisible = m_series->isVisible();
42
43 // Domain:
44 qreal width = geometry().width();
45 qreal height = geometry().height();
46 qreal rangeY = m_domainMaxY - m_domainMinY;
47 qreal rangeX = m_domainMaxX - m_domainMinX;
48 qreal scaleY = (height / rangeY);
49 qreal scaleX = (width / rangeX);
50 qreal barHeight = scaleY * m_series->d_func()->barWidth(); // On horizontal chart barWidth of the barseries means height of the rect.
51
52 int itemIndex(0);
53 for (int category = 0; category < categoryCount; category++) {
54 qreal colSum = m_series->d_func()->categorySum(category);
55 qreal percentage = (100 / colSum);
56 qreal xPos = rangeX * m_domainMinX + geometry().left();
57 for (int set = 0; set < setCount; set++) {
58 QBarSetPrivate* barSet = m_series->d_func()->barsetAt(set)->d_ptr.data();
59
60 qreal yPos = -(barSet->pos(category) - m_domainMinY -0.5) * scaleY + m_rect.bottom() - barHeight/2;
61
62 qreal barWidth = barSet->value(category) * percentage * scaleX;
63 Bar* bar = m_bars.at(itemIndex);
64
65 QRectF rect(xPos, yPos - barHeight, barWidth, barHeight);
66 layout.append(rect);
67 bar->setPen(barSet->m_pen);
68 bar->setBrush(barSet->m_brush);
69 if (qFuzzyIsNull(barHeight)) {
70 bar->setVisible(false);
71 } else {
72 bar->setVisible(barsVisible);
73 }
74
75 QGraphicsSimpleTextItem* label = m_labels.at(itemIndex);
76
77 if (!qFuzzyIsNull(m_series->d_func()->valueAt(set,category))) {
78 int p = m_series->d_func()->percentageAt(set,category) * 100;
79 QString vString(QString::number(p));
80 vString.truncate(3);
81 vString.append("%");
82 label->setText(vString);
83 } else {
84 label->setText(QString(""));
85 }
86
87 label->setPos(xPos + (rect.width()/2 - label->boundingRect().width()/2)
88 ,yPos - barHeight/2 - label->boundingRect().height()/2);
89 label->setFont(barSet->m_labelFont);
90 label->setBrush(barSet->m_labelBrush);
91
92 itemIndex++;
93 xPos += barWidth;
94 }
95 }
96 return layout;
97 }
98
99 #include "moc_horizontalpercentbarchartitem_p.cpp"
100
101 QTCOMMERCIALCHART_END_NAMESPACE
102
@@ -0,0 +1,50
1 /****************************************************************************
2 **
3 ** Copyright (C) 2012 Digia Plc
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 **
7 ** This file is part of the Qt Commercial Charts Add-on.
8 **
9 ** $QT_BEGIN_LICENSE$
10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 ** accordance with the Qt Commercial License Agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia.
14 **
15 ** If you have questions regarding the use of this file, please use
16 ** contact form at http://qt.digia.com
17 ** $QT_END_LICENSE$
18 **
19 ****************************************************************************/
20
21 // W A R N I N G
22 // -------------
23 //
24 // This file is not part of the QtCommercial Chart API. It exists purely as an
25 // implementation detail. This header file may change from version to
26 // version without notice, or even be removed.
27 //
28 // We mean it.
29
30 #ifndef HORIZONTALPERCENTBARCHARTITEM_P_H
31 #define HORIZONTALPERCENTBARCHARTITEM_P_H
32
33 #include "abstractbarchartitem_p.h"
34 #include <QGraphicsItem>
35
36 QTCOMMERCIALCHART_BEGIN_NAMESPACE
37
38 class HorizontalPercentBarChartItem : public AbstractBarChartItem
39 {
40 Q_OBJECT
41 public:
42 HorizontalPercentBarChartItem(QAbstractBarSeries *series, ChartPresenter *presenter);
43
44 private:
45 virtual QVector<QRectF> calculateLayout();
46 };
47
48 QTCOMMERCIALCHART_END_NAMESPACE
49
50 #endif // HORIZONTALPERCENTBARCHARTITEM_P_H
@@ -0,0 +1,75
1 #include "qhorizontalpercentbarseries.h"
2 #include "qhorizontalpercentbarseries_p.h"
3 #include "horizontalpercentbarchartitem_p.h"
4 #include "horizontalpercentbaranimation_p.h"
5
6 #include "chartdataset_p.h"
7 #include "charttheme_p.h"
8
9 QTCOMMERCIALCHART_BEGIN_NAMESPACE
10
11 QHorizontalPercentBarSeries::QHorizontalPercentBarSeries(QObject *parent) :
12 QAbstractBarSeries(*new QHorizontalPercentBarSeriesPrivate(this), parent)
13 {
14 }
15
16 QAbstractSeries::SeriesType QHorizontalPercentBarSeries::type() const
17 {
18 return QAbstractSeries::SeriesTypeHorizontalPercentBar;
19 }
20
21
22
23 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
24
25 QHorizontalPercentBarSeriesPrivate::QHorizontalPercentBarSeriesPrivate(QHorizontalPercentBarSeries *q) : QAbstractBarSeriesPrivate(q)
26 {
27
28 }
29
30 void QHorizontalPercentBarSeriesPrivate::scaleDomain(Domain& domain)
31 {
32 qreal minX(domain.minX());
33 qreal minY(domain.minY());
34 qreal maxX(domain.maxX());
35 qreal maxY(domain.maxY());
36 int tickXCount(domain.tickXCount());
37 int tickYCount(domain.tickYCount());
38
39 qreal y = categoryCount();
40 minX = 0;
41 maxX = 100;
42 minY = qMin(minY, - (qreal)0.5);
43 maxY = qMax(maxY, y - (qreal)0.5);
44 tickYCount = y+1;
45
46 domain.setRange(minX,maxX,minY,maxY,tickXCount,tickYCount);
47 }
48
49 Chart* QHorizontalPercentBarSeriesPrivate::createGraphics(ChartPresenter* presenter)
50 {
51 Q_Q(QHorizontalPercentBarSeries);
52
53 HorizontalPercentBarChartItem* bar = new HorizontalPercentBarChartItem(q,presenter);
54 if(presenter->animationOptions().testFlag(QChart::SeriesAnimations)) {
55 bar->setAnimator(presenter->animator());
56 bar->setAnimation(new HorizontalPercentBarAnimation(bar));
57 }
58 presenter->chartTheme()->decorate(q, presenter->dataSet()->seriesIndex(q));
59 return bar;
60 }
61
62 QAbstractAxis::AxisType QHorizontalPercentBarSeriesPrivate::defaultAxisXType() const
63 {
64 return QAbstractAxis::AxisTypeValues;
65 }
66
67 QAbstractAxis::AxisType QHorizontalPercentBarSeriesPrivate::defaultAxisYType() const
68 {
69 return QAbstractAxis::AxisTypeCategories;
70 }
71
72
73 #include "moc_qhorizontalpercentbarseries.cpp"
74
75 QTCOMMERCIALCHART_END_NAMESPACE
@@ -0,0 +1,44
1 /****************************************************************************
2 **
3 ** Copyright (C) 2012 Digia Plc
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 **
7 ** This file is part of the Qt Commercial Charts Add-on.
8 **
9 ** $QT_BEGIN_LICENSE$
10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 ** accordance with the Qt Commercial License Agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia.
14 **
15 ** If you have questions regarding the use of this file, please use
16 ** contact form at http://qt.digia.com
17 ** $QT_END_LICENSE$
18 **
19 ****************************************************************************/
20
21 #ifndef QHORIZONTALPERCENTBARSERIES_H
22 #define QHORIZONTALPERCENTBARSERIES_H
23
24 #include <qabstractbarseries.h>
25
26 QTCOMMERCIALCHART_BEGIN_NAMESPACE
27
28 class QHorizontalPercentBarSeriesPrivate;
29
30 class QTCOMMERCIALCHART_EXPORT QHorizontalPercentBarSeries : public QAbstractBarSeries
31 {
32 Q_OBJECT
33 public:
34 explicit QHorizontalPercentBarSeries(QObject *parent = 0);
35 QAbstractSeries::SeriesType type() const;
36
37 private:
38 Q_DECLARE_PRIVATE(QHorizontalPercentBarSeries)
39 Q_DISABLE_COPY(QHorizontalPercentBarSeries)
40 };
41
42 QTCOMMERCIALCHART_END_NAMESPACE
43
44 #endif // QHORIZONTALPERCENTBARSERIES_H
@@ -0,0 +1,53
1 /****************************************************************************
2 **
3 ** Copyright (C) 2012 Digia Plc
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 **
7 ** This file is part of the Qt Commercial Charts Add-on.
8 **
9 ** $QT_BEGIN_LICENSE$
10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 ** accordance with the Qt Commercial License Agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia.
14 **
15 ** If you have questions regarding the use of this file, please use
16 ** contact form at http://qt.digia.com
17 ** $QT_END_LICENSE$
18 **
19 ****************************************************************************/
20
21 // W A R N I N G
22 // -------------
23 //
24 // This file is not part of the QtCommercial Chart API. It exists purely as an
25 // implementation detail. This header file may change from version to
26 // version without notice, or even be removed.
27 //
28 // We mean it.
29
30 #ifndef QHORIZONTALPERCENTBARSERIES_P_H
31 #define QHORIZONTALPERCENTBARSERIES_P_H
32
33 #include "qabstractbarseries_p.h"
34 #include "domain_p.h"
35
36 QTCOMMERCIALCHART_BEGIN_NAMESPACE
37
38 class QHorizontalPercentBarSeriesPrivate: public QAbstractBarSeriesPrivate
39 {
40 public:
41 QHorizontalPercentBarSeriesPrivate(QHorizontalPercentBarSeries* q);
42 Chart* createGraphics(ChartPresenter* presenter);
43 void scaleDomain(Domain& domain);
44 QAbstractAxis::AxisType defaultAxisXType() const;
45 QAbstractAxis::AxisType defaultAxisYType() const;
46
47 private:
48 Q_DECLARE_PUBLIC(QHorizontalPercentBarSeries)
49 };
50
51 QTCOMMERCIALCHART_END_NAMESPACE
52
53 #endif // QHORIZONTALPERCENTBARSERIES_P_H
@@ -25,4 +25,5 SUBDIRS += \
25 25 qmlpiechart \
26 26 lineandbar \
27 27 horizontalbarchart \
28 horizontalstackedbarchart
28 horizontalstackedbarchart \
29 horizontalpercentbarchart
@@ -13,8 +13,8 SOURCES += \
13 13 $$PWD/percentbaranimation.cpp \
14 14 $$PWD/abstractbaranimation.cpp \
15 15 $$PWD/horizontalbaranimation.cpp \
16 $$PWD/horizontalstackedbaranimation.cpp
17
16 $$PWD/horizontalstackedbaranimation.cpp \
17 $$PWD/horizontalpercentbaranimation.cpp
18 18
19 19 PRIVATE_HEADERS += \
20 20 $$PWD/axisanimation_p.h \
@@ -29,4 +29,5 PRIVATE_HEADERS += \
29 29 $$PWD/percentbaranimation_p.h \
30 30 $$PWD/abstractbaranimation_p.h \
31 31 $$PWD/horizontalbaranimation_p.h \
32 $$PWD/horizontalstackedbaranimation_p.h
32 $$PWD/horizontalstackedbaranimation_p.h \
33 $$PWD/horizontalpercentbaranimation_p.h
@@ -49,7 +49,7 QVariant HorizontalStackedBarAnimation::interpolated(const QVariant &from, const
49 49
50 50 for(int i = 0; i < startVector.count(); i++) {
51 51 qreal h = endVector[i].height();
52 qreal w = startVector[i].width() + ((endVector[i].width() - startVector[i].width()) * progress);
52 qreal w = endVector[i].width() * progress;
53 53 qreal x = xAxis + ((endVector[i].left() - xAxis) * progress);
54 54 qreal y = endVector[i].top();
55 55
@@ -18,7 +18,9 SOURCES += \
18 18 $$PWD/qhorizontalbarseries.cpp \
19 19 $$PWD/horizontalbarchartitem.cpp \
20 20 $$PWD/qhorizontalstackedbarseries.cpp \
21 $$PWD/horizontalstackedbarchartitem.cpp
21 $$PWD/horizontalstackedbarchartitem.cpp \
22 $$PWD/qhorizontalpercentbarseries.cpp \
23 $$PWD/horizontalpercentbarchartitem.cpp
22 24
23 25 PRIVATE_HEADERS += \
24 26 $$PWD/bar_p.h \
@@ -35,7 +37,9 PRIVATE_HEADERS += \
35 37 $$PWD/qhorizontalbarseries_p.h \
36 38 $$PWD/horizontalbarchartitem_p.h \
37 39 $$PWD/qhorizontalstackedbarseries_p.h \
38 $$PWD/horizontalstackedbarchartitem_p.h
40 $$PWD/horizontalstackedbarchartitem_p.h \
41 $$PWD/qhorizontalpercentbarseries_p.h \
42 $$PWD/horizontalpercentbarchartitem_p.h
39 43
40 44 PUBLIC_HEADERS += \
41 45 $$PWD/qabstractbarseries.h \
@@ -47,4 +51,5 PUBLIC_HEADERS += \
47 51 $$PWD/qvbarmodelmapper.h \
48 52 $$PWD/qhbarmodelmapper.h \
49 53 $$PWD/qhorizontalbarseries.h \
50 $$PWD/qhorizontalstackedbarseries.h
54 $$PWD/qhorizontalstackedbarseries.h \
55 $$PWD/qhorizontalpercentbarseries.h
@@ -77,6 +77,7 protected:
77 77 friend class BarChartItem;
78 78 friend class HorizontalBarChartItem;
79 79 friend class HorizontalStackedBarChartItem;
80 friend class HorizontalPercentBarChartItem;
80 81 };
81 82
82 83 QTCOMMERCIALCHART_END_NAMESPACE
@@ -110,6 +110,7 private:
110 110 friend class BarChartItem;
111 111 friend class HorizontalBarChartItem;
112 112 friend class HorizontalStackedBarChartItem;
113 friend class HorizontalPercentBarChartItem;
113 114 };
114 115
115 116 QTCOMMERCIALCHART_END_NAMESPACE
@@ -40,9 +40,9 void QHorizontalBarSeriesPrivate::scaleDomain(Domain& domain)
40 40 qreal y = categoryCount();
41 41 qreal x = max();
42 42 minX = qMin(minX, x);
43 minY = qMin(minY, -0.5);
43 minY = qMin(minY, - (qreal)0.5);
44 44 maxX = qMax(maxX, x);
45 maxY = qMax(maxY, y -0.5);
45 maxY = qMax(maxY, y - (qreal)0.5);
46 46 tickYCount = y+1;
47 47
48 48 domain.setRange(minX,maxX,minY,maxY,tickXCount,tickYCount);
@@ -39,9 +39,9 void QHorizontalStackedBarSeriesPrivate::scaleDomain(Domain& domain)
39 39 qreal y = categoryCount();
40 40 qreal x = maxCategorySum();
41 41 minX = qMin(minX, x);
42 minY = qMin(minY, -0.5);
42 minY = qMin(minY, - (qreal)0.5);
43 43 maxX = qMax(maxX, x);
44 maxY = qMax(maxY, y -0.5);
44 maxY = qMax(maxY, y - (qreal)0.5);
45 45 tickYCount = y+1;
46 46
47 47 domain.setRange(minX,maxX,minY,maxY,tickXCount,tickYCount);
General Comments 0
You need to be logged in to leave comments. Login now