forked from dimv36/QCustomPlot-PyQt5
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathplottable-bars.sip
123 lines (100 loc) · 3.83 KB
/
plottable-bars.sip
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
/** PyQt5 binding for QCustomPlot v2.0.0
*
* Authors: Dmitry Voronin, Giuseppe Corbelli
* License: MIT
*
* QCustomPlot author: Emanuel Eichhammer
* QCustomPlot Website/Contact: http://www.qcustomplot.com
*/
class QCPBarsGroup : public QObject
{
%TypeHeaderCode
#include <QCustomPlot/src/plottables/plottable-bars.h>
%End
public:
enum SpacingType { stAbsolute ///< Bar spacing is in absolute pixels
,stAxisRectRatio ///< Bar spacing is given by a fraction of the axis rect size
,stPlotCoords ///< Bar spacing is in key coordinates and thus scales with the key axis range
};
QCPBarsGroup(QCustomPlot *parentPlot /TransferThis/);
virtual ~QCPBarsGroup();
// getters:
SpacingType spacingType() const;
double spacing() const;
// setters:
void setSpacingType(SpacingType spacingType);
void setSpacing(double spacing);
// non-virtual methods:
QList<QCPBars*> bars() const;
QCPBars* bars(int index) const;
int size() const;
bool isEmpty() const;
void clear();
bool contains(QCPBars *bars) const;
void append(QCPBars *bars);
void insert(int i, QCPBars *bars);
void remove(QCPBars *bars);
};
class QCPBarsData
{
%TypeHeaderCode
#include <QCustomPlot/src/plottables/plottable-bars.h>
typedef QCPAbstractPlottable1D<QCPBarsData> QCPAbstractPlottable1D_QCPBarsData;
%End
public:
QCPBarsData();
QCPBarsData(double key, double value);
double sortKey() const;
static QCPBarsData fromSortKey(double sortKey);
static bool sortKeyIsMainKey();
double mainKey() const;
double mainValue() const;
QCPRange valueRange() const; // note that bar base value isn't held in each QCPBarsData and thus can't/shouldn't be returned here
double key;
double value;
};
typedef QCPAbstractPlottable1D<QCPBarsData> QCPAbstractPlottable1D_QCPBarsData;
class QCPBars : public QCPAbstractPlottable1D_QCPBarsData
{
%TypeHeaderCode
#include <QCustomPlot/src/qcp.h>
typedef QCPAbstractPlottable1D<QCPBarsData> QCPAbstractPlottable1D_QCPBarsData;
%End
public:
enum WidthType { wtAbsolute ///< Bar width is in absolute pixels
,wtAxisRectRatio ///< Bar width is given by a fraction of the axis rect size
,wtPlotCoords ///< Bar width is in key coordinates and thus scales with the key axis range
};
explicit QCPBars(QCPAxis *keyAxis, QCPAxis *valueAxis);
virtual ~QCPBars();
// getters:
double width() const;
WidthType widthType() const;
QCPBarsGroup *barsGroup() const;
double baseValue() const;
double stackingGap() const;
QCPBars *barBelow() const;
QCPBars *barAbove() const;
// TODO: provide methodcode
// QSharedPointer<QCPBarsDataContainer> data() const;
// setters:
// TODO: provide methodcode
// void setData(QSharedPointer<QCPBarsDataContainer> data);
void setData(const QVector<double> &keys, const QVector<double> &values, bool alreadySorted=false);
void setWidth(double width);
void setWidthType(WidthType widthType);
void setBarsGroup(QCPBarsGroup *barsGroup);
void setBaseValue(double baseValue);
void setStackingGap(double pixels);
// non-property methods:
void addData(const QVector<double> &keys, const QVector<double> &values, bool alreadySorted=false);
void addData(double key, double value);
void moveBelow(QCPBars *bars);
void moveAbove(QCPBars *bars);
// reimplemented virtual methods:
virtual QCPDataSelection selectTestRect(const QRectF &rect, bool onlySelectable) const;
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;
virtual QCPRange getKeyRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth) const;
virtual QCPRange getValueRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth, const QCPRange &inKeyRange=QCPRange()) const;
virtual QPointF dataPixelPosition(int index) const;
};