@@ -1,56 +1,65 | |||||
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 | // 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 | ||||
21 | #ifndef BAR_H |
|
30 | #ifndef BAR_H | |
22 | #define BAR_H |
|
31 | #define BAR_H | |
23 |
|
32 | |||
24 | #include "qchartglobal.h" |
|
33 | #include "qchartglobal.h" | |
25 | #include <QGraphicsRectItem> |
|
34 | #include <QGraphicsRectItem> | |
26 |
|
35 | |||
27 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
36 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
28 |
|
37 | |||
29 | class QBarSet; |
|
38 | class QBarSet; | |
30 |
|
39 | |||
31 | // Single visual bar item of chart |
|
40 | // Single visual bar item of chart | |
32 | class Bar : public QObject, public QGraphicsRectItem |
|
41 | class Bar : public QObject, public QGraphicsRectItem | |
33 | { |
|
42 | { | |
34 | Q_OBJECT |
|
43 | Q_OBJECT | |
35 | public: |
|
44 | public: | |
36 | Bar(QBarSet *barset, QString category, QGraphicsItem *parent = 0); |
|
45 | Bar(QBarSet *barset, QString category, QGraphicsItem *parent = 0); | |
37 |
|
46 | |||
38 | public: |
|
47 | public: | |
39 | void mousePressEvent(QGraphicsSceneMouseEvent *event); |
|
48 | void mousePressEvent(QGraphicsSceneMouseEvent *event); | |
40 | void hoverEnterEvent(QGraphicsSceneHoverEvent *event); |
|
49 | void hoverEnterEvent(QGraphicsSceneHoverEvent *event); | |
41 | void hoverLeaveEvent(QGraphicsSceneHoverEvent *event); |
|
50 | void hoverLeaveEvent(QGraphicsSceneHoverEvent *event); | |
42 |
|
51 | |||
43 | Q_SIGNALS: |
|
52 | Q_SIGNALS: | |
44 | void clicked(QString category); |
|
53 | void clicked(QString category); | |
45 | void clicked(QBarSet *barset, QString category); |
|
54 | void clicked(QBarSet *barset, QString category); | |
46 | void hovered(bool status); |
|
55 | void hovered(bool status); | |
47 | void hovered(QBarSet *barset, bool status); |
|
56 | void hovered(QBarSet *barset, bool status); | |
48 |
|
57 | |||
49 | private: |
|
58 | private: | |
50 | QString m_category; |
|
59 | QString m_category; | |
51 | QBarSet *m_barset; |
|
60 | QBarSet *m_barset; | |
52 | }; |
|
61 | }; | |
53 |
|
62 | |||
54 | QTCOMMERCIALCHART_END_NAMESPACE |
|
63 | QTCOMMERCIALCHART_END_NAMESPACE | |
55 |
|
64 | |||
56 | #endif // BAR_H |
|
65 | #endif // BAR_H |
@@ -1,83 +1,90 | |||||
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 | // 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 | ||||
21 | #ifndef BARCHARTITEM_H |
|
31 | #ifndef BARCHARTITEM_H | |
22 | #define BARCHARTITEM_H |
|
32 | #define BARCHARTITEM_H | |
23 |
|
33 | |||
24 | #include "chartitem_p.h" |
|
34 | #include "chartitem_p.h" | |
25 | #include "qbarseries.h" |
|
35 | #include "qbarseries.h" | |
26 | #include <QPen> |
|
36 | #include <QPen> | |
27 | #include <QBrush> |
|
37 | #include <QBrush> | |
28 |
|
38 | |||
29 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
39 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
30 |
|
40 | |||
31 | class Bar; |
|
41 | class Bar; | |
32 | class QAxisCategories; |
|
42 | class QAxisCategories; | |
33 | class QChart; |
|
43 | class QChart; | |
34 |
|
44 | |||
35 | //typedef QVector<QRectF> BarLayout; |
|
|||
36 |
|
||||
37 | class BarChartItem : public ChartItem |
|
45 | class BarChartItem : public ChartItem | |
38 | { |
|
46 | { | |
39 | Q_OBJECT |
|
47 | Q_OBJECT | |
40 | public: |
|
48 | public: | |
41 | BarChartItem(QBarSeries *series, ChartPresenter *presenter); |
|
49 | BarChartItem(QBarSeries *series, ChartPresenter *presenter); | |
42 | virtual ~BarChartItem(); |
|
50 | virtual ~BarChartItem(); | |
43 |
|
51 | |||
44 | public: |
|
52 | public: | |
45 | // From QGraphicsItem |
|
|||
46 | void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); |
|
53 | void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); | |
47 | QRectF boundingRect() const; |
|
54 | QRectF boundingRect() const; | |
48 |
|
55 | |||
49 | virtual void dataChanged(); // data of series has changed -> need to recalculate bar sizes |
|
56 | virtual void dataChanged(); // data of series has changed -> need to recalculate bar sizes | |
50 |
|
57 | |||
51 | virtual QVector<QRectF> calculateLayout(); |
|
58 | virtual QVector<QRectF> calculateLayout(); | |
52 | void applyLayout(const QVector<QRectF> &layout); |
|
59 | void applyLayout(const QVector<QRectF> &layout); | |
53 | void setLayout(const QVector<QRectF> &layout); |
|
60 | void setLayout(const QVector<QRectF> &layout); | |
54 | void updateLayout(const QVector<QRectF> &layout); |
|
61 | void updateLayout(const QVector<QRectF> &layout); | |
55 |
|
62 | |||
56 | QRectF geometry() const { return m_rect;} |
|
63 | QRectF geometry() const { return m_rect;} | |
57 |
|
64 | |||
58 | public Q_SLOTS: |
|
65 | public Q_SLOTS: | |
59 | void handleModelChanged(); |
|
66 | void handleModelChanged(); | |
60 | void handleDomainChanged(qreal minX, qreal maxX, qreal minY, qreal maxY); |
|
67 | void handleDomainChanged(qreal minX, qreal maxX, qreal minY, qreal maxY); | |
61 | void handleGeometryChanged(const QRectF &size); |
|
68 | void handleGeometryChanged(const QRectF &size); | |
62 | void handleLayoutChanged(); |
|
69 | void handleLayoutChanged(); | |
63 | void labelsVisibleChanged(bool visible); |
|
70 | void labelsVisibleChanged(bool visible); | |
64 |
|
71 | |||
65 | protected: |
|
72 | protected: | |
66 |
|
73 | |||
67 | qreal m_domainMinX; |
|
74 | qreal m_domainMinX; | |
68 | qreal m_domainMaxX; |
|
75 | qreal m_domainMaxX; | |
69 | qreal m_domainMinY; |
|
76 | qreal m_domainMinY; | |
70 | qreal m_domainMaxY; |
|
77 | qreal m_domainMaxY; | |
71 |
|
78 | |||
72 | QRectF m_rect; |
|
79 | QRectF m_rect; | |
73 | QVector<QRectF> m_layout; |
|
80 | QVector<QRectF> m_layout; | |
74 |
|
81 | |||
75 | // Not owned. |
|
82 | // Not owned. | |
76 | QBarSeries *m_series; |
|
83 | QBarSeries *m_series; | |
77 | QList<Bar *> m_bars; |
|
84 | QList<Bar *> m_bars; | |
78 | QList<QGraphicsSimpleTextItem *> m_labels; |
|
85 | QList<QGraphicsSimpleTextItem *> m_labels; | |
79 | }; |
|
86 | }; | |
80 |
|
87 | |||
81 | QTCOMMERCIALCHART_END_NAMESPACE |
|
88 | QTCOMMERCIALCHART_END_NAMESPACE | |
82 |
|
89 | |||
83 | #endif // BARCHARTITEM_H |
|
90 | #endif // BARCHARTITEM_H |
@@ -1,47 +1,52 | |||||
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 | // 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 | ||||
21 | #ifndef GROUPEDBARCHARTITEM_H |
|
31 | #ifndef GROUPEDBARCHARTITEM_H | |
22 | #define GROUPEDBARCHARTITEM_H |
|
32 | #define GROUPEDBARCHARTITEM_H | |
23 |
|
33 | |||
24 | #include "barchartitem_p.h" |
|
34 | #include "barchartitem_p.h" | |
25 | #include "qstackedbarseries.h" |
|
35 | #include "qstackedbarseries.h" | |
26 | #include <QGraphicsItem> |
|
36 | #include <QGraphicsItem> | |
27 |
|
37 | |||
28 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
38 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
29 |
|
39 | |||
30 | class GroupedBarChartItem : public BarChartItem |
|
40 | class GroupedBarChartItem : public BarChartItem | |
31 | { |
|
41 | { | |
32 | Q_OBJECT |
|
42 | Q_OBJECT | |
33 | public: |
|
43 | public: | |
34 | GroupedBarChartItem(QBarSeries *series, ChartPresenter *presenter); |
|
44 | GroupedBarChartItem(QBarSeries *series, ChartPresenter *presenter); | |
35 |
|
45 | |||
36 | private: |
|
46 | private: | |
37 | // From BarChartItem |
|
|||
38 | virtual QVector<QRectF> calculateLayout(); |
|
47 | virtual QVector<QRectF> calculateLayout(); | |
39 |
|
||||
40 | private: |
|
|||
41 |
|
||||
42 | // Data |
|
|||
43 | }; |
|
48 | }; | |
44 |
|
49 | |||
45 | QTCOMMERCIALCHART_END_NAMESPACE |
|
50 | QTCOMMERCIALCHART_END_NAMESPACE | |
46 |
|
51 | |||
47 | #endif // GROUPEDBARCHARTITEM_H |
|
52 | #endif // GROUPEDBARCHARTITEM_H |
@@ -1,47 +1,53 | |||||
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 | // 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 | ||||
21 | #ifndef PERCENTBARCHARTITEM_H |
|
31 | #ifndef PERCENTBARCHARTITEM_H | |
22 | #define PERCENTBARCHARTITEM_H |
|
32 | #define PERCENTBARCHARTITEM_H | |
23 |
|
33 | |||
24 | #include "barchartitem_p.h" |
|
34 | #include "barchartitem_p.h" | |
25 | #include <QGraphicsItem> |
|
35 | #include <QGraphicsItem> | |
26 |
|
36 | |||
27 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
37 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
28 |
|
38 | |||
29 | class QBarSeries; |
|
39 | class QBarSeries; | |
30 |
|
40 | |||
31 | class PercentBarChartItem : public BarChartItem |
|
41 | class PercentBarChartItem : public BarChartItem | |
32 | { |
|
42 | { | |
33 | Q_OBJECT |
|
43 | Q_OBJECT | |
34 | public: |
|
44 | public: | |
35 | PercentBarChartItem(QBarSeries *series, ChartPresenter *presenter); |
|
45 | PercentBarChartItem(QBarSeries *series, ChartPresenter *presenter); | |
36 |
|
46 | |||
37 | private: |
|
47 | private: | |
38 | virtual QVector<QRectF> calculateLayout(); |
|
48 | virtual QVector<QRectF> calculateLayout(); | |
39 |
|
||||
40 | private: |
|
|||
41 |
|
||||
42 | // Data |
|
|||
43 | }; |
|
49 | }; | |
44 |
|
50 | |||
45 | QTCOMMERCIALCHART_END_NAMESPACE |
|
51 | QTCOMMERCIALCHART_END_NAMESPACE | |
46 |
|
52 | |||
47 | #endif // PERCENTBARCHARTITEM_H |
|
53 | #endif // PERCENTBARCHARTITEM_H |
@@ -1,64 +1,92 | |||||
|
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 | ||||
1 | #ifndef QBARSERIES_P_H |
|
30 | #ifndef QBARSERIES_P_H | |
2 | #define QBARSERIES_P_H |
|
31 | #define QBARSERIES_P_H | |
3 |
|
32 | |||
4 | #include "qbarseries.h" |
|
33 | #include "qbarseries.h" | |
5 | #include "qabstractseries_p.h" |
|
34 | #include "qabstractseries_p.h" | |
6 | #include <QStringList> |
|
35 | #include <QStringList> | |
7 | #include <QAbstractSeries> |
|
36 | #include <QAbstractSeries> | |
8 |
|
37 | |||
9 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
38 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
10 |
|
39 | |||
11 | class QBarModelMapper; |
|
40 | class QBarModelMapper; | |
12 |
|
41 | |||
13 | // Container for series |
|
|||
14 | class QBarSeriesPrivate : public QAbstractSeriesPrivate |
|
42 | class QBarSeriesPrivate : public QAbstractSeriesPrivate | |
15 | { |
|
43 | { | |
16 | Q_OBJECT |
|
44 | Q_OBJECT | |
17 | public: |
|
45 | public: | |
18 | QBarSeriesPrivate(QBarSeries *parent); |
|
46 | QBarSeriesPrivate(QBarSeries *parent); | |
19 | void setCategories(QBarCategories categories); |
|
47 | void setCategories(QBarCategories categories); | |
20 | void insertCategory(int index, const QString category); |
|
48 | void insertCategory(int index, const QString category); | |
21 | void removeCategory(int index); |
|
49 | void removeCategory(int index); | |
22 | int categoryCount() const; |
|
50 | int categoryCount() const; | |
23 | QBarCategories categories() const; |
|
51 | QBarCategories categories() const; | |
24 |
|
52 | |||
25 | void setBarMargin(qreal margin); |
|
53 | void setBarMargin(qreal margin); | |
26 | qreal barMargin(); |
|
54 | qreal barMargin(); | |
27 |
|
55 | |||
28 | void scaleDomain(Domain& domain); |
|
56 | void scaleDomain(Domain& domain); | |
29 | Chart* createGraphics(ChartPresenter* presenter); |
|
57 | Chart* createGraphics(ChartPresenter* presenter); | |
30 | QList<LegendMarker*> createLegendMarker(QLegend* legend); |
|
58 | QList<LegendMarker*> createLegendMarker(QLegend* legend); | |
31 |
|
59 | |||
32 | QBarSet* barsetAt(int index); |
|
60 | QBarSet* barsetAt(int index); | |
33 | QString categoryName(int category); |
|
61 | QString categoryName(int category); | |
34 | qreal min(); |
|
62 | qreal min(); | |
35 | qreal max(); |
|
63 | qreal max(); | |
36 | qreal valueAt(int set, int category); |
|
64 | qreal valueAt(int set, int category); | |
37 | qreal percentageAt(int set, int category); |
|
65 | qreal percentageAt(int set, int category); | |
38 | qreal categorySum(int category); |
|
66 | qreal categorySum(int category); | |
39 | qreal absoluteCategorySum(int category); |
|
67 | qreal absoluteCategorySum(int category); | |
40 | qreal maxCategorySum(); |
|
68 | qreal maxCategorySum(); | |
41 |
|
69 | |||
42 | Q_SIGNALS: |
|
70 | Q_SIGNALS: | |
43 | void clicked(QBarSet *barset, QString category); |
|
71 | void clicked(QBarSet *barset, QString category); | |
44 | void updatedBars(); |
|
72 | void updatedBars(); | |
45 | void restructuredBars(); |
|
73 | void restructuredBars(); | |
46 | void categoriesUpdated(); |
|
74 | void categoriesUpdated(); | |
47 | void labelsVisibleChanged(bool visible); |
|
75 | void labelsVisibleChanged(bool visible); | |
48 |
|
76 | |||
49 | private Q_SLOTS: |
|
77 | private Q_SLOTS: | |
50 | void barsetChanged(); |
|
78 | void barsetChanged(); | |
51 |
|
79 | |||
52 | protected: |
|
80 | protected: | |
53 | QList<QBarSet *> m_barSets; |
|
81 | QList<QBarSet *> m_barSets; | |
54 | QBarCategories m_categories; |
|
82 | QBarCategories m_categories; | |
55 | qreal m_barMargin; |
|
83 | qreal m_barMargin; | |
56 | bool m_labelsVisible; |
|
84 | bool m_labelsVisible; | |
57 |
|
85 | |||
58 | private: |
|
86 | private: | |
59 | Q_DECLARE_PUBLIC(QBarSeries) |
|
87 | Q_DECLARE_PUBLIC(QBarSeries) | |
60 | }; |
|
88 | }; | |
61 |
|
89 | |||
62 | QTCOMMERCIALCHART_END_NAMESPACE |
|
90 | QTCOMMERCIALCHART_END_NAMESPACE | |
63 |
|
91 | |||
64 | #endif // QBARSERIESPRIVATE_P_H |
|
92 | #endif // QBARSERIESPRIVATE_P_H |
@@ -1,40 +1,69 | |||||
|
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 | ||||
1 | #ifndef QBARSET_P_H |
|
30 | #ifndef QBARSET_P_H | |
2 | #define QBARSET_P_H |
|
31 | #define QBARSET_P_H | |
3 |
|
32 | |||
4 | #include "qbarset.h" |
|
33 | #include "qbarset.h" | |
5 | #include <QMap> |
|
34 | #include <QMap> | |
6 | #include <QPen> |
|
35 | #include <QPen> | |
7 | #include <QBrush> |
|
36 | #include <QBrush> | |
8 | #include <QFont> |
|
37 | #include <QFont> | |
9 |
|
38 | |||
10 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
39 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
11 |
|
40 | |||
12 | class QBarSetPrivate : public QObject |
|
41 | class QBarSetPrivate : public QObject | |
13 | { |
|
42 | { | |
14 | Q_OBJECT |
|
43 | Q_OBJECT | |
15 |
|
44 | |||
16 | public: |
|
45 | public: | |
17 | QBarSetPrivate(const QString name, QBarSet *parent); |
|
46 | QBarSetPrivate(const QString name, QBarSet *parent); | |
18 | ~QBarSetPrivate(); |
|
47 | ~QBarSetPrivate(); | |
19 |
|
48 | |||
20 | Q_SIGNALS: |
|
49 | Q_SIGNALS: | |
21 | void clicked(QString category); |
|
50 | void clicked(QString category); | |
22 | void restructuredBars(); |
|
51 | void restructuredBars(); | |
23 | void updatedBars(); |
|
52 | void updatedBars(); | |
24 |
|
53 | |||
25 | public: |
|
54 | public: | |
26 | QBarSet * const q_ptr; |
|
55 | QBarSet * const q_ptr; | |
27 | QString m_name; |
|
56 | QString m_name; | |
28 | QList<QPointF> m_values; |
|
57 | QList<QPointF> m_values; | |
29 | QPen m_pen; |
|
58 | QPen m_pen; | |
30 | QBrush m_brush; |
|
59 | QBrush m_brush; | |
31 | QPen m_labelPen; |
|
60 | QPen m_labelPen; | |
32 | QBrush m_labelBrush; |
|
61 | QBrush m_labelBrush; | |
33 | QFont m_labelFont; |
|
62 | QFont m_labelFont; | |
34 |
|
63 | |||
35 | friend class QBarSet; |
|
64 | friend class QBarSet; | |
36 | }; |
|
65 | }; | |
37 |
|
66 | |||
38 | QTCOMMERCIALCHART_END_NAMESPACE |
|
67 | QTCOMMERCIALCHART_END_NAMESPACE | |
39 |
|
68 | |||
40 | #endif // QBARSETPRIVATE_P_H |
|
69 | #endif // QBARSETPRIVATE_P_H |
@@ -1,47 +1,52 | |||||
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 | // 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 | ||||
21 | #ifndef STACKEDBARCHARTITEM_H |
|
31 | #ifndef STACKEDBARCHARTITEM_H | |
22 | #define STACKEDBARCHARTITEM_H |
|
32 | #define STACKEDBARCHARTITEM_H | |
23 |
|
33 | |||
24 | #include "barchartitem_p.h" |
|
34 | #include "barchartitem_p.h" | |
25 | #include "qstackedbarseries.h" |
|
35 | #include "qstackedbarseries.h" | |
26 | #include <QGraphicsItem> |
|
36 | #include <QGraphicsItem> | |
27 |
|
37 | |||
28 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
38 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
29 |
|
39 | |||
30 | class StackedBarChartItem : public BarChartItem |
|
40 | class StackedBarChartItem : public BarChartItem | |
31 | { |
|
41 | { | |
32 | Q_OBJECT |
|
42 | Q_OBJECT | |
33 | public: |
|
43 | public: | |
34 | StackedBarChartItem(QBarSeries *series, ChartPresenter *presenter); |
|
44 | StackedBarChartItem(QBarSeries *series, ChartPresenter *presenter); | |
35 |
|
45 | |||
36 | private: |
|
46 | private: | |
37 | // From BarChartItem |
|
|||
38 | virtual QVector<QRectF> calculateLayout(); |
|
47 | virtual QVector<QRectF> calculateLayout(); | |
39 |
|
||||
40 | private: |
|
|||
41 |
|
||||
42 | // Data |
|
|||
43 | }; |
|
48 | }; | |
44 |
|
49 | |||
45 | QTCOMMERCIALCHART_END_NAMESPACE |
|
50 | QTCOMMERCIALCHART_END_NAMESPACE | |
46 |
|
51 | |||
47 | #endif // STACKEDBARCHARTITEM_H |
|
52 | #endif // STACKEDBARCHARTITEM_H |
General Comments 0
You need to be logged in to leave comments.
Login now