29#include <QtCore/qglobal.h>
32#ifdef QCUSTOMPLOT_USE_OPENGL
33# if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
34# define QCP_OPENGL_PBUFFER
36# define QCP_OPENGL_FBO
38# if QT_VERSION >= QT_VERSION_CHECK(5, 3, 0)
39# define QCP_OPENGL_OFFSCREENSURFACE
43#if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0)
44# define QCP_DEVICEPIXELRATIO_SUPPORTED
45# if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
46# define QCP_DEVICEPIXELRATIO_FLOAT
50#include <QtCore/QObject>
51#include <QtCore/QPointer>
52#include <QtCore/QSharedPointer>
53#include <QtCore/QTimer>
54#include <QtGui/QPainter>
55#include <QtGui/QPaintEvent>
56#include <QtGui/QMouseEvent>
57#include <QtGui/QWheelEvent>
58#include <QtGui/QPixmap>
59#include <QtCore/QVector>
60#include <QtCore/QString>
61#include <QtCore/QDateTime>
62#include <QtCore/QMultiMap>
63#include <QtCore/QFlags>
64#include <QtCore/QDebug>
65#include <QtCore/QStack>
66#include <QtCore/QCache>
67#include <QtCore/QMargins>
72# include <QtGui/QOpenGLContext>
73# include <QtGui/QOpenGLFramebufferObject>
74# ifdef QCP_OPENGL_OFFSCREENSURFACE
75# include <QtGui/QOffscreenSurface>
77# include <QtGui/QWindow>
80#ifdef QCP_OPENGL_PBUFFER
81# include <QtOpenGL/QGLPixelBuffer>
83#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
85# include <QtGui/QWidget>
86# include <QtGui/QPrinter>
87# include <QtGui/QPrintEngine>
90# include <QtWidgets/QWidget>
91# include <QtPrintSupport/QtPrintSupport>
119#if defined(QCUSTOMPLOT_COMPILE_LIBRARY)
120# define QCP_LIB_DECL Q_DECL_EXPORT
121#elif defined(QCUSTOMPLOT_USE_LIBRARY)
122# define QCP_LIB_DECL Q_DECL_IMPORT
128#ifndef Q_DECL_OVERRIDE
129# define Q_DECL_OVERRIDE
149 Q_FLAGS(AntialiasedElements)
151 Q_FLAGS(PlottingHints)
153 Q_FLAGS(Interactions)
304inline bool isInvalidData(
double value)
306 return qIsNaN(value) || qIsInf(value);
314inline bool isInvalidData(
double value1,
double value2)
316 return isInvalidData(value1) || isInvalidData(value2);
325inline void setMarginValue(QMargins &margins,
QCP::MarginSide side,
int value)
331 case QCP::msTop: margins.setTop(value);
break;
333 case QCP::msAll: margins = QMargins(value, value, value, value);
break;
345inline int getMarginValue(
const QMargins &margins,
QCP::MarginSide side)
359extern const QMetaObject staticMetaObject;
362Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::AntialiasedElements)
363Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::PlottingHints)
364Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::MarginSides)
365Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::Interactions)
391 double x()
const {
return mX; }
392 double y()
const {
return mY; }
393 double &rx() {
return mX; }
394 double &ry() {
return mY; }
397 void setX(
double x) { mX = x; }
398 void setY(
double y) { mY = y; }
401 double length()
const {
return qSqrt(mX*mX+mY*mY); }
403 QPoint
toPoint()
const {
return QPoint(mX, mY); }
404 QPointF
toPointF()
const {
return QPointF(mX, mY); }
406 bool isNull()
const {
return qIsNull(mX) && qIsNull(mY); }
412 double distanceSquaredToLine(
const QLineF &line)
const;
446 d.nospace() <<
"QCPVector2D(" << vec.x() <<
", " << vec.y() <<
")";
467 ,pmNonCosmetic = 0x04
470 Q_FLAGS(PainterModes)
471 Q_DECLARE_FLAGS(PainterModes, PainterMode)
477 bool antialiasing()
const {
return testRenderHint(QPainter::Antialiasing); }
478 PainterModes modes()
const {
return mModes; }
481 void setAntialiasing(
bool enabled);
482 void setMode(PainterMode mode,
bool enabled=
true);
483 void setModes(PainterModes modes);
486 bool begin(QPaintDevice *device);
487 void setPen(
const QPen &pen);
488 void setPen(
const QColor &color);
489 void setPen(Qt::PenStyle penStyle);
490 void drawLine(
const QLineF &line);
491 void drawLine(
const QPointF &p1,
const QPointF &p2) {drawLine(QLineF(p1, p2));}
496 void makeNonCosmetic();
501 bool mIsAntialiasing;
504 QStack<bool> mAntialiasingStack;
506Q_DECLARE_OPERATORS_FOR_FLAGS(QCPPainter::PainterModes)
522 QSize size()
const {
return mSize; }
523 bool invalidated()
const {
return mInvalidated; }
524 double devicePixelRatio()
const {
return mDevicePixelRatio; }
527 void setSize(
const QSize &size);
528 void setInvalidated(
bool invalidated=
true);
529 void setDevicePixelRatio(
double ratio);
535 virtual void clear(
const QColor &color) = 0;
540 double mDevicePixelRatio;
557 virtual QCPPainter *startPainting() Q_DECL_OVERRIDE;
558 virtual void draw(
QCPPainter *painter)
const Q_DECL_OVERRIDE;
559 void clear(
const QColor &color) Q_DECL_OVERRIDE;
566 virtual void reallocateBuffer() Q_DECL_OVERRIDE;
570#ifdef QCP_OPENGL_PBUFFER
574 explicit QCPPaintBufferGlPbuffer(
const QSize &size,
double devicePixelRatio,
int multisamples);
575 virtual ~QCPPaintBufferGlPbuffer();
578 virtual QCPPainter *startPainting() Q_DECL_OVERRIDE;
579 virtual
void draw(
QCPPainter *painter) const Q_DECL_OVERRIDE;
580 void clear(const QColor &color) Q_DECL_OVERRIDE;
584 QGLPixelBuffer *mGlPBuffer;
588 virtual
void reallocateBuffer() Q_DECL_OVERRIDE;
597 explicit QCPPaintBufferGlFbo(
const QSize &size,
double devicePixelRatio, QWeakPointer<QOpenGLContext> glContext, QWeakPointer<QOpenGLPaintDevice> glPaintDevice);
598 virtual ~QCPPaintBufferGlFbo();
601 virtual QCPPainter *startPainting() Q_DECL_OVERRIDE;
602 virtual
void donePainting() Q_DECL_OVERRIDE;
603 virtual
void draw(
QCPPainter *painter) const Q_DECL_OVERRIDE;
604 void clear(const QColor &color) Q_DECL_OVERRIDE;
608 QWeakPointer<QOpenGLContext> mGlContext;
609 QWeakPointer<QOpenGLPaintDevice> mGlPaintDevice;
610 QOpenGLFramebufferObject *mGlFrameBuffer;
613 virtual
void reallocateBuffer() Q_DECL_OVERRIDE;
627 Q_PROPERTY(
QCustomPlot* parentPlot READ parentPlot)
628 Q_PROPERTY(QString name READ name)
629 Q_PROPERTY(
int index READ index)
630 Q_PROPERTY(QList<QCPLayerable*> children READ children)
631 Q_PROPERTY(
bool visible READ visible WRITE setVisible)
632 Q_PROPERTY(
LayerMode mode READ mode WRITE setMode)
652 QCustomPlot *parentPlot()
const {
return mParentPlot; }
653 QString name()
const {
return mName; }
654 int index()
const {
return mIndex; }
655 QList<QCPLayerable*>
children()
const {
return mChildren; }
656 bool visible()
const {
return mVisible; }
657 LayerMode mode()
const {
return mMode; }
660 void setVisible(
bool visible);
661 void setMode(LayerMode mode);
671 QList<QCPLayerable*> mChildren;
676 QWeakPointer<QCPAbstractPaintBuffer> mPaintBuffer;
680 void drawToPaintBuffer();
696 Q_PROPERTY(
bool visible READ visible WRITE setVisible)
697 Q_PROPERTY(
QCustomPlot* parentPlot READ parentPlot)
698 Q_PROPERTY(
QCPLayerable* parentLayerable READ parentLayerable)
699 Q_PROPERTY(
QCPLayer* layer READ layer WRITE setLayer NOTIFY layerChanged)
700 Q_PROPERTY(
bool antialiased READ antialiased WRITE setAntialiased)
707 bool visible()
const {
return mVisible; }
708 QCustomPlot *parentPlot()
const {
return mParentPlot; }
710 QCPLayer *layer()
const {
return mLayer; }
711 bool antialiased()
const {
return mAntialiased; }
714 void setVisible(
bool on);
715 Q_SLOT
bool setLayer(
QCPLayer *layer);
716 bool setLayer(
const QString &layerName);
717 void setAntialiased(
bool enabled);
720 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0)
const;
723 bool realVisibility()
const;
732 QPointer<QCPLayerable> mParentLayerable;
737 virtual void parentPlotInitialized(
QCustomPlot *parentPlot);
739 virtual QRect clipRect()
const;
740 virtual void applyDefaultAntialiasingHint(
QCPPainter *painter)
const = 0;
743 virtual void selectEvent(QMouseEvent *event,
bool additive,
const QVariant &details,
bool *selectionStateChanged);
744 virtual void deselectEvent(
bool *selectionStateChanged);
746 virtual void mousePressEvent(QMouseEvent *event,
const QVariant &details);
747 virtual void mouseMoveEvent(QMouseEvent *event,
const QPointF &startPos);
748 virtual void mouseReleaseEvent(QMouseEvent *event,
const QPointF &startPos);
749 virtual void mouseDoubleClickEvent(QMouseEvent *event,
const QVariant &details);
750 virtual void wheelEvent(QWheelEvent *event);
753 void initializeParentPlot(
QCustomPlot *parentPlot);
755 bool moveToLayer(
QCPLayer *layer,
bool prepend);
778 QCPRange(
double lower,
double upper);
780 bool operator==(
const QCPRange& other)
const {
return lower == other.lower && upper == other.upper; }
781 bool operator!=(
const QCPRange& other)
const {
return !(*
this == other); }
789 friend inline const QCPRange operator-(
const QCPRange& range,
double value);
790 friend inline const QCPRange operator*(
const QCPRange& range,
double value);
791 friend inline const QCPRange operator*(
double value,
const QCPRange& range);
792 friend inline const QCPRange operator/(
const QCPRange& range,
double value);
794 double size()
const {
return upper-lower; }
795 double center()
const {
return (upper+lower)*0.5; }
796 void normalize() {
if (lower > upper) qSwap(lower, upper); }
797 void expand(
const QCPRange &otherRange);
798 void expand(
double includeCoord);
800 QCPRange expanded(
double includeCoord)
const;
801 QCPRange bounded(
double lowerBound,
double upperBound)
const;
802 QCPRange sanitizedForLogScale()
const;
803 QCPRange sanitizedForLinScale()
const;
804 bool contains(
double value)
const {
return value >= lower && value <= upper; }
806 static bool validRange(
double lower,
double upper);
807 static bool validRange(
const QCPRange &range);
812Q_DECLARE_TYPEINFO(
QCPRange, Q_MOVABLE_TYPE);
818inline QDebug operator<< (QDebug d,
const QCPRange &range)
820 d.nospace() <<
"QCPRange(" << range.lower <<
", " << range.upper <<
")";
896 bool operator==(
const QCPDataRange& other)
const {
return mBegin == other.mBegin && mEnd == other.mEnd; }
897 bool operator!=(
const QCPDataRange& other)
const {
return !(*
this == other); }
900 int begin()
const {
return mBegin; }
901 int end()
const {
return mEnd; }
902 int size()
const {
return mEnd-mBegin; }
910 bool isValid()
const {
return (mEnd >= mBegin) && (mBegin >= 0); }
911 bool isEmpty()
const {
return length() == 0; }
934 bool operator!=(
const QCPDataSelection& other)
const {
return !(*
this == other); }
950 int dataPointCount()
const;
952 QList<QCPDataRange>
dataRanges()
const {
return mDataRanges; }
956 void addDataRange(
const QCPDataRange &dataRange,
bool simplify=
true);
958 bool isEmpty()
const {
return mDataRanges.isEmpty(); }
968 QList<QCPDataRange> mDataRanges;
970 inline static bool lessThanDataRangeBegin(
const QCPDataRange &a,
const QCPDataRange &b) {
return a.begin() < b.begin(); }
1065 d.nospace() <<
"[" << dataRange.begin() <<
".." << dataRange.end()-1 <<
"]";
1075 d.nospace() <<
"QCPDataSelection(";
1102 QRect rect()
const {
return mRect; }
1104 QPen pen()
const {
return mPen; }
1105 QBrush brush()
const {
return mBrush; }
1109 void setPen(
const QPen &pen);
1110 void setBrush(
const QBrush &brush);
1113 Q_SLOT
void cancel();
1117 void changed(
const QRect &rect, QMouseEvent *event);
1130 virtual void startSelection(QMouseEvent *event);
1131 virtual void moveSelection(QMouseEvent *event);
1132 virtual void endSelection(QMouseEvent *event);
1133 virtual void keyPressEvent(QKeyEvent *event);
1136 virtual void applyDefaultAntialiasingHint(
QCPPainter *painter)
const Q_DECL_OVERRIDE;
1137 virtual void draw(
QCPPainter *painter) Q_DECL_OVERRIDE;
1157 bool isEmpty()
const;
1163 QHash<QCP::MarginSide, QList<QCPLayoutElement*> > mChildren;
1183 Q_PROPERTY(
QCPLayout* layout READ layout)
1184 Q_PROPERTY(QRect rect READ rect)
1185 Q_PROPERTY(QRect outerRect READ outerRect WRITE setOuterRect)
1186 Q_PROPERTY(QMargins margins READ margins WRITE setMargins)
1187 Q_PROPERTY(QMargins minimumMargins READ minimumMargins WRITE setMinimumMargins)
1188 Q_PROPERTY(QSize minimumSize READ minimumSize WRITE setMinimumSize)
1189 Q_PROPERTY(QSize maximumSize READ maximumSize WRITE setMaximumSize)
1190 Q_PROPERTY(
SizeConstraintRect sizeConstraintRect READ sizeConstraintRect WRITE setSizeConstraintRect)
1201 Q_ENUMS(UpdatePhase)
1214 Q_ENUMS(SizeConstraintRect)
1221 QRect
rect()
const {
return mRect; }
1223 QMargins margins()
const {
return mMargins; }
1224 QMargins minimumMargins()
const {
return mMinimumMargins; }
1225 QCP::MarginSides autoMargins()
const {
return mAutoMargins; }
1226 QSize minimumSize()
const {
return mMinimumSize; }
1227 QSize maximumSize()
const {
return mMaximumSize; }
1228 SizeConstraintRect sizeConstraintRect()
const {
return mSizeConstraintRect; }
1230 QHash<QCP::MarginSide, QCPMarginGroup*> marginGroups()
const {
return mMarginGroups; }
1233 void setOuterRect(
const QRect &rect);
1234 void setMargins(
const QMargins &margins);
1235 void setMinimumMargins(
const QMargins &margins);
1236 void setAutoMargins(QCP::MarginSides sides);
1237 void setMinimumSize(
const QSize &size);
1238 void setMinimumSize(
int width,
int height);
1239 void setMaximumSize(
const QSize &size);
1240 void setMaximumSize(
int width,
int height);
1241 void setSizeConstraintRect(SizeConstraintRect constraintRect);
1242 void setMarginGroup(QCP::MarginSides sides,
QCPMarginGroup *group);
1245 virtual void update(UpdatePhase phase);
1246 virtual QSize minimumOuterSizeHint()
const;
1247 virtual QSize maximumOuterSizeHint()
const;
1248 virtual QList<QCPLayoutElement*> elements(
bool recursive)
const;
1251 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0) const Q_DECL_OVERRIDE;
1256 QSize mMinimumSize, mMaximumSize;
1257 SizeConstraintRect mSizeConstraintRect;
1258 QRect mRect, mOuterRect;
1259 QMargins mMargins, mMinimumMargins;
1260 QCP::MarginSides mAutoMargins;
1264 virtual
int calculateAutoMargin(
QCP::MarginSide side);
1265 virtual
void layoutChanged();
1268 virtual
void applyDefaultAntialiasingHint(
QCPPainter *painter) const Q_DECL_OVERRIDE { Q_UNUSED(painter) }
1269 virtual void draw(
QCPPainter *painter) Q_DECL_OVERRIDE { Q_UNUSED(painter) }
1270 virtual void parentPlotInitialized(
QCustomPlot *parentPlot) Q_DECL_OVERRIDE;
1289 virtual void update(
UpdatePhase phase) Q_DECL_OVERRIDE;
1290 virtual QList<QCPLayoutElement*> elements(
bool recursive)
const Q_DECL_OVERRIDE;
1297 virtual void simplify();
1300 bool removeAt(
int index);
1306 virtual void updateLayout();
1309 void sizeConstraintsChanged()
const;
1312 QVector<int> getSectionSizes(QVector<int> maxSizes, QVector<int> minSizes, QVector<double> stretchFactors,
int totalSize)
const;
1326 Q_PROPERTY(
int rowCount READ rowCount)
1327 Q_PROPERTY(
int columnCount READ columnCount)
1328 Q_PROPERTY(QList<double> columnStretchFactors READ columnStretchFactors WRITE setColumnStretchFactors)
1329 Q_PROPERTY(QList<double> rowStretchFactors READ rowStretchFactors WRITE setRowStretchFactors)
1330 Q_PROPERTY(
int columnSpacing READ columnSpacing WRITE setColumnSpacing)
1331 Q_PROPERTY(
int rowSpacing READ rowSpacing WRITE setRowSpacing)
1332 Q_PROPERTY(
FillOrder fillOrder READ fillOrder WRITE setFillOrder)
1333 Q_PROPERTY(
int wrap READ wrap WRITE setWrap)
1354 int columnCount()
const {
return mElements.size() > 0 ? mElements.first().size() : 0; }
1355 QList<double> columnStretchFactors()
const {
return mColumnStretchFactors; }
1356 QList<double> rowStretchFactors()
const {
return mRowStretchFactors; }
1357 int columnSpacing()
const {
return mColumnSpacing; }
1358 int rowSpacing()
const {
return mRowSpacing; }
1359 int wrap()
const {
return mWrap; }
1360 FillOrder fillOrder()
const {
return mFillOrder; }
1363 void setColumnStretchFactor(
int column,
double factor);
1364 void setColumnStretchFactors(
const QList<double> &factors);
1365 void setRowStretchFactor(
int row,
double factor);
1366 void setRowStretchFactors(
const QList<double> &factors);
1367 void setColumnSpacing(
int pixels);
1368 void setRowSpacing(
int pixels);
1369 void setWrap(
int count);
1370 void setFillOrder(FillOrder order,
bool rearrange=
true);
1373 virtual void updateLayout() Q_DECL_OVERRIDE;
1374 virtual
int elementCount() const Q_DECL_OVERRIDE {
return rowCount()*columnCount(); }
1378 virtual QList<QCPLayoutElement*> elements(
bool recursive)
const Q_DECL_OVERRIDE;
1379 virtual void simplify() Q_DECL_OVERRIDE;
1380 virtual QSize minimumOuterSizeHint() const Q_DECL_OVERRIDE;
1381 virtual QSize maximumOuterSizeHint() const Q_DECL_OVERRIDE;
1387 bool hasElement(
int row,
int column);
1388 void expandTo(
int newRowCount,
int newColumnCount);
1389 void insertRow(
int newIndex);
1390 void insertColumn(
int newIndex);
1391 int rowColToIndex(
int row,
int column) const;
1392 void indexToRowCol(
int index,
int &row,
int &column) const;
1397 QList<
double> mColumnStretchFactors;
1398 QList<
double> mRowStretchFactors;
1399 int mColumnSpacing, mRowSpacing;
1401 FillOrder mFillOrder;
1404 void getMinimumRowColSizes(QVector<
int> *minColWidths, QVector<
int> *minRowHeights) const;
1405 void getMaximumRowColSizes(QVector<
int> *maxColWidths, QVector<
int> *maxRowHeights) const;
1423 Q_ENUMS(InsetPlacement)
1429 InsetPlacement insetPlacement(
int index)
const;
1430 Qt::Alignment insetAlignment(
int index)
const;
1431 QRectF insetRect(
int index)
const;
1434 void setInsetPlacement(
int index, InsetPlacement placement);
1435 void setInsetAlignment(
int index, Qt::Alignment alignment);
1436 void setInsetRect(
int index,
const QRectF &rect);
1439 virtual void updateLayout() Q_DECL_OVERRIDE;
1440 virtual
int elementCount() const Q_DECL_OVERRIDE;
1444 virtual
void simplify() Q_DECL_OVERRIDE {}
1445 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0) const Q_DECL_OVERRIDE;
1454 QList<InsetPlacement> mInsetPlacement;
1455 QList<Qt::Alignment> mInsetAlignment;
1456 QList<QRectF> mInsetRect;
1495 Q_ENUMS(EndingStyle)
1498 QCPLineEnding(EndingStyle style,
double width=8,
double length=10,
bool inverted=
false);
1501 EndingStyle style()
const {
return mStyle; }
1502 double width()
const {
return mWidth; }
1503 double length()
const {
return mLength; }
1504 bool inverted()
const {
return mInverted; }
1507 void setStyle(EndingStyle style);
1508 void setWidth(
double width);
1509 void setLength(
double length);
1510 void setInverted(
bool inverted);
1513 double boundingDistance()
const;
1514 double realLength()
const;
1521 double mWidth, mLength;
1547 Q_ENUMS(TickStepStrategy)
1553 TickStepStrategy tickStepStrategy()
const {
return mTickStepStrategy; }
1554 int tickCount()
const {
return mTickCount; }
1555 double tickOrigin()
const {
return mTickOrigin; }
1558 void setTickStepStrategy(TickStepStrategy strategy);
1559 void setTickCount(
int count);
1560 void setTickOrigin(
double origin);
1563 virtual void generate(
const QCPRange &range,
const QLocale &locale, QChar formatChar,
int precision, QVector<double> &ticks, QVector<double> *subTicks, QVector<QString> *tickLabels);
1567 TickStepStrategy mTickStepStrategy;
1572 virtual double getTickStep(
const QCPRange &range);
1573 virtual int getSubTickCount(
double tickStep);
1574 virtual QString getTickLabel(
double tick,
const QLocale &locale, QChar formatChar,
int precision);
1575 virtual QVector<double> createTickVector(
double tickStep,
const QCPRange &range);
1576 virtual QVector<double> createSubTickVector(
int subTickCount,
const QVector<double> &ticks);
1577 virtual QVector<QString> createLabelVector(
const QVector<double> &ticks,
const QLocale &locale, QChar formatChar,
int precision);
1580 void trimTicks(
const QCPRange &range, QVector<double> &ticks,
bool keepOneOutlier)
const;
1581 double pickClosest(
double target,
const QVector<double> &candidates)
const;
1582 double getMantissa(
double input,
double *magnitude=0)
const;
1583 double cleanMantissa(
double input)
const;
1586Q_DECLARE_METATYPE(QSharedPointer<QCPAxisTicker>)
1600 QString dateTimeFormat()
const {
return mDateTimeFormat; }
1601 Qt::TimeSpec dateTimeSpec()
const {
return mDateTimeSpec; }
1604 void setDateTimeFormat(
const QString &format);
1605 void setDateTimeSpec(Qt::TimeSpec spec);
1606 void setTickOrigin(
double origin);
1607 void setTickOrigin(
const QDateTime &origin);
1610 static QDateTime keyToDateTime(
double key);
1611 static double dateTimeToKey(
const QDateTime dateTime);
1612 static double dateTimeToKey(
const QDate date);
1616 QString mDateTimeFormat;
1617 Qt::TimeSpec mDateTimeSpec;
1620 enum DateStrategy {dsNone, dsUniformTimeInDay, dsUniformDayInMonth} mDateStrategy;
1623 virtual double getTickStep(
const QCPRange &range) Q_DECL_OVERRIDE;
1624 virtual int getSubTickCount(
double tickStep) Q_DECL_OVERRIDE;
1625 virtual QString getTickLabel(
double tick,
const QLocale &locale, QChar formatChar,
int precision) Q_DECL_OVERRIDE;
1626 virtual QVector<double> createTickVector(
double tickStep,
const QCPRange &range) Q_DECL_OVERRIDE;
1655 QString timeFormat()
const {
return mTimeFormat; }
1656 int fieldWidth(TimeUnit unit)
const {
return mFieldWidth.value(unit); }
1659 void setTimeFormat(
const QString &format);
1660 void setFieldWidth(TimeUnit unit,
int width);
1664 QString mTimeFormat;
1665 QHash<TimeUnit, int> mFieldWidth;
1668 TimeUnit mSmallestUnit, mBiggestUnit;
1669 QHash<TimeUnit, QString> mFormatPattern;
1672 virtual double getTickStep(
const QCPRange &range) Q_DECL_OVERRIDE;
1673 virtual int getSubTickCount(
double tickStep) Q_DECL_OVERRIDE;
1674 virtual QString getTickLabel(
double tick,
const QLocale &locale, QChar formatChar,
int precision) Q_DECL_OVERRIDE;
1677 void replaceUnit(QString &text, TimeUnit unit,
int value)
const;
1701 Q_ENUMS(ScaleStrategy)
1706 double tickStep()
const {
return mTickStep; }
1707 ScaleStrategy scaleStrategy()
const {
return mScaleStrategy; }
1710 void setTickStep(
double step);
1711 void setScaleStrategy(ScaleStrategy strategy);
1716 ScaleStrategy mScaleStrategy;
1719 virtual double getTickStep(
const QCPRange &range) Q_DECL_OVERRIDE;
1735 QMap<double, QString> &
ticks() {
return mTicks; }
1736 int subTickCount()
const {
return mSubTickCount; }
1739 void setTicks(
const QMap<double, QString> &ticks);
1740 void setTicks(
const QVector<double> &positions,
const QVector<QString> labels);
1741 void setSubTickCount(
int subTicks);
1745 void addTick(
double position, QString label);
1746 void addTicks(
const QMultiMap<double, QString> &ticks);
1747 void addTicks(
const QVector<double> &positions,
const QVector<QString> &labels);
1751 QMap<double, QString> mTicks;
1755 virtual double getTickStep(
const QCPRange &range) Q_DECL_OVERRIDE;
1756 virtual int getSubTickCount(
double tickStep) Q_DECL_OVERRIDE;
1757 virtual QString getTickLabel(
double tick,
const QLocale &locale, QChar formatChar,
int precision) Q_DECL_OVERRIDE;
1758 virtual QVector<double> createTickVector(
double tickStep,
const QCPRange &range) Q_DECL_OVERRIDE;
1781 Q_ENUMS(FractionStyle)
1786 QString piSymbol()
const {
return mPiSymbol; }
1787 double piValue()
const {
return mPiValue; }
1788 bool periodicity()
const {
return mPeriodicity; }
1789 FractionStyle fractionStyle()
const {
return mFractionStyle; }
1792 void setPiSymbol(QString symbol);
1793 void setPiValue(
double pi);
1794 void setPeriodicity(
int multiplesOfPi);
1795 void setFractionStyle(FractionStyle style);
1802 FractionStyle mFractionStyle;
1808 virtual double getTickStep(
const QCPRange &range) Q_DECL_OVERRIDE;
1809 virtual int getSubTickCount(
double tickStep) Q_DECL_OVERRIDE;
1810 virtual QString getTickLabel(
double tick,
const QLocale &locale, QChar formatChar,
int precision) Q_DECL_OVERRIDE;
1813 void simplifyFraction(
int &numerator,
int &denominator)
const;
1814 QString fractionToString(
int numerator,
int denominator)
const;
1815 QString unicodeFraction(
int numerator,
int denominator)
const;
1816 QString unicodeSuperscript(
int number)
const;
1817 QString unicodeSubscript(
int number)
const;
1833 double logBase()
const {
return mLogBase; }
1834 int subTickCount()
const {
return mSubTickCount; }
1837 void setLogBase(
double base);
1838 void setSubTickCount(
int subTicks);
1846 double mLogBaseLnInv;
1849 virtual double getTickStep(
const QCPRange &range) Q_DECL_OVERRIDE;
1850 virtual int getSubTickCount(
double tickStep) Q_DECL_OVERRIDE;
1851 virtual QVector<double> createTickVector(
double tickStep,
const QCPRange &range) Q_DECL_OVERRIDE;
1864 Q_PROPERTY(
bool subGridVisible READ subGridVisible WRITE setSubGridVisible)
1865 Q_PROPERTY(
bool antialiasedSubGrid READ antialiasedSubGrid WRITE setAntialiasedSubGrid)
1866 Q_PROPERTY(
bool antialiasedZeroLine READ antialiasedZeroLine WRITE setAntialiasedZeroLine)
1867 Q_PROPERTY(QPen pen READ pen WRITE setPen)
1868 Q_PROPERTY(QPen subGridPen READ subGridPen WRITE setSubGridPen)
1869 Q_PROPERTY(QPen zeroLinePen READ zeroLinePen WRITE setZeroLinePen)
1875 bool subGridVisible()
const {
return mSubGridVisible; }
1876 bool antialiasedSubGrid()
const {
return mAntialiasedSubGrid; }
1877 bool antialiasedZeroLine()
const {
return mAntialiasedZeroLine; }
1878 QPen pen()
const {
return mPen; }
1879 QPen subGridPen()
const {
return mSubGridPen; }
1880 QPen zeroLinePen()
const {
return mZeroLinePen; }
1883 void setSubGridVisible(
bool visible);
1884 void setAntialiasedSubGrid(
bool enabled);
1885 void setAntialiasedZeroLine(
bool enabled);
1886 void setPen(
const QPen &pen);
1887 void setSubGridPen(
const QPen &pen);
1888 void setZeroLinePen(
const QPen &pen);
1892 bool mSubGridVisible;
1893 bool mAntialiasedSubGrid, mAntialiasedZeroLine;
1894 QPen mPen, mSubGridPen, mZeroLinePen;
1900 virtual void applyDefaultAntialiasingHint(
QCPPainter *painter)
const Q_DECL_OVERRIDE;
1901 virtual void draw(
QCPPainter *painter) Q_DECL_OVERRIDE;
1904 void drawGridLines(
QCPPainter *painter)
const;
1905 void drawSubGridLines(
QCPPainter *painter)
const;
1915 Q_PROPERTY(
AxisType axisType READ axisType)
1917 Q_PROPERTY(
ScaleType scaleType READ scaleType WRITE setScaleType NOTIFY scaleTypeChanged)
1918 Q_PROPERTY(
QCPRange range READ range WRITE setRange NOTIFY rangeChanged)
1919 Q_PROPERTY(
bool rangeReversed READ rangeReversed WRITE setRangeReversed)
1920 Q_PROPERTY(QSharedPointer<QCPAxisTicker> ticker READ ticker WRITE setTicker)
1921 Q_PROPERTY(
bool ticks READ ticks WRITE setTicks)
1922 Q_PROPERTY(
bool tickLabels READ tickLabels WRITE setTickLabels)
1923 Q_PROPERTY(
int tickLabelPadding READ tickLabelPadding WRITE setTickLabelPadding)
1924 Q_PROPERTY(QFont tickLabelFont READ tickLabelFont WRITE setTickLabelFont)
1925 Q_PROPERTY(QColor tickLabelColor READ tickLabelColor WRITE setTickLabelColor)
1926 Q_PROPERTY(
double tickLabelRotation READ tickLabelRotation WRITE setTickLabelRotation)
1927 Q_PROPERTY(
LabelSide tickLabelSide READ tickLabelSide WRITE setTickLabelSide)
1928 Q_PROPERTY(QString numberFormat READ numberFormat WRITE setNumberFormat)
1929 Q_PROPERTY(
int numberPrecision READ numberPrecision WRITE setNumberPrecision)
1930 Q_PROPERTY(QVector<double> tickVector READ tickVector)
1931 Q_PROPERTY(QVector<QString> tickVectorLabels READ tickVectorLabels)
1932 Q_PROPERTY(
int tickLengthIn READ tickLengthIn WRITE setTickLengthIn)
1933 Q_PROPERTY(
int tickLengthOut READ tickLengthOut WRITE setTickLengthOut)
1934 Q_PROPERTY(
bool subTicks READ subTicks WRITE setSubTicks)
1935 Q_PROPERTY(
int subTickLengthIn READ subTickLengthIn WRITE setSubTickLengthIn)
1936 Q_PROPERTY(
int subTickLengthOut READ subTickLengthOut WRITE setSubTickLengthOut)
1937 Q_PROPERTY(QPen basePen READ basePen WRITE setBasePen)
1938 Q_PROPERTY(QPen tickPen READ tickPen WRITE setTickPen)
1939 Q_PROPERTY(QPen subTickPen READ subTickPen WRITE setSubTickPen)
1940 Q_PROPERTY(QFont labelFont READ labelFont WRITE setLabelFont)
1941 Q_PROPERTY(QColor labelColor READ labelColor WRITE setLabelColor)
1942 Q_PROPERTY(QString label READ label WRITE setLabel)
1943 Q_PROPERTY(
int labelPadding READ labelPadding WRITE setLabelPadding)
1944 Q_PROPERTY(
int padding READ padding WRITE setPadding)
1945 Q_PROPERTY(
int offset READ offset WRITE setOffset)
1946 Q_PROPERTY(SelectableParts selectedParts READ selectedParts WRITE setSelectedParts NOTIFY selectionChanged)
1947 Q_PROPERTY(SelectableParts selectableParts READ selectableParts WRITE setSelectableParts NOTIFY selectableChanged)
1948 Q_PROPERTY(QFont selectedTickLabelFont READ selectedTickLabelFont WRITE setSelectedTickLabelFont)
1949 Q_PROPERTY(QFont selectedLabelFont READ selectedLabelFont WRITE setSelectedLabelFont)
1950 Q_PROPERTY(QColor selectedTickLabelColor READ selectedTickLabelColor WRITE setSelectedTickLabelColor)
1951 Q_PROPERTY(QColor selectedLabelColor READ selectedLabelColor WRITE setSelectedLabelColor)
1952 Q_PROPERTY(QPen selectedBasePen READ selectedBasePen WRITE setSelectedBasePen)
1953 Q_PROPERTY(QPen selectedTickPen READ selectedTickPen WRITE setSelectedTickPen)
1954 Q_PROPERTY(QPen selectedSubTickPen READ selectedSubTickPen WRITE setSelectedSubTickPen)
1955 Q_PROPERTY(
QCPLineEnding lowerEnding READ lowerEnding WRITE setLowerEnding)
1956 Q_PROPERTY(
QCPLineEnding upperEnding READ upperEnding WRITE setUpperEnding)
1957 Q_PROPERTY(
QCPGrid* grid READ grid)
1971 Q_DECLARE_FLAGS(AxisTypes, AxisType)
1995 ,spTickLabels = 0x002
1996 ,spAxisLabel = 0x004
1998 Q_ENUMS(SelectablePart)
1999 Q_FLAGS(SelectableParts)
2000 Q_DECLARE_FLAGS(SelectableParts, SelectablePart)
2006 AxisType axisType()
const {
return mAxisType; }
2007 QCPAxisRect *axisRect()
const {
return mAxisRect; }
2008 ScaleType scaleType()
const {
return mScaleType; }
2009 const QCPRange range()
const {
return mRange; }
2010 bool rangeReversed()
const {
return mRangeReversed; }
2011 QSharedPointer<QCPAxisTicker>
ticker()
const {
return mTicker; }
2012 bool ticks()
const {
return mTicks; }
2013 bool tickLabels()
const {
return mTickLabels; }
2014 int tickLabelPadding()
const;
2015 QFont tickLabelFont()
const {
return mTickLabelFont; }
2016 QColor tickLabelColor()
const {
return mTickLabelColor; }
2017 double tickLabelRotation()
const;
2018 LabelSide tickLabelSide()
const;
2019 QString numberFormat()
const;
2020 int numberPrecision()
const {
return mNumberPrecision; }
2021 QVector<double> tickVector()
const {
return mTickVector; }
2022 QVector<QString> tickVectorLabels()
const {
return mTickVectorLabels; }
2023 int tickLengthIn()
const;
2024 int tickLengthOut()
const;
2025 bool subTicks()
const {
return mSubTicks; }
2026 int subTickLengthIn()
const;
2027 int subTickLengthOut()
const;
2028 QPen basePen()
const {
return mBasePen; }
2029 QPen tickPen()
const {
return mTickPen; }
2030 QPen subTickPen()
const {
return mSubTickPen; }
2031 QFont labelFont()
const {
return mLabelFont; }
2032 QColor labelColor()
const {
return mLabelColor; }
2033 QString label()
const {
return mLabel; }
2034 int labelPadding()
const;
2035 int padding()
const {
return mPadding; }
2037 SelectableParts selectedParts()
const {
return mSelectedParts; }
2038 SelectableParts selectableParts()
const {
return mSelectableParts; }
2039 QFont selectedTickLabelFont()
const {
return mSelectedTickLabelFont; }
2040 QFont selectedLabelFont()
const {
return mSelectedLabelFont; }
2041 QColor selectedTickLabelColor()
const {
return mSelectedTickLabelColor; }
2042 QColor selectedLabelColor()
const {
return mSelectedLabelColor; }
2043 QPen selectedBasePen()
const {
return mSelectedBasePen; }
2044 QPen selectedTickPen()
const {
return mSelectedTickPen; }
2045 QPen selectedSubTickPen()
const {
return mSelectedSubTickPen; }
2052 Q_SLOT
void setRange(
const QCPRange &range);
2053 void setRange(
double lower,
double upper);
2054 void setRange(
double position,
double size, Qt::AlignmentFlag alignment);
2055 void setRangeLower(
double lower);
2056 void setRangeUpper(
double upper);
2057 void setRangeReversed(
bool reversed);
2058 void setTicker(QSharedPointer<QCPAxisTicker> ticker);
2059 void setTicks(
bool show);
2060 void setTickLabels(
bool show);
2061 void setTickLabelPadding(
int padding);
2062 void setTickLabelFont(
const QFont &font);
2063 void setTickLabelColor(
const QColor &color);
2064 void setTickLabelRotation(
double degrees);
2065 void setTickLabelSide(LabelSide side);
2066 void setNumberFormat(
const QString &formatCode);
2067 void setNumberPrecision(
int precision);
2068 void setTickLength(
int inside,
int outside=0);
2069 void setTickLengthIn(
int inside);
2070 void setTickLengthOut(
int outside);
2071 void setSubTicks(
bool show);
2072 void setSubTickLength(
int inside,
int outside=0);
2073 void setSubTickLengthIn(
int inside);
2074 void setSubTickLengthOut(
int outside);
2075 void setBasePen(
const QPen &pen);
2076 void setTickPen(
const QPen &pen);
2077 void setSubTickPen(
const QPen &pen);
2078 void setLabelFont(
const QFont &font);
2079 void setLabelColor(
const QColor &color);
2080 void setLabel(
const QString &str);
2081 void setLabelPadding(
int padding);
2082 void setPadding(
int padding);
2083 void setOffset(
int offset);
2084 void setSelectedTickLabelFont(
const QFont &font);
2085 void setSelectedLabelFont(
const QFont &font);
2086 void setSelectedTickLabelColor(
const QColor &color);
2087 void setSelectedLabelColor(
const QColor &color);
2088 void setSelectedBasePen(
const QPen &pen);
2089 void setSelectedTickPen(
const QPen &pen);
2090 void setSelectedSubTickPen(
const QPen &pen);
2091 Q_SLOT
void setSelectableParts(
const QCPAxis::SelectableParts &selectableParts);
2092 Q_SLOT
void setSelectedParts(
const QCPAxis::SelectableParts &selectedParts);
2097 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0) const Q_DECL_OVERRIDE;
2100 Qt::Orientation orientation()
const {
return mOrientation; }
2101 int pixelOrientation()
const {
return rangeReversed() != (orientation()==Qt::Vertical) ? -1 : 1; }
2102 void moveRange(
double diff);
2103 void scaleRange(
double factor);
2104 void scaleRange(
double factor,
double center);
2105 void setScaleRatio(
const QCPAxis *otherAxis,
double ratio=1.0);
2106 void rescale(
bool onlyVisiblePlottables=
false);
2107 double pixelToCoord(
double value)
const;
2108 double coordToPixel(
double value)
const;
2109 SelectablePart getPartAt(
const QPointF &pos)
const;
2110 QList<QCPAbstractPlottable*> plottables()
const;
2111 QList<QCPGraph*> graphs()
const;
2112 QList<QCPAbstractItem*> items()
const;
2115 static Qt::Orientation
orientation(
AxisType type) {
return type==atBottom||type==atTop ? Qt::Horizontal : Qt::Vertical; }
2116 static AxisType opposite(AxisType type);
2132 Qt::Orientation mOrientation;
2133 SelectableParts mSelectableParts, mSelectedParts;
2134 QPen mBasePen, mSelectedBasePen;
2139 QFont mLabelFont, mSelectedLabelFont;
2140 QColor mLabelColor, mSelectedLabelColor;
2145 QFont mTickLabelFont, mSelectedTickLabelFont;
2146 QColor mTickLabelColor, mSelectedTickLabelColor;
2147 int mNumberPrecision;
2148 QLatin1Char mNumberFormatChar;
2149 bool mNumberBeautifulPowers;
2155 QPen mTickPen, mSelectedTickPen;
2156 QPen mSubTickPen, mSelectedSubTickPen;
2159 bool mRangeReversed;
2165 QSharedPointer<QCPAxisTicker> mTicker;
2166 QVector<double> mTickVector;
2167 QVector<QString> mTickVectorLabels;
2168 QVector<double> mSubTickVector;
2169 bool mCachedMarginValid;
2173 QCP::AntialiasedElements mAADragBackup, mNotAADragBackup;
2176 virtual int calculateMargin();
2179 virtual void applyDefaultAntialiasingHint(
QCPPainter *painter)
const Q_DECL_OVERRIDE;
2180 virtual void draw(
QCPPainter *painter) Q_DECL_OVERRIDE;
2183 virtual
void selectEvent(QMouseEvent *event,
bool additive, const QVariant &details,
bool *selectionStateChanged) Q_DECL_OVERRIDE;
2184 virtual
void deselectEvent(
bool *selectionStateChanged) Q_DECL_OVERRIDE;
2186 virtual
void mousePressEvent(QMouseEvent *event, const QVariant &details);
2187 virtual
void mouseMoveEvent(QMouseEvent *event, const QPointF &startPos);
2188 virtual
void mouseReleaseEvent(QMouseEvent *event, const QPointF &startPos);
2189 virtual
void wheelEvent(QWheelEvent *event);
2192 void setupTickVectors();
2193 QPen getBasePen() const;
2194 QPen getTickPen() const;
2195 QPen getSubTickPen() const;
2196 QFont getTickLabelFont() const;
2197 QFont getLabelFont() const;
2198 QColor getTickLabelColor() const;
2199 QColor getLabelColor() const;
2208Q_DECLARE_OPERATORS_FOR_FLAGS(
QCPAxis::SelectableParts)
2209Q_DECLARE_OPERATORS_FOR_FLAGS(
QCPAxis::AxisTypes)
2223 virtual int size()
const;
2226 QRect axisSelectionBox()
const {
return mAxisSelectionBox; }
2227 QRect tickLabelsSelectionBox()
const {
return mTickLabelsSelectionBox; }
2228 QRect labelSelectionBox()
const {
return mLabelSelectionBox; }
2238 int tickLabelPadding;
2239 double tickLabelRotation;
2241 bool substituteExponent;
2242 bool numberMultiplyCross;
2243 int tickLengthIn, tickLengthOut, subTickLengthIn, subTickLengthOut;
2244 QPen tickPen, subTickPen;
2245 QFont tickLabelFont;
2246 QColor tickLabelColor;
2247 QRect axisRect, viewportRect;
2249 bool abbreviateDecimalPowers;
2250 bool reversedEndings;
2252 QVector<double> subTickPositions;
2253 QVector<double> tickPositions;
2254 QVector<QString> tickLabels;
2264 QString basePart, expPart, suffixPart;
2265 QRect baseBounds, expBounds, suffixBounds, totalBounds, rotatedTotalBounds;
2266 QFont baseFont, expFont;
2269 QByteArray mLabelParameterHash;
2270 QCache<QString, CachedLabel> mLabelCache;
2271 QRect mAxisSelectionBox, mTickLabelsSelectionBox, mLabelSelectionBox;
2273 virtual QByteArray generateLabelParameterHash()
const;
2275 virtual void placeTickLabel(
QCPPainter *painter,
double position,
int distanceToAxis,
const QString &text, QSize *tickLabelsSize);
2277 virtual TickLabelData getTickLabelData(
const QFont &font,
const QString &text)
const;
2278 virtual QPointF getTickLabelDrawOffset(
const TickLabelData &labelData)
const;
2279 virtual void getMaxTickLabelSize(
const QFont &font,
const QString &text, QSize *tickLabelsSize)
const;
2307 Q_ENUMS(ScatterProperty)
2308 Q_FLAGS(ScatterProperties)
2309 Q_DECLARE_FLAGS(ScatterProperties, ScatterProperty)
2337 Q_ENUMS(ScatterShape)
2341 QCPScatterStyle(ScatterShape shape,
const QColor &color,
double size);
2342 QCPScatterStyle(ScatterShape shape,
const QColor &color,
const QColor &fill,
double size);
2343 QCPScatterStyle(ScatterShape shape,
const QPen &pen,
const QBrush &brush,
double size);
2345 QCPScatterStyle(
const QPainterPath &customPath,
const QPen &pen,
const QBrush &brush=Qt::NoBrush,
double size=6);
2348 double size()
const {
return mSize; }
2349 ScatterShape shape()
const {
return mShape; }
2350 QPen pen()
const {
return mPen; }
2351 QBrush brush()
const {
return mBrush; }
2352 QPixmap pixmap()
const {
return mPixmap; }
2353 QPainterPath customPath()
const {
return mCustomPath; }
2356 void setFromOther(
const QCPScatterStyle &other, ScatterProperties properties);
2357 void setSize(
double size);
2358 void setShape(ScatterShape shape);
2359 void setPen(
const QPen &pen);
2360 void setBrush(
const QBrush &brush);
2361 void setPixmap(
const QPixmap &pixmap);
2362 void setCustomPath(
const QPainterPath &customPath);
2365 bool isNone()
const {
return mShape == ssNone; }
2368 void applyTo(
QCPPainter *painter,
const QPen &defaultPen)
const;
2369 void drawShape(
QCPPainter *painter,
const QPointF &pos)
const;
2370 void drawShape(
QCPPainter *painter,
double x,
double y)
const;
2375 ScatterShape mShape;
2379 QPainterPath mCustomPath;
2385Q_DECLARE_OPERATORS_FOR_FLAGS(QCPScatterStyle::ScatterProperties)
2400template <
class DataType>
2401inline bool qcpLessThanSortKey(
const DataType &a,
const DataType &b) {
return a.sortKey() < b.sortKey(); }
2403template <
class DataType>
2407 typedef typename QVector<DataType>::const_iterator const_iterator;
2408 typedef typename QVector<DataType>::iterator iterator;
2413 int size()
const {
return mData.size()-mPreallocSize; }
2415 bool autoSqueeze()
const {
return mAutoSqueeze; }
2418 void setAutoSqueeze(
bool enabled);
2422 void set(
const QVector<DataType> &data,
bool alreadySorted=
false);
2424 void add(
const QVector<DataType> &data,
bool alreadySorted=
false);
2425 void add(
const DataType &data);
2426 void removeBefore(
double sortKey);
2427 void removeAfter(
double sortKey);
2428 void remove(
double sortKeyFrom,
double sortKeyTo);
2429 void remove(
double sortKey);
2432 void squeeze(
bool preAllocation=
true,
bool postAllocation=
true);
2434 const_iterator
constBegin()
const {
return mData.constBegin()+mPreallocSize; }
2435 const_iterator
constEnd()
const {
return mData.constEnd(); }
2436 iterator
begin() {
return mData.begin()+mPreallocSize; }
2437 iterator
end() {
return mData.end(); }
2438 const_iterator findBegin(
double sortKey,
bool expandedRange=
true)
const;
2439 const_iterator findEnd(
double sortKey,
bool expandedRange=
true)
const;
2440 const_iterator
at(
int index)
const {
return constBegin()+qBound(0, index, size()); }
2444 void limitIteratorsToDataRange(const_iterator &begin, const_iterator &end,
const QCPDataRange &dataRange)
const;
2451 QVector<DataType> mData;
2453 int mPreallocIteration;
2456 void preallocateGrow(
int minimumPreallocSize);
2457 void performAutoSqueeze();
2598template <
class DataType>
2602 mPreallocIteration(0)
2614template <
class DataType>
2617 if (mAutoSqueeze != enabled)
2619 mAutoSqueeze = enabled;
2621 performAutoSqueeze();
2631template <
class DataType>
2647template <
class DataType>
2652 mPreallocIteration = 0;
2663template <
class DataType>
2669 const int n = data.
size();
2670 const int oldSize = size();
2672 if (oldSize > 0 && !qcpLessThanSortKey<DataType>(*constBegin(), *(data.
constEnd()-1)))
2674 if (mPreallocSize < n)
2680 mData.resize(mData.size()+n);
2682 if (oldSize > 0 && !qcpLessThanSortKey<DataType>(*(constEnd()-n-1), *(constEnd()-n)))
2683 std::inplace_merge(begin(), end()-n, end(), qcpLessThanSortKey<DataType>);
2695template <
class DataType>
2702 set(data, alreadySorted);
2706 const int n = data.size();
2707 const int oldSize = size();
2709 if (alreadySorted && oldSize > 0 && !qcpLessThanSortKey<DataType>(*constBegin(), *(data.constEnd()-1)))
2711 if (mPreallocSize < n)
2714 std::copy(data.constBegin(), data.constEnd(), begin());
2717 mData.resize(mData.size()+n);
2718 std::copy(data.constBegin(), data.constEnd(), end()-n);
2720 std::sort(end()-n, end(), qcpLessThanSortKey<DataType>);
2721 if (oldSize > 0 && !qcpLessThanSortKey<DataType>(*(constEnd()-n-1), *(constEnd()-n)))
2722 std::inplace_merge(begin(), end()-n, end(), qcpLessThanSortKey<DataType>);
2732template <
class DataType>
2735 if (isEmpty() || !qcpLessThanSortKey<DataType>(data, *(constEnd()-1)))
2738 }
else if (qcpLessThanSortKey<DataType>(data, *constBegin()))
2740 if (mPreallocSize < 1)
2746 QCPDataContainer<DataType>::iterator insertionPoint = std::lower_bound(begin(), end(), data, qcpLessThanSortKey<DataType>);
2747 mData.insert(insertionPoint, data);
2756template <
class DataType>
2759 QCPDataContainer<DataType>::iterator it = begin();
2760 QCPDataContainer<DataType>::iterator itEnd = std::lower_bound(begin(), end(), DataType::fromSortKey(sortKey), qcpLessThanSortKey<DataType>);
2761 mPreallocSize += itEnd-it;
2763 performAutoSqueeze();
2771template <
class DataType>
2774 QCPDataContainer<DataType>::iterator it = std::upper_bound(begin(), end(), DataType::fromSortKey(sortKey), qcpLessThanSortKey<DataType>);
2775 QCPDataContainer<DataType>::iterator itEnd = end();
2776 mData.erase(it, itEnd);
2778 performAutoSqueeze();
2788template <
class DataType>
2791 if (sortKeyFrom >= sortKeyTo || isEmpty())
2794 QCPDataContainer<DataType>::iterator it = std::lower_bound(begin(), end(), DataType::fromSortKey(sortKeyFrom), qcpLessThanSortKey<DataType>);
2795 QCPDataContainer<DataType>::iterator itEnd = std::upper_bound(it, end(), DataType::fromSortKey(sortKeyTo), qcpLessThanSortKey<DataType>);
2796 mData.erase(it, itEnd);
2798 performAutoSqueeze();
2810template <
class DataType>
2813 QCPDataContainer::iterator it = std::lower_bound(begin(), end(), DataType::fromSortKey(sortKey), qcpLessThanSortKey<DataType>);
2814 if (it != end() && it->sortKey() == sortKey)
2822 performAutoSqueeze();
2830template <
class DataType>
2834 mPreallocIteration = 0;
2849template <
class DataType>
2852 std::sort(begin(), end(), qcpLessThanSortKey<DataType>);
2865template <
class DataType>
2870 if (mPreallocSize > 0)
2872 std::copy(begin(), end(), mData.begin());
2873 mData.resize(size());
2876 mPreallocIteration = 0;
2897template <
class DataType>
2903 QCPDataContainer<DataType>::const_iterator it = std::lower_bound(constBegin(), constEnd(), DataType::fromSortKey(sortKey), qcpLessThanSortKey<DataType>);
2904 if (expandedRange && it != constBegin())
2924template <
class DataType>
2930 QCPDataContainer<DataType>::const_iterator it = std::upper_bound(constBegin(), constEnd(), DataType::fromSortKey(sortKey), qcpLessThanSortKey<DataType>);
2931 if (expandedRange && it != constEnd())
2951template <
class DataType>
2960 bool haveLower =
false;
2961 bool haveUpper =
false;
2964 QCPDataContainer<DataType>::const_iterator it = constBegin();
2965 QCPDataContainer<DataType>::const_iterator itEnd = constEnd();
2968 if (DataType::sortKeyIsMainKey())
2972 if (!qIsNaN(it->mainValue()))
2974 range.lower = it->mainKey();
2981 while (it != constBegin())
2984 if (!qIsNaN(it->mainValue()))
2986 range.upper = it->mainKey();
2995 if (!qIsNaN(it->mainValue()))
2997 current = it->mainKey();
2998 if (current < range.lower || !haveLower)
3000 range.lower = current;
3003 if (current > range.upper || !haveUpper)
3005 range.upper = current;
3016 if (!qIsNaN(it->mainValue()))
3018 current = it->mainKey();
3019 if ((current < range.lower || !haveLower) && current < 0)
3021 range.lower = current;
3024 if ((current > range.upper || !haveUpper) && current < 0)
3026 range.upper = current;
3036 if (!qIsNaN(it->mainValue()))
3038 current = it->mainKey();
3039 if ((current < range.lower || !haveLower) && current > 0)
3041 range.lower = current;
3044 if ((current > range.upper || !haveUpper) && current > 0)
3046 range.upper = current;
3054 foundRange = haveLower && haveUpper;
3074template <
class DataType>
3083 const bool restrictKeyRange = inKeyRange !=
QCPRange();
3084 bool haveLower =
false;
3085 bool haveUpper =
false;
3087 QCPDataContainer<DataType>::const_iterator itBegin = constBegin();
3088 QCPDataContainer<DataType>::const_iterator itEnd = constEnd();
3089 if (DataType::sortKeyIsMainKey() && restrictKeyRange)
3091 itBegin = findBegin(inKeyRange.lower);
3092 itEnd = findEnd(inKeyRange.upper);
3096 for (QCPDataContainer<DataType>::const_iterator it = itBegin; it != itEnd; ++it)
3098 if (restrictKeyRange && (it->mainKey() < inKeyRange.lower || it->mainKey() > inKeyRange.upper))
3100 current = it->valueRange();
3101 if ((current.lower < range.lower || !haveLower) && !qIsNaN(current.lower))
3103 range.lower = current.lower;
3106 if ((current.upper > range.upper || !haveUpper) && !qIsNaN(current.upper))
3108 range.upper = current.upper;
3114 for (QCPDataContainer<DataType>::const_iterator it = itBegin; it != itEnd; ++it)
3116 if (restrictKeyRange && (it->mainKey() < inKeyRange.lower || it->mainKey() > inKeyRange.upper))
3118 current = it->valueRange();
3119 if ((current.lower < range.lower || !haveLower) && current.lower < 0 && !qIsNaN(current.lower))
3121 range.lower = current.lower;
3124 if ((current.upper > range.upper || !haveUpper) && current.upper < 0 && !qIsNaN(current.upper))
3126 range.upper = current.upper;
3132 for (QCPDataContainer<DataType>::const_iterator it = itBegin; it != itEnd; ++it)
3134 if (restrictKeyRange && (it->mainKey() < inKeyRange.lower || it->mainKey() > inKeyRange.upper))
3136 current = it->valueRange();
3137 if ((current.lower < range.lower || !haveLower) && current.lower > 0 && !qIsNaN(current.lower))
3139 range.lower = current.lower;
3142 if ((current.upper > range.upper || !haveUpper) && current.upper > 0 && !qIsNaN(current.upper))
3144 range.upper = current.upper;
3150 foundRange = haveLower && haveUpper;
3162template <
class DataType>
3165 QCPDataRange iteratorRange(begin-constBegin(), end-constBegin());
3166 iteratorRange = iteratorRange.
bounded(dataRange.
bounded(this->dataRange()));
3167 begin = constBegin()+iteratorRange.begin();
3168 end = constBegin()+iteratorRange.end();
3180template <
class DataType>
3183 if (minimumPreallocSize <= mPreallocSize)
3186 int newPreallocSize = minimumPreallocSize;
3187 newPreallocSize += (1u<<qBound(4, mPreallocIteration+4, 15)) - 12;
3188 ++mPreallocIteration;
3190 int sizeDifference = newPreallocSize-mPreallocSize;
3191 mData.resize(mData.size()+sizeDifference);
3192 std::copy_backward(mData.begin()+mPreallocSize, mData.end()-sizeDifference, mData.end());
3193 mPreallocSize = newPreallocSize;
3210template <
class DataType>
3213 const int totalAlloc = mData.capacity();
3214 const int postAllocSize = totalAlloc-mData.
size();
3215 const int usedSize = size();
3216 bool shrinkPostAllocation =
false;
3217 bool shrinkPreAllocation =
false;
3218 if (totalAlloc > 650000)
3220 shrinkPostAllocation = postAllocSize > usedSize*1.5;
3221 shrinkPreAllocation = mPreallocSize*10 > usedSize;
3222 }
else if (totalAlloc > 1000)
3224 shrinkPostAllocation = postAllocSize > usedSize*5;
3225 shrinkPreAllocation = mPreallocSize > usedSize*1.5;
3228 if (shrinkPreAllocation || shrinkPostAllocation)
3229 squeeze(shrinkPreAllocation, shrinkPostAllocation);
3248 QPen pen()
const {
return mPen; }
3249 QBrush brush()
const {
return mBrush; }
3251 QCPScatterStyle::ScatterProperties usedScatterProperties()
const {
return mUsedScatterProperties; }
3254 void setPen(
const QPen &pen);
3255 void setBrush(
const QBrush &brush);
3257 void setUsedScatterProperties(
const QCPScatterStyle::ScatterProperties &properties);
3273 QCPScatterStyle::ScatterProperties mUsedScatterProperties;
3291 Q_PROPERTY(QString name READ name WRITE
setName)
3294 Q_PROPERTY(QPen pen READ pen WRITE
setPen)
3295 Q_PROPERTY(QBrush brush READ brush WRITE
setBrush)
3307 QString name()
const {
return mName; }
3308 bool antialiasedFill()
const {
return mAntialiasedFill; }
3309 bool antialiasedScatters()
const {
return mAntialiasedScatters; }
3310 QPen pen()
const {
return mPen; }
3311 QBrush brush()
const {
return mBrush; }
3312 QCPAxis *keyAxis()
const {
return mKeyAxis.data(); }
3313 QCPAxis *valueAxis()
const {
return mValueAxis.data(); }
3315 bool selected()
const {
return !mSelection.isEmpty(); }
3320 void setName(
const QString &name);
3323 void setPen(
const QPen &pen);
3324 void setBrush(
const QBrush &brush);
3332 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0)
const = 0;
3338 void coordsToPixels(
double key,
double value,
double &x,
double &y)
const;
3340 void pixelsToCoords(
double x,
double y,
double &key,
double &value)
const;
3341 void pixelsToCoords(
const QPointF &pixelPos,
double &key,
double &value)
const;
3344 void rescaleValueAxis(
bool onlyEnlarge=
false,
bool inKeyRange=
false)
const;
3358 bool mAntialiasedFill, mAntialiasedScatters;
3361 QPointer<QCPAxis> mKeyAxis, mValueAxis;
3367 virtual QRect clipRect() const Q_DECL_OVERRIDE;
3368 virtual
void draw(
QCPPainter *painter) Q_DECL_OVERRIDE = 0;
3369 virtual
QCP::Interaction selectionCategory() const Q_DECL_OVERRIDE;
3370 void applyDefaultAntialiasingHint(
QCPPainter *painter) const Q_DECL_OVERRIDE;
3372 virtual
void selectEvent(QMouseEvent *event,
bool additive, const QVariant &details,
bool *selectionStateChanged) Q_DECL_OVERRIDE;
3373 virtual
void deselectEvent(
bool *selectionStateChanged) Q_DECL_OVERRIDE;
3376 virtual
void drawLegendIcon(
QCPPainter *painter, const QRectF &rect) const = 0;
3379 void applyFillAntialiasingHint(
QCPPainter *painter) const;
3380 void applyScattersAntialiasingHint(
QCPPainter *painter) const;
3405 QString name()
const {
return mName; }
3406 virtual QPointF pixelPosition()
const;
3416 QSet<QCPItemPosition*> mChildrenX, mChildrenY;
3454 Q_ENUMS(PositionType)
3461 PositionType typeX()
const {
return mPositionTypeX; }
3462 PositionType typeY()
const {
return mPositionTypeY; }
3464 QCPItemAnchor *parentAnchorX()
const {
return mParentAnchorX; }
3465 QCPItemAnchor *parentAnchorY()
const {
return mParentAnchorY; }
3466 double key()
const {
return mKey; }
3467 double value()
const {
return mValue; }
3468 QPointF coords()
const {
return QPointF(mKey, mValue); }
3469 QCPAxis *keyAxis()
const {
return mKeyAxis.data(); }
3470 QCPAxis *valueAxis()
const {
return mValueAxis.data(); }
3472 virtual QPointF pixelPosition() const Q_DECL_OVERRIDE;
3475 void setType(PositionType type);
3476 void setTypeX(PositionType type);
3477 void setTypeY(PositionType type);
3478 bool setParentAnchor(
QCPItemAnchor *parentAnchor,
bool keepPixelPosition=false);
3479 bool setParentAnchorX(
QCPItemAnchor *parentAnchor,
bool keepPixelPosition=false);
3480 bool setParentAnchorY(
QCPItemAnchor *parentAnchor,
bool keepPixelPosition=false);
3481 void setCoords(
double key,
double value);
3482 void setCoords(const QPointF &coords);
3485 void setPixelPosition(const QPointF &pixelPosition);
3489 PositionType mPositionTypeX, mPositionTypeY;
3490 QPointer<
QCPAxis> mKeyAxis, mValueAxis;
3492 double mKey, mValue;
3509 Q_PROPERTY(
bool clipToAxisRect READ clipToAxisRect WRITE setClipToAxisRect)
3510 Q_PROPERTY(
QCPAxisRect* clipAxisRect READ clipAxisRect WRITE setClipAxisRect)
3511 Q_PROPERTY(
bool selectable READ selectable WRITE setSelectable NOTIFY selectableChanged)
3512 Q_PROPERTY(
bool selected READ selected WRITE setSelected NOTIFY selectionChanged)
3519 bool clipToAxisRect()
const {
return mClipToAxisRect; }
3521 bool selectable()
const {
return mSelectable; }
3522 bool selected()
const {
return mSelected; }
3525 void setClipToAxisRect(
bool clip);
3527 Q_SLOT
void setSelectable(
bool selectable);
3528 Q_SLOT
void setSelected(
bool selected);
3531 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0) const Q_DECL_OVERRIDE = 0;
3535 QList<QCPItemAnchor*>
anchors()
const {
return mAnchors; }
3538 bool hasAnchor(
const QString &name)
const;
3542 void selectableChanged(
bool selectable);
3546 bool mClipToAxisRect;
3547 QPointer<QCPAxisRect> mClipAxisRect;
3548 QList<QCPItemPosition*> mPositions;
3549 QList<QCPItemAnchor*> mAnchors;
3550 bool mSelectable, mSelected;
3554 virtual QRect clipRect() const Q_DECL_OVERRIDE;
3555 virtual
void applyDefaultAntialiasingHint(
QCPPainter *painter) const Q_DECL_OVERRIDE;
3556 virtual
void draw(
QCPPainter *painter) Q_DECL_OVERRIDE = 0;
3558 virtual
void selectEvent(QMouseEvent *event,
bool additive, const QVariant &details,
bool *selectionStateChanged) Q_DECL_OVERRIDE;
3559 virtual
void deselectEvent(
bool *selectionStateChanged) Q_DECL_OVERRIDE;
3562 virtual QPointF anchorPixelPosition(
int anchorId) const;
3565 double rectDistance(const QRectF &rect, const QPointF &pos,
bool filledRect) const;
3567 QCPItemAnchor *createAnchor(const QString &name,
int anchorId);
3586 Q_PROPERTY(QRect viewport READ viewport WRITE setViewport)
3587 Q_PROPERTY(QPixmap background READ background WRITE setBackground)
3588 Q_PROPERTY(
bool backgroundScaled READ backgroundScaled WRITE setBackgroundScaled)
3589 Q_PROPERTY(Qt::AspectRatioMode backgroundScaledMode READ backgroundScaledMode WRITE setBackgroundScaledMode)
3591 Q_PROPERTY(
bool autoAddPlottableToLegend READ autoAddPlottableToLegend WRITE setAutoAddPlottableToLegend)
3592 Q_PROPERTY(
int selectionTolerance READ selectionTolerance WRITE setSelectionTolerance)
3593 Q_PROPERTY(
bool noAntialiasingOnDrag READ noAntialiasingOnDrag WRITE setNoAntialiasingOnDrag)
3594 Q_PROPERTY(Qt::KeyboardModifier multiSelectModifier READ multiSelectModifier WRITE setMultiSelectModifier)
3595 Q_PROPERTY(
bool openGl READ openGl WRITE setOpenGl)
3606 Q_ENUMS(LayerInsertMode)
3618 Q_ENUMS(RefreshPriority)
3624 QRect viewport()
const {
return mViewport; }
3625 double bufferDevicePixelRatio()
const {
return mBufferDevicePixelRatio; }
3626 QPixmap background()
const {
return mBackgroundPixmap; }
3627 bool backgroundScaled()
const {
return mBackgroundScaled; }
3628 Qt::AspectRatioMode backgroundScaledMode()
const {
return mBackgroundScaledMode; }
3630 QCP::AntialiasedElements antialiasedElements()
const {
return mAntialiasedElements; }
3631 QCP::AntialiasedElements notAntialiasedElements()
const {
return mNotAntialiasedElements; }
3632 bool autoAddPlottableToLegend()
const {
return mAutoAddPlottableToLegend; }
3633 const QCP::Interactions interactions()
const {
return mInteractions; }
3634 int selectionTolerance()
const {
return mSelectionTolerance; }
3635 bool noAntialiasingOnDrag()
const {
return mNoAntialiasingOnDrag; }
3636 QCP::PlottingHints plottingHints()
const {
return mPlottingHints; }
3637 Qt::KeyboardModifier multiSelectModifier()
const {
return mMultiSelectModifier; }
3640 bool openGl()
const {
return mOpenGl; }
3643 void setViewport(
const QRect &rect);
3644 void setBufferDevicePixelRatio(
double ratio);
3645 void setBackground(
const QPixmap &pm);
3646 void setBackground(
const QPixmap &pm,
bool scaled, Qt::AspectRatioMode mode=Qt::KeepAspectRatioByExpanding);
3647 void setBackground(
const QBrush &brush);
3648 void setBackgroundScaled(
bool scaled);
3649 void setBackgroundScaledMode(Qt::AspectRatioMode mode);
3650 void setAntialiasedElements(
const QCP::AntialiasedElements &antialiasedElements);
3652 void setNotAntialiasedElements(
const QCP::AntialiasedElements ¬AntialiasedElements);
3654 void setAutoAddPlottableToLegend(
bool on);
3655 void setInteractions(
const QCP::Interactions &interactions);
3656 void setInteraction(
const QCP::Interaction &interaction,
bool enabled=
true);
3657 void setSelectionTolerance(
int pixels);
3658 void setNoAntialiasingOnDrag(
bool enabled);
3659 void setPlottingHints(
const QCP::PlottingHints &hints);
3661 void setMultiSelectModifier(Qt::KeyboardModifier modifier);
3664 void setOpenGl(
bool enabled,
int multisampling=16);
3671 bool removePlottable(
int index);
3672 int clearPlottables();
3673 int plottableCount()
const;
3674 QList<QCPAbstractPlottable*> selectedPlottables()
const;
3683 bool removeGraph(
int index);
3685 int graphCount()
const;
3686 QList<QCPGraph*> selectedGraphs()
const;
3692 bool removeItem(
int index);
3694 int itemCount()
const;
3695 QList<QCPAbstractItem*> selectedItems()
const;
3696 QCPAbstractItem *itemAt(
const QPointF &pos,
bool onlySelectable=
false)
const;
3700 QCPLayer *layer(
const QString &name)
const;
3703 bool setCurrentLayer(
const QString &name);
3704 bool setCurrentLayer(
QCPLayer *layer);
3705 int layerCount()
const;
3706 bool addLayer(
const QString &name,
QCPLayer *otherLayer=0, LayerInsertMode insertMode=limAbove);
3708 bool moveLayer(
QCPLayer *layer,
QCPLayer *otherLayer, LayerInsertMode insertMode=limAbove);
3711 int axisRectCount()
const;
3713 QList<QCPAxisRect*> axisRects()
const;
3715 QCPAxisRect* axisRectAt(
const QPointF &pos)
const;
3716 Q_SLOT
void rescaleAxes(
bool onlyVisiblePlottables=
false);
3718 QList<QCPAxis*> selectedAxes()
const;
3719 QList<QCPLegend*> selectedLegends()
const;
3720 Q_SLOT
void deselectAll();
3722 bool savePdf(
const QString &fileName,
int width=0,
int height=0,
QCP::ExportPen exportPen=
QCP::epAllowCosmetic,
const QString &pdfCreator=QString(),
const QString &pdfTitle=QString());
3726 bool saveRastered(
const QString &fileName,
int width,
int height,
double scale,
const char *format,
int quality=-1,
int resolution=96,
QCP::ResolutionUnit resolutionUnit=
QCP::ruDotsPerInch);
3727 QPixmap toPixmap(
int width=0,
int height=0,
double scale=1.0);
3728 void toPainter(
QCPPainter *painter,
int width=0,
int height=0);
3757 double mBufferDevicePixelRatio;
3759 bool mAutoAddPlottableToLegend;
3760 QList<QCPAbstractPlottable*> mPlottables;
3761 QList<QCPGraph*> mGraphs;
3762 QList<QCPAbstractItem*> mItems;
3763 QList<QCPLayer*> mLayers;
3764 QCP::AntialiasedElements mAntialiasedElements, mNotAntialiasedElements;
3765 QCP::Interactions mInteractions;
3766 int mSelectionTolerance;
3767 bool mNoAntialiasingOnDrag;
3768 QBrush mBackgroundBrush;
3769 QPixmap mBackgroundPixmap;
3770 QPixmap mScaledBackgroundPixmap;
3771 bool mBackgroundScaled;
3772 Qt::AspectRatioMode mBackgroundScaledMode;
3774 QCP::PlottingHints mPlottingHints;
3775 Qt::KeyboardModifier mMultiSelectModifier;
3781 QList<QSharedPointer<QCPAbstractPaintBuffer> > mPaintBuffers;
3782 QPoint mMousePressPos;
3783 bool mMouseHasMoved;
3784 QPointer<QCPLayerable> mMouseEventLayerable;
3785 QPointer<QCPLayerable> mMouseSignalLayerable;
3786 QVariant mMouseEventLayerableDetails;
3787 QVariant mMouseSignalLayerableDetails;
3790 int mOpenGlMultisamples;
3791 QCP::AntialiasedElements mOpenGlAntialiasedElementsBackup;
3792 bool mOpenGlCacheLabelsBackup;
3793#ifdef QCP_OPENGL_FBO
3794 QSharedPointer<QOpenGLContext> mGlContext;
3795 QSharedPointer<QSurface> mGlSurface;
3796 QSharedPointer<QOpenGLPaintDevice> mGlPaintDevice;
3800 virtual QSize minimumSizeHint() const Q_DECL_OVERRIDE;
3801 virtual QSize sizeHint() const Q_DECL_OVERRIDE;
3802 virtual
void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
3803 virtual
void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
3804 virtual
void mouseDoubleClickEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
3805 virtual
void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
3806 virtual
void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
3807 virtual
void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
3808 virtual
void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE;
3812 virtual
void updateLayout();
3813 virtual
void axisRemoved(
QCPAxis *axis);
3814 virtual
void legendRemoved(
QCPLegend *legend);
3815 Q_SLOT virtual
void processRectSelection(QRect rect, QMouseEvent *event);
3816 Q_SLOT virtual
void processRectZoom(QRect rect, QMouseEvent *event);
3817 Q_SLOT virtual
void processPointSelection(QMouseEvent *event);
3821 bool registerGraph(
QCPGraph *graph);
3823 void updateLayerIndices() const;
3824 QCPLayerable *layerableAt(const QPointF &pos,
bool onlySelectable, QVariant *selectionDetails=0) const;
3825 QList<
QCPLayerable*> layerableListAt(const QPointF &pos,
bool onlySelectable, QList<QVariant> *selectionDetails=0) const;
3827 void setupPaintBuffers();
3829 bool hasInvalidatedPaintBuffers();
3863 virtual int findBegin(
double sortKey,
bool expandedRange=
true)
const = 0;
3864 virtual int findEnd(
double sortKey,
bool expandedRange=
true)
const = 0;
3867template <
class DataType>
3885 virtual
int findBegin(
double sortKey,
bool expandedRange=true) const Q_DECL_OVERRIDE;
3886 virtual
int findEnd(
double sortKey,
bool expandedRange=true) const Q_DECL_OVERRIDE;
3889 virtual
double selectTest(const QPointF &pos,
bool onlySelectable, QVariant *details=0) const Q_DECL_OVERRIDE;
3894 QSharedPointer<QCPDataContainer<DataType> > mDataContainer;
3897 void getDataSegments(QList<QCPDataRange> &selectedSegments, QList<QCPDataRange> &unselectedSegments)
const;
4095template <
class DataType>
4102template <
class DataType>
4110template <
class DataType>
4113 return mDataContainer->size();
4119template <
class DataType>
4122 if (index >= 0 && index < mDataContainer->size())
4124 return (mDataContainer->constBegin()+index)->mainKey();
4127 qDebug() << Q_FUNC_INFO <<
"Index out of bounds" << index;
4135template <
class DataType>
4138 if (index >= 0 && index < mDataContainer->size())
4140 return (mDataContainer->constBegin()+index)->sortKey();
4143 qDebug() << Q_FUNC_INFO <<
"Index out of bounds" << index;
4151template <
class DataType>
4154 if (index >= 0 && index < mDataContainer->size())
4156 return (mDataContainer->constBegin()+index)->mainValue();
4159 qDebug() << Q_FUNC_INFO <<
"Index out of bounds" << index;
4167template <
class DataType>
4170 if (index >= 0 && index < mDataContainer->size())
4172 return (mDataContainer->constBegin()+index)->valueRange();
4175 qDebug() << Q_FUNC_INFO <<
"Index out of bounds" << index;
4183template <
class DataType>
4186 if (index >= 0 && index < mDataContainer->size())
4188 const typename QCPDataContainer<DataType>::const_iterator it = mDataContainer->constBegin()+index;
4189 return coordsToPixels(it->mainKey(), it->mainValue());
4192 qDebug() << Q_FUNC_INFO <<
"Index out of bounds" << index;
4200template <
class DataType>
4203 return DataType::sortKeyIsMainKey();
4213template <
class DataType>
4217 if ((onlySelectable && mSelectable ==
QCP::stNone) || mDataContainer->isEmpty())
4219 if (!mKeyAxis || !mValueAxis)
4223 double key1, value1, key2, value2;
4224 pixelsToCoords(rect.topLeft(), key1, value1);
4225 pixelsToCoords(rect.bottomRight(), key2, value2);
4227 QCPRange valueRange(value1, value2);
4228 typename QCPDataContainer<DataType>::const_iterator begin = mDataContainer->constBegin();
4229 typename QCPDataContainer<DataType>::const_iterator end = mDataContainer->constEnd();
4230 if (DataType::sortKeyIsMainKey())
4232 begin = mDataContainer->
findBegin(keyRange.lower,
false);
4233 end = mDataContainer->
findEnd(keyRange.upper,
false);
4238 int currentSegmentBegin = -1;
4239 for (
typename QCPDataContainer<DataType>::const_iterator it=begin; it!=end; ++it)
4241 if (currentSegmentBegin == -1)
4243 if (valueRange.
contains(it->mainValue()) && keyRange.
contains(it->mainKey()))
4244 currentSegmentBegin = it-mDataContainer->constBegin();
4245 }
else if (!valueRange.
contains(it->mainValue()) || !keyRange.
contains(it->mainKey()))
4248 currentSegmentBegin = -1;
4252 if (currentSegmentBegin != -1)
4262template <
class DataType>
4265 return mDataContainer->findBegin(sortKey, expandedRange)-mDataContainer->constBegin();
4271template <
class DataType>
4274 return mDataContainer->findEnd(sortKey, expandedRange)-mDataContainer->constBegin();
4284template <
class DataType>
4287 if ((onlySelectable && mSelectable ==
QCP::stNone) || mDataContainer->isEmpty())
4289 if (!mKeyAxis || !mValueAxis)
4293 double minDistSqr = std::numeric_limits<double>::max();
4294 int minDistIndex = mDataContainer->size();
4296 typename QCPDataContainer<DataType>::const_iterator begin = mDataContainer->constBegin();
4297 typename QCPDataContainer<DataType>::const_iterator end = mDataContainer->constEnd();
4298 if (DataType::sortKeyIsMainKey())
4301 double posKeyMin, posKeyMax, dummy;
4302 pixelsToCoords(pos-QPointF(mParentPlot->selectionTolerance(), mParentPlot->selectionTolerance()), posKeyMin, dummy);
4303 pixelsToCoords(pos+QPointF(mParentPlot->selectionTolerance(), mParentPlot->selectionTolerance()), posKeyMax, dummy);
4304 if (posKeyMin > posKeyMax)
4305 qSwap(posKeyMin, posKeyMax);
4306 begin = mDataContainer->
findBegin(posKeyMin,
true);
4307 end = mDataContainer->
findEnd(posKeyMax,
true);
4311 QCPRange keyRange(mKeyAxis->range());
4312 QCPRange valueRange(mValueAxis->range());
4313 for (
typename QCPDataContainer<DataType>::const_iterator it=begin; it!=end; ++it)
4315 const double mainKey = it->mainKey();
4316 const double mainValue = it->mainValue();
4320 if (currentDistSqr < minDistSqr)
4322 minDistSqr = currentDistSqr;
4323 minDistIndex = it-mDataContainer->constBegin();
4327 if (minDistIndex != mDataContainer->size())
4332 details->setValue(selectionResult);
4333 return qSqrt(minDistSqr);
4346template <
class DataType>
4349 selectedSegments.clear();
4350 unselectedSegments.clear();
4376template <
class DataType>
4381 painter->pen().style() == Qt::SolidLine &&
4386 bool lastIsNan =
false;
4387 const int lineDataSize = lineData.size();
4388 while (i < lineDataSize && (qIsNaN(lineData.at(i).y()) || qIsNaN(lineData.at(i).x())))
4391 while (i < lineDataSize)
4393 if (!qIsNaN(lineData.at(i).y()) && !qIsNaN(lineData.at(i).x()))
4396 painter->
drawLine(lineData.at(i-1), lineData.at(i));
4405 int segmentStart = 0;
4407 const int lineDataSize = lineData.size();
4408 while (i < lineDataSize)
4410 if (qIsNaN(lineData.at(i).y()) || qIsNaN(lineData.at(i).x()) || qIsInf(lineData.at(i).y()))
4412 painter->drawPolyline(lineData.constData()+segmentStart, i-segmentStart);
4418 painter->drawPolyline(lineData.constData()+segmentStart, lineDataSize-segmentStart);
4442 Q_ENUMS(ColorInterpolation)
4461 Q_ENUMS(GradientPreset)
4466 bool operator!=(
const QCPColorGradient &other)
const {
return !(*
this == other); }
4469 int levelCount()
const {
return mLevelCount; }
4470 QMap<double, QColor> colorStops()
const {
return mColorStops; }
4471 ColorInterpolation colorInterpolation()
const {
return mColorInterpolation; }
4472 bool periodic()
const {
return mPeriodic; }
4475 void setLevelCount(
int n);
4476 void setColorStops(
const QMap<double, QColor> &colorStops);
4477 void setColorStopAt(
double position,
const QColor &color);
4478 void setColorInterpolation(ColorInterpolation interpolation);
4479 void setPeriodic(
bool enabled);
4482 void colorize(
const double *data,
const QCPRange &range, QRgb *scanLine,
int n,
int dataIndexFactor=1,
bool logarithmic=
false);
4483 void colorize(
const double *data,
const unsigned char *alpha,
const QCPRange &range, QRgb *scanLine,
int n,
int dataIndexFactor=1,
bool logarithmic=
false);
4484 QRgb color(
double position,
const QCPRange &range,
bool logarithmic=
false);
4485 void loadPreset(GradientPreset preset);
4486 void clearColorStops();
4492 QMap<double, QColor> mColorStops;
4493 ColorInterpolation mColorInterpolation;
4497 QVector<QRgb> mColorBuffer;
4498 bool mColorBufferInvalidated;
4501 bool stopsUseAlpha()
const;
4502 void updateColorBuffer();
4530 Q_ENUMS(BracketStyle)
4536 QPen bracketPen()
const {
return mBracketPen; }
4537 QBrush bracketBrush()
const {
return mBracketBrush; }
4538 int bracketWidth()
const {
return mBracketWidth; }
4539 int bracketHeight()
const {
return mBracketHeight; }
4540 BracketStyle bracketStyle()
const {
return mBracketStyle; }
4541 bool tangentToData()
const {
return mTangentToData; }
4542 int tangentAverage()
const {
return mTangentAverage; }
4545 void setBracketPen(
const QPen &pen);
4546 void setBracketBrush(
const QBrush &brush);
4547 void setBracketWidth(
int width);
4548 void setBracketHeight(
int height);
4549 void setBracketStyle(BracketStyle style);
4550 void setTangentToData(
bool enabled);
4551 void setTangentAverage(
int pointCount);
4554 virtual void drawBracket(
QCPPainter *painter,
int direction)
const;
4562 QBrush mBracketBrush;
4565 BracketStyle mBracketStyle;
4566 bool mTangentToData;
4567 int mTangentAverage;
4586 Q_PROPERTY(QPixmap background READ background WRITE setBackground)
4587 Q_PROPERTY(
bool backgroundScaled READ backgroundScaled WRITE setBackgroundScaled)
4588 Q_PROPERTY(Qt::AspectRatioMode backgroundScaledMode READ backgroundScaledMode WRITE setBackgroundScaledMode)
4589 Q_PROPERTY(Qt::Orientations rangeDrag READ rangeDrag WRITE setRangeDrag)
4590 Q_PROPERTY(Qt::Orientations rangeZoom READ rangeZoom WRITE setRangeZoom)
4597 QPixmap background()
const {
return mBackgroundPixmap; }
4598 QBrush backgroundBrush()
const {
return mBackgroundBrush; }
4599 bool backgroundScaled()
const {
return mBackgroundScaled; }
4600 Qt::AspectRatioMode backgroundScaledMode()
const {
return mBackgroundScaledMode; }
4601 Qt::Orientations rangeDrag()
const {
return mRangeDrag; }
4602 Qt::Orientations rangeZoom()
const {
return mRangeZoom; }
4603 QCPAxis *rangeDragAxis(Qt::Orientation orientation);
4604 QCPAxis *rangeZoomAxis(Qt::Orientation orientation);
4605 QList<QCPAxis*> rangeDragAxes(Qt::Orientation orientation);
4606 QList<QCPAxis*> rangeZoomAxes(Qt::Orientation orientation);
4607 double rangeZoomFactor(Qt::Orientation orientation);
4610 void setBackground(
const QPixmap &pm);
4611 void setBackground(
const QPixmap &pm,
bool scaled, Qt::AspectRatioMode mode=Qt::KeepAspectRatioByExpanding);
4612 void setBackground(
const QBrush &brush);
4613 void setBackgroundScaled(
bool scaled);
4614 void setBackgroundScaledMode(Qt::AspectRatioMode mode);
4615 void setRangeDrag(Qt::Orientations orientations);
4616 void setRangeZoom(Qt::Orientations orientations);
4618 void setRangeDragAxes(QList<QCPAxis*> axes);
4619 void setRangeDragAxes(QList<QCPAxis*> horizontal, QList<QCPAxis*> vertical);
4621 void setRangeZoomAxes(QList<QCPAxis*> axes);
4622 void setRangeZoomAxes(QList<QCPAxis*> horizontal, QList<QCPAxis*> vertical);
4623 void setRangeZoomFactor(
double horizontalFactor,
double verticalFactor);
4624 void setRangeZoomFactor(
double factor);
4629 QList<QCPAxis*> axes(QCPAxis::AxisTypes types)
const;
4630 QList<QCPAxis*> axes()
const;
4632 QList<QCPAxis*> addAxes(QCPAxis::AxisTypes types);
4633 bool removeAxis(
QCPAxis *axis);
4636 void zoom(
const QRectF &pixelRect);
4637 void zoom(
const QRectF &pixelRect,
const QList<QCPAxis*> &affectedAxes);
4638 void setupFullAxesBox(
bool connectRanges=
false);
4639 QList<QCPAbstractPlottable*> plottables()
const;
4640 QList<QCPGraph*> graphs()
const;
4641 QList<QCPAbstractItem*> items()
const;
4644 int left()
const {
return mRect.left(); }
4645 int right()
const {
return mRect.right(); }
4646 int top()
const {
return mRect.top(); }
4647 int bottom()
const {
return mRect.bottom(); }
4648 int width()
const {
return mRect.width(); }
4649 int height()
const {
return mRect.height(); }
4650 QSize
size()
const {
return mRect.size(); }
4651 QPoint
topLeft()
const {
return mRect.topLeft(); }
4655 QPoint
center()
const {
return mRect.center(); }
4658 virtual void update(UpdatePhase phase) Q_DECL_OVERRIDE;
4659 virtual QList<QCPLayoutElement*> elements(
bool recursive)
const Q_DECL_OVERRIDE;
4663 QBrush mBackgroundBrush;
4664 QPixmap mBackgroundPixmap;
4665 QPixmap mScaledBackgroundPixmap;
4666 bool mBackgroundScaled;
4667 Qt::AspectRatioMode mBackgroundScaledMode;
4669 Qt::Orientations mRangeDrag, mRangeZoom;
4670 QList<QPointer<QCPAxis> > mRangeDragHorzAxis, mRangeDragVertAxis;
4671 QList<QPointer<QCPAxis> > mRangeZoomHorzAxis, mRangeZoomVertAxis;
4672 double mRangeZoomFactorHorz, mRangeZoomFactorVert;
4675 QList<QCPRange> mDragStartHorzRange, mDragStartVertRange;
4676 QCP::AntialiasedElements mAADragBackup, mNotAADragBackup;
4678 QHash<QCPAxis::AxisType, QList<QCPAxis*> > mAxes;
4681 virtual void applyDefaultAntialiasingHint(
QCPPainter *painter)
const Q_DECL_OVERRIDE;
4682 virtual void draw(
QCPPainter *painter) Q_DECL_OVERRIDE;
4683 virtual int calculateAutoMargin(
QCP::MarginSide side) Q_DECL_OVERRIDE;
4684 virtual void layoutChanged() Q_DECL_OVERRIDE;
4686 virtual
void mousePressEvent(QMouseEvent *event, const QVariant &details) Q_DECL_OVERRIDE;
4687 virtual
void mouseMoveEvent(QMouseEvent *event, const QPointF &startPos) Q_DECL_OVERRIDE;
4688 virtual
void mouseReleaseEvent(QMouseEvent *event, const QPointF &startPos) Q_DECL_OVERRIDE;
4689 virtual
void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE;
4693 void updateAxesOffset(
QCPAxis::AxisType type);
4712 Q_PROPERTY(
QCPLegend* parentLegend READ parentLegend)
4713 Q_PROPERTY(QFont font READ font WRITE setFont)
4714 Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor)
4715 Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont)
4716 Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE setSelectedTextColor)
4717 Q_PROPERTY(
bool selectable READ selectable WRITE setSelectable NOTIFY selectionChanged)
4718 Q_PROPERTY(
bool selected READ selected WRITE setSelected NOTIFY selectableChanged)
4724 QCPLegend *parentLegend()
const {
return mParentLegend; }
4725 QFont font()
const {
return mFont; }
4726 QColor textColor()
const {
return mTextColor; }
4727 QFont selectedFont()
const {
return mSelectedFont; }
4728 QColor selectedTextColor()
const {
return mSelectedTextColor; }
4729 bool selectable()
const {
return mSelectable; }
4730 bool selected()
const {
return mSelected; }
4733 void setFont(
const QFont &font);
4734 void setTextColor(
const QColor &color);
4735 void setSelectedFont(
const QFont &font);
4736 void setSelectedTextColor(
const QColor &color);
4737 Q_SLOT
void setSelectable(
bool selectable);
4738 Q_SLOT
void setSelected(
bool selected);
4741 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0)
const Q_DECL_OVERRIDE;
4745 void selectableChanged(
bool selectable);
4752 QFont mSelectedFont;
4753 QColor mSelectedTextColor;
4754 bool mSelectable, mSelected;
4758 virtual
void applyDefaultAntialiasingHint(
QCPPainter *painter) const Q_DECL_OVERRIDE;
4759 virtual QRect clipRect() const Q_DECL_OVERRIDE;
4760 virtual
void draw(
QCPPainter *painter) Q_DECL_OVERRIDE = 0;
4762 virtual
void selectEvent(QMouseEvent *event,
bool additive, const QVariant &details,
bool *selectionStateChanged) Q_DECL_OVERRIDE;
4763 virtual
void deselectEvent(
bool *selectionStateChanged) Q_DECL_OVERRIDE;
4786 virtual void draw(
QCPPainter *painter) Q_DECL_OVERRIDE;
4787 virtual QSize minimumOuterSizeHint()
const Q_DECL_OVERRIDE;
4790 QPen getIconBorderPen()
const;
4791 QColor getTextColor()
const;
4792 QFont getFont()
const;
4800 Q_PROPERTY(QPen borderPen READ borderPen WRITE setBorderPen)
4801 Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
4802 Q_PROPERTY(QFont font READ font WRITE setFont)
4803 Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor)
4804 Q_PROPERTY(QSize iconSize READ iconSize WRITE setIconSize)
4805 Q_PROPERTY(
int iconTextPadding READ iconTextPadding WRITE setIconTextPadding)
4806 Q_PROPERTY(QPen iconBorderPen READ iconBorderPen WRITE setIconBorderPen)
4807 Q_PROPERTY(SelectableParts selectableParts READ selectableParts WRITE setSelectableParts NOTIFY selectionChanged)
4808 Q_PROPERTY(SelectableParts selectedParts READ selectedParts WRITE setSelectedParts NOTIFY selectableChanged)
4809 Q_PROPERTY(QPen selectedBorderPen READ selectedBorderPen WRITE setSelectedBorderPen)
4810 Q_PROPERTY(QPen selectedIconBorderPen READ selectedIconBorderPen WRITE setSelectedIconBorderPen)
4811 Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
4812 Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont)
4813 Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE setSelectedTextColor)
4822 ,spLegendBox = 0x001
4825 Q_ENUMS(SelectablePart)
4826 Q_FLAGS(SelectableParts)
4827 Q_DECLARE_FLAGS(SelectableParts, SelectablePart)
4833 QPen borderPen()
const {
return mBorderPen; }
4834 QBrush brush()
const {
return mBrush; }
4835 QFont font()
const {
return mFont; }
4836 QColor textColor()
const {
return mTextColor; }
4837 QSize iconSize()
const {
return mIconSize; }
4838 int iconTextPadding()
const {
return mIconTextPadding; }
4839 QPen iconBorderPen()
const {
return mIconBorderPen; }
4840 SelectableParts selectableParts()
const {
return mSelectableParts; }
4841 SelectableParts selectedParts()
const;
4842 QPen selectedBorderPen()
const {
return mSelectedBorderPen; }
4843 QPen selectedIconBorderPen()
const {
return mSelectedIconBorderPen; }
4844 QBrush selectedBrush()
const {
return mSelectedBrush; }
4845 QFont selectedFont()
const {
return mSelectedFont; }
4846 QColor selectedTextColor()
const {
return mSelectedTextColor; }
4849 void setBorderPen(
const QPen &pen);
4850 void setBrush(
const QBrush &brush);
4851 void setFont(
const QFont &font);
4852 void setTextColor(
const QColor &color);
4853 void setIconSize(
const QSize &size);
4854 void setIconSize(
int width,
int height);
4855 void setIconTextPadding(
int padding);
4856 void setIconBorderPen(
const QPen &pen);
4857 Q_SLOT
void setSelectableParts(
const SelectableParts &selectableParts);
4858 Q_SLOT
void setSelectedParts(
const SelectableParts &selectedParts);
4859 void setSelectedBorderPen(
const QPen &pen);
4860 void setSelectedIconBorderPen(
const QPen &pen);
4861 void setSelectedBrush(
const QBrush &brush);
4862 void setSelectedFont(
const QFont &font);
4863 void setSelectedTextColor(
const QColor &color);
4866 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0) const Q_DECL_OVERRIDE;
4871 int itemCount() const;
4875 bool removeItem(
int index);
4882 void selectableChanged(
QCPLegend::SelectableParts parts);
4886 QPen mBorderPen, mIconBorderPen;
4891 int mIconTextPadding;
4892 SelectableParts mSelectedParts, mSelectableParts;
4893 QPen mSelectedBorderPen, mSelectedIconBorderPen;
4894 QBrush mSelectedBrush;
4895 QFont mSelectedFont;
4896 QColor mSelectedTextColor;
4899 virtual
void parentPlotInitialized(
QCustomPlot *parentPlot) Q_DECL_OVERRIDE;
4900 virtual
QCP::Interaction selectionCategory() const Q_DECL_OVERRIDE;
4901 virtual
void applyDefaultAntialiasingHint(
QCPPainter *painter) const Q_DECL_OVERRIDE;
4902 virtual
void draw(
QCPPainter *painter) Q_DECL_OVERRIDE;
4904 virtual
void selectEvent(QMouseEvent *event,
bool additive, const QVariant &details,
bool *selectionStateChanged) Q_DECL_OVERRIDE;
4905 virtual
void deselectEvent(
bool *selectionStateChanged) Q_DECL_OVERRIDE;
4908 QPen getBorderPen() const;
4909 QBrush getBrush() const;
4917Q_DECLARE_OPERATORS_FOR_FLAGS(
QCPLegend::SelectableParts)
4930 Q_PROPERTY(QString text READ text WRITE setText)
4931 Q_PROPERTY(QFont font READ font WRITE setFont)
4932 Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor)
4933 Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont)
4934 Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE setSelectedTextColor)
4935 Q_PROPERTY(
bool selectable READ selectable WRITE setSelectable NOTIFY selectableChanged)
4936 Q_PROPERTY(
bool selected READ selected WRITE setSelected NOTIFY selectionChanged)
4946 QString text()
const {
return mText; }
4947 int textFlags()
const {
return mTextFlags; }
4948 QFont font()
const {
return mFont; }
4949 QColor textColor()
const {
return mTextColor; }
4950 QFont selectedFont()
const {
return mSelectedFont; }
4951 QColor selectedTextColor()
const {
return mSelectedTextColor; }
4952 bool selectable()
const {
return mSelectable; }
4953 bool selected()
const {
return mSelected; }
4956 void setText(
const QString &text);
4957 void setTextFlags(
int flags);
4958 void setFont(
const QFont &font);
4959 void setTextColor(
const QColor &color);
4960 void setSelectedFont(
const QFont &font);
4961 void setSelectedTextColor(
const QColor &color);
4962 Q_SLOT
void setSelectable(
bool selectable);
4963 Q_SLOT
void setSelected(
bool selected);
4966 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0)
const Q_DECL_OVERRIDE;
4967 virtual void mousePressEvent(QMouseEvent *event,
const QVariant &details) Q_DECL_OVERRIDE;
4968 virtual void mouseReleaseEvent(QMouseEvent *event,
const QPointF &startPos) Q_DECL_OVERRIDE;
4969 virtual void mouseDoubleClickEvent(QMouseEvent *event,
const QVariant &details) Q_DECL_OVERRIDE;
4973 void selectableChanged(
bool selectable);
4983 QFont mSelectedFont;
4984 QColor mSelectedTextColor;
4985 QRect mTextBoundingRect;
4986 bool mSelectable, mSelected;
4989 virtual void applyDefaultAntialiasingHint(
QCPPainter *painter)
const Q_DECL_OVERRIDE;
4990 virtual void draw(
QCPPainter *painter) Q_DECL_OVERRIDE;
4991 virtual QSize minimumOuterSizeHint() const Q_DECL_OVERRIDE;
4992 virtual QSize maximumOuterSizeHint() const Q_DECL_OVERRIDE;
4994 virtual
void selectEvent(QMouseEvent *event,
bool additive, const QVariant &details,
bool *selectionStateChanged) Q_DECL_OVERRIDE;
4995 virtual
void deselectEvent(
bool *selectionStateChanged) Q_DECL_OVERRIDE;
4998 QFont mainFont() const;
4999 QColor mainTextColor() const;
5021 QImage mGradientImage;
5022 bool mGradientImageInvalidated;
5024 using QCPAxisRect::calculateAutoMargin;
5030 virtual void draw(
QCPPainter *painter) Q_DECL_OVERRIDE;
5031 void updateGradientImage();
5032 Q_SLOT
void axisSelectionChanged(QCPAxis::SelectableParts selectedParts);
5033 Q_SLOT
void axisSelectableChanged(QCPAxis::SelectableParts selectableParts);
5043 Q_PROPERTY(
QCPRange dataRange READ dataRange WRITE setDataRange NOTIFY dataRangeChanged)
5044 Q_PROPERTY(
QCPAxis::ScaleType dataScaleType READ dataScaleType WRITE setDataScaleType NOTIFY dataScaleTypeChanged)
5045 Q_PROPERTY(
QCPColorGradient gradient READ gradient WRITE setGradient NOTIFY gradientChanged)
5046 Q_PROPERTY(QString label READ label WRITE setLabel)
5047 Q_PROPERTY(
int barWidth READ barWidth WRITE setBarWidth)
5048 Q_PROPERTY(
bool rangeDrag READ rangeDrag WRITE setRangeDrag)
5049 Q_PROPERTY(
bool rangeZoom READ rangeZoom WRITE setRangeZoom)
5058 QCPRange dataRange()
const {
return mDataRange; }
5061 QString label()
const;
5062 int barWidth ()
const {
return mBarWidth; }
5063 bool rangeDrag()
const;
5064 bool rangeZoom()
const;
5068 Q_SLOT
void setDataRange(
const QCPRange &dataRange);
5071 void setLabel(
const QString &str);
5072 void setBarWidth(
int width);
5073 void setRangeDrag(
bool enabled);
5074 void setRangeZoom(
bool enabled);
5077 QList<QCPColorMap*> colorMaps()
const;
5078 void rescaleDataRange(
bool onlyVisibleMaps);
5081 virtual void update(UpdatePhase phase) Q_DECL_OVERRIDE;
5097 QPointer<QCPColorScaleAxisRectPrivate> mAxisRect;
5098 QPointer<QCPAxis> mColorAxis;
5101 virtual void applyDefaultAntialiasingHint(
QCPPainter *painter)
const Q_DECL_OVERRIDE;
5103 virtual void mousePressEvent(QMouseEvent *event,
const QVariant &details) Q_DECL_OVERRIDE;
5104 virtual void mouseMoveEvent(QMouseEvent *event,
const QPointF &startPos) Q_DECL_OVERRIDE;
5105 virtual void mouseReleaseEvent(QMouseEvent *event,
const QPointF &startPos) Q_DECL_OVERRIDE;
5106 virtual void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE;
5156 Q_PROPERTY(
LineStyle lineStyle READ lineStyle WRITE setLineStyle)
5157 Q_PROPERTY(
QCPScatterStyle scatterStyle READ scatterStyle WRITE setScatterStyle)
5158 Q_PROPERTY(
int scatterSkip READ scatterSkip WRITE setScatterSkip)
5159 Q_PROPERTY(
QCPGraph* channelFillGraph READ channelFillGraph WRITE setChannelFillGraph)
5160 Q_PROPERTY(
bool adaptiveSampling READ adaptiveSampling WRITE setAdaptiveSampling)
5182 QSharedPointer<QCPGraphDataContainer>
data()
const {
return mDataContainer; }
5183 LineStyle lineStyle()
const {
return mLineStyle; }
5185 int scatterSkip()
const {
return mScatterSkip; }
5186 QCPGraph *channelFillGraph()
const {
return mChannelFillGraph.
data(); }
5187 bool adaptiveSampling()
const {
return mAdaptiveSampling; }
5190 void setData(QSharedPointer<QCPGraphDataContainer> data);
5191 void setData(
const QVector<double> &keys,
const QVector<double> &values,
bool alreadySorted=
false);
5192 void setLineStyle(LineStyle ls);
5194 void setScatterSkip(
int skip);
5195 void setChannelFillGraph(
QCPGraph *targetGraph);
5196 void setAdaptiveSampling(
bool enabled);
5199 void addData(
const QVector<double> &keys,
const QVector<double> &values,
bool alreadySorted=
false);
5200 void addData(
double key,
double value);
5203 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0) const Q_DECL_OVERRIDE;
5204 virtual
QCPRange getKeyRange(
bool &foundRange,
QCP::SignDomain inSignDomain=
QCP::sdBoth) const Q_DECL_OVERRIDE;
5205 virtual
QCPRange getValueRange(
bool &foundRange,
QCP::SignDomain inSignDomain=
QCP::sdBoth, const
QCPRange &inKeyRange=
QCPRange()) const Q_DECL_OVERRIDE;
5209 LineStyle mLineStyle;
5212 QPointer<
QCPGraph> mChannelFillGraph;
5213 bool mAdaptiveSampling;
5216 virtual
void draw(
QCPPainter *painter) Q_DECL_OVERRIDE;
5217 virtual
void drawLegendIcon(
QCPPainter *painter, const QRectF &rect) const Q_DECL_OVERRIDE;
5220 virtual
void drawFill(
QCPPainter *painter, QVector<QPointF> *lines) const;
5221 virtual
void drawScatterPlot(
QCPPainter *painter, const QVector<QPointF> &scatters, const
QCPScatterStyle &style) const;
5222 virtual
void drawLinePlot(
QCPPainter *painter, const QVector<QPointF> &lines) const;
5223 virtual
void drawImpulsePlot(
QCPPainter *painter, const QVector<QPointF> &lines) const;
5230 void getLines(QVector<QPointF> *lines, const
QCPDataRange &dataRange) const;
5231 void getScatters(QVector<QPointF> *scatters, const
QCPDataRange &dataRange) const;
5232 QVector<QPointF> dataToLines(const QVector<
QCPGraphData> &data) const;
5233 QVector<QPointF> dataToStepLeftLines(const QVector<
QCPGraphData> &data) const;
5234 QVector<QPointF> dataToStepRightLines(const QVector<
QCPGraphData> &data) const;
5235 QVector<QPointF> dataToStepCenterLines(const QVector<
QCPGraphData> &data) const;
5236 QVector<QPointF> dataToImpulseLines(const QVector<
QCPGraphData> &data) const;
5237 QVector<
QCPDataRange> getNonNanSegments(const QVector<QPointF> *lineData, Qt::Orientation keyOrientation) const;
5239 bool segmentsIntersect(
double aLower,
double aUpper,
double bLower,
double bUpper,
int &bPrecedence) const;
5240 QPointF getFillBasePoint(QPointF matchingDataPoint) const;
5241 const QPolygonF getFillPolygon(const QVector<QPointF> *lineData,
QCPDataRange segment) const;
5242 const QPolygonF getChannelFillPolygon(const QVector<QPointF> *lineData,
QCPDataRange thisSegment, const QVector<QPointF> *otherData,
QCPDataRange otherSegment) const;
5243 int findIndexBelowX(const QVector<QPointF> *data,
double x) const;
5244 int findIndexAboveX(const QVector<QPointF> *data,
double x) const;
5245 int findIndexBelowY(const QVector<QPointF> *data,
double y) const;
5246 int findIndexAboveY(const QVector<QPointF> *data,
double y) const;
5247 double pointDistance(const QPointF &pixelPoint,
QCPGraphDataContainer::const_iterator &closestData) const;
5252Q_DECLARE_METATYPE(
QCPGraph::LineStyle)
5275 double t, key, value;
5296 Q_PROPERTY(
QCPScatterStyle scatterStyle READ scatterStyle WRITE setScatterStyle)
5297 Q_PROPERTY(
int scatterSkip READ scatterSkip WRITE setScatterSkip)
5298 Q_PROPERTY(
LineStyle lineStyle READ lineStyle WRITE setLineStyle)
5315 QSharedPointer<QCPCurveDataContainer>
data()
const {
return mDataContainer; }
5317 int scatterSkip()
const {
return mScatterSkip; }
5318 LineStyle lineStyle()
const {
return mLineStyle; }
5321 void setData(QSharedPointer<QCPCurveDataContainer> data);
5322 void setData(
const QVector<double> &t,
const QVector<double> &keys,
const QVector<double> &values,
bool alreadySorted=
false);
5323 void setData(
const QVector<double> &keys,
const QVector<double> &values);
5325 void setScatterSkip(
int skip);
5326 void setLineStyle(LineStyle style);
5329 void addData(
const QVector<double> &t,
const QVector<double> &keys,
const QVector<double> &values,
bool alreadySorted=
false);
5330 void addData(
const QVector<double> &keys,
const QVector<double> &values);
5331 void addData(
double t,
double key,
double value);
5332 void addData(
double key,
double value);
5335 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0) const Q_DECL_OVERRIDE;
5336 virtual
QCPRange getKeyRange(
bool &foundRange,
QCP::SignDomain inSignDomain=
QCP::sdBoth) const Q_DECL_OVERRIDE;
5337 virtual
QCPRange getValueRange(
bool &foundRange,
QCP::SignDomain inSignDomain=
QCP::sdBoth, const
QCPRange &inKeyRange=
QCPRange()) const Q_DECL_OVERRIDE;
5343 LineStyle mLineStyle;
5346 virtual
void draw(
QCPPainter *painter) Q_DECL_OVERRIDE;
5347 virtual
void drawLegendIcon(
QCPPainter *painter, const QRectF &rect) const Q_DECL_OVERRIDE;
5350 virtual
void drawCurveLine(
QCPPainter *painter, const QVector<QPointF> &lines) const;
5354 void getCurveLines(QVector<QPointF> *lines, const
QCPDataRange &dataRange,
double penWidth) const;
5355 void getScatters(QVector<QPointF> *scatters, const
QCPDataRange &dataRange,
double scatterWidth) const;
5356 int getRegion(
double key,
double value,
double keyMin,
double valueMax,
double keyMax,
double valueMin) const;
5357 QPointF getOptimizedPoint(
int prevRegion,
double prevKey,
double prevValue,
double key,
double value,
double keyMin,
double valueMax,
double keyMax,
double valueMin) const;
5358 QVector<QPointF> getOptimizedCornerPoints(
int prevRegion,
int currentRegion,
double prevKey,
double prevValue,
double key,
double value,
double keyMin,
double valueMax,
double keyMax,
double valueMin) const;
5359 bool mayTraverse(
int prevRegion,
int currentRegion) const;
5360 bool getTraverse(
double prevKey,
double prevValue,
double key,
double value,
double keyMin,
double valueMax,
double keyMax,
double valueMin, QPointF &crossA, QPointF &crossB) const;
5361 void getTraverseCornerPoints(
int prevRegion,
int currentRegion,
double keyMin,
double valueMax,
double keyMax,
double valueMin, QVector<QPointF> &beforeTraverse, QVector<QPointF> &afterTraverse) const;
5362 double pointDistance(const QPointF &pixelPoint,
QCPCurveDataContainer::const_iterator &closestData) const;
5367Q_DECLARE_METATYPE(
QCPCurve::LineStyle)
5379 Q_PROPERTY(
SpacingType spacingType READ spacingType WRITE setSpacingType)
5380 Q_PROPERTY(
double spacing READ spacing WRITE setSpacing)
5393 Q_ENUMS(SpacingType)
5399 SpacingType spacingType()
const {
return mSpacingType; }
5400 double spacing()
const {
return mSpacing; }
5403 void setSpacingType(SpacingType spacingType);
5404 void setSpacing(
double spacing);
5407 QList<QCPBars*>
bars()
const {
return mBars; }
5408 QCPBars* bars(
int index)
const;
5409 int size()
const {
return mBars.size(); }
5414 void insert(
int i,
QCPBars *bars);
5420 SpacingType mSpacingType;
5422 QList<QCPBars*> mBars;
5425 void registerBars(
QCPBars *bars);
5426 void unregisterBars(
QCPBars *bars);
5429 double keyPixelOffset(
const QCPBars *bars,
double keyCoord);
5430 double getPixelSpacing(
const QCPBars *bars,
double keyCoord);
5475 Q_PROPERTY(
double width READ width WRITE setWidth)
5476 Q_PROPERTY(
WidthType widthType READ widthType WRITE setWidthType)
5477 Q_PROPERTY(
QCPBarsGroup* barsGroup READ barsGroup WRITE setBarsGroup)
5478 Q_PROPERTY(
double baseValue READ baseValue WRITE setBaseValue)
5479 Q_PROPERTY(
double stackingGap READ stackingGap WRITE setStackingGap)
5480 Q_PROPERTY(
QCPBars* barBelow READ barBelow)
5481 Q_PROPERTY(
QCPBars* barAbove READ barAbove)
5500 double width()
const {
return mWidth; }
5501 WidthType widthType()
const {
return mWidthType; }
5503 double baseValue()
const {
return mBaseValue; }
5504 double stackingGap()
const {
return mStackingGap; }
5507 QSharedPointer<QCPBarsDataContainer>
data()
const {
return mDataContainer; }
5510 void setData(QSharedPointer<QCPBarsDataContainer> data);
5511 void setData(
const QVector<double> &keys,
const QVector<double> &values,
bool alreadySorted=
false);
5512 void setWidth(
double width);
5513 void setWidthType(WidthType widthType);
5515 void setBaseValue(
double baseValue);
5516 void setStackingGap(
double pixels);
5519 void addData(
const QVector<double> &keys,
const QVector<double> &values,
bool alreadySorted=
false);
5520 void addData(
double key,
double value);
5521 void moveBelow(
QCPBars *bars);
5522 void moveAbove(
QCPBars *bars);
5525 virtual QCPDataSelection selectTestRect(
const QRectF &rect,
bool onlySelectable)
const Q_DECL_OVERRIDE;
5526 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0) const Q_DECL_OVERRIDE;
5527 virtual
QCPRange getKeyRange(
bool &foundRange,
QCP::SignDomain inSignDomain=
QCP::sdBoth) const Q_DECL_OVERRIDE;
5528 virtual
QCPRange getValueRange(
bool &foundRange,
QCP::SignDomain inSignDomain=
QCP::sdBoth, const
QCPRange &inKeyRange=
QCPRange()) const Q_DECL_OVERRIDE;
5529 virtual QPointF dataPixelPosition(
int index) const Q_DECL_OVERRIDE;
5534 WidthType mWidthType;
5537 double mStackingGap;
5538 QPointer<
QCPBars> mBarBelow, mBarAbove;
5541 virtual
void draw(
QCPPainter *painter) Q_DECL_OVERRIDE;
5542 virtual
void drawLegendIcon(
QCPPainter *painter, const QRectF &rect) const Q_DECL_OVERRIDE;
5546 QRectF getBarRect(
double key,
double value) const;
5547 void getPixelWidth(
double key,
double &lower,
double &upper) const;
5548 double getStackedBaseValue(
double key,
bool positive) const;
5555Q_DECLARE_METATYPE(
QCPBars::WidthType)
5567 QCPStatisticalBoxData(
double key,
double minimum,
double lowerQuartile,
double median,
double upperQuartile,
double maximum,
const QVector<double>& outliers=QVector<double>());
5579 for (QVector<double>::const_iterator it = outliers.constBegin(); it != outliers.constEnd(); ++it)
5584 double key, minimum, lowerQuartile, median, upperQuartile, maximum;
5585 QVector<double> outliers;
5606 Q_PROPERTY(
double width READ width WRITE setWidth)
5607 Q_PROPERTY(
double whiskerWidth READ whiskerWidth WRITE setWhiskerWidth)
5608 Q_PROPERTY(QPen whiskerPen READ whiskerPen WRITE setWhiskerPen)
5609 Q_PROPERTY(QPen whiskerBarPen READ whiskerBarPen WRITE setWhiskerBarPen)
5610 Q_PROPERTY(
bool whiskerAntialiased READ whiskerAntialiased WRITE setWhiskerAntialiased)
5611 Q_PROPERTY(QPen medianPen READ medianPen WRITE setMedianPen)
5612 Q_PROPERTY(
QCPScatterStyle outlierStyle READ outlierStyle WRITE setOutlierStyle)
5618 QSharedPointer<QCPStatisticalBoxDataContainer>
data()
const {
return mDataContainer; }
5619 double width()
const {
return mWidth; }
5620 double whiskerWidth()
const {
return mWhiskerWidth; }
5621 QPen whiskerPen()
const {
return mWhiskerPen; }
5622 QPen whiskerBarPen()
const {
return mWhiskerBarPen; }
5623 bool whiskerAntialiased()
const {
return mWhiskerAntialiased; }
5624 QPen medianPen()
const {
return mMedianPen; }
5628 void setData(QSharedPointer<QCPStatisticalBoxDataContainer> data);
5629 void setData(
const QVector<double> &keys,
const QVector<double> &minimum,
const QVector<double> &lowerQuartile,
const QVector<double> &median,
const QVector<double> &upperQuartile,
const QVector<double> &maximum,
bool alreadySorted=
false);
5630 void setWidth(
double width);
5631 void setWhiskerWidth(
double width);
5632 void setWhiskerPen(
const QPen &pen);
5633 void setWhiskerBarPen(
const QPen &pen);
5634 void setWhiskerAntialiased(
bool enabled);
5635 void setMedianPen(
const QPen &pen);
5639 void addData(
const QVector<double> &keys,
const QVector<double> &minimum,
const QVector<double> &lowerQuartile,
const QVector<double> &median,
const QVector<double> &upperQuartile,
const QVector<double> &maximum,
bool alreadySorted=
false);
5640 void addData(
double key,
double minimum,
double lowerQuartile,
double median,
double upperQuartile,
double maximum,
const QVector<double> &outliers=QVector<double>());
5643 virtual QCPDataSelection selectTestRect(
const QRectF &rect,
bool onlySelectable)
const Q_DECL_OVERRIDE;
5644 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0) const Q_DECL_OVERRIDE;
5645 virtual
QCPRange getKeyRange(
bool &foundRange,
QCP::SignDomain inSignDomain=
QCP::sdBoth) const Q_DECL_OVERRIDE;
5646 virtual
QCPRange getValueRange(
bool &foundRange,
QCP::SignDomain inSignDomain=
QCP::sdBoth, const
QCPRange &inKeyRange=
QCPRange()) const Q_DECL_OVERRIDE;
5651 double mWhiskerWidth;
5652 QPen mWhiskerPen, mWhiskerBarPen;
5653 bool mWhiskerAntialiased;
5658 virtual
void draw(
QCPPainter *painter) Q_DECL_OVERRIDE;
5659 virtual
void drawLegendIcon(
QCPPainter *painter, const QRectF &rect) const Q_DECL_OVERRIDE;
5689 int keySize()
const {
return mKeySize; }
5690 int valueSize()
const {
return mValueSize; }
5691 QCPRange keyRange()
const {
return mKeyRange; }
5692 QCPRange valueRange()
const {
return mValueRange; }
5693 QCPRange dataBounds()
const {
return mDataBounds; }
5694 double data(
double key,
double value);
5695 double cell(
int keyIndex,
int valueIndex);
5696 unsigned char alpha(
int keyIndex,
int valueIndex);
5699 void setSize(
int keySize,
int valueSize);
5700 void setKeySize(
int keySize);
5701 void setValueSize(
int valueSize);
5703 void setKeyRange(
const QCPRange &keyRange);
5704 void setValueRange(
const QCPRange &valueRange);
5705 void setData(
double key,
double value,
double z);
5706 void setCell(
int keyIndex,
int valueIndex,
double z);
5707 void setAlpha(
int keyIndex,
int valueIndex,
unsigned char alpha);
5710 void recalculateDataBounds();
5713 void fill(
double z);
5714 void fillAlpha(
unsigned char alpha);
5716 void coordToCell(
double key,
double value,
int *keyIndex,
int *valueIndex)
const;
5717 void cellToCoord(
int keyIndex,
int valueIndex,
double *key,
double *value)
const;
5721 int mKeySize, mValueSize;
5727 unsigned char *mAlpha;
5731 bool createAlpha(
bool initializeOpaque=
true);
5741 Q_PROPERTY(
QCPRange dataRange READ dataRange WRITE setDataRange NOTIFY dataRangeChanged)
5742 Q_PROPERTY(
QCPAxis::ScaleType dataScaleType READ dataScaleType WRITE setDataScaleType NOTIFY dataScaleTypeChanged)
5743 Q_PROPERTY(
QCPColorGradient gradient READ gradient WRITE setGradient NOTIFY gradientChanged)
5744 Q_PROPERTY(
bool interpolate READ interpolate WRITE setInterpolate)
5745 Q_PROPERTY(
bool tightBoundary READ tightBoundary WRITE setTightBoundary)
5746 Q_PROPERTY(
QCPColorScale* colorScale READ colorScale WRITE setColorScale)
5754 QCPRange dataRange()
const {
return mDataRange; }
5756 bool interpolate()
const {
return mInterpolate; }
5757 bool tightBoundary()
const {
return mTightBoundary; }
5759 QCPColorScale *colorScale()
const {
return mColorScale.data(); }
5763 Q_SLOT
void setDataRange(
const QCPRange &dataRange);
5766 void setInterpolate(
bool enabled);
5767 void setTightBoundary(
bool enabled);
5771 void rescaleDataRange(
bool recalculateDataBounds=
false);
5772 Q_SLOT
void updateLegendIcon(Qt::TransformationMode transformMode=Qt::SmoothTransformation,
const QSize &thumbSize=QSize(32, 18));
5775 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0) const Q_DECL_OVERRIDE;
5776 virtual
QCPRange getKeyRange(
bool &foundRange,
QCP::SignDomain inSignDomain=
QCP::sdBoth) const Q_DECL_OVERRIDE;
5777 virtual
QCPRange getValueRange(
bool &foundRange,
QCP::SignDomain inSignDomain=
QCP::sdBoth, const
QCPRange &inKeyRange=
QCPRange()) const Q_DECL_OVERRIDE;
5781 void dataScaleTypeChanged(
QCPAxis::ScaleType scaleType);
5787 QCPAxis::ScaleType mDataScaleType;
5791 bool mTightBoundary;
5795 QImage mMapImage, mUndersampledMapImage;
5796 QPixmap mLegendIcon;
5797 bool mMapImageInvalidated;
5800 virtual
void updateMapImage();
5803 virtual
void draw(
QCPPainter *painter) Q_DECL_OVERRIDE;
5804 virtual
void drawLegendIcon(
QCPPainter *painter, const QRectF &rect) const Q_DECL_OVERRIDE;
5820 QCPFinancialData(
double key,
double open,
double high,
double low,
double close);
5831 double key, open, high, low, close;
5851 Q_PROPERTY(
ChartStyle chartStyle READ chartStyle WRITE setChartStyle)
5852 Q_PROPERTY(
double width READ width WRITE setWidth)
5853 Q_PROPERTY(
WidthType widthType READ widthType WRITE setWidthType)
5854 Q_PROPERTY(
bool twoColored READ twoColored WRITE setTwoColored)
5855 Q_PROPERTY(QBrush brushPositive READ brushPositive WRITE setBrushPositive)
5856 Q_PROPERTY(QBrush brushNegative READ brushNegative WRITE setBrushNegative)
5857 Q_PROPERTY(QPen penPositive READ penPositive WRITE setPenPositive)
5858 Q_PROPERTY(QPen penNegative READ penNegative WRITE setPenNegative)
5887 QSharedPointer<QCPFinancialDataContainer>
data()
const {
return mDataContainer; }
5888 ChartStyle chartStyle()
const {
return mChartStyle; }
5889 double width()
const {
return mWidth; }
5890 WidthType widthType()
const {
return mWidthType; }
5891 bool twoColored()
const {
return mTwoColored; }
5892 QBrush brushPositive()
const {
return mBrushPositive; }
5893 QBrush brushNegative()
const {
return mBrushNegative; }
5894 QPen penPositive()
const {
return mPenPositive; }
5895 QPen penNegative()
const {
return mPenNegative; }
5898 void setData(QSharedPointer<QCPFinancialDataContainer> data);
5899 void setData(
const QVector<double> &keys,
const QVector<double> &open,
const QVector<double> &high,
const QVector<double> &low,
const QVector<double> &close,
bool alreadySorted=
false);
5900 void setChartStyle(ChartStyle style);
5901 void setWidth(
double width);
5902 void setWidthType(WidthType widthType);
5903 void setTwoColored(
bool twoColored);
5904 void setBrushPositive(
const QBrush &brush);
5905 void setBrushNegative(
const QBrush &brush);
5906 void setPenPositive(
const QPen &pen);
5907 void setPenNegative(
const QPen &pen);
5910 void addData(
const QVector<double> &keys,
const QVector<double> &open,
const QVector<double> &high,
const QVector<double> &low,
const QVector<double> &close,
bool alreadySorted=
false);
5911 void addData(
double key,
double open,
double high,
double low,
double close);
5914 virtual QCPDataSelection selectTestRect(
const QRectF &rect,
bool onlySelectable)
const Q_DECL_OVERRIDE;
5915 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0) const Q_DECL_OVERRIDE;
5916 virtual
QCPRange getKeyRange(
bool &foundRange,
QCP::SignDomain inSignDomain=
QCP::sdBoth) const Q_DECL_OVERRIDE;
5917 virtual
QCPRange getValueRange(
bool &foundRange,
QCP::SignDomain inSignDomain=
QCP::sdBoth, const
QCPRange &inKeyRange=
QCPRange()) const Q_DECL_OVERRIDE;
5920 static
QCPFinancialDataContainer timeSeriesToOhlc(const QVector<
double> &time, const QVector<
double> &value,
double timeBinSize,
double timeBinOffset = 0);
5924 ChartStyle mChartStyle;
5926 WidthType mWidthType;
5928 QBrush mBrushPositive, mBrushNegative;
5929 QPen mPenPositive, mPenNegative;
5932 virtual
void draw(
QCPPainter *painter) Q_DECL_OVERRIDE;
5933 virtual
void drawLegendIcon(
QCPPainter *painter, const QRectF &rect) const Q_DECL_OVERRIDE;
5938 double getPixelWidth(
double key,
double keyPixel) const;
5962 double errorMinus, errorPlus;
5982typedef QVector<QCPErrorBarsData> QCPErrorBarsDataContainer;
5988 Q_PROPERTY(QSharedPointer<QCPErrorBarsDataContainer> data READ data WRITE setData)
5990 Q_PROPERTY(
ErrorType errorType READ errorType WRITE setErrorType)
5991 Q_PROPERTY(
double whiskerWidth READ whiskerWidth WRITE setWhiskerWidth)
5992 Q_PROPERTY(
double symbolGap READ symbolGap WRITE setSymbolGap)
6010 QSharedPointer<QCPErrorBarsDataContainer>
data()
const {
return mDataContainer; }
6012 ErrorType errorType()
const {
return mErrorType; }
6013 double whiskerWidth()
const {
return mWhiskerWidth; }
6014 double symbolGap()
const {
return mSymbolGap; }
6017 void setData(QSharedPointer<QCPErrorBarsDataContainer> data);
6018 void setData(
const QVector<double> &error);
6019 void setData(
const QVector<double> &errorMinus,
const QVector<double> &errorPlus);
6021 void setErrorType(ErrorType type);
6022 void setWhiskerWidth(
double pixels);
6023 void setSymbolGap(
double pixels);
6026 void addData(
const QVector<double> &error);
6027 void addData(
const QVector<double> &errorMinus,
const QVector<double> &errorPlus);
6028 void addData(
double error);
6029 void addData(
double errorMinus,
double errorPlus);
6032 virtual int dataCount() const Q_DECL_OVERRIDE;
6033 virtual
double dataMainKey(
int index) const Q_DECL_OVERRIDE;
6034 virtual
double dataSortKey(
int index) const Q_DECL_OVERRIDE;
6035 virtual
double dataMainValue(
int index) const Q_DECL_OVERRIDE;
6036 virtual
QCPRange dataValueRange(
int index) const Q_DECL_OVERRIDE;
6037 virtual QPointF dataPixelPosition(
int index) const Q_DECL_OVERRIDE;
6038 virtual
bool sortKeyIsMainKey() const Q_DECL_OVERRIDE;
6039 virtual
QCPDataSelection selectTestRect(const QRectF &rect,
bool onlySelectable) const Q_DECL_OVERRIDE;
6040 virtual
int findBegin(
double sortKey,
bool expandedRange=true) const Q_DECL_OVERRIDE;
6041 virtual
int findEnd(
double sortKey,
bool expandedRange=true) const Q_DECL_OVERRIDE;
6044 virtual
double selectTest(const QPointF &pos,
bool onlySelectable, QVariant *details=0) const Q_DECL_OVERRIDE;
6049 QSharedPointer<QCPErrorBarsDataContainer> mDataContainer;
6050 QPointer<QCPAbstractPlottable> mDataPlottable;
6051 ErrorType mErrorType;
6052 double mWhiskerWidth;
6056 virtual void draw(
QCPPainter *painter) Q_DECL_OVERRIDE;
6057 virtual void drawLegendIcon(
QCPPainter *painter,
const QRectF &rect)
const Q_DECL_OVERRIDE;
6062 void getErrorBarLines(QCPErrorBarsDataContainer::const_iterator it, QVector<QLineF> &backbones, QVector<QLineF> &whiskers) const;
6063 void getVisibleDataBounds(QCPErrorBarsDataContainer::const_iterator &begin, QCPErrorBarsDataContainer::const_iterator &end, const
QCPDataRange &rangeRestriction) const;
6064 double pointDistance(const QPointF &pixelPoint, QCPErrorBarsDataContainer::const_iterator &closestData) const;
6067 bool errorBarVisible(
int index) const;
6068 bool rectIntersectsLine(const QRectF &pixelRect, const QLineF &line) const;
6084 Q_PROPERTY(QPen pen READ pen WRITE setPen)
6085 Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
6092 QPen pen()
const {
return mPen; }
6093 QPen selectedPen()
const {
return mSelectedPen; }
6096 void setPen(
const QPen &pen);
6097 void setSelectedPen(
const QPen &pen);
6100 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0)
const Q_DECL_OVERRIDE;
6107 QPen mPen, mSelectedPen;
6110 virtual void draw(
QCPPainter *painter) Q_DECL_OVERRIDE;
6113 QLineF getRectClippedStraightLine(
const QCPVector2D &point1,
const QCPVector2D &vec,
const QRect &rect)
const;
6114 QPen mainPen()
const;
6127 Q_PROPERTY(QPen pen READ pen WRITE setPen)
6128 Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
6137 QPen pen()
const {
return mPen; }
6138 QPen selectedPen()
const {
return mSelectedPen; }
6143 void setPen(
const QPen &pen);
6144 void setSelectedPen(
const QPen &pen);
6149 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0)
const Q_DECL_OVERRIDE;
6156 QPen mPen, mSelectedPen;
6160 virtual void draw(
QCPPainter *painter) Q_DECL_OVERRIDE;
6164 QPen mainPen()
const;
6177 Q_PROPERTY(QPen pen READ pen WRITE setPen)
6178 Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
6187 QPen pen()
const {
return mPen; }
6188 QPen selectedPen()
const {
return mSelectedPen; }
6193 void setPen(
const QPen &pen);
6194 void setSelectedPen(
const QPen &pen);
6199 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0)
const Q_DECL_OVERRIDE;
6208 QPen mPen, mSelectedPen;
6212 virtual void draw(
QCPPainter *painter) Q_DECL_OVERRIDE;
6215 QPen mainPen()
const;
6228 Q_PROPERTY(QPen pen READ pen WRITE setPen)
6229 Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
6230 Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
6231 Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
6238 QPen pen()
const {
return mPen; }
6239 QPen selectedPen()
const {
return mSelectedPen; }
6240 QBrush brush()
const {
return mBrush; }
6241 QBrush selectedBrush()
const {
return mSelectedBrush; }
6244 void setPen(
const QPen &pen);
6245 void setSelectedPen(
const QPen &pen);
6246 void setBrush(
const QBrush &brush);
6247 void setSelectedBrush(
const QBrush &brush);
6250 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0)
const Q_DECL_OVERRIDE;
6262 enum AnchorIndex {aiTop, aiTopRight, aiRight, aiBottom, aiBottomLeft, aiLeft};
6265 QPen mPen, mSelectedPen;
6266 QBrush mBrush, mSelectedBrush;
6269 virtual void draw(
QCPPainter *painter) Q_DECL_OVERRIDE;
6270 virtual QPointF anchorPixelPosition(
int anchorId)
const Q_DECL_OVERRIDE;
6273 QPen mainPen()
const;
6274 QBrush mainBrush()
const;
6287 Q_PROPERTY(QColor color READ color WRITE setColor)
6288 Q_PROPERTY(QColor selectedColor READ selectedColor WRITE setSelectedColor)
6289 Q_PROPERTY(QPen pen READ pen WRITE setPen)
6290 Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
6291 Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
6292 Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
6293 Q_PROPERTY(QFont font READ font WRITE setFont)
6294 Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont)
6295 Q_PROPERTY(QString text READ text WRITE setText)
6296 Q_PROPERTY(Qt::Alignment positionAlignment READ positionAlignment WRITE setPositionAlignment)
6297 Q_PROPERTY(Qt::Alignment textAlignment READ textAlignment WRITE setTextAlignment)
6298 Q_PROPERTY(
double rotation READ rotation WRITE setRotation)
6299 Q_PROPERTY(QMargins padding READ padding WRITE setPadding)
6306 QColor color()
const {
return mColor; }
6307 QColor selectedColor()
const {
return mSelectedColor; }
6308 QPen pen()
const {
return mPen; }
6309 QPen selectedPen()
const {
return mSelectedPen; }
6310 QBrush brush()
const {
return mBrush; }
6311 QBrush selectedBrush()
const {
return mSelectedBrush; }
6312 QFont font()
const {
return mFont; }
6313 QFont selectedFont()
const {
return mSelectedFont; }
6314 QString text()
const {
return mText; }
6315 Qt::Alignment positionAlignment()
const {
return mPositionAlignment; }
6316 Qt::Alignment textAlignment()
const {
return mTextAlignment; }
6317 double rotation()
const {
return mRotation; }
6318 QMargins padding()
const {
return mPadding; }
6321 void setColor(
const QColor &color);
6322 void setSelectedColor(
const QColor &color);
6323 void setPen(
const QPen &pen);
6324 void setSelectedPen(
const QPen &pen);
6325 void setBrush(
const QBrush &brush);
6326 void setSelectedBrush(
const QBrush &brush);
6327 void setFont(
const QFont &font);
6328 void setSelectedFont(
const QFont &font);
6329 void setText(
const QString &text);
6330 void setPositionAlignment(Qt::Alignment alignment);
6331 void setTextAlignment(Qt::Alignment alignment);
6332 void setRotation(
double degrees);
6333 void setPadding(
const QMargins &padding);
6336 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0)
const Q_DECL_OVERRIDE;
6349 enum AnchorIndex {aiTopLeft, aiTop, aiTopRight, aiRight, aiBottomRight, aiBottom, aiBottomLeft, aiLeft};
6352 QColor mColor, mSelectedColor;
6353 QPen mPen, mSelectedPen;
6354 QBrush mBrush, mSelectedBrush;
6355 QFont mFont, mSelectedFont;
6357 Qt::Alignment mPositionAlignment;
6358 Qt::Alignment mTextAlignment;
6363 virtual void draw(
QCPPainter *painter) Q_DECL_OVERRIDE;
6364 virtual QPointF anchorPixelPosition(
int anchorId)
const Q_DECL_OVERRIDE;
6367 QPointF getTextDrawPoint(
const QPointF &pos,
const QRectF &rect, Qt::Alignment positionAlignment)
const;
6368 QFont mainFont()
const;
6369 QColor mainColor()
const;
6370 QPen mainPen()
const;
6371 QBrush mainBrush()
const;
6384 Q_PROPERTY(QPen pen READ pen WRITE setPen)
6385 Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
6386 Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
6387 Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
6394 QPen pen()
const {
return mPen; }
6395 QPen selectedPen()
const {
return mSelectedPen; }
6396 QBrush brush()
const {
return mBrush; }
6397 QBrush selectedBrush()
const {
return mSelectedBrush; }
6400 void setPen(
const QPen &pen);
6401 void setSelectedPen(
const QPen &pen);
6402 void setBrush(
const QBrush &brush);
6403 void setSelectedBrush(
const QBrush &brush);
6406 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0)
const Q_DECL_OVERRIDE;
6421 enum AnchorIndex {aiTopLeftRim, aiTop, aiTopRightRim, aiRight, aiBottomRightRim, aiBottom, aiBottomLeftRim, aiLeft, aiCenter};
6424 QPen mPen, mSelectedPen;
6425 QBrush mBrush, mSelectedBrush;
6428 virtual void draw(
QCPPainter *painter) Q_DECL_OVERRIDE;
6429 virtual QPointF anchorPixelPosition(
int anchorId)
const Q_DECL_OVERRIDE;
6432 QPen mainPen()
const;
6433 QBrush mainBrush()
const;
6446 Q_PROPERTY(QPixmap pixmap READ pixmap WRITE setPixmap)
6447 Q_PROPERTY(
bool scaled READ scaled WRITE setScaled)
6448 Q_PROPERTY(Qt::AspectRatioMode aspectRatioMode READ aspectRatioMode)
6449 Q_PROPERTY(Qt::TransformationMode transformationMode READ transformationMode)
6450 Q_PROPERTY(QPen pen READ pen WRITE setPen)
6451 Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
6458 QPixmap pixmap()
const {
return mPixmap; }
6459 bool scaled()
const {
return mScaled; }
6460 Qt::AspectRatioMode aspectRatioMode()
const {
return mAspectRatioMode; }
6461 Qt::TransformationMode transformationMode()
const {
return mTransformationMode; }
6462 QPen pen()
const {
return mPen; }
6463 QPen selectedPen()
const {
return mSelectedPen; }
6466 void setPixmap(
const QPixmap &pixmap);
6467 void setScaled(
bool scaled, Qt::AspectRatioMode aspectRatioMode=Qt::KeepAspectRatio, Qt::TransformationMode transformationMode=Qt::SmoothTransformation);
6468 void setPen(
const QPen &pen);
6469 void setSelectedPen(
const QPen &pen);
6472 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0)
const Q_DECL_OVERRIDE;
6484 enum AnchorIndex {aiTop, aiTopRight, aiRight, aiBottom, aiBottomLeft, aiLeft};
6488 QPixmap mScaledPixmap;
6490 bool mScaledPixmapInvalidated;
6491 Qt::AspectRatioMode mAspectRatioMode;
6492 Qt::TransformationMode mTransformationMode;
6493 QPen mPen, mSelectedPen;
6496 virtual void draw(
QCPPainter *painter) Q_DECL_OVERRIDE;
6497 virtual QPointF anchorPixelPosition(
int anchorId)
const Q_DECL_OVERRIDE;
6500 void updateScaledPixmap(QRect finalRect=QRect(),
bool flipHorz=
false,
bool flipVert=
false);
6501 QRect getFinalRect(
bool *flippedHorz=0,
bool *flippedVert=0)
const;
6502 QPen mainPen()
const;
6515 Q_PROPERTY(QPen pen READ pen WRITE setPen)
6516 Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
6517 Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
6518 Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
6519 Q_PROPERTY(
double size READ size WRITE setSize)
6520 Q_PROPERTY(
TracerStyle style READ style WRITE setStyle)
6521 Q_PROPERTY(
QCPGraph* graph READ graph WRITE setGraph)
6522 Q_PROPERTY(
double graphKey READ graphKey WRITE setGraphKey)
6523 Q_PROPERTY(
bool interpolating READ interpolating WRITE setInterpolating)
6537 Q_ENUMS(TracerStyle)
6543 QPen pen()
const {
return mPen; }
6544 QPen selectedPen()
const {
return mSelectedPen; }
6545 QBrush brush()
const {
return mBrush; }
6546 QBrush selectedBrush()
const {
return mSelectedBrush; }
6547 double size()
const {
return mSize; }
6548 TracerStyle style()
const {
return mStyle; }
6549 QCPGraph *graph()
const {
return mGraph; }
6550 double graphKey()
const {
return mGraphKey; }
6551 bool interpolating()
const {
return mInterpolating; }
6554 void setPen(
const QPen &pen);
6555 void setSelectedPen(
const QPen &pen);
6556 void setBrush(
const QBrush &brush);
6557 void setSelectedBrush(
const QBrush &brush);
6558 void setSize(
double size);
6559 void setStyle(TracerStyle style);
6561 void setGraphKey(
double key);
6562 void setInterpolating(
bool enabled);
6565 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0) const Q_DECL_OVERRIDE;
6568 void updatePosition();
6574 QPen mPen, mSelectedPen;
6575 QBrush mBrush, mSelectedBrush;
6580 bool mInterpolating;
6583 virtual
void draw(
QCPPainter *painter) Q_DECL_OVERRIDE;
6586 QPen mainPen() const;
6587 QBrush mainBrush() const;
6601 Q_PROPERTY(QPen pen READ pen WRITE setPen)
6602 Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
6603 Q_PROPERTY(
double length READ length WRITE setLength)
6604 Q_PROPERTY(
BracketStyle style READ style WRITE setStyle)
6618 Q_ENUMS(BracketStyle)
6624 QPen pen()
const {
return mPen; }
6625 QPen selectedPen()
const {
return mSelectedPen; }
6626 double length()
const {
return mLength; }
6627 BracketStyle style()
const {
return mStyle; }
6630 void setPen(
const QPen &pen);
6631 void setSelectedPen(
const QPen &pen);
6632 void setLength(
double length);
6633 void setStyle(BracketStyle style);
6636 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0) const Q_DECL_OVERRIDE;
6644 enum AnchorIndex {aiCenter};
6645 QPen mPen, mSelectedPen;
6647 BracketStyle mStyle;
6650 virtual void draw(
QCPPainter *painter) Q_DECL_OVERRIDE;
6651 virtual QPointF anchorPixelPosition(
int anchorId)
const Q_DECL_OVERRIDE;
6654 QPen mainPen()
const;
The abstract base class for all items in a plot.
Definition: qcustomplot.h:3506
QList< QCPItemAnchor * > anchors() const
Returns all anchors of the item in a list.
Definition: qcustomplot.h:3535
void selectionChanged(bool selected)
This signal is emitted when the selection state of this item has changed, either by user interaction ...
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const Q_DECL_OVERRIDE=0
This function is used to decide whether a click hits a layerable object or not.
The abstract base class for all entries in a QCPLegend.
Definition: qcustomplot.h:4709
void selectionChanged(bool selected)
This signal is emitted when the selection state of this legend item has changed, either by user inter...
The abstract base class for paint buffers, which define the rendering backend.
Definition: qcustomplot.h:516
virtual void donePainting()
If you have acquired a QCPPainter to paint onto this paint buffer via startPainting,...
Definition: qcustomplot.h:533
virtual void clear(const QColor &color)=0
Fills the entire buffer with the provided color.
virtual QCPPainter * startPainting()=0
Returns a QCPPainter which is ready to draw to this buffer.
virtual void reallocateBuffer()=0
Reallocates the internal buffer with the currently configured size (setSize) and device pixel ratio,...
virtual void draw(QCPPainter *painter) const =0
Draws the contents of this buffer with the provided painter.
A template base class for plottables with one-dimensional data.
Definition: qcustomplot.h:3869
virtual QCPDataSelection selectTestRect(const QRectF &rect, bool onlySelectable) const Q_DECL_OVERRIDE
Implements a rect-selection algorithm assuming the data (accessed via the 1D data interface) is point...
Definition: qcustomplot.h:4214
QCPAbstractPlottable1D(QCPAxis *keyAxis, QCPAxis *valueAxis)
Forwards keyAxis and valueAxis to the QCPAbstractPlottable constructor and allocates the mDataContain...
Definition: qcustomplot.h:4096
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const Q_DECL_OVERRIDE
Implements a point-selection algorithm assuming the data (accessed via the 1D data interface) is poin...
Definition: qcustomplot.h:4285
virtual QCPRange dataValueRange(int index) const Q_DECL_OVERRIDE
Returns the value range of the data point at the given index.
Definition: qcustomplot.h:4168
virtual double dataMainValue(int index) const Q_DECL_OVERRIDE
Returns the main value of the data point at the given index.
Definition: qcustomplot.h:4152
virtual QPointF dataPixelPosition(int index) const Q_DECL_OVERRIDE
Returns the pixel position on the widget surface at which the data point at the given index appears.
Definition: qcustomplot.h:4184
virtual int findEnd(double sortKey, bool expandedRange=true) const Q_DECL_OVERRIDE
Returns the index one after the data point with a (sort-)key that is equal to, just above,...
Definition: qcustomplot.h:4272
void drawPolyline(QCPPainter *painter, const QVector< QPointF > &lineData) const
A helper method which draws a line with the passed painter, according to the pixel data in lineData.
Definition: qcustomplot.h:4377
virtual double dataSortKey(int index) const Q_DECL_OVERRIDE
Returns the sort key of the data point at the given index.
Definition: qcustomplot.h:4136
virtual int dataCount() const Q_DECL_OVERRIDE
Returns the number of data points of the plottable.
Definition: qcustomplot.h:4111
virtual QCPPlottableInterface1D * interface1D() Q_DECL_OVERRIDE
Returns a QCPPlottableInterface1D pointer to this plottable, providing access to its 1D interface.
Definition: qcustomplot.h:3890
virtual int findBegin(double sortKey, bool expandedRange=true) const Q_DECL_OVERRIDE
Returns the index of the data point with a (sort-)key that is equal to, just below,...
Definition: qcustomplot.h:4263
void getDataSegments(QList< QCPDataRange > &selectedSegments, QList< QCPDataRange > &unselectedSegments) const
Splits all data into selected and unselected segments and outputs them via selectedSegments and unsel...
Definition: qcustomplot.h:4347
virtual double dataMainKey(int index) const Q_DECL_OVERRIDE
Returns the main key of the data point at the given index.
Definition: qcustomplot.h:4120
virtual bool sortKeyIsMainKey() const Q_DECL_OVERRIDE
Returns whether the sort key (dataSortKey) is identical to the main key (dataMainKey).
Definition: qcustomplot.h:4201
The abstract base class for all data representing objects in a plot.
Definition: qcustomplot.h:3288
QCPDataSelection selection() const
Returns a QCPDataSelection encompassing all the data points that are currently selected on this plott...
Definition: qcustomplot.h:3316
void setAntialiasedFill(bool enabled)
Sets whether fills of this plottable are drawn antialiased or not.
Definition: qcustomplot.cpp:10741
bool selected() const
Returns true if there are any data points of the plottable currently selected.
Definition: qcustomplot.h:3315
void rescaleAxes(bool onlyEnlarge=false) const
Rescales the key and value axes associated with this plottable to contain all displayed data,...
Definition: qcustomplot.cpp:10989
void setSelectionDecorator(QCPSelectionDecorator *decorator)
Use this method to set an own QCPSelectionDecorator (subclass) instance.
Definition: qcustomplot.cpp:10855
Q_SLOT void setSelection(QCPDataSelection selection)
Sets which data ranges of this plottable are selected.
Definition: qcustomplot.cpp:10835
void setAntialiasedScatters(bool enabled)
Sets whether the scatter symbols of this plottable are drawn antialiased or not.
Definition: qcustomplot.cpp:10752
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const =0
This function is used to decide whether a click hits a layerable object or not.
void pixelsToCoords(double x, double y, double &key, double &value) const
Convenience function for transforming a x/y pixel pair on the QCustomPlot surface to plot coordinates...
Definition: qcustomplot.cpp:10950
void selectionChanged(bool selected)
This signal is emitted when the selection state of this plottable has changed, either by user interac...
virtual QCPRange getKeyRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth) const =0
Returns the coordinate range that all data in this plottable span in the key axis dimension.
virtual QCPRange getValueRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth, const QCPRange &inKeyRange=QCPRange()) const =0
Returns the coordinate range that the data points in the specified key range (inKeyRange) span in the...
void selectableChanged(QCP::SelectionType selectable)
This signal is emitted when the selectability of this plottable has changed.
bool addToLegend()
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: qcustomplot.cpp:11116
void rescaleValueAxis(bool onlyEnlarge=false, bool inKeyRange=false) const
Rescales the value axis of the plottable so the whole plottable is visible.
Definition: qcustomplot.cpp:11042
void setValueAxis(QCPAxis *axis)
The value axis of a plottable can be set to any axis of a QCustomPlot, as long as it is orthogonal to...
Definition: qcustomplot.cpp:10811
QCPSelectionDecorator * selectionDecorator() const
Provides access to the selection decorator of this plottable.
Definition: qcustomplot.h:3317
void selectionChanged(const QCPDataSelection &selection)
This signal is emitted when the selection state of this plottable has changed, either by user interac...
void setBrush(const QBrush &brush)
The brush is used to draw basic fills of the plottable representation in the plot.
Definition: qcustomplot.cpp:10779
void coordsToPixels(double key, double value, double &x, double &y) const
Convenience function for transforming a key/value pair to pixels on the QCustomPlot surface,...
Definition: qcustomplot.cpp:10908
virtual QCPPlottableInterface1D * interface1D()
If this plottable is a one-dimensional plottable, i.e.
Definition: qcustomplot.h:3333
void setKeyAxis(QCPAxis *axis)
The key axis of a plottable can be set to any axis of a QCustomPlot, as long as it is orthogonal to t...
Definition: qcustomplot.cpp:10795
void setPen(const QPen &pen)
The pen is used to draw basic lines that make up the plottable representation in the plot.
Definition: qcustomplot.cpp:10765
void setName(const QString &name)
The name is the textual representation of this plottable as it is displayed in the legend (QCPLegend)...
Definition: qcustomplot.cpp:10730
Q_SLOT void setSelectable(QCP::SelectionType selectable)
Sets whether and to which granularity this plottable can be selected.
Definition: qcustomplot.cpp:10882
bool removeFromLegend() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: qcustomplot.cpp:11154
void rescaleKeyAxis(bool onlyEnlarge=false) const
Rescales the key axis of the plottable so the whole plottable is visible.
Definition: qcustomplot.cpp:11000
Manages a single axis inside a QCustomPlot.
Definition: qcustomplot.h:1912
void rangeChanged(const QCPRange &newRange)
This signal is emitted when the range of this axis has changed.
LabelSide
Defines on which side of the axis the tick labels (numbers) shall appear.
Definition: qcustomplot.h:1977
void scaleTypeChanged(QCPAxis::ScaleType scaleType)
This signal is emitted when the scale type changes, by calls to setScaleType.
ScaleType
Defines the scale of an axis.
Definition: qcustomplot.h:1985
int pixelOrientation() const
Returns which direction points towards higher coordinate values/keys, in pixel space.
Definition: qcustomplot.h:2101
void selectionChanged(const QCPAxis::SelectableParts &parts)
This signal is emitted when the selection state of this axis has changed, either by user interaction ...
QCPGrid * grid() const
Returns the QCPGrid instance belonging to this axis.
Definition: qcustomplot.h:2048
QSharedPointer< QCPAxisTicker > ticker() const
Returns a modifiable shared pointer to the currently installed axis ticker.
Definition: qcustomplot.h:2011
static Qt::Orientation orientation(AxisType type)
Returns the orientation of the specified axis type.
Definition: qcustomplot.h:2115
void selectableChanged(const QCPAxis::SelectableParts &parts)
This signal is emitted when the selectability changes, by calls to setSelectableParts.
void rangeChanged(const QCPRange &newRange, const QCPRange &oldRange)
This is an overloaded member function, provided for convenience. It differs from the above function o...
SelectablePart
Defines the selectable parts of an axis.
Definition: qcustomplot.h:1993
AxisType
Defines at which side of the axis rect the axis will appear.
Definition: qcustomplot.h:1964
Definition: qcustomplot.h:2217
Holds multiple axes and arranges them in a rectangular shape.
Definition: qcustomplot.h:4583
int width() const
Returns the pixel width of this axis rect.
Definition: qcustomplot.h:4648
QPoint bottomRight() const
Returns the bottom right corner of this axis rect in pixels.
Definition: qcustomplot.h:4654
int right() const
Returns the pixel position of the right border of this axis rect.
Definition: qcustomplot.h:4645
int top() const
Returns the pixel position of the top border of this axis rect.
Definition: qcustomplot.h:4646
QPoint topLeft() const
Returns the top left corner of this axis rect in pixels.
Definition: qcustomplot.h:4651
virtual void mouseReleaseEvent(QMouseEvent *event, const QPointF &startPos) Q_DECL_OVERRIDE
This event gets called when the user releases the mouse button, after this layerable has become the m...
Definition: qcustomplot.cpp:17870
QSize size() const
Returns the pixel size of this axis rect.
Definition: qcustomplot.h:4650
QPoint topRight() const
Returns the top right corner of this axis rect in pixels.
Definition: qcustomplot.h:4652
virtual void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE
This event gets called when the user turns the mouse scroll wheel while the cursor is over the layera...
Definition: qcustomplot.cpp:17896
QCPLayoutInset * insetLayout() const
Returns the inset layout of this axis rect.
Definition: qcustomplot.h:4634
virtual void mouseMoveEvent(QMouseEvent *event, const QPointF &startPos) Q_DECL_OVERRIDE
This event gets called when the user moves the mouse while holding a mouse button,...
Definition: qcustomplot.cpp:17810
virtual void mousePressEvent(QMouseEvent *event, const QVariant &details) Q_DECL_OVERRIDE
This event gets called when the user presses a mouse button while the cursor is over the layerable.
Definition: qcustomplot.cpp:17778
QPoint bottomLeft() const
Returns the bottom left corner of this axis rect in pixels.
Definition: qcustomplot.h:4653
int height() const
Returns the pixel height of this axis rect.
Definition: qcustomplot.h:4649
int bottom() const
Returns the pixel position of the bottom border of this axis rect.
Definition: qcustomplot.h:4647
virtual void update(UpdatePhase phase) Q_DECL_OVERRIDE
This method is called automatically upon replot and doesn't need to be called by users of QCPAxisRect...
Definition: qcustomplot.cpp:17226
QPoint center() const
Returns the center of this axis rect in pixels.
Definition: qcustomplot.h:4655
int left() const
Returns the pixel position of the left border of this axis rect.
Definition: qcustomplot.h:4644
Specialized axis ticker for calendar dates and times as axis ticks.
Definition: qcustomplot.h:1595
Specialized axis ticker with a fixed tick step.
Definition: qcustomplot.h:1688
ScaleStrategy
Defines how the axis ticker may modify the specified tick step (setTickStep) in order to control the ...
Definition: qcustomplot.h:1697
The base class tick generator used by QCPAxis to create tick positions and tick labels.
Definition: qcustomplot.h:1534
TickStepStrategy
Defines the strategies that the axis ticker may follow when choosing the size of the tick step.
Definition: qcustomplot.h:1543
Specialized axis ticker suited for logarithmic axes.
Definition: qcustomplot.h:1828
Specialized axis ticker to display ticks in units of an arbitrary constant, for example pi.
Definition: qcustomplot.h:1769
FractionStyle
Defines how fractions should be displayed in tick labels.
Definition: qcustomplot.h:1777
Specialized axis ticker which allows arbitrary labels at specified coordinates.
Definition: qcustomplot.h:1730
QMap< double, QString > & ticks()
Returns a non-const reference to the internal map which stores the tick coordinates and their labels.
Definition: qcustomplot.h:1735
Specialized axis ticker for time spans in units of milliseconds to days.
Definition: qcustomplot.h:1636
TimeUnit
Defines the logical units in which fractions of time spans can be expressed.
Definition: qcustomplot.h:1644
Holds the data of one single data point (one bar) for QCPBars.
Definition: qcustomplot.h:5441
double sortKey() const
Returns the key member of this data point.
Definition: qcustomplot.h:5446
double mainValue() const
Returns the value member of this data point.
Definition: qcustomplot.h:5451
double mainKey() const
Returns the key member of this data point.
Definition: qcustomplot.h:5450
QCPRange valueRange() const
Returns a QCPRange with both lower and upper boundary set to value of this data point.
Definition: qcustomplot.h:5453
static QCPBarsData fromSortKey(double sortKey)
Returns a data point with the specified sortKey.
Definition: qcustomplot.h:5447
static bool sortKeyIsMainKey()
Since the member key is both the data point key coordinate and the data ordering parameter,...
Definition: qcustomplot.h:5448
Groups multiple QCPBars together so they appear side by side.
Definition: qcustomplot.h:5376
int size() const
Returns the number of QCPBars plottables that are part of this group.
Definition: qcustomplot.h:5409
SpacingType
Defines the ways the spacing between bars in the group can be specified.
Definition: qcustomplot.h:5389
QList< QCPBars * > bars() const
Returns all bars currently in this group.
Definition: qcustomplot.h:5407
bool isEmpty() const
Returns whether this bars group is empty.
Definition: qcustomplot.h:5410
bool contains(QCPBars *bars) const
Returns whether the specified bars plottable is part of this group.
Definition: qcustomplot.h:5412
A plottable representing a bar chart in a plot.
Definition: qcustomplot.h:5472
QCPBars * barBelow() const
Returns the bars plottable that is directly below this bars plottable.
Definition: qcustomplot.h:5505
WidthType
Defines the ways the width of the bar can be specified.
Definition: qcustomplot.h:5490
QSharedPointer< QCPBarsDataContainer > data() const
Returns a shared pointer to the internal data storage of type QCPBarsDataContainer.
Definition: qcustomplot.h:5507
QCPBars * barAbove() const
Returns the bars plottable that is directly above this bars plottable.
Definition: qcustomplot.h:5506
Defines a color gradient for use with e.g.
Definition: qcustomplot.h:4431
ColorInterpolation
Defines the color spaces in which color interpolation between gradient stops can be performed.
Definition: qcustomplot.h:4439
GradientPreset
Defines the available presets that can be loaded with loadPreset.
Definition: qcustomplot.h:4448
Holds the two-dimensional data of a QCPColorMap plottable.
Definition: qcustomplot.h:5681
bool isEmpty() const
Returns whether this instance carries no data.
Definition: qcustomplot.h:5715
A plottable representing a two-dimensional color map in a plot.
Definition: qcustomplot.h:5738
QCPColorMapData * data() const
Returns a pointer to the internal data storage of type QCPColorMapData.
Definition: qcustomplot.h:5753
Definition: qcustomplot.h:5015
A color scale for use with color coding data such as QCPColorMap.
Definition: qcustomplot.h:5039
QCPAxis * axis() const
Returns the internal QCPAxis instance of this color scale.
Definition: qcustomplot.h:5056
void gradientChanged(const QCPColorGradient &newGradient)
This signal is emitted when the gradient changes.
void dataScaleTypeChanged(QCPAxis::ScaleType scaleType)
This signal is emitted when the data scale type changes.
void dataRangeChanged(const QCPRange &newRange)
This signal is emitted when the data range changes.
Holds the data of one single data point for QCPCurve.
Definition: qcustomplot.h:5261
static bool sortKeyIsMainKey()
Since the member key is the data point key coordinate and the member t is the data ordering parameter...
Definition: qcustomplot.h:5268
double mainValue() const
Returns the value member of this data point.
Definition: qcustomplot.h:5271
static QCPCurveData fromSortKey(double sortKey)
Returns a data point with the specified sortKey (assigned to the data point's t member).
Definition: qcustomplot.h:5267
double sortKey() const
Returns the t member of this data point.
Definition: qcustomplot.h:5266
double mainKey() const
Returns the key member of this data point.
Definition: qcustomplot.h:5270
QCPRange valueRange() const
Returns a QCPRange with both lower and upper boundary set to value of this data point.
Definition: qcustomplot.h:5273
A plottable representing a parametric curve in a plot.
Definition: qcustomplot.h:5293
LineStyle
Defines how the curve's line is represented visually in the plot.
Definition: qcustomplot.h:5306
QSharedPointer< QCPCurveDataContainer > data() const
Returns a shared pointer to the internal data storage of type QCPCurveDataContainer.
Definition: qcustomplot.h:5315
The generic data container for one-dimensional plottables.
Definition: qcustomplot.h:2405
void setAutoSqueeze(bool enabled)
Sets whether the container automatically decides when to release memory from its post- and preallocat...
Definition: qcustomplot.h:2615
const_iterator findBegin(double sortKey, bool expandedRange=true) const
Returns an iterator to the data point with a (sort-)key that is equal to, just below,...
Definition: qcustomplot.h:2898
QCPRange valueRange(bool &foundRange, QCP::SignDomain signDomain=QCP::sdBoth, const QCPRange &inKeyRange=QCPRange())
Returns the range encompassed by the value coordinates of the data points in the specified key range ...
Definition: qcustomplot.h:3075
void add(const QCPDataContainer< DataType > &data)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: qcustomplot.h:2664
const_iterator constBegin() const
Returns a const iterator to the first data point in this container.
Definition: qcustomplot.h:2434
bool qcpLessThanSortKey(const DataType &a, const DataType &b)
Returns whether the sort key of a is less than the sort key of b.
Definition: qcustomplot.h:2401
void sort()
Re-sorts all data points in the container by their sort key.
Definition: qcustomplot.h:2850
bool isEmpty() const
Returns whether this container holds no data points.
Definition: qcustomplot.h:2414
void clear()
Removes all data points.
Definition: qcustomplot.h:2831
iterator begin()
Returns a non-const iterator to the first data point in this container.
Definition: qcustomplot.h:2436
void squeeze(bool preAllocation=true, bool postAllocation=true)
Frees all unused memory that is currently in the preallocation and postallocation pools.
Definition: qcustomplot.h:2866
int size() const
Returns the number of data points in the container.
Definition: qcustomplot.h:2413
void limitIteratorsToDataRange(const_iterator &begin, const_iterator &end, const QCPDataRange &dataRange) const
Makes sure begin and end mark a data range that is both within the bounds of this data container's da...
Definition: qcustomplot.h:3163
void removeBefore(double sortKey)
Removes all data points with (sort-)keys smaller than or equal to sortKey.
Definition: qcustomplot.h:2757
const_iterator constEnd() const
Returns a const iterator to the element past the last data point in this container.
Definition: qcustomplot.h:2435
QCPRange keyRange(bool &foundRange, QCP::SignDomain signDomain=QCP::sdBoth)
Returns the range encompassed by the (main-)key coordinate of all data points.
Definition: qcustomplot.h:2952
void removeAfter(double sortKey)
Removes all data points with (sort-)keys greater than or equal to sortKey.
Definition: qcustomplot.h:2772
iterator end()
Returns a non-const iterator to the element past the last data point in this container.
Definition: qcustomplot.h:2437
void remove(double sortKeyFrom, double sortKeyTo)
Removes all data points with (sort-)keys between sortKeyFrom and sortKeyTo.
Definition: qcustomplot.h:2789
void set(const QCPDataContainer< DataType > &data)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: qcustomplot.h:2632
const_iterator at(int index) const
Returns a const iterator to the element with the specified index.
Definition: qcustomplot.h:2440
QCPDataRange dataRange() const
Returns a QCPDataRange encompassing the entire data set of this container.
Definition: qcustomplot.h:2443
QCPDataContainer()
Constructs a QCPDataContainer used for plottable classes that represent a series of key-sorted data.
Definition: qcustomplot.h:2599
const_iterator findEnd(double sortKey, bool expandedRange=true) const
Returns an iterator to the element after the data point with a (sort-)key that is equal to,...
Definition: qcustomplot.h:2925
Describes a data range given by begin and end index.
Definition: qcustomplot.h:891
int length() const
Returns the number of data points described by this data range.
Definition: qcustomplot.h:903
void setEnd(int end)
Sets the end of this data range.
Definition: qcustomplot.h:907
QCPDataRange adjusted(int changeBegin, int changeEnd) const
Returns a data range where changeBegin and changeEnd were added to the begin and end indices,...
Definition: qcustomplot.h:915
void setBegin(int begin)
Sets the begin of this data range.
Definition: qcustomplot.h:906
QCPDataRange bounded(const QCPDataRange &other) const
Returns a data range that matches this data range, except that parts exceeding other are excluded.
Definition: qcustomplot.cpp:2253
bool isValid() const
Returns whether this range is valid.
Definition: qcustomplot.h:910
bool isEmpty() const
Returns whether this range is empty, i.e.
Definition: qcustomplot.h:911
int size() const
Returns the number of data points described by this data range.
Definition: qcustomplot.h:902
Describes a data set by holding multiple QCPDataRange instances.
Definition: qcustomplot.h:928
void addDataRange(const QCPDataRange &dataRange, bool simplify=true)
Adds the given dataRange to this data selection.
Definition: qcustomplot.cpp:2544
void simplify()
Sorts all data ranges by range begin index in ascending order, and then joins directly adjacent or ov...
Definition: qcustomplot.cpp:2570
QCPDataRange dataRange(int index=0) const
Returns the data range with the specified index.
Definition: qcustomplot.cpp:2514
bool isEmpty() const
Returns true if there are no data ranges, and thus no data points, in this QCPDataSelection instance.
Definition: qcustomplot.h:958
int dataRangeCount() const
Returns the number of ranges that make up the data selection.
Definition: qcustomplot.h:949
QList< QCPDataRange > dataRanges() const
Returns all data ranges that make up the data selection.
Definition: qcustomplot.h:952
QCPDataSelection inverse(const QCPDataRange &outerRange) const
Returns a data selection which is the exact inverse of this data selection, with outerRange defining ...
Definition: qcustomplot.cpp:2708
Holds the data of one single error bar for QCPErrorBars.
Definition: qcustomplot.h:5956
A plottable that adds a set of error bars to other plottables.
Definition: qcustomplot.h:5985
ErrorType
Defines in which orientation the error bars shall appear.
Definition: qcustomplot.h:6002
QSharedPointer< QCPErrorBarsDataContainer > data() const
Returns a shared pointer to the internal data storage of type QCPErrorBarsDataContainer.
Definition: qcustomplot.h:6010
Holds the data of one single data point for QCPFinancial.
Definition: qcustomplot.h:5817
static bool sortKeyIsMainKey()
Since the member key is both the data point key coordinate and the data ordering parameter,...
Definition: qcustomplot.h:5824
QCPRange valueRange() const
Returns a QCPRange spanning from the low to the high value of this data point.
Definition: qcustomplot.h:5829
static QCPFinancialData fromSortKey(double sortKey)
Returns a data point with the specified sortKey.
Definition: qcustomplot.h:5823
double mainValue() const
Returns the open member of this data point.
Definition: qcustomplot.h:5827
double sortKey() const
Returns the key member of this data point.
Definition: qcustomplot.h:5822
double mainKey() const
Returns the key member of this data point.
Definition: qcustomplot.h:5826
A plottable representing a financial stock chart.
Definition: qcustomplot.h:5848
ChartStyle
Defines the possible representations of OHLC data in the plot.
Definition: qcustomplot.h:5878
QSharedPointer< QCPFinancialDataContainer > data() const
Returns a pointer to the internal data storage of type QCPFinancialDataContainer.
Definition: qcustomplot.h:5887
WidthType
Defines the ways the width of the financial bar can be specified.
Definition: qcustomplot.h:5867
Holds the data of one single data point for QCPGraph.
Definition: qcustomplot.h:5122
double mainValue() const
Returns the value member of this data point.
Definition: qcustomplot.h:5132
static bool sortKeyIsMainKey()
Since the member key is both the data point key coordinate and the data ordering parameter,...
Definition: qcustomplot.h:5129
QCPRange valueRange() const
Returns a QCPRange with both lower and upper boundary set to value of this data point.
Definition: qcustomplot.h:5134
static QCPGraphData fromSortKey(double sortKey)
Returns a data point with the specified sortKey.
Definition: qcustomplot.h:5128
double sortKey() const
Returns the key member of this data point.
Definition: qcustomplot.h:5127
double mainKey() const
Returns the key member of this data point.
Definition: qcustomplot.h:5131
A plottable representing a graph in a plot.
Definition: qcustomplot.h:5153
QSharedPointer< QCPGraphDataContainer > data() const
Returns a shared pointer to the internal data storage of type QCPGraphDataContainer.
Definition: qcustomplot.h:5182
LineStyle
Defines how the graph's line is represented visually in the plot.
Definition: qcustomplot.h:5168
Responsible for drawing the grid of a QCPAxis.
Definition: qcustomplot.h:1861
An anchor of an item to which positions can be attached to.
Definition: qcustomplot.h:3398
virtual QCPItemPosition * toQCPItemPosition()
Returns 0 if this instance is merely a QCPItemAnchor, and a valid pointer of type QCPItemPosition* if...
Definition: qcustomplot.h:3419
A bracket for referencing/highlighting certain parts in the plot.
Definition: qcustomplot.h:6598
BracketStyle
Defines the various visual shapes of the bracket item.
Definition: qcustomplot.h:6613
A curved line from one point to another.
Definition: qcustomplot.h:6174
An ellipse.
Definition: qcustomplot.h:6381
A line from one point to another.
Definition: qcustomplot.h:6124
An arbitrary pixmap.
Definition: qcustomplot.h:6443
Manages the position of an item.
Definition: qcustomplot.h:3436
QCPItemAnchor * parentAnchor() const
Returns the current parent anchor.
Definition: qcustomplot.h:3463
PositionType
Defines the ways an item position can be specified.
Definition: qcustomplot.h:3445
PositionType type() const
Returns the current position type.
Definition: qcustomplot.h:3460
A rectangle.
Definition: qcustomplot.h:6225
A straight line that spans infinitely in both directions.
Definition: qcustomplot.h:6081
A text label.
Definition: qcustomplot.h:6284
Item that sticks to QCPGraph data points.
Definition: qcustomplot.h:6512
TracerStyle
The different visual appearances a tracer item can have.
Definition: qcustomplot.h:6531
A layer that may contain objects, to control the rendering order.
Definition: qcustomplot.h:624
QList< QCPLayerable * > children() const
Returns a list of all layerables on this layer.
Definition: qcustomplot.h:655
LayerMode
Defines the different rendering modes of a layer.
Definition: qcustomplot.h:643
int index() const
Returns the index this layer has in the QCustomPlot.
Definition: qcustomplot.h:654
Base class for all drawable objects.
Definition: qcustomplot.h:693
QCPLayerable * parentLayerable() const
Returns the parent layerable of this layerable.
Definition: qcustomplot.h:709
void layerChanged(QCPLayer *newLayer)
This signal is emitted when the layer of this layerable changes, i.e.
The abstract base class for all objects that form the layout system.
Definition: qcustomplot.h:1180
SizeConstraintRect
Defines to which rect of a layout element the size constraints that can be set via setMinimumSize and...
Definition: qcustomplot.h:1211
UpdatePhase
Defines the phases of the update process, that happens just before a replot.
Definition: qcustomplot.h:1197
QRect rect() const
Returns the inner rect of this layout element.
Definition: qcustomplot.h:1221
QRect outerRect() const
Returns the outer rect of this layout element.
Definition: qcustomplot.h:1222
QCPLayout * layout() const
Returns the parent layout of this layout element.
Definition: qcustomplot.h:1220
A layout that arranges child elements in a grid.
Definition: qcustomplot.h:1323
int rowCount() const
Returns the number of rows in the layout.
Definition: qcustomplot.h:1353
int columnCount() const
Returns the number of columns in the layout.
Definition: qcustomplot.h:1354
FillOrder
Defines in which direction the grid is filled when using addElement(QCPLayoutElement*).
Definition: qcustomplot.h:1344
The abstract base class for layouts.
Definition: qcustomplot.h:1283
virtual int elementCount() const =0
Returns the number of elements/cells in the layout.
virtual QCPLayoutElement * takeAt(int index)=0
Removes the element with the given index from the layout and returns it.
virtual bool take(QCPLayoutElement *element)=0
Removes the specified element from the layout and returns true on success.
virtual QCPLayoutElement * elementAt(int index) const =0
Returns the element in the cell with the given index.
A layout that places child elements aligned to the border or arbitrarily positioned.
Definition: qcustomplot.h:1414
InsetPlacement
Defines how the placement and sizing is handled for a certain element in a QCPLayoutInset.
Definition: qcustomplot.h:1420
Manages a legend inside a QCustomPlot.
Definition: qcustomplot.h:4797
SelectablePart
Defines the selectable parts of a legend.
Definition: qcustomplot.h:4821
Handles the different ending decorations for line-like items.
Definition: qcustomplot.h:1470
EndingStyle
Defines the type of ending decoration for line-like items, e.g.
Definition: qcustomplot.h:1484
A margin group allows synchronization of margin sides if working with multiple layout elements.
Definition: qcustomplot.h:1149
QList< QCPLayoutElement * > elements(QCP::MarginSide side) const
Returns a list of all layout elements that have their margin side associated with this margin group.
Definition: qcustomplot.h:1156
A paint buffer based on QPixmap, using software raster rendering.
Definition: qcustomplot.h:551
QPainter subclass used internally.
Definition: qcustomplot.h:457
void drawLine(const QLineF &line)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: qcustomplot.cpp:360
PainterMode
Defines special modes the painter can operate in.
Definition: qcustomplot.h:464
@ pmNoCaching
0x02 Mode for all sorts of exports (e.g. PNG, PDF,...). For example, this prevents using cached pixma...
Definition: qcustomplot.h:466
@ pmVectorized
0x01 Mode for vectorized painting (e.g. PDF export). For example, this prevents some antialiasing fix...
Definition: qcustomplot.h:465
Defines an abstract interface for one-dimensional plottables.
Definition: qcustomplot.h:3851
virtual int dataCount() const =0
Returns the number of data points of the plottable.
virtual bool sortKeyIsMainKey() const =0
Returns whether the sort key (dataSortKey) is identical to the main key (dataMainKey).
virtual double dataMainKey(int index) const =0
Returns the main key of the data point at the given index.
virtual int findBegin(double sortKey, bool expandedRange=true) const =0
Returns the index of the data point with a (sort-)key that is equal to, just below,...
virtual int findEnd(double sortKey, bool expandedRange=true) const =0
Returns the index one after the data point with a (sort-)key that is equal to, just above,...
virtual QCPDataSelection selectTestRect(const QRectF &rect, bool onlySelectable) const =0
Returns a data selection containing all the data points of this plottable which are contained (or hit...
virtual QPointF dataPixelPosition(int index) const =0
Returns the pixel position on the widget surface at which the data point at the given index appears.
virtual QCPRange dataValueRange(int index) const =0
Returns the value range of the data point at the given index.
virtual double dataMainValue(int index) const =0
Returns the main value of the data point at the given index.
virtual double dataSortKey(int index) const =0
Returns the sort key of the data point at the given index.
A legend item representing a plottable with an icon and the plottable name.
Definition: qcustomplot.h:4773
Represents the range an axis is encompassing.
Definition: qcustomplot.h:773
void expand(const QCPRange &otherRange)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: qcustomplot.cpp:1929
static const double maxRange
Maximum values (negative and positive) the range will accept in range-changing functions.
Definition: qcustomplot.h:809
QCPRange & operator/=(const double &value)
Divides both boundaries of the range by value.
Definition: qcustomplot.h:786
double size() const
Returns the size of the range, i.e.
Definition: qcustomplot.h:794
QCPRange & operator*=(const double &value)
Multiplies both boundaries of the range by value.
Definition: qcustomplot.h:785
QCPRange & operator-=(const double &value)
Subtracts value from both boundaries of the range.
Definition: qcustomplot.h:784
static const double minRange
Minimum range size (upper - lower) the range changing functions will accept.
Definition: qcustomplot.h:808
bool contains(double value) const
Returns true when value lies within or exactly on the borders of the range.
Definition: qcustomplot.h:804
double center() const
Returns the center of the range, i.e.
Definition: qcustomplot.h:795
void normalize()
Makes sure lower is numerically smaller than upper.
Definition: qcustomplot.h:796
QCPRange & operator+=(const double &value)
Adds value to both boundaries of the range.
Definition: qcustomplot.h:783
Represents the visual appearance of scatter points.
Definition: qcustomplot.h:2289
bool isPenDefined() const
Returns whether a pen has been defined for this scatter style.
Definition: qcustomplot.h:2366
bool isNone() const
Returns whether the scatter shape is ssNone.
Definition: qcustomplot.h:2365
ScatterProperty
Represents the various properties of a scatter style instance.
Definition: qcustomplot.h:2300
@ spPen
0x01 The pen property, see setPen
Definition: qcustomplot.h:2301
ScatterShape
Defines the shape used for scatter points.
Definition: qcustomplot.h:2318
A selection decorator which draws brackets around each selected data segment.
Definition: qcustomplot.h:4514
BracketStyle
Defines which shape is drawn at the boundaries of selected data ranges.
Definition: qcustomplot.h:4524
Controls how a plottable's data selection is drawn.
Definition: qcustomplot.h:3241
Provides rect/rubber-band data selection and range zoom interaction.
Definition: qcustomplot.h:1095
void accepted(const QRect &rect, QMouseEvent *event)
This signal is emitted when the selection interaction was completed by the user releasing the mouse b...
void changed(const QRect &rect, QMouseEvent *event)
This signal is emitted while the selection rect interaction is ongoing and the rect has changed its s...
void started(QMouseEvent *event)
This signal is emitted when a selection rect interaction was initiated, i.e.
bool isActive() const
Returns true if there is currently a selection going on, i.e.
Definition: qcustomplot.h:1106
void canceled(const QRect &rect, QInputEvent *event)
This signal is emitted when the selection interaction was cancelled.
Holds the data of one single data point for QCPStatisticalBox.
Definition: qcustomplot.h:5564
double mainValue() const
Returns the median member of this data point.
Definition: qcustomplot.h:5574
double sortKey() const
Returns the key member of this data point.
Definition: qcustomplot.h:5569
QCPRange valueRange() const
Returns a QCPRange spanning from the minimum to the maximum member of this statistical box data point...
Definition: qcustomplot.h:5576
static bool sortKeyIsMainKey()
Since the member key is both the data point key coordinate and the data ordering parameter,...
Definition: qcustomplot.h:5571
double mainKey() const
Returns the key member of this data point.
Definition: qcustomplot.h:5573
static QCPStatisticalBoxData fromSortKey(double sortKey)
Returns a data point with the specified sortKey.
Definition: qcustomplot.h:5570
A plottable representing a single statistical box in a plot.
Definition: qcustomplot.h:5603
QSharedPointer< QCPStatisticalBoxDataContainer > data() const
Returns a shared pointer to the internal data storage of type QCPStatisticalBoxDataContainer.
Definition: qcustomplot.h:5618
A layout element displaying a text.
Definition: qcustomplot.h:4927
void selectionChanged(bool selected)
This signal is emitted when the selection state has changed to selected, either by user interaction o...
void doubleClicked(QMouseEvent *event)
This signal is emitted when the text element is double clicked.
void clicked(QMouseEvent *event)
This signal is emitted when the text element is clicked.
Represents two doubles as a mathematical 2D vector.
Definition: qcustomplot.h:383
QCPVector2D perpendicular() const
Returns a vector perpendicular to this vector, with the same length.
Definition: qcustomplot.h:409
double length() const
Returns the length of this vector.
Definition: qcustomplot.h:401
double dot(const QCPVector2D &vec) const
Returns the dot/scalar product of this vector with the specified vector vec.
Definition: qcustomplot.h:410
double lengthSquared() const
Returns the squared length of this vector.
Definition: qcustomplot.h:402
void setX(double x)
Sets the x coordinate of this vector to x.
Definition: qcustomplot.h:397
QPointF toPointF() const
Returns a QPointF which has the x and y coordinates of this vector.
Definition: qcustomplot.h:404
bool isNull() const
Returns whether this vector is null.
Definition: qcustomplot.h:406
void setY(double y)
Sets the y coordinate of this vector to y.
Definition: qcustomplot.h:398
QPoint toPoint() const
Returns a QPoint which has the x and y coordinates of this vector, truncating any floating point info...
Definition: qcustomplot.h:403
The central class of the library.
Definition: qcustomplot.h:3583
void legendDoubleClick(QCPLegend *legend, QCPAbstractLegendItem *item, QMouseEvent *event)
This signal is emitted when a legend (item) is double clicked.
void beforeReplot()
This signal is emitted immediately before a replot takes place (caused by a call to the slot replot).
RefreshPriority
Defines with what timing the QCustomPlot surface is refreshed after a replot.
Definition: qcustomplot.h:3613
@ rpRefreshHint
Whether to use immediate or queued refresh depends on whether the plotting hint QCP::phImmediateRefre...
Definition: qcustomplot.h:3615
QCPLegend * legend
A pointer to the default legend of the main axis rect.
Definition: qcustomplot.h:3732
void selectionChangedByUser()
This signal is emitted after the user has changed the selection in the QCustomPlot,...
void axisDoubleClick(QCPAxis *axis, QCPAxis::SelectablePart part, QMouseEvent *event)
This signal is emitted when an axis is double clicked.
void afterReplot()
This signal is emitted immediately after a replot has taken place (caused by a call to the slot replo...
void mouseMove(QMouseEvent *event)
This signal is emitted when the QCustomPlot receives a mouse move event.
LayerInsertMode
Defines how a layer should be inserted relative to an other layer.
Definition: qcustomplot.h:3603
void legendClick(QCPLegend *legend, QCPAbstractLegendItem *item, QMouseEvent *event)
This signal is emitted when a legend (item) is clicked.
void plottableDoubleClick(QCPAbstractPlottable *plottable, int dataIndex, QMouseEvent *event)
This signal is emitted when a plottable is double clicked.
QCPAxis * xAxis
A pointer to the primary x Axis (bottom) of the main axis rect of the plot.
Definition: qcustomplot.h:3731
void mouseDoubleClick(QMouseEvent *event)
This signal is emitted when the QCustomPlot receives a mouse double click event.
void axisClick(QCPAxis *axis, QCPAxis::SelectablePart part, QMouseEvent *event)
This signal is emitted when an axis is clicked.
void mouseWheel(QWheelEvent *event)
This signal is emitted when the QCustomPlot receives a mouse wheel event.
void itemDoubleClick(QCPAbstractItem *item, QMouseEvent *event)
This signal is emitted when an item is double clicked.
void mouseRelease(QMouseEvent *event)
This signal is emitted when the QCustomPlot receives a mouse release event.
void mousePress(QMouseEvent *event)
This signal is emitted when the QCustomPlot receives a mouse press event.
QCPSelectionRect * selectionRect() const
Allows access to the currently used QCPSelectionRect instance (or subclass thereof),...
Definition: qcustomplot.h:3639
void itemClick(QCPAbstractItem *item, QMouseEvent *event)
This signal is emitted when an item is clicked.
QCPLayoutGrid * plotLayout() const
Returns the top level layout of this QCustomPlot instance.
Definition: qcustomplot.h:3629
void plottableClick(QCPAbstractPlottable *plottable, int dataIndex, QMouseEvent *event)
This signal is emitted when a plottable is clicked.
The QCP Namespace contains general enums, QFlags and functions used throughout the QCustomPlot librar...
Definition: qcustomplot.h:139
ExportPen
Defines how cosmetic pens (pens with numerical width 0) are handled during export.
Definition: qcustomplot.h:175
@ epAllowCosmetic
Cosmetic pens are exported normally (e.g. in PDF exports, cosmetic pens always appear as 1 pixel on s...
Definition: qcustomplot.h:176
@ epNoCosmetic
Cosmetic pens are converted to pens with pixel width 1 when exporting.
Definition: qcustomplot.h:175
Interaction
Defines the mouse interactions possible with QCustomPlot.
Definition: qcustomplot.h:251
@ iSelectLegend
0x020 Legends are selectable (or their child items, see QCPLegend::setSelectableParts)
Definition: qcustomplot.h:256
@ iRangeDrag
0x001 Axis ranges are draggable (see QCPAxisRect::setRangeDrag, QCPAxisRect::setRangeDragAxes)
Definition: qcustomplot.h:251
@ iSelectPlottables
0x008 Plottables are selectable (e.g. graphs, curves, bars,... see QCPAbstractPlottable)
Definition: qcustomplot.h:254
@ iRangeZoom
0x002 Axis ranges are zoomable with the mouse wheel (see QCPAxisRect::setRangeZoom,...
Definition: qcustomplot.h:252
@ iSelectAxes
0x010 Axes are selectable (or parts of them, see QCPAxis::setSelectableParts)
Definition: qcustomplot.h:255
@ iSelectItems
0x040 Items are selectable (Rectangles, Arrows, Textitems, etc. see QCPAbstractItem)
Definition: qcustomplot.h:257
@ iMultiSelect
0x004 The user can select multiple objects by holding the modifier set by QCustomPlot::setMultiSelect...
Definition: qcustomplot.h:253
@ iSelectOther
0x080 All other objects are selectable (e.g. your own derived layerables, other layout elements,...
Definition: qcustomplot.h:258
PlottingHint
Defines plotting hints that control various aspects of the quality and speed of plotting.
Definition: qcustomplot.h:235
@ phImmediateRefresh
Definition: qcustomplot.h:238
@ phCacheLabels
0x004 axis (tick) labels will be cached as pixmaps, increasing replot performance.
Definition: qcustomplot.h:240
@ phFastPolylines
Definition: qcustomplot.h:236
@ phNone
0x000 No hints are set
Definition: qcustomplot.h:235
ResolutionUnit
Defines the different units in which the image resolution can be specified in the export functions.
Definition: qcustomplot.h:165
@ ruDotsPerCentimeter
Resolution is given in dots per centimeter (dpcm)
Definition: qcustomplot.h:166
@ ruDotsPerMeter
Resolution is given in dots per meter (dpm)
Definition: qcustomplot.h:165
@ ruDotsPerInch
Resolution is given in dots per inch (DPI/PPI)
Definition: qcustomplot.h:167
MarginSide
Defines the sides of a rectangular entity to which margins can be applied.
Definition: qcustomplot.h:196
@ msAll
0xFF all margins
Definition: qcustomplot.h:200
@ msBottom
0x08 bottom margin
Definition: qcustomplot.h:199
@ msTop
0x04 top margin
Definition: qcustomplot.h:198
@ msNone
0x00 no margin
Definition: qcustomplot.h:201
@ msRight
0x02 right margin
Definition: qcustomplot.h:197
@ msLeft
0x01 left margin
Definition: qcustomplot.h:196
SelectionType
Defines the different ways a plottable can be selected.
Definition: qcustomplot.h:291
@ stMultipleDataRanges
Any combination of data points/ranges can be selected.
Definition: qcustomplot.h:295
@ stDataRange
Multiple contiguous data points (a data range) can be selected.
Definition: qcustomplot.h:294
@ stNone
The plottable is not selectable.
Definition: qcustomplot.h:291
@ stSingleData
One individual data point can be selected at a time.
Definition: qcustomplot.h:293
@ stWhole
Selection behaves like stMultipleDataRanges, but if there are any data points selected,...
Definition: qcustomplot.h:292
SelectionRectMode
Defines the behaviour of the selection rect.
Definition: qcustomplot.h:267
@ srmCustom
When dragging the mouse, a selection rect becomes active. It is the programmer's responsibility to co...
Definition: qcustomplot.h:270
@ srmSelect
When dragging the mouse, a selection rect becomes active. Upon releasing, plottable data points that ...
Definition: qcustomplot.h:269
@ srmZoom
When dragging the mouse, a selection rect becomes active. Upon releasing, the axes that are currently...
Definition: qcustomplot.h:268
@ srmNone
The selection rect is disabled, and all mouse events are forwarded to the underlying objects,...
Definition: qcustomplot.h:267
AntialiasedElement
Defines what objects of a plot can be forcibly drawn antialiased/not antialiased.
Definition: qcustomplot.h:214
@ aeLegendItems
0x0010 Legend items
Definition: qcustomplot.h:218
@ aeZeroLine
0x0200 Zero-lines, see QCPGrid::setZeroLinePen
Definition: qcustomplot.h:223
@ aePlottables
0x0020 Main lines of plottables
Definition: qcustomplot.h:219
@ aeGrid
0x0002 Grid lines
Definition: qcustomplot.h:215
@ aeOther
0x8000 Other elements that don't fit into any of the existing categories
Definition: qcustomplot.h:224
@ aeFills
0x0100 Borders of fills (e.g. under or between graphs)
Definition: qcustomplot.h:222
@ aeLegend
0x0008 Legend box
Definition: qcustomplot.h:217
@ aeAll
0xFFFF All elements
Definition: qcustomplot.h:225
@ aeNone
0x0000 No elements
Definition: qcustomplot.h:226
@ aeSubGrid
0x0004 Sub grid lines
Definition: qcustomplot.h:216
@ aeScatters
0x0080 Scatter symbols of plottables (excluding scatter symbols of type ssPixmap)
Definition: qcustomplot.h:221
@ aeAxes
0x0001 Axis base line and tick marks
Definition: qcustomplot.h:214
@ aeItems
0x0040 Main lines of items
Definition: qcustomplot.h:220
SignDomain
Represents negative and positive sign domain, e.g.
Definition: qcustomplot.h:186
@ sdNegative
The negative sign domain, i.e. numbers smaller than zero.
Definition: qcustomplot.h:186
@ sdPositive
The positive sign domain, i.e. numbers greater than zero.
Definition: qcustomplot.h:188
@ sdBoth
Both sign domains, including zero, i.e. all numbers.
Definition: qcustomplot.h:187
Definition: qcustomplot.h:2258
Definition: qcustomplot.h:2263