##// 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 INCLUDEPATH += $$PWD
1 INCLUDEPATH += $$PWD
2 DEPENDPATH += $$PWD
2 DEPENDPATH += $$PWD
3
3
4 SOURCES += \
4 SOURCES += \
5 $$PWD/bar.cpp \
5 $$PWD/bar.cpp \
6 $$PWD/barchartitem.cpp \
6 $$PWD/barchartitem.cpp \
7 $$PWD/percentbarchartitem.cpp \
7 $$PWD/percentbarchartitem.cpp \
8 $$PWD/groupedbarchartitem.cpp \
8 $$PWD/groupedbarchartitem.cpp \
9 $$PWD/qabstractbarseries.cpp \
9 $$PWD/qabstractbarseries.cpp \
10 $$PWD/qbarset.cpp \
10 $$PWD/qbarset.cpp \
11 $$PWD/qpercentbarseries.cpp \
11 $$PWD/qpercentbarseries.cpp \
12 $$PWD/qstackedbarseries.cpp \
12 $$PWD/qstackedbarseries.cpp \
13 $$PWD/qbarseries.cpp \
13 $$PWD/qbarseries.cpp \
14 $$PWD/stackedbarchartitem.cpp \
14 $$PWD/stackedbarchartitem.cpp \
15 $$PWD/qbarmodelmapper.cpp \
15 $$PWD/qbarmodelmapper.cpp \
16 $$PWD/qvbarmodelmapper.cpp \
16 $$PWD/qvbarmodelmapper.cpp \
17 $$PWD/qhbarmodelmapper.cpp
17 $$PWD/qhbarmodelmapper.cpp \
18 $$PWD/qhorizontalbarseries.cpp \
19 $$PWD/horizontalbarchartitem.cpp
18
20
19 PRIVATE_HEADERS += \
21 PRIVATE_HEADERS += \
20 $$PWD/bar_p.h \
22 $$PWD/bar_p.h \
21 $$PWD/barchartitem_p.h \
23 $$PWD/barchartitem_p.h \
22 $$PWD/percentbarchartitem_p.h \
24 $$PWD/percentbarchartitem_p.h \
23 $$PWD/stackedbarchartitem_p.h \
25 $$PWD/stackedbarchartitem_p.h \
24 $$PWD/groupedbarchartitem_p.h \
26 $$PWD/groupedbarchartitem_p.h \
25 $$PWD/qbarset_p.h \
27 $$PWD/qbarset_p.h \
26 $$PWD/qabstractbarseries_p.h \
28 $$PWD/qabstractbarseries_p.h \
27 $$PWD/qstackedbarseries_p.h\
29 $$PWD/qstackedbarseries_p.h\
28 $$PWD/qpercentbarseries_p.h \
30 $$PWD/qpercentbarseries_p.h \
29 $$PWD/qbarseries_p.h \
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 PUBLIC_HEADERS += \
36 PUBLIC_HEADERS += \
33 $$PWD/qabstractbarseries.h \
37 $$PWD/qabstractbarseries.h \
34 $$PWD/qbarset.h \
38 $$PWD/qbarset.h \
35 $$PWD/qpercentbarseries.h \
39 $$PWD/qpercentbarseries.h \
36 $$PWD/qstackedbarseries.h \
40 $$PWD/qstackedbarseries.h \
37 $$PWD/qbarseries.h \
41 $$PWD/qbarseries.h \
38 $$PWD/qbarmodelmapper.h \
42 $$PWD/qbarmodelmapper.h \
39 $$PWD/qvbarmodelmapper.h \
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 ** Copyright (C) 2012 Digia Plc
3 ** Copyright (C) 2012 Digia Plc
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 **
6 **
7 ** This file is part of the Qt Commercial Charts Add-on.
7 ** This file is part of the Qt Commercial Charts Add-on.
8 **
8 **
9 ** $QT_BEGIN_LICENSE$
9 ** $QT_BEGIN_LICENSE$
10 ** Licensees holding valid Qt Commercial licenses may use this file in
10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 ** accordance with the Qt Commercial License Agreement provided with the
11 ** accordance with the Qt Commercial License Agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia.
13 ** a written agreement between you and Digia.
14 **
14 **
15 ** If you have questions regarding the use of this file, please use
15 ** If you have questions regarding the use of this file, please use
16 ** contact form at http://qt.digia.com
16 ** contact form at http://qt.digia.com
17 ** $QT_END_LICENSE$
17 ** $QT_END_LICENSE$
18 **
18 **
19 ****************************************************************************/
19 ****************************************************************************/
20
20
21 #ifndef QABSTRACTSERIES_H
21 #ifndef QABSTRACTSERIES_H
22 #define QABSTRACTSERIES_H
22 #define QABSTRACTSERIES_H
23
23
24 #include <qchartglobal.h>
24 #include <qchartglobal.h>
25 #include <qabstractaxis.h>
25 #include <qabstractaxis.h>
26 #include <QObject>
26 #include <QObject>
27 #include <QPen>
27 #include <QPen>
28
28
29 QTCOMMERCIALCHART_BEGIN_NAMESPACE
29 QTCOMMERCIALCHART_BEGIN_NAMESPACE
30
30
31 class QAbstractSeriesPrivate;
31 class QAbstractSeriesPrivate;
32 class QChart;
32 class QChart;
33
33
34 class QTCOMMERCIALCHART_EXPORT QAbstractSeries : public QObject
34 class QTCOMMERCIALCHART_EXPORT QAbstractSeries : public QObject
35 {
35 {
36 Q_OBJECT
36 Q_OBJECT
37 Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
37 Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
38 Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged)
38 Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged)
39 Q_PROPERTY(SeriesType type READ type)
39 Q_PROPERTY(SeriesType type READ type)
40 Q_ENUMS(SeriesType)
40 Q_ENUMS(SeriesType)
41
41
42 public:
42 public:
43 enum SeriesType {
43 enum SeriesType {
44 SeriesTypeLine,
44 SeriesTypeLine,
45 SeriesTypeArea,
45 SeriesTypeArea,
46 SeriesTypeBar,
46 SeriesTypeBar,
47 SeriesTypeStackedBar,
47 SeriesTypeStackedBar,
48 SeriesTypePercentBar,
48 SeriesTypePercentBar,
49 SeriesTypePie,
49 SeriesTypePie,
50 SeriesTypeScatter,
50 SeriesTypeScatter,
51 SeriesTypeSpline
51 SeriesTypeSpline,
52 SeriesTypeHorizontalBar
53
52 };
54 };
53
55
54 protected:
56 protected:
55 QAbstractSeries(QAbstractSeriesPrivate &d, QObject *parent = 0);
57 QAbstractSeries(QAbstractSeriesPrivate &d, QObject *parent = 0);
56
58
57 public:
59 public:
58 ~QAbstractSeries();
60 ~QAbstractSeries();
59 virtual SeriesType type() const = 0;
61 virtual SeriesType type() const = 0;
60
62
61 void setName(const QString& name);
63 void setName(const QString& name);
62 QString name() const;
64 QString name() const;
63 void setVisible(bool visible = true);
65 void setVisible(bool visible = true);
64 bool isVisible() const;
66 bool isVisible() const;
65 QChart* chart() const;
67 QChart* chart() const;
66
68
67 void show();
69 void show();
68 void hide();
70 void hide();
69
71
70 Q_SIGNALS:
72 Q_SIGNALS:
71 void nameChanged();
73 void nameChanged();
72 void visibleChanged();
74 void visibleChanged();
73
75
74 protected:
76 protected:
75 QScopedPointer<QAbstractSeriesPrivate> d_ptr;
77 QScopedPointer<QAbstractSeriesPrivate> d_ptr;
76 friend class ChartDataSet;
78 friend class ChartDataSet;
77 friend class ChartPresenter;
79 friend class ChartPresenter;
78 friend class QLegendPrivate;
80 friend class QLegendPrivate;
79 };
81 };
80
82
81 QTCOMMERCIALCHART_END_NAMESPACE
83 QTCOMMERCIALCHART_END_NAMESPACE
82
84
83 #endif
85 #endif
General Comments 0
You need to be logged in to leave comments. Login now