1/****************************************************************************
2**
3** Copyright (C) 2016 The Qt Company Ltd.
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the Qt Charts module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:GPL$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU
19** General Public License version 3 or (at your option) any later version
20** approved by the KDE Free Qt Foundation. The licenses are as published by
21** the Free Software Foundation and appearing in the file LICENSE.GPL3
22** included in the packaging of this file. Please review the following
23** information to ensure the GNU General Public License requirements will
24** be met: https://www.gnu.org/licenses/gpl-3.0.html.
25**
26** $QT_END_LICENSE$
27**
28****************************************************************************/
29
30#ifndef QCANDLESTICKSERIES_H
31#define QCANDLESTICKSERIES_H
32
33#include <QtCharts/QAbstractSeries>
34
35QT_CHARTS_BEGIN_NAMESPACE
36
37class QCandlestickSeriesPrivate;
38class QCandlestickSet;
39
40class Q_CHARTS_EXPORT QCandlestickSeries : public QAbstractSeries
41{
42 Q_OBJECT
43 Q_PROPERTY(int count READ count NOTIFY countChanged)
44 Q_PROPERTY(qreal maximumColumnWidth READ maximumColumnWidth WRITE setMaximumColumnWidth NOTIFY maximumColumnWidthChanged)
45 Q_PROPERTY(qreal minimumColumnWidth READ minimumColumnWidth WRITE setMinimumColumnWidth NOTIFY minimumColumnWidthChanged)
46 Q_PROPERTY(qreal bodyWidth READ bodyWidth WRITE setBodyWidth NOTIFY bodyWidthChanged)
47 Q_PROPERTY(bool bodyOutlineVisible READ bodyOutlineVisible WRITE setBodyOutlineVisible NOTIFY bodyOutlineVisibilityChanged)
48 Q_PROPERTY(qreal capsWidth READ capsWidth WRITE setCapsWidth NOTIFY capsWidthChanged)
49 Q_PROPERTY(bool capsVisible READ capsVisible WRITE setCapsVisible NOTIFY capsVisibilityChanged)
50 Q_PROPERTY(QColor increasingColor READ increasingColor WRITE setIncreasingColor NOTIFY increasingColorChanged)
51 Q_PROPERTY(QColor decreasingColor READ decreasingColor WRITE setDecreasingColor NOTIFY decreasingColorChanged)
52 Q_PROPERTY(QBrush brush READ brush WRITE setBrush NOTIFY brushChanged)
53 Q_PROPERTY(QPen pen READ pen WRITE setPen NOTIFY penChanged)
54
55public:
56 explicit QCandlestickSeries(QObject *parent = nullptr);
57 ~QCandlestickSeries();
58
59 bool append(QCandlestickSet *set);
60 bool remove(QCandlestickSet *set);
61 bool append(const QList<QCandlestickSet *> &sets);
62 bool remove(const QList<QCandlestickSet *> &sets);
63 bool insert(int index, QCandlestickSet *set);
64 bool take(QCandlestickSet *set);
65 void clear();
66
67 QList<QCandlestickSet *> sets() const;
68 int count() const;
69
70 QAbstractSeries::SeriesType type() const;
71
72 void setMaximumColumnWidth(qreal maximumColumnWidth);
73 qreal maximumColumnWidth() const;
74
75 void setMinimumColumnWidth(qreal minimumColumnWidth);
76 qreal minimumColumnWidth() const;
77
78 void setBodyWidth(qreal bodyWidth);
79 qreal bodyWidth() const;
80
81 void setBodyOutlineVisible(bool bodyOutlineVisible);
82 bool bodyOutlineVisible() const;
83
84 void setCapsWidth(qreal capsWidth);
85 qreal capsWidth() const;
86
87 void setCapsVisible(bool capsVisible);
88 bool capsVisible() const;
89
90 void setIncreasingColor(const QColor &increasingColor);
91 QColor increasingColor() const;
92
93 void setDecreasingColor(const QColor &decreasingColor);
94 QColor decreasingColor() const;
95
96 void setBrush(const QBrush &brush);
97 QBrush brush() const;
98
99 void setPen(const QPen &pen);
100 QPen pen() const;
101
102Q_SIGNALS:
103 void clicked(QCandlestickSet *set);
104 void hovered(bool status, QCandlestickSet *set);
105 void pressed(QCandlestickSet *set);
106 void released(QCandlestickSet *set);
107 void doubleClicked(QCandlestickSet *set);
108 void candlestickSetsAdded(const QList<QCandlestickSet *> &sets);
109 void candlestickSetsRemoved(const QList<QCandlestickSet *> &sets);
110 void countChanged();
111 void maximumColumnWidthChanged();
112 void minimumColumnWidthChanged();
113 void bodyWidthChanged();
114 void bodyOutlineVisibilityChanged();
115 void capsWidthChanged();
116 void capsVisibilityChanged();
117 void increasingColorChanged();
118 void decreasingColorChanged();
119 void brushChanged();
120 void penChanged();
121
122private:
123 Q_DISABLE_COPY(QCandlestickSeries)
124 Q_DECLARE_PRIVATE(QCandlestickSeries)
125 friend class CandlestickChartItem;
126 friend class QCandlestickLegendMarkerPrivate;
127};
128
129QT_CHARTS_END_NAMESPACE
130
131#endif // QCANDLESTICKSERIES_H
132

source code of qtcharts/src/charts/candlestickchart/qcandlestickseries.h