##// END OF EJS Templates
horizontal barchart frame
sauimone -
r1672:3408cb5163eb
parent child
Show More
@@ -0,0 +1,19
1 #include "horizontalbarchartitem_p.h"
2
3 QTCOMMERCIALCHART_BEGIN_NAMESPACE
4
5 HorizontalBarChartitem::HorizontalBarChartitem(QAbstractBarSeries *series, ChartPresenter *presenter) :
6 BarChartItem(series, presenter)
7 {
8 }
9
10 QVector<QRectF> HorizontalBarChartitem::calculateLayout()
11 {
12 // TODO:
13 QVector<QRectF> layout;
14 return layout;
15 }
16
17 #include "moc_horizontalbarchartitem_p.cpp"
18
19 QTCOMMERCIALCHART_END_NAMESPACE
@@ -0,0 +1,23
1 #ifndef HORIZONTALBARCHARTITEM_H
2 #define HORIZONTALBARCHARTITEM_H
3
4 #include "barchartitem_p.h"
5 #include "qstackedbarseries.h"
6 #include <QGraphicsItem>
7
8 QTCOMMERCIALCHART_BEGIN_NAMESPACE
9
10
11 class HorizontalBarChartitem : public BarChartItem
12 {
13 Q_OBJECT
14 public:
15 HorizontalBarChartitem(QAbstractBarSeries *series, ChartPresenter *presenter);
16
17 private:
18 virtual QVector<QRectF> calculateLayout();
19 };
20
21 QTCOMMERCIALCHART_END_NAMESPACE
22
23 #endif // HORIZONTALBARCHARTITEM_H
@@ -0,0 +1,69
1 #include "qhorizontalbarseries.h"
2 #include "qhorizontalbarseries_p.h"
3 QTCOMMERCIALCHART_BEGIN_NAMESPACE
4
5 QHorizontalBarSeries::QHorizontalBarSeries(QObject *parent) :
6 QAbstractBarSeries(parent)
7 {
8 }
9
10 QAbstractSeries::SeriesType QHorizontalBarSeries::type() const
11 {
12 return QAbstractSeries::SeriesTypeHorizontalBar;
13 }
14
15
16
17 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
18
19 QHorizontalBarSeriesPrivate::QHorizontalBarSeriesPrivate(QHorizontalBarSeries *q) : QAbstractBarSeriesPrivate(q)
20 {
21
22 }
23
24 void QHorizontalBarSeriesPrivate::scaleDomain(Domain& domain)
25 {
26 // TODO:
27 Q_UNUSED(domain);
28 /*
29 qreal minX(domain.minX());
30 qreal minY(domain.minY());
31 qreal maxX(domain.maxX());
32 qreal maxY(domain.maxY());
33 int tickXCount(domain.tickXCount());
34 int tickYCount(domain.tickYCount());
35
36 qreal x = categoryCount();
37 qreal y = max();
38 minX = qMin(minX, -0.5);
39 minY = qMin(minY, y);
40 maxX = qMax(maxX, x - 0.5);
41 maxY = qMax(maxY, y);
42 tickXCount = x+1;
43
44 domain.setRange(minX,maxX,minY,maxY,tickXCount,tickYCount);
45 */
46 }
47
48
49 Chart* QHorizontalBarSeriesPrivate::createGraphics(ChartPresenter* presenter)
50 {
51 // TODO:
52 Q_UNUSED(presenter);
53 return 0;
54 /*
55 Q_Q(QHorizontalBarSeries);
56
57 GroupedBarChartItem* bar = new GroupedBarChartItem(q,presenter);
58 if(presenter->animationOptions().testFlag(QChart::SeriesAnimations)) {
59 presenter->animator()->addAnimation(bar);
60 }
61 presenter->chartTheme()->decorate(q, presenter->dataSet()->seriesIndex(q));
62 return bar;
63 */
64 }
65
66
67 #include "moc_qhorizontalbarseries.cpp"
68
69 QTCOMMERCIALCHART_END_NAMESPACE
@@ -0,0 +1,24
1 #ifndef QHORIZONTALBARSERIES_H
2 #define QHORIZONTALBARSERIES_H
3
4 #include <qabstractbarseries.h>
5
6 QTCOMMERCIALCHART_BEGIN_NAMESPACE
7
8 class QHorizontalBarSeriesPrivate;
9
10 class QTCOMMERCIALCHART_EXPORT QHorizontalBarSeries : public QAbstractBarSeries
11 {
12 Q_OBJECT
13 public:
14 explicit QHorizontalBarSeries(QObject *parent = 0);
15 QAbstractSeries::SeriesType type() const;
16
17 private:
18 Q_DECLARE_PRIVATE(QHorizontalBarSeries)
19 Q_DISABLE_COPY(QHorizontalBarSeries)
20 };
21
22 QTCOMMERCIALCHART_END_NAMESPACE
23
24 #endif // QHORIZONTALBARSERIES_H
@@ -0,0 +1,51
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 QHORIZONTALBARSERIES_P_H
31 #define QHORIZONTALBARSERIES_P_H
32
33 #include "qabstractbarseries_p.h"
34 #include "domain_p.h"
35
36 QTCOMMERCIALCHART_BEGIN_NAMESPACE
37
38 class QHorizontalBarSeriesPrivate: public QAbstractBarSeriesPrivate
39 {
40 public:
41 QHorizontalBarSeriesPrivate(QHorizontalBarSeries* q);
42 Chart* createGraphics(ChartPresenter* presenter);
43 void scaleDomain(Domain& domain);
44
45 private:
46 Q_DECLARE_PUBLIC(QHorizontalBarSeries)
47 };
48
49 QTCOMMERCIALCHART_END_NAMESPACE
50
51 #endif // QHORIZONTALBARSERIES_P_H
@@ -1,40 +1,45
1 1 INCLUDEPATH += $$PWD
2 2 DEPENDPATH += $$PWD
3 3
4 4 SOURCES += \
5 5 $$PWD/bar.cpp \
6 6 $$PWD/barchartitem.cpp \
7 7 $$PWD/percentbarchartitem.cpp \
8 8 $$PWD/groupedbarchartitem.cpp \
9 9 $$PWD/qabstractbarseries.cpp \
10 10 $$PWD/qbarset.cpp \
11 11 $$PWD/qpercentbarseries.cpp \
12 12 $$PWD/qstackedbarseries.cpp \
13 13 $$PWD/qbarseries.cpp \
14 14 $$PWD/stackedbarchartitem.cpp \
15 15 $$PWD/qbarmodelmapper.cpp \
16 16 $$PWD/qvbarmodelmapper.cpp \
17 $$PWD/qhbarmodelmapper.cpp
17 $$PWD/qhbarmodelmapper.cpp \
18 $$PWD/qhorizontalbarseries.cpp \
19 $$PWD/horizontalbarchartitem.cpp
18 20
19 21 PRIVATE_HEADERS += \
20 22 $$PWD/bar_p.h \
21 23 $$PWD/barchartitem_p.h \
22 24 $$PWD/percentbarchartitem_p.h \
23 25 $$PWD/stackedbarchartitem_p.h \
24 26 $$PWD/groupedbarchartitem_p.h \
25 27 $$PWD/qbarset_p.h \
26 28 $$PWD/qabstractbarseries_p.h \
27 29 $$PWD/qstackedbarseries_p.h\
28 30 $$PWD/qpercentbarseries_p.h \
29 31 $$PWD/qbarseries_p.h \
30 $$PWD/qbarmodelmapper_p.h
32 $$PWD/qbarmodelmapper_p.h \
33 $$PWD/qhorizontalbarseries_p.h \
34 $$PWD/horizontalbarchartitem_p.h
31 35
32 36 PUBLIC_HEADERS += \
33 37 $$PWD/qabstractbarseries.h \
34 38 $$PWD/qbarset.h \
35 39 $$PWD/qpercentbarseries.h \
36 40 $$PWD/qstackedbarseries.h \
37 41 $$PWD/qbarseries.h \
38 42 $$PWD/qbarmodelmapper.h \
39 43 $$PWD/qvbarmodelmapper.h \
40 $$PWD/qhbarmodelmapper.h
44 $$PWD/qhbarmodelmapper.h \
45 $$PWD/qhorizontalbarseries.h
@@ -1,83 +1,85
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2012 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Commercial Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 11 ** accordance with the Qt Commercial License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 #ifndef QABSTRACTSERIES_H
22 22 #define QABSTRACTSERIES_H
23 23
24 24 #include <qchartglobal.h>
25 25 #include <qabstractaxis.h>
26 26 #include <QObject>
27 27 #include <QPen>
28 28
29 29 QTCOMMERCIALCHART_BEGIN_NAMESPACE
30 30
31 31 class QAbstractSeriesPrivate;
32 32 class QChart;
33 33
34 34 class QTCOMMERCIALCHART_EXPORT QAbstractSeries : public QObject
35 35 {
36 36 Q_OBJECT
37 37 Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
38 38 Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged)
39 39 Q_PROPERTY(SeriesType type READ type)
40 40 Q_ENUMS(SeriesType)
41 41
42 42 public:
43 43 enum SeriesType {
44 44 SeriesTypeLine,
45 45 SeriesTypeArea,
46 46 SeriesTypeBar,
47 47 SeriesTypeStackedBar,
48 48 SeriesTypePercentBar,
49 49 SeriesTypePie,
50 50 SeriesTypeScatter,
51 SeriesTypeSpline
51 SeriesTypeSpline,
52 SeriesTypeHorizontalBar
53
52 54 };
53 55
54 56 protected:
55 57 QAbstractSeries(QAbstractSeriesPrivate &d, QObject *parent = 0);
56 58
57 59 public:
58 60 ~QAbstractSeries();
59 61 virtual SeriesType type() const = 0;
60 62
61 63 void setName(const QString& name);
62 64 QString name() const;
63 65 void setVisible(bool visible = true);
64 66 bool isVisible() const;
65 67 QChart* chart() const;
66 68
67 69 void show();
68 70 void hide();
69 71
70 72 Q_SIGNALS:
71 73 void nameChanged();
72 74 void visibleChanged();
73 75
74 76 protected:
75 77 QScopedPointer<QAbstractSeriesPrivate> d_ptr;
76 78 friend class ChartDataSet;
77 79 friend class ChartPresenter;
78 80 friend class QLegendPrivate;
79 81 };
80 82
81 83 QTCOMMERCIALCHART_END_NAMESPACE
82 84
83 85 #endif
General Comments 0
You need to be logged in to leave comments. Login now