26 #ifndef QCP_PLOTTABLE_BARS_H
27 #define QCP_PLOTTABLE_BARS_H
29 #include "../global.h"
31 #include "../plottable.h"
41 Q_PROPERTY(
SpacingType spacingType READ spacingType WRITE setSpacingType)
42 Q_PROPERTY(
double spacing READ spacing WRITE setSpacing)
59 SpacingType spacingType()
const {
return mSpacingType; }
60 double spacing()
const {
return mSpacing; }
63 void setSpacingType(SpacingType spacingType);
64 void setSpacing(
double spacing);
67 QList<QCPBars*>
bars()
const {
return mBars; }
69 int size()
const {
return mBars.size(); }
70 bool isEmpty()
const {
return mBars.isEmpty(); }
74 void insert(
int i,
QCPBars *bars);
80 SpacingType mSpacingType;
82 QList<QCPBars*> mBars;
85 void registerBars(
QCPBars *bars);
86 void unregisterBars(
QCPBars *bars);
89 double keyPixelOffset(
const QCPBars *bars,
double keyCoord);
90 double getPixelSpacing(
const QCPBars *bars,
double keyCoord);
103 QCPBarData(
double key,
double value);
106 Q_DECLARE_TYPEINFO(
QCPBarData, Q_MOVABLE_TYPE);
116 typedef QMapIterator<double, QCPBarData> QCPBarDataMapIterator;
117 typedef QMutableMapIterator<double, QCPBarData> QCPBarDataMutableMapIterator;
124 Q_PROPERTY(
double width READ width WRITE setWidth)
125 Q_PROPERTY(
WidthType widthType READ widthType WRITE setWidthType)
126 Q_PROPERTY(
QCPBarsGroup* barsGroup READ barsGroup WRITE setBarsGroup)
127 Q_PROPERTY(
double baseValue READ baseValue WRITE setBaseValue)
128 Q_PROPERTY(
QCPBars* barBelow READ barBelow)
129 Q_PROPERTY(
QCPBars* barAbove READ barAbove)
148 double width()
const {
return mWidth; }
149 WidthType widthType()
const {
return mWidthType; }
151 double baseValue()
const {
return mBaseValue; }
157 void setWidth(
double width);
158 void setWidthType(WidthType widthType);
160 void setBaseValue(
double baseValue);
162 void setData(
const QVector<double> &key,
const QVector<double> &value);
169 void addData(
double key,
double value);
170 void addData(
const QVector<double> &keys,
const QVector<double> &values);
171 void removeDataBefore(
double key);
172 void removeDataAfter(
double key);
173 void removeData(
double fromKey,
double toKey);
174 void removeData(
double key);
178 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0)
const;
184 WidthType mWidthType;
187 QPointer<QCPBars> mBarBelow, mBarAbove;
196 void getVisibleDataBounds(QCPBarDataMap::const_iterator &lower, QCPBarDataMap::const_iterator &upperEnd)
const;
197 QPolygonF getBarPolygon(
double key,
double value)
const;
198 void getPixelWidth(
double key,
double &lower,
double &upper)
const;
199 double getStackedBaseValue(
double key,
bool positive)
const;
207 #endif // QCP_PLOTTABLE_BARS_H
QMap< double, QCPBarData > QCPBarDataMap
Definition: plottable-bars.h:115
QCPBars * barBelow() const
Definition: plottable-bars.h:152
int size() const
Definition: plottable-bars.h:69
virtual QCPRange getValueRange(bool &foundRange, SignDomain inSignDomain=sdBoth) const =0
Represents the range an axis is encompassing.
Definition: range.h:31
virtual QCPRange getKeyRange(bool &foundRange, SignDomain inSignDomain=sdBoth) const =0
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const =0
The central class of the library. This is the QWidget which displays the plot and interacts with the ...
Definition: core.h:42
Holds the data of one single data point (one bar) for QCPBars.
Definition: plottable-bars.h:99
virtual void draw(QCPPainter *painter)=0
Manages a legend inside a QCustomPlot.
Definition: layoutelement-legend.h:126
QPainter subclass used internally.
Definition: painter.h:111
Groups multiple QCPBars together so they appear side by side.
Definition: plottable-bars.h:37
Manages a single axis inside a QCustomPlot.
Definition: axis.h:94
WidthType
Definition: plottable-bars.h:138
bool contains(QCPBars *bars) const
Definition: plottable-bars.h:72
QList< QCPBars * > bars() const
Definition: plottable-bars.h:67
A plottable representing a bar chart in a plot.
Definition: plottable-bars.h:120
bool isEmpty() const
Definition: plottable-bars.h:70
QCPBars * barAbove() const
Definition: plottable-bars.h:153
The abstract base class for all data representing objects in a plot.
Definition: plottable.h:36
SpacingType
Definition: plottable-bars.h:51
virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const =0
virtual void clearData()=0