##// END OF EJS Templates
BoxPlot type and a friend...
Mika Salmela -
r2472:15b722b37660
parent child
Show More
@@ -1,83 +1,84
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2013 Digia Plc
3 ** Copyright (C) 2013 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 QABSTRACTBARSERIES_H
21 #ifndef QABSTRACTBARSERIES_H
22 #define QABSTRACTBARSERIES_H
22 #define QABSTRACTBARSERIES_H
23
23
24 #include <qabstractseries.h>
24 #include <qabstractseries.h>
25 #include <QStringList>
25 #include <QStringList>
26
26
27 QTCOMMERCIALCHART_BEGIN_NAMESPACE
27 QTCOMMERCIALCHART_BEGIN_NAMESPACE
28
28
29 class QBarSet;
29 class QBarSet;
30 class QAbstractBarSeriesPrivate;
30 class QAbstractBarSeriesPrivate;
31
31
32 // Container for series
32 // Container for series
33 class QTCOMMERCIALCHART_EXPORT QAbstractBarSeries : public QAbstractSeries
33 class QTCOMMERCIALCHART_EXPORT QAbstractBarSeries : public QAbstractSeries
34 {
34 {
35 Q_OBJECT
35 Q_OBJECT
36 Q_PROPERTY(qreal barWidth READ barWidth WRITE setBarWidth)
36 Q_PROPERTY(qreal barWidth READ barWidth WRITE setBarWidth)
37 Q_PROPERTY(int count READ count NOTIFY countChanged)
37 Q_PROPERTY(int count READ count NOTIFY countChanged)
38 Q_PROPERTY(bool labelsVisible READ isLabelsVisible WRITE setLabelsVisible NOTIFY labelsVisibleChanged)
38 Q_PROPERTY(bool labelsVisible READ isLabelsVisible WRITE setLabelsVisible NOTIFY labelsVisibleChanged)
39
39
40 public:
40 public:
41 virtual ~QAbstractBarSeries();
41 virtual ~QAbstractBarSeries();
42
42
43 void setBarWidth(qreal width);
43 void setBarWidth(qreal width);
44 qreal barWidth() const;
44 qreal barWidth() const;
45
45
46 bool append(QBarSet *set);
46 bool append(QBarSet *set);
47 bool remove(QBarSet *set);
47 bool remove(QBarSet *set);
48 bool take(QBarSet *set);
48 bool take(QBarSet *set);
49 bool append(QList<QBarSet *> sets);
49 bool append(QList<QBarSet *> sets);
50 bool insert(int index, QBarSet *set);
50 bool insert(int index, QBarSet *set);
51 int count() const;
51 int count() const;
52 QList<QBarSet *> barSets() const;
52 QList<QBarSet *> barSets() const;
53 void clear();
53 void clear();
54
54
55 void setLabelsVisible(bool visible = true);
55 void setLabelsVisible(bool visible = true);
56 bool isLabelsVisible() const;
56 bool isLabelsVisible() const;
57
57
58 protected:
58 protected:
59 explicit QAbstractBarSeries(QAbstractBarSeriesPrivate &d, QObject *parent = 0);
59 explicit QAbstractBarSeries(QAbstractBarSeriesPrivate &d, QObject *parent = 0);
60
60
61 Q_SIGNALS:
61 Q_SIGNALS:
62 void clicked(int index, QBarSet *barset);
62 void clicked(int index, QBarSet *barset);
63 void hovered(bool status, QBarSet *barset);
63 void hovered(bool status, QBarSet *barset);
64 void countChanged();
64 void countChanged();
65 void labelsVisibleChanged();
65 void labelsVisibleChanged();
66
66
67 void barsetsAdded(QList<QBarSet *> sets);
67 void barsetsAdded(QList<QBarSet *> sets);
68 void barsetsRemoved(QList<QBarSet *> sets);
68 void barsetsRemoved(QList<QBarSet *> sets);
69
69
70 protected:
70 protected:
71 Q_DECLARE_PRIVATE(QAbstractBarSeries)
71 Q_DECLARE_PRIVATE(QAbstractBarSeries)
72 friend class AbstractBarChartItem;
72 friend class AbstractBarChartItem;
73 friend class PercentBarChartItem;
73 friend class PercentBarChartItem;
74 friend class StackedBarChartItem;
74 friend class StackedBarChartItem;
75 friend class BoxPlotChartItem;
75 friend class BarChartItem;
76 friend class BarChartItem;
76 friend class HorizontalBarChartItem;
77 friend class HorizontalBarChartItem;
77 friend class HorizontalStackedBarChartItem;
78 friend class HorizontalStackedBarChartItem;
78 friend class HorizontalPercentBarChartItem;
79 friend class HorizontalPercentBarChartItem;
79 };
80 };
80
81
81 QTCOMMERCIALCHART_END_NAMESPACE
82 QTCOMMERCIALCHART_END_NAMESPACE
82
83
83 #endif // QABSTRACTBARSERIES_H
84 #endif // QABSTRACTBARSERIES_H
@@ -1,118 +1,119
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2013 Digia Plc
3 ** Copyright (C) 2013 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 QBARSET_H
21 #ifndef QBARSET_H
22 #define QBARSET_H
22 #define QBARSET_H
23
23
24 #include <qchartglobal.h>
24 #include <qchartglobal.h>
25 #include <QPen>
25 #include <QPen>
26 #include <QBrush>
26 #include <QBrush>
27 #include <QFont>
27 #include <QFont>
28
28
29 QTCOMMERCIALCHART_BEGIN_NAMESPACE
29 QTCOMMERCIALCHART_BEGIN_NAMESPACE
30 class QBarSetPrivate;
30 class QBarSetPrivate;
31
31
32 class QTCOMMERCIALCHART_EXPORT QBarSet : public QObject
32 class QTCOMMERCIALCHART_EXPORT QBarSet : public QObject
33 {
33 {
34 Q_OBJECT
34 Q_OBJECT
35 Q_PROPERTY(QString label READ label WRITE setLabel NOTIFY labelChanged)
35 Q_PROPERTY(QString label READ label WRITE setLabel NOTIFY labelChanged)
36 Q_PROPERTY(QPen pen READ pen WRITE setPen NOTIFY penChanged)
36 Q_PROPERTY(QPen pen READ pen WRITE setPen NOTIFY penChanged)
37 Q_PROPERTY(QBrush brush READ brush WRITE setBrush NOTIFY brushChanged)
37 Q_PROPERTY(QBrush brush READ brush WRITE setBrush NOTIFY brushChanged)
38 Q_PROPERTY(QBrush labelBrush READ labelBrush WRITE setLabelBrush NOTIFY labelBrushChanged)
38 Q_PROPERTY(QBrush labelBrush READ labelBrush WRITE setLabelBrush NOTIFY labelBrushChanged)
39 Q_PROPERTY(QFont labelFont READ labelFont WRITE setLabelFont NOTIFY labelFontChanged)
39 Q_PROPERTY(QFont labelFont READ labelFont WRITE setLabelFont NOTIFY labelFontChanged)
40 Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
40 Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
41 Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor NOTIFY borderColorChanged)
41 Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor NOTIFY borderColorChanged)
42 Q_PROPERTY(QColor labelColor READ labelColor WRITE setLabelColor NOTIFY labelColorChanged)
42 Q_PROPERTY(QColor labelColor READ labelColor WRITE setLabelColor NOTIFY labelColorChanged)
43
43
44 public:
44 public:
45 explicit QBarSet(const QString label, QObject *parent = 0);
45 explicit QBarSet(const QString label, QObject *parent = 0);
46 virtual ~QBarSet();
46 virtual ~QBarSet();
47
47
48 void setLabel(const QString label);
48 void setLabel(const QString label);
49 QString label() const;
49 QString label() const;
50
50
51 void append(const qreal value);
51 void append(const qreal value);
52 void append(const QList<qreal> &values);
52 void append(const QList<qreal> &values);
53
53
54 QBarSet &operator << (const qreal &value);
54 QBarSet &operator << (const qreal &value);
55
55
56 void insert(const int index, const qreal value);
56 void insert(const int index, const qreal value);
57 void remove(const int index, const int count = 1);
57 void remove(const int index, const int count = 1);
58 void replace(const int index, const qreal value);
58 void replace(const int index, const qreal value);
59 qreal at(const int index) const;
59 qreal at(const int index) const;
60 qreal operator [](const int index) const;
60 qreal operator [](const int index) const;
61 int count() const;
61 int count() const;
62 qreal sum() const;
62 qreal sum() const;
63
63
64 void setPen(const QPen &pen);
64 void setPen(const QPen &pen);
65 QPen pen() const;
65 QPen pen() const;
66
66
67 void setBrush(const QBrush &brush);
67 void setBrush(const QBrush &brush);
68 QBrush brush() const;
68 QBrush brush() const;
69
69
70 void setLabelBrush(const QBrush &brush);
70 void setLabelBrush(const QBrush &brush);
71 QBrush labelBrush() const;
71 QBrush labelBrush() const;
72
72
73 void setLabelFont(const QFont &font);
73 void setLabelFont(const QFont &font);
74 QFont labelFont() const;
74 QFont labelFont() const;
75
75
76 QColor color();
76 QColor color();
77 void setColor(QColor color);
77 void setColor(QColor color);
78
78
79 QColor borderColor();
79 QColor borderColor();
80 void setBorderColor(QColor color);
80 void setBorderColor(QColor color);
81
81
82 QColor labelColor();
82 QColor labelColor();
83 void setLabelColor(QColor color);
83 void setLabelColor(QColor color);
84
84
85 Q_SIGNALS:
85 Q_SIGNALS:
86 void clicked(int index);
86 void clicked(int index);
87 void hovered(bool status);
87 void hovered(bool status);
88 void penChanged();
88 void penChanged();
89 void brushChanged();
89 void brushChanged();
90 void labelChanged();
90 void labelChanged();
91 void labelBrushChanged();
91 void labelBrushChanged();
92 void labelFontChanged();
92 void labelFontChanged();
93 void colorChanged(QColor color);
93 void colorChanged(QColor color);
94 void borderColorChanged(QColor color);
94 void borderColorChanged(QColor color);
95 void labelColorChanged(QColor color);
95 void labelColorChanged(QColor color);
96
96
97 void valuesAdded(int index, int count);
97 void valuesAdded(int index, int count);
98 void valuesRemoved(int index, int count);
98 void valuesRemoved(int index, int count);
99 void valueChanged(int index);
99 void valueChanged(int index);
100
100
101 private:
101 private:
102 QScopedPointer<QBarSetPrivate> d_ptr;
102 QScopedPointer<QBarSetPrivate> d_ptr;
103 Q_DISABLE_COPY(QBarSet)
103 Q_DISABLE_COPY(QBarSet)
104 friend class QAbstractBarSeries;
104 friend class QAbstractBarSeries;
105 friend class BarLegendMarker;
105 friend class BarLegendMarker;
106 friend class AbstractBarChartItem;
106 friend class AbstractBarChartItem;
107 friend class QAbstractBarSeriesPrivate;
107 friend class QAbstractBarSeriesPrivate;
108 friend class StackedBarChartItem;
108 friend class StackedBarChartItem;
109 friend class PercentBarChartItem;
109 friend class PercentBarChartItem;
110 friend class BarChartItem;
110 friend class BarChartItem;
111 friend class HorizontalBarChartItem;
111 friend class HorizontalBarChartItem;
112 friend class HorizontalStackedBarChartItem;
112 friend class HorizontalStackedBarChartItem;
113 friend class HorizontalPercentBarChartItem;
113 friend class HorizontalPercentBarChartItem;
114 friend class BoxPlotChartItem;
114 };
115 };
115
116
116 QTCOMMERCIALCHART_END_NAMESPACE
117 QTCOMMERCIALCHART_END_NAMESPACE
117
118
118 #endif // QBARSET_H
119 #endif // QBARSET_H
General Comments 0
You need to be logged in to leave comments. Login now