29#include <QtCore/qglobal.h>
33#ifdef QCUSTOMPLOT_USE_OPENGL
34#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
35#define QCP_OPENGL_PBUFFER
39#if QT_VERSION >= QT_VERSION_CHECK(5, 3, 0)
40#define QCP_OPENGL_OFFSCREENSURFACE
44#if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0)
45#define QCP_DEVICEPIXELRATIO_SUPPORTED
46#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
47#define QCP_DEVICEPIXELRATIO_FLOAT
51#include <QtCore/QCache>
52#include <QtCore/QDateTime>
53#include <QtCore/QDebug>
54#include <QtCore/QFlags>
55#include <QtCore/QMargins>
56#include <QtCore/QMultiMap>
57#include <QtCore/QObject>
58#include <QtCore/QPointer>
59#include <QtCore/QSharedPointer>
60#include <QtCore/QStack>
61#include <QtCore/QString>
62#include <QtCore/QTimer>
63#include <QtCore/QVector>
64#include <QtGui/QMouseEvent>
65#include <QtGui/QPaintEvent>
66#include <QtGui/QPainter>
67#include <QtGui/QPainterPath>
68#include <QtGui/QPixmap>
69#include <QtGui/QWheelEvent>
74#include <QtGui/QOpenGLContext>
75#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
76#include <QtGui/QOpenGLFramebufferObject>
78#include <QOpenGLFramebufferObject>
79#include <QOpenGLPaintDevice>
81#ifdef QCP_OPENGL_OFFSCREENSURFACE
82#include <QtGui/QOffscreenSurface>
84#include <QtGui/QWindow>
87#ifdef QCP_OPENGL_PBUFFER
88#include <QtOpenGL/QGLPixelBuffer>
90#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
91#include <QtGui/QPrintEngine>
92#include <QtGui/QPrinter>
93#include <QtGui/QWidget>
97#include <QtPrintSupport/QtPrintSupport>
98#include <QtWidgets/QWidget>
100#if QT_VERSION >= QT_VERSION_CHECK(4, 8, 0)
101#include <QtCore/QElapsedTimer>
103#if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0)
104#include <QtCore/QTimeZone>
135#define QCUSTOMPLOT_VERSION_STR "2.1.1"
136#define QCUSTOMPLOT_VERSION 0x020101
139#if defined(QT_STATIC_BUILD)
141#elif defined(QCUSTOMPLOT_COMPILE_LIBRARY)
142#define QCP_LIB_DECL Q_DECL_EXPORT
143#elif defined(QCUSTOMPLOT_USE_LIBRARY)
144#define QCP_LIB_DECL Q_DECL_IMPORT
150#ifndef Q_DECL_OVERRIDE
151#define Q_DECL_OVERRIDE
164#if QT_VERSION >= 0x060200
185 Q_FLAGS(AntialiasedElements)
186 Q_FLAGS(PlottingHints)
188 Q_FLAGS(Interactions)
448inline bool isInvalidData(
double value) {
449 return qIsNaN(value) || qIsInf(value);
457inline bool isInvalidData(
double value1,
double value2) {
458 return isInvalidData(value1) || isInvalidData(value2);
467inline void setMarginValue(QMargins& margins,
QCP::MarginSide side,
int value) {
470 margins.setLeft(value);
473 margins.setRight(value);
476 margins.setTop(value);
479 margins.setBottom(value);
482 margins = QMargins(value, value, value, value);
496inline int getMarginValue(
const QMargins& margins,
QCP::MarginSide side) {
499 return margins.left();
501 return margins.right();
503 return margins.top();
505 return margins.bottom();
516#if QT_VERSION >= 0x060200
527Q_FLAG_NS(AntialiasedElements)
528Q_FLAG_NS(PlottingHints)
529Q_FLAG_NS(MarginSides)
530Q_FLAG_NS(Interactions)
532extern const QMetaObject staticMetaObject;
537Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::AntialiasedElements)
538Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::PlottingHints)
539Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::MarginSides)
540Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::Interactions)
546#if QT_VERSION < QT_VERSION_CHECK(6, 2, 0)
571 double x()
const {
return mX; }
572 double y()
const {
return mY; }
573 double& rx() {
return mX; }
574 double& ry() {
return mY; }
577 void setX(
double x) { mX = x; }
578 void setY(
double y) { mY = y; }
581 double length()
const {
return qSqrt(mX * mX + mY * mY); }
583 double angle()
const {
return qAtan2(mY, mX); }
584 QPoint
toPoint()
const {
return QPoint(
int(mX),
int(mY)); }
585 QPointF
toPointF()
const {
return QPointF(mX, mY); }
587 bool isNull()
const {
return qIsNull(mX) && qIsNull(mY); }
592 double distanceSquaredToLine(
const QCPVector2D& start,
594 double distanceSquaredToLine(
const QLineF& line)
const;
595 double distanceToStraightLine(
const QCPVector2D& base,
607 friend inline const QCPVector2D operator*(
double factor,
622 return QCPVector2D(vec.mX * factor, vec.mY * factor);
625 return QCPVector2D(vec.mX * factor, vec.mY * factor);
628 return QCPVector2D(vec.mX / divisor, vec.mY / divisor);
632 return QCPVector2D(vec1.mX + vec2.mX, vec1.mY + vec2.mY);
636 return QCPVector2D(vec1.mX - vec2.mX, vec1.mY - vec2.mY);
647 d.nospace() <<
"QCPVector2D(" << vec.x() <<
", " << vec.y() <<
")";
682 Q_FLAGS(PainterModes)
683 Q_DECLARE_FLAGS(PainterModes, PainterMode)
689 bool antialiasing()
const {
return testRenderHint(QPainter::Antialiasing); }
690 PainterModes modes()
const {
return mModes; }
693 void setAntialiasing(
bool enabled);
694 void setMode(PainterMode mode,
bool enabled =
true);
695 void setModes(PainterModes modes);
698 bool begin(QPaintDevice* device);
699 void setPen(
const QPen& pen);
700 void setPen(
const QColor& color);
701 void setPen(Qt::PenStyle penStyle);
702 void drawLine(
const QLineF& line);
703 void drawLine(
const QPointF& p1,
const QPointF& p2) {
704 drawLine(QLineF(p1, p2));
710 void makeNonCosmetic();
715 bool mIsAntialiasing;
718 QStack<bool> mAntialiasingStack;
720Q_DECLARE_OPERATORS_FOR_FLAGS(QCPPainter::PainterModes)
734 QSize size()
const {
return mSize; }
735 bool invalidated()
const {
return mInvalidated; }
736 double devicePixelRatio()
const {
return mDevicePixelRatio; }
739 void setSize(
const QSize& size);
740 void setInvalidated(
bool invalidated =
true);
741 void setDevicePixelRatio(
double ratio);
747 virtual void clear(
const QColor& color) = 0;
752 double mDevicePixelRatio;
767 virtual QCPPainter* startPainting() Q_DECL_OVERRIDE;
768 virtual void draw(
QCPPainter* painter)
const Q_DECL_OVERRIDE;
769 void clear(
const QColor& color) Q_DECL_OVERRIDE;
776 virtual void reallocateBuffer() Q_DECL_OVERRIDE;
779#ifdef QCP_OPENGL_PBUFFER
782 explicit QCPPaintBufferGlPbuffer(
const QSize& size,
double devicePixelRatio,
784 virtual ~QCPPaintBufferGlPbuffer() Q_DECL_OVERRIDE;
787 virtual
QCPPainter* startPainting() Q_DECL_OVERRIDE;
788 virtual
void draw(
QCPPainter* painter) const Q_DECL_OVERRIDE;
789 void clear(const QColor& color) Q_DECL_OVERRIDE;
793 QGLPixelBuffer* mGlPBuffer;
797 virtual
void reallocateBuffer() Q_DECL_OVERRIDE;
804 explicit QCPPaintBufferGlFbo(
const QSize& size,
double devicePixelRatio,
805 QWeakPointer<QOpenGLContext> glContext,
806 QWeakPointer<QOpenGLPaintDevice> glPaintDevice);
807 virtual ~QCPPaintBufferGlFbo() Q_DECL_OVERRIDE;
810 virtual
QCPPainter* startPainting() Q_DECL_OVERRIDE;
811 virtual
void donePainting() Q_DECL_OVERRIDE;
812 virtual
void draw(
QCPPainter* painter) const Q_DECL_OVERRIDE;
813 void clear(const QColor& color) Q_DECL_OVERRIDE;
817 QWeakPointer<QOpenGLContext> mGlContext;
818 QWeakPointer<QOpenGLPaintDevice> mGlPaintDevice;
819 QOpenGLFramebufferObject* mGlFrameBuffer;
822 virtual
void reallocateBuffer() Q_DECL_OVERRIDE;
834 Q_PROPERTY(
QCustomPlot* parentPlot READ parentPlot)
835 Q_PROPERTY(QString name READ name)
836 Q_PROPERTY(
int index READ index)
837 Q_PROPERTY(QList<QCPLayerable*> children READ children)
838 Q_PROPERTY(
bool visible READ visible WRITE setVisible)
839 Q_PROPERTY(
LayerMode mode READ mode WRITE setMode)
862 QCustomPlot* parentPlot()
const {
return mParentPlot; }
863 QString name()
const {
return mName; }
864 int index()
const {
return mIndex; }
865 QList<QCPLayerable*>
children()
const {
return mChildren; }
866 bool visible()
const {
return mVisible; }
867 LayerMode mode()
const {
return mMode; }
870 void setVisible(
bool visible);
871 void setMode(LayerMode mode);
881 QList<QCPLayerable*> mChildren;
886 QWeakPointer<QCPAbstractPaintBuffer> mPaintBuffer;
890 void drawToPaintBuffer();
905 Q_PROPERTY(
bool visible READ visible WRITE setVisible)
906 Q_PROPERTY(
QCustomPlot* parentPlot READ parentPlot)
907 Q_PROPERTY(
QCPLayerable* parentLayerable READ parentLayerable)
908 Q_PROPERTY(
QCPLayer* layer READ layer WRITE setLayer NOTIFY layerChanged)
909 Q_PROPERTY(
bool antialiased READ antialiased WRITE setAntialiased)
917 bool visible()
const {
return mVisible; }
918 QCustomPlot* parentPlot()
const {
return mParentPlot; }
920 QCPLayer* layer()
const {
return mLayer; }
921 bool antialiased()
const {
return mAntialiased; }
924 void setVisible(
bool on);
925 Q_SLOT
bool setLayer(
QCPLayer* layer);
926 bool setLayer(
const QString& layerName);
927 void setAntialiased(
bool enabled);
930 virtual double selectTest(
const QPointF& pos,
bool onlySelectable,
931 QVariant* details =
nullptr)
const;
934 bool realVisibility()
const;
943 QPointer<QCPLayerable> mParentLayerable;
948 virtual void parentPlotInitialized(
QCustomPlot* parentPlot);
950 virtual QRect clipRect()
const;
954 virtual void selectEvent(QMouseEvent* event,
bool additive,
955 const QVariant& details,
956 bool* selectionStateChanged);
957 virtual void deselectEvent(
bool* selectionStateChanged);
959 virtual void mousePressEvent(QMouseEvent* event,
const QVariant& details);
960 virtual void mouseMoveEvent(QMouseEvent* event,
const QPointF& startPos);
961 virtual void mouseReleaseEvent(QMouseEvent* event,
const QPointF& startPos);
962 virtual void mouseDoubleClickEvent(QMouseEvent* event,
963 const QVariant& details);
964 virtual void wheelEvent(QWheelEvent* event);
967 void initializeParentPlot(
QCustomPlot* parentPlot);
969 bool moveToLayer(
QCPLayer* layer,
bool prepend);
970 void applyAntialiasingHint(
QCPPainter* painter,
bool localAntialiased,
991 QCPRange(
double lower,
double upper);
993 bool operator==(
const QCPRange& other)
const {
994 return lower == other.lower && upper == other.upper;
996 bool operator!=(
const QCPRange& other)
const {
return !(*
this == other); }
1020 friend inline const QCPRange operator-(
const QCPRange& range,
double value);
1021 friend inline const QCPRange operator*(
const QCPRange& range,
double value);
1022 friend inline const QCPRange operator*(
double value,
const QCPRange& range);
1023 friend inline const QCPRange operator/(
const QCPRange& range,
double value);
1025 double size()
const {
return upper - lower; }
1026 double center()
const {
return (upper + lower) * 0.5; }
1028 if (lower > upper) {
1029 qSwap(lower, upper);
1032 void expand(
const QCPRange& otherRange);
1033 void expand(
double includeCoord);
1035 QCPRange expanded(
double includeCoord)
const;
1036 QCPRange bounded(
double lowerBound,
double upperBound)
const;
1037 QCPRange sanitizedForLogScale()
const;
1038 QCPRange sanitizedForLinScale()
const;
1039 bool contains(
double value)
const {
return value >= lower && value <= upper; }
1041 static bool validRange(
double lower,
double upper);
1042 static bool validRange(
const QCPRange& range);
1046Q_DECLARE_TYPEINFO(
QCPRange, Q_MOVABLE_TYPE);
1053 d.nospace() <<
"QCPRange(" << range.lower <<
", " << range.upper <<
")";
1122 return mBegin == other.mBegin && mEnd == other.mEnd;
1124 bool operator!=(
const QCPDataRange& other)
const {
return !(*
this == other); }
1127 int begin()
const {
return mBegin; }
1128 int end()
const {
return mEnd; }
1129 int size()
const {
return mEnd - mBegin; }
1137 bool isValid()
const {
return (mEnd >= mBegin) && (mBegin >= 0); }
1143 return QCPDataRange(mBegin + changeBegin, mEnd + changeEnd);
1161 return !(*
this == other);
1186 int dataPointCount()
const;
1192 void addDataRange(
const QCPDataRange& dataRange,
bool simplify =
true);
1194 bool isEmpty()
const {
return mDataRanges.isEmpty(); }
1204 QList<QCPDataRange> mDataRanges;
1206 inline static bool lessThanDataRangeBegin(
const QCPDataRange& a,
1208 return a.begin() < b.begin();
1310 d.nospace() <<
"QCPDataRange(" << dataRange.begin() <<
", " << dataRange.end()
1320 d.nospace() <<
"QCPDataSelection(";
1343 QRect rect()
const {
return mRect; }
1345 QPen pen()
const {
return mPen; }
1346 QBrush brush()
const {
return mBrush; }
1350 void setPen(
const QPen& pen);
1351 void setBrush(
const QBrush& brush);
1354 Q_SLOT
void cancel();
1358 void changed(
const QRect& rect, QMouseEvent* event);
1371 virtual void startSelection(QMouseEvent* event);
1372 virtual void moveSelection(QMouseEvent* event);
1373 virtual void endSelection(QMouseEvent* event);
1374 virtual void keyPressEvent(QKeyEvent* event);
1378 applyDefaultAntialiasingHint(
QCPPainter* painter)
const Q_DECL_OVERRIDE;
1379 virtual void draw(
QCPPainter* painter) Q_DECL_OVERRIDE;
1397 return mChildren.value(side);
1399 bool isEmpty()
const;
1405 QHash<QCP::MarginSide, QList<QCPLayoutElement*>> mChildren;
1423 Q_PROPERTY(
QCPLayout* layout READ layout)
1424 Q_PROPERTY(QRect rect READ rect)
1425 Q_PROPERTY(QRect outerRect READ outerRect WRITE setOuterRect)
1426 Q_PROPERTY(QMargins margins READ margins WRITE setMargins)
1428 QMargins minimumMargins READ minimumMargins WRITE setMinimumMargins)
1429 Q_PROPERTY(QSize minimumSize READ minimumSize WRITE setMinimumSize)
1430 Q_PROPERTY(QSize maximumSize READ maximumSize WRITE setMaximumSize)
1432 setSizeConstraintRect)
1448 Q_ENUMS(UpdatePhase)
1464 Q_ENUMS(SizeConstraintRect)
1471 QRect
rect()
const {
return mRect; }
1473 QMargins margins()
const {
return mMargins; }
1474 QMargins minimumMargins()
const {
return mMinimumMargins; }
1475 QCP::MarginSides autoMargins()
const {
return mAutoMargins; }
1476 QSize minimumSize()
const {
return mMinimumSize; }
1477 QSize maximumSize()
const {
return mMaximumSize; }
1478 SizeConstraintRect sizeConstraintRect()
const {
return mSizeConstraintRect; }
1480 return mMarginGroups.value(side,
nullptr);
1482 QHash<QCP::MarginSide, QCPMarginGroup*> marginGroups()
const {
1483 return mMarginGroups;
1487 void setOuterRect(
const QRect& rect);
1488 void setMargins(
const QMargins& margins);
1489 void setMinimumMargins(
const QMargins& margins);
1490 void setAutoMargins(QCP::MarginSides sides);
1491 void setMinimumSize(
const QSize& size);
1492 void setMinimumSize(
int width,
int height);
1493 void setMaximumSize(
const QSize& size);
1494 void setMaximumSize(
int width,
int height);
1495 void setSizeConstraintRect(SizeConstraintRect constraintRect);
1496 void setMarginGroup(QCP::MarginSides sides,
QCPMarginGroup* group);
1499 virtual void update(UpdatePhase phase);
1500 virtual QSize minimumOuterSizeHint()
const;
1501 virtual QSize maximumOuterSizeHint()
const;
1502 virtual QList<QCPLayoutElement*> elements(
bool recursive)
const;
1505 virtual double selectTest(
const QPointF& pos,
bool onlySelectable,
1506 QVariant* details =
nullptr) const Q_DECL_OVERRIDE;
1511 QSize mMinimumSize, mMaximumSize;
1512 SizeConstraintRect mSizeConstraintRect;
1513 QRect mRect, mOuterRect;
1514 QMargins mMargins, mMinimumMargins;
1515 QCP::MarginSides mAutoMargins;
1519 virtual
int calculateAutoMargin(
QCP::MarginSide side);
1520 virtual
void layoutChanged();
1524 applyDefaultAntialiasingHint(
QCPPainter* painter) const Q_DECL_OVERRIDE {
1527 virtual void draw(
QCPPainter* painter) Q_DECL_OVERRIDE { Q_UNUSED(painter) }
1528 virtual void parentPlotInitialized(
QCustomPlot* parentPlot) Q_DECL_OVERRIDE;
1545 virtual void update(
UpdatePhase phase) Q_DECL_OVERRIDE;
1546 virtual QList<QCPLayoutElement*>
1547 elements(
bool recursive)
const Q_DECL_OVERRIDE;
1554 virtual void simplify();
1557 bool removeAt(
int index);
1563 virtual void updateLayout();
1566 void sizeConstraintsChanged()
const;
1569 QVector<int> getSectionSizes(QVector<int> maxSizes, QVector<int> minSizes,
1570 QVector<double> stretchFactors,
1571 int totalSize)
const;
1583 Q_PROPERTY(
int rowCount READ rowCount)
1584 Q_PROPERTY(
int columnCount READ columnCount)
1585 Q_PROPERTY(QList<double> columnStretchFactors READ columnStretchFactors WRITE
1586 setColumnStretchFactors)
1587 Q_PROPERTY(QList<double> rowStretchFactors READ rowStretchFactors WRITE
1588 setRowStretchFactors)
1589 Q_PROPERTY(
int columnSpacing READ columnSpacing WRITE setColumnSpacing)
1590 Q_PROPERTY(
int rowSpacing READ rowSpacing WRITE setRowSpacing)
1591 Q_PROPERTY(
FillOrder fillOrder READ fillOrder WRITE setFillOrder)
1592 Q_PROPERTY(
int wrap READ wrap WRITE setWrap)
1616 int rowCount()
const {
return mElements.size(); }
1618 return mElements.size() > 0 ? mElements.first().size() : 0;
1620 QList<double> columnStretchFactors()
const {
return mColumnStretchFactors; }
1621 QList<double> rowStretchFactors()
const {
return mRowStretchFactors; }
1622 int columnSpacing()
const {
return mColumnSpacing; }
1623 int rowSpacing()
const {
return mRowSpacing; }
1624 int wrap()
const {
return mWrap; }
1625 FillOrder fillOrder()
const {
return mFillOrder; }
1628 void setColumnStretchFactor(
int column,
double factor);
1629 void setColumnStretchFactors(
const QList<double>& factors);
1630 void setRowStretchFactor(
int row,
double factor);
1631 void setRowStretchFactors(
const QList<double>& factors);
1632 void setColumnSpacing(
int pixels);
1633 void setRowSpacing(
int pixels);
1634 void setWrap(
int count);
1635 void setFillOrder(FillOrder order,
bool rearrange =
true);
1638 virtual void updateLayout() Q_DECL_OVERRIDE;
1639 virtual
int elementCount() const Q_DECL_OVERRIDE {
1640 return rowCount() * columnCount();
1645 virtual QList<QCPLayoutElement*>
1646 elements(
bool recursive)
const Q_DECL_OVERRIDE;
1647 virtual void simplify() Q_DECL_OVERRIDE;
1648 virtual QSize minimumOuterSizeHint() const Q_DECL_OVERRIDE;
1649 virtual QSize maximumOuterSizeHint() const Q_DECL_OVERRIDE;
1655 bool hasElement(
int row,
int column);
1656 void expandTo(
int newRowCount,
int newColumnCount);
1657 void insertRow(
int newIndex);
1658 void insertColumn(
int newIndex);
1659 int rowColToIndex(
int row,
int column) const;
1660 void indexToRowCol(
int index,
int& row,
int& column) const;
1665 QList<
double> mColumnStretchFactors;
1666 QList<
double> mRowStretchFactors;
1667 int mColumnSpacing, mRowSpacing;
1669 FillOrder mFillOrder;
1672 void getMinimumRowColSizes(QVector<
int>* minColWidths,
1673 QVector<
int>* minRowHeights) const;
1674 void getMaximumRowColSizes(QVector<
int>* maxColWidths,
1675 QVector<
int>* maxRowHeights) const;
1696 Q_ENUMS(InsetPlacement)
1702 InsetPlacement insetPlacement(
int index) const;
1703 Qt::Alignment insetAlignment(
int index) const;
1704 QRectF insetRect(
int index) const;
1707 void setInsetPlacement(
int index, InsetPlacement placement);
1708 void setInsetAlignment(
int index, Qt::Alignment alignment);
1709 void setInsetRect(
int index, const QRectF& rect);
1712 virtual
void updateLayout() Q_DECL_OVERRIDE;
1713 virtual
int elementCount() const Q_DECL_OVERRIDE;
1717 virtual
void simplify() Q_DECL_OVERRIDE {}
1718 virtual double selectTest(
const QPointF& pos,
bool onlySelectable,
1719 QVariant* details =
nullptr) const Q_DECL_OVERRIDE;
1728 QList<InsetPlacement> mInsetPlacement;
1729 QList<Qt::Alignment> mInsetAlignment;
1730 QList<QRectF> mInsetRect;
1780 Q_ENUMS(EndingStyle)
1783 QCPLineEnding(EndingStyle style,
double width = 8,
double length = 10,
1784 bool inverted =
false);
1787 EndingStyle style()
const {
return mStyle; }
1788 double width()
const {
return mWidth; }
1789 double length()
const {
return mLength; }
1790 bool inverted()
const {
return mInverted; }
1793 void setStyle(EndingStyle style);
1794 void setWidth(
double width);
1795 void setLength(
double length);
1796 void setInverted(
bool inverted);
1799 double boundingDistance()
const;
1800 double realLength()
const;
1808 double mWidth, mLength;
1842 Q_ENUMS(AnchorReferenceType)
1867 void setAnchorSide(AnchorSide side);
1868 void setAnchorMode(AnchorMode mode);
1869 void setAnchorReference(
const QPointF& pixelPoint);
1870 void setAnchorReferenceType(AnchorReferenceType type);
1871 void setFont(
const QFont& font);
1872 void setColor(
const QColor& color);
1873 void setPadding(
int padding);
1874 void setRotation(
double rotation);
1875 void setSubstituteExponent(
bool enabled);
1876 void setMultiplicationSymbol(QChar symbol);
1877 void setAbbreviateDecimalPowers(
bool enabled);
1878 void setCacheSize(
int labelCount);
1881 AnchorMode anchorMode()
const {
return mAnchorMode; }
1882 AnchorSide anchorSide()
const {
return mAnchorSide; }
1883 QPointF anchorReference()
const {
return mAnchorReference; }
1884 AnchorReferenceType anchorReferenceType()
const {
1885 return mAnchorReferenceType;
1887 QFont font()
const {
return mFont; }
1888 QColor color()
const {
return mColor; }
1889 int padding()
const {
return mPadding; }
1890 double rotation()
const {
return mRotation; }
1891 bool substituteExponent()
const {
return mSubstituteExponent; }
1892 QChar multiplicationSymbol()
const {
return mMultiplicationSymbol; }
1893 bool abbreviateDecimalPowers()
const {
return mAbbreviateDecimalPowers; }
1894 int cacheSize()
const;
1899 void drawTickLabel(
QCPPainter* painter,
const QPointF& tickPos,
1900 const QString& text);
1904 static const QChar SymbolDot;
1905 static const QChar SymbolCross;
1915 QTransform transform;
1918 QString basePart, expPart, suffixPart;
1919 QRect baseBounds, expBounds, suffixBounds;
1922 QRect rotatedTotalBounds;
1924 QFont baseFont, expFont;
1931 QPointF mAnchorReference;
1938 bool mSubstituteExponent;
1939 QChar mMultiplicationSymbol;
1940 bool mAbbreviateDecimalPowers;
1943 QByteArray mLabelParameterHash;
1945 QCache<QString, CachedLabel> mLabelCache;
1946 QRect mAxisSelectionBox, mTickLabelsSelectionBox, mLabelSelectionBox;
1947 int mLetterCapHeight, mLetterDescent;
1950 virtual void drawLabelMaybeCached(
QCPPainter* painter,
const QFont& font,
1951 const QColor& color,
const QPointF& pos,
1953 const QString& text);
1955 generateLabelParameterHash()
const;
1959 QPointF getAnchorPos(
const QPointF& tickPos);
1960 void drawText(
QCPPainter* painter,
const QPointF& pos,
1962 LabelData getTickLabelData(
const QFont& font,
const QColor& color,
1964 const QString& text)
const;
1965 void applyAnchorTransform(
LabelData& labelData)
const;
1969 QByteArray cacheKey(
const QString& text,
const QColor& color,
double rotation,
1971 AnchorSide skewedAnchorSide(
const QPointF& tickPos,
double sideExpandHorz,
1972 double sideExpandVert)
const;
1974 void analyzeFontMetrics();
2000 Q_ENUMS(TickStepStrategy)
2006 TickStepStrategy tickStepStrategy()
const {
return mTickStepStrategy; }
2007 int tickCount()
const {
return mTickCount; }
2008 double tickOrigin()
const {
return mTickOrigin; }
2011 void setTickStepStrategy(TickStepStrategy strategy);
2012 void setTickCount(
int count);
2013 void setTickOrigin(
double origin);
2016 virtual void generate(
const QCPRange& range,
const QLocale& locale,
2017 QChar formatChar,
int precision, QVector<double>& ticks,
2018 QVector<double>* subTicks,
2019 QVector<QString>* tickLabels);
2023 TickStepStrategy mTickStepStrategy;
2028 virtual double getTickStep(
const QCPRange& range);
2029 virtual int getSubTickCount(
double tickStep);
2030 virtual QString getTickLabel(
double tick,
const QLocale& locale,
2031 QChar formatChar,
int precision);
2032 virtual QVector<double> createTickVector(
double tickStep,
2034 virtual QVector<double> createSubTickVector(
int subTickCount,
2035 const QVector<double>& ticks);
2036 virtual QVector<QString> createLabelVector(
const QVector<double>& ticks,
2037 const QLocale& locale,
2038 QChar formatChar,
int precision);
2041 void trimTicks(
const QCPRange& range, QVector<double>& ticks,
2042 bool keepOneOutlier)
const;
2043 double pickClosest(
double target,
const QVector<double>& candidates)
const;
2044 double getMantissa(
double input,
double* magnitude =
nullptr)
const;
2045 double cleanMantissa(
double input)
const;
2051Q_DECLARE_METATYPE(QSharedPointer<QCPAxisTicker>)
2063 QString dateTimeFormat()
const {
return mDateTimeFormat; }
2064 Qt::TimeSpec dateTimeSpec()
const {
return mDateTimeSpec; }
2065#if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0)
2066 QTimeZone timeZone()
const {
return mTimeZone; }
2070 void setDateTimeFormat(
const QString& format);
2071 void setDateTimeSpec(Qt::TimeSpec spec);
2072#if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0)
2073 void setTimeZone(
const QTimeZone& zone);
2078 void setTickOrigin(
const QDateTime& origin);
2081 static QDateTime keyToDateTime(
double key);
2082 static double dateTimeToKey(
const QDateTime& dateTime);
2083 static double dateTimeToKey(
const QDate& date,
2084 Qt::TimeSpec timeSpec = Qt::LocalTime);
2088 QString mDateTimeFormat;
2089 Qt::TimeSpec mDateTimeSpec;
2090#if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0)
2091 QTimeZone mTimeZone;
2101 virtual double getTickStep(
const QCPRange& range) Q_DECL_OVERRIDE;
2102 virtual int getSubTickCount(
double tickStep) Q_DECL_OVERRIDE;
2103 virtual QString getTickLabel(
double tick,
const QLocale& locale,
2104 QChar formatChar,
int precision) Q_DECL_OVERRIDE;
2105 virtual QVector<double>
2106 createTickVector(
double tickStep,
const QCPRange& range) Q_DECL_OVERRIDE;
2139 QString timeFormat()
const {
return mTimeFormat; }
2140 int fieldWidth(TimeUnit unit)
const {
return mFieldWidth.value(unit); }
2143 void setTimeFormat(
const QString& format);
2144 void setFieldWidth(TimeUnit unit,
int width);
2148 QString mTimeFormat;
2149 QHash<TimeUnit, int> mFieldWidth;
2152 TimeUnit mSmallestUnit, mBiggestUnit;
2153 QHash<TimeUnit, QString> mFormatPattern;
2156 virtual double getTickStep(
const QCPRange& range) Q_DECL_OVERRIDE;
2157 virtual int getSubTickCount(
double tickStep) Q_DECL_OVERRIDE;
2158 virtual QString getTickLabel(
double tick,
const QLocale& locale,
2159 QChar formatChar,
int precision) Q_DECL_OVERRIDE;
2162 void replaceUnit(QString& text, TimeUnit unit,
int value)
const;
2191 Q_ENUMS(ScaleStrategy)
2196 double tickStep()
const {
return mTickStep; }
2197 ScaleStrategy scaleStrategy()
const {
return mScaleStrategy; }
2200 void setTickStep(
double step);
2201 void setScaleStrategy(ScaleStrategy strategy);
2206 ScaleStrategy mScaleStrategy;
2209 virtual double getTickStep(
const QCPRange& range) Q_DECL_OVERRIDE;
2223 QMap<double, QString>&
ticks() {
return mTicks; }
2224 int subTickCount()
const {
return mSubTickCount; }
2227 void setTicks(
const QMap<double, QString>& ticks);
2228 void setTicks(
const QVector<double>& positions,
2229 const QVector<QString>& labels);
2230 void setSubTickCount(
int subTicks);
2234 void addTick(
double position,
const QString& label);
2235 void addTicks(
const QMap<double, QString>& ticks);
2236 void addTicks(
const QVector<double>& positions,
2237 const QVector<QString>& labels);
2241 QMap<double, QString> mTicks;
2245 virtual double getTickStep(
const QCPRange& range) Q_DECL_OVERRIDE;
2246 virtual int getSubTickCount(
double tickStep) Q_DECL_OVERRIDE;
2247 virtual QString getTickLabel(
double tick,
const QLocale& locale,
2248 QChar formatChar,
int precision) Q_DECL_OVERRIDE;
2249 virtual QVector<double>
2250 createTickVector(
double tickStep,
const QCPRange& range) Q_DECL_OVERRIDE;
2276 Q_ENUMS(FractionStyle)
2281 QString piSymbol()
const {
return mPiSymbol; }
2282 double piValue()
const {
return mPiValue; }
2283 bool periodicity()
const {
return mPeriodicity; }
2284 FractionStyle fractionStyle()
const {
return mFractionStyle; }
2287 void setPiSymbol(QString symbol);
2288 void setPiValue(
double pi);
2289 void setPeriodicity(
int multiplesOfPi);
2290 void setFractionStyle(FractionStyle style);
2297 FractionStyle mFractionStyle;
2303 virtual double getTickStep(
const QCPRange& range) Q_DECL_OVERRIDE;
2304 virtual int getSubTickCount(
double tickStep) Q_DECL_OVERRIDE;
2305 virtual QString getTickLabel(
double tick,
const QLocale& locale,
2306 QChar formatChar,
int precision) Q_DECL_OVERRIDE;
2309 void simplifyFraction(
int& numerator,
int& denominator)
const;
2310 QString fractionToString(
int numerator,
int denominator)
const;
2311 QString unicodeFraction(
int numerator,
int denominator)
const;
2312 QString unicodeSuperscript(
int number)
const;
2313 QString unicodeSubscript(
int number)
const;
2327 double logBase()
const {
return mLogBase; }
2328 int subTickCount()
const {
return mSubTickCount; }
2331 void setLogBase(
double base);
2332 void setSubTickCount(
int subTicks);
2340 double mLogBaseLnInv;
2343 virtual int getSubTickCount(
double tickStep) Q_DECL_OVERRIDE;
2344 virtual QVector<double>
2345 createTickVector(
double tickStep,
const QCPRange& range) Q_DECL_OVERRIDE;
2356 Q_PROPERTY(
bool subGridVisible READ subGridVisible WRITE setSubGridVisible)
2357 Q_PROPERTY(
bool antialiasedSubGrid READ antialiasedSubGrid WRITE
2358 setAntialiasedSubGrid)
2359 Q_PROPERTY(
bool antialiasedZeroLine READ antialiasedZeroLine WRITE
2360 setAntialiasedZeroLine)
2361 Q_PROPERTY(QPen pen READ pen WRITE setPen)
2362 Q_PROPERTY(QPen subGridPen READ subGridPen WRITE setSubGridPen)
2363 Q_PROPERTY(QPen zeroLinePen READ zeroLinePen WRITE setZeroLinePen)
2369 bool subGridVisible()
const {
return mSubGridVisible; }
2370 bool antialiasedSubGrid()
const {
return mAntialiasedSubGrid; }
2371 bool antialiasedZeroLine()
const {
return mAntialiasedZeroLine; }
2372 QPen pen()
const {
return mPen; }
2373 QPen subGridPen()
const {
return mSubGridPen; }
2374 QPen zeroLinePen()
const {
return mZeroLinePen; }
2377 void setSubGridVisible(
bool visible);
2378 void setAntialiasedSubGrid(
bool enabled);
2379 void setAntialiasedZeroLine(
bool enabled);
2380 void setPen(
const QPen& pen);
2381 void setSubGridPen(
const QPen& pen);
2382 void setZeroLinePen(
const QPen& pen);
2386 bool mSubGridVisible;
2387 bool mAntialiasedSubGrid, mAntialiasedZeroLine;
2388 QPen mPen, mSubGridPen, mZeroLinePen;
2395 applyDefaultAntialiasingHint(
QCPPainter* painter)
const Q_DECL_OVERRIDE;
2396 virtual void draw(
QCPPainter* painter) Q_DECL_OVERRIDE;
2399 void drawGridLines(
QCPPainter* painter)
const;
2400 void drawSubGridLines(
QCPPainter* painter)
const;
2408 Q_PROPERTY(
AxisType axisType READ axisType)
2410 Q_PROPERTY(
ScaleType scaleType READ scaleType WRITE setScaleType NOTIFY
2412 Q_PROPERTY(
QCPRange range READ range WRITE setRange NOTIFY rangeChanged)
2413 Q_PROPERTY(
bool rangeReversed READ rangeReversed WRITE setRangeReversed)
2414 Q_PROPERTY(QSharedPointer<QCPAxisTicker> ticker READ ticker WRITE setTicker)
2415 Q_PROPERTY(
bool ticks READ ticks WRITE setTicks)
2416 Q_PROPERTY(
bool tickLabels READ tickLabels WRITE setTickLabels)
2418 int tickLabelPadding READ tickLabelPadding WRITE setTickLabelPadding)
2419 Q_PROPERTY(QFont tickLabelFont READ tickLabelFont WRITE setTickLabelFont)
2420 Q_PROPERTY(QColor tickLabelColor READ tickLabelColor WRITE setTickLabelColor)
2421 Q_PROPERTY(
double tickLabelRotation READ tickLabelRotation WRITE
2422 setTickLabelRotation)
2423 Q_PROPERTY(
LabelSide tickLabelSide READ tickLabelSide WRITE setTickLabelSide)
2424 Q_PROPERTY(QString numberFormat READ numberFormat WRITE setNumberFormat)
2425 Q_PROPERTY(
int numberPrecision READ numberPrecision WRITE setNumberPrecision)
2426 Q_PROPERTY(QVector<double> tickVector READ tickVector)
2427 Q_PROPERTY(QVector<QString> tickVectorLabels READ tickVectorLabels)
2428 Q_PROPERTY(
int tickLengthIn READ tickLengthIn WRITE setTickLengthIn)
2429 Q_PROPERTY(
int tickLengthOut READ tickLengthOut WRITE setTickLengthOut)
2430 Q_PROPERTY(
bool subTicks READ subTicks WRITE setSubTicks)
2431 Q_PROPERTY(
int subTickLengthIn READ subTickLengthIn WRITE setSubTickLengthIn)
2433 int subTickLengthOut READ subTickLengthOut WRITE setSubTickLengthOut)
2434 Q_PROPERTY(QPen basePen READ basePen WRITE setBasePen)
2435 Q_PROPERTY(QPen tickPen READ tickPen WRITE setTickPen)
2436 Q_PROPERTY(QPen subTickPen READ subTickPen WRITE setSubTickPen)
2437 Q_PROPERTY(QFont labelFont READ labelFont WRITE setLabelFont)
2438 Q_PROPERTY(QColor labelColor READ labelColor WRITE setLabelColor)
2439 Q_PROPERTY(QString label READ label WRITE setLabel)
2440 Q_PROPERTY(
int labelPadding READ labelPadding WRITE setLabelPadding)
2441 Q_PROPERTY(
int padding READ padding WRITE setPadding)
2442 Q_PROPERTY(
int offset READ offset WRITE setOffset)
2443 Q_PROPERTY(SelectableParts selectedParts READ selectedParts WRITE
2444 setSelectedParts NOTIFY selectionChanged)
2445 Q_PROPERTY(SelectableParts selectableParts READ selectableParts WRITE
2446 setSelectableParts NOTIFY selectableChanged)
2447 Q_PROPERTY(QFont selectedTickLabelFont READ selectedTickLabelFont WRITE
2448 setSelectedTickLabelFont)
2450 QFont selectedLabelFont READ selectedLabelFont WRITE setSelectedLabelFont)
2451 Q_PROPERTY(QColor selectedTickLabelColor READ selectedTickLabelColor WRITE
2452 setSelectedTickLabelColor)
2453 Q_PROPERTY(QColor selectedLabelColor READ selectedLabelColor WRITE
2454 setSelectedLabelColor)
2455 Q_PROPERTY(QPen selectedBasePen READ selectedBasePen WRITE setSelectedBasePen)
2456 Q_PROPERTY(QPen selectedTickPen READ selectedTickPen WRITE setSelectedTickPen)
2457 Q_PROPERTY(QPen selectedSubTickPen READ selectedSubTickPen WRITE
2458 setSelectedSubTickPen)
2459 Q_PROPERTY(
QCPLineEnding lowerEnding READ lowerEnding WRITE setLowerEnding)
2460 Q_PROPERTY(
QCPLineEnding upperEnding READ upperEnding WRITE setUpperEnding)
2461 Q_PROPERTY(
QCPGrid* grid READ grid)
2484 Q_DECLARE_FLAGS(AxisTypes, AxisType)
2518 spTickLabels = 0x002
2523 Q_ENUMS(SelectablePart)
2524 Q_FLAGS(SelectableParts)
2525 Q_DECLARE_FLAGS(SelectableParts, SelectablePart)
2528 virtual ~QCPAxis() Q_DECL_OVERRIDE;
2531 AxisType axisType()
const {
return mAxisType; }
2532 QCPAxisRect* axisRect()
const {
return mAxisRect; }
2533 ScaleType scaleType()
const {
return mScaleType; }
2534 const QCPRange range()
const {
return mRange; }
2535 bool rangeReversed()
const {
return mRangeReversed; }
2536 QSharedPointer<QCPAxisTicker>
ticker()
const {
return mTicker; }
2537 bool ticks()
const {
return mTicks; }
2538 bool tickLabels()
const {
return mTickLabels; }
2539 int tickLabelPadding()
const;
2540 QFont tickLabelFont()
const {
return mTickLabelFont; }
2541 QColor tickLabelColor()
const {
return mTickLabelColor; }
2542 double tickLabelRotation()
const;
2543 LabelSide tickLabelSide()
const;
2544 QString numberFormat()
const;
2545 int numberPrecision()
const {
return mNumberPrecision; }
2546 QVector<double> tickVector()
const {
return mTickVector; }
2547 QVector<QString> tickVectorLabels()
const {
return mTickVectorLabels; }
2548 int tickLengthIn()
const;
2549 int tickLengthOut()
const;
2550 bool subTicks()
const {
return mSubTicks; }
2551 int subTickLengthIn()
const;
2552 int subTickLengthOut()
const;
2553 QPen basePen()
const {
return mBasePen; }
2554 QPen tickPen()
const {
return mTickPen; }
2555 QPen subTickPen()
const {
return mSubTickPen; }
2556 QFont labelFont()
const {
return mLabelFont; }
2557 QColor labelColor()
const {
return mLabelColor; }
2558 QString label()
const {
return mLabel; }
2559 int labelPadding()
const;
2560 int padding()
const {
return mPadding; }
2562 SelectableParts selectedParts()
const {
return mSelectedParts; }
2563 SelectableParts selectableParts()
const {
return mSelectableParts; }
2564 QFont selectedTickLabelFont()
const {
return mSelectedTickLabelFont; }
2565 QFont selectedLabelFont()
const {
return mSelectedLabelFont; }
2566 QColor selectedTickLabelColor()
const {
return mSelectedTickLabelColor; }
2567 QColor selectedLabelColor()
const {
return mSelectedLabelColor; }
2568 QPen selectedBasePen()
const {
return mSelectedBasePen; }
2569 QPen selectedTickPen()
const {
return mSelectedTickPen; }
2570 QPen selectedSubTickPen()
const {
return mSelectedSubTickPen; }
2577 Q_SLOT
void setRange(
const QCPRange& range);
2578 void setRange(
double lower,
double upper);
2579 void setRange(
double position,
double size, Qt::AlignmentFlag alignment);
2580 void setRangeLower(
double lower);
2581 void setRangeUpper(
double upper);
2582 void setRangeReversed(
bool reversed);
2583 void setTicker(QSharedPointer<QCPAxisTicker> ticker);
2584 void setTicks(
bool show);
2585 void setTickLabels(
bool show);
2586 void setTickLabelPadding(
int padding);
2587 void setTickLabelFont(
const QFont& font);
2588 void setTickLabelColor(
const QColor& color);
2589 void setTickLabelRotation(
double degrees);
2590 void setTickLabelSide(LabelSide side);
2591 void setNumberFormat(
const QString& formatCode);
2592 void setNumberPrecision(
int precision);
2593 void setTickLength(
int inside,
int outside = 0);
2594 void setTickLengthIn(
int inside);
2595 void setTickLengthOut(
int outside);
2596 void setSubTicks(
bool show);
2597 void setSubTickLength(
int inside,
int outside = 0);
2598 void setSubTickLengthIn(
int inside);
2599 void setSubTickLengthOut(
int outside);
2600 void setBasePen(
const QPen& pen);
2601 void setTickPen(
const QPen& pen);
2602 void setSubTickPen(
const QPen& pen);
2603 void setLabelFont(
const QFont& font);
2604 void setLabelColor(
const QColor& color);
2605 void setLabel(
const QString& str);
2606 void setLabelPadding(
int padding);
2607 void setPadding(
int padding);
2608 void setOffset(
int offset);
2609 void setSelectedTickLabelFont(
const QFont& font);
2610 void setSelectedLabelFont(
const QFont& font);
2611 void setSelectedTickLabelColor(
const QColor& color);
2612 void setSelectedLabelColor(
const QColor& color);
2613 void setSelectedBasePen(
const QPen& pen);
2614 void setSelectedTickPen(
const QPen& pen);
2615 void setSelectedSubTickPen(
const QPen& pen);
2617 setSelectableParts(
const QCPAxis::SelectableParts& selectableParts);
2618 Q_SLOT
void setSelectedParts(
const QCPAxis::SelectableParts& selectedParts);
2623 virtual double selectTest(
const QPointF& pos,
bool onlySelectable,
2624 QVariant* details =
nullptr) const Q_DECL_OVERRIDE;
2627 Qt::Orientation orientation()
const {
return mOrientation; }
2629 return rangeReversed() != (orientation() == Qt::Vertical) ? -1 : 1;
2631 void moveRange(
double diff);
2632 void scaleRange(
double factor);
2633 void scaleRange(
double factor,
double center);
2634 void setScaleRatio(
const QCPAxis* otherAxis,
double ratio = 1.0);
2635 void rescale(
bool onlyVisiblePlottables =
false);
2636 double pixelToCoord(
double value)
const;
2637 double coordToPixel(
double value)
const;
2638 SelectablePart getPartAt(
const QPointF& pos)
const;
2639 QList<QCPAbstractPlottable*> plottables()
const;
2640 QList<QCPGraph*> graphs()
const;
2641 QList<QCPAbstractItem*> items()
const;
2645 return type == atBottom || type == atTop ? Qt::Horizontal : Qt::Vertical;
2647 static AxisType opposite(AxisType type);
2663 Qt::Orientation mOrientation;
2664 SelectableParts mSelectableParts, mSelectedParts;
2665 QPen mBasePen, mSelectedBasePen;
2670 QFont mLabelFont, mSelectedLabelFont;
2671 QColor mLabelColor, mSelectedLabelColor;
2676 QFont mTickLabelFont, mSelectedTickLabelFont;
2677 QColor mTickLabelColor, mSelectedTickLabelColor;
2678 int mNumberPrecision;
2679 QLatin1Char mNumberFormatChar;
2680 bool mNumberBeautifulPowers;
2687 QPen mTickPen, mSelectedTickPen;
2688 QPen mSubTickPen, mSelectedSubTickPen;
2691 bool mRangeReversed;
2697 QSharedPointer<QCPAxisTicker> mTicker;
2698 QVector<double> mTickVector;
2699 QVector<QString> mTickVectorLabels;
2700 QVector<double> mSubTickVector;
2701 bool mCachedMarginValid;
2705 QCP::AntialiasedElements mAADragBackup, mNotAADragBackup;
2708 virtual int calculateMargin();
2712 applyDefaultAntialiasingHint(
QCPPainter* painter)
const Q_DECL_OVERRIDE;
2713 virtual void draw(
QCPPainter* painter) Q_DECL_OVERRIDE;
2716 virtual
void selectEvent(QMouseEvent* event,
bool additive,
2717 const QVariant& details,
2718 bool* selectionStateChanged) Q_DECL_OVERRIDE;
2719 virtual
void deselectEvent(
bool* selectionStateChanged) Q_DECL_OVERRIDE;
2721 virtual
void mousePressEvent(QMouseEvent* event,
2722 const QVariant& details) Q_DECL_OVERRIDE;
2723 virtual
void mouseMoveEvent(QMouseEvent* event,
2724 const QPointF& startPos) Q_DECL_OVERRIDE;
2725 virtual
void mouseReleaseEvent(QMouseEvent* event,
2726 const QPointF& startPos) Q_DECL_OVERRIDE;
2727 virtual
void wheelEvent(QWheelEvent* event) Q_DECL_OVERRIDE;
2730 void setupTickVectors();
2731 QPen getBasePen() const;
2732 QPen getTickPen() const;
2733 QPen getSubTickPen() const;
2734 QFont getTickLabelFont() const;
2735 QFont getLabelFont() const;
2736 QColor getTickLabelColor() const;
2737 QColor getLabelColor() const;
2746Q_DECLARE_OPERATORS_FOR_FLAGS(
QCPAxis::SelectableParts)
2747Q_DECLARE_OPERATORS_FOR_FLAGS(
QCPAxis::AxisTypes)
2762 QRect axisSelectionBox()
const {
return mAxisSelectionBox; }
2763 QRect tickLabelsSelectionBox()
const {
return mTickLabelsSelectionBox; }
2764 QRect labelSelectionBox()
const {
return mLabelSelectionBox; }
2775 int tickLabelPadding;
2776 double tickLabelRotation;
2779 bool substituteExponent;
2780 bool numberMultiplyCross;
2781 int tickLengthIn, tickLengthOut, subTickLengthIn,
2783 QPen tickPen, subTickPen;
2784 QFont tickLabelFont;
2785 QColor tickLabelColor;
2786 QRect axisRect, viewportRect;
2788 bool abbreviateDecimalPowers;
2789 bool reversedEndings;
2791 QVector<double> subTickPositions;
2792 QVector<double> tickPositions;
2793 QVector<QString> tickLabels;
2801 QString basePart, expPart, suffixPart;
2802 QRect baseBounds, expBounds, suffixBounds, totalBounds, rotatedTotalBounds;
2803 QFont baseFont, expFont;
2806 QByteArray mLabelParameterHash;
2808 QCache<QString, CachedLabel> mLabelCache;
2809 QRect mAxisSelectionBox, mTickLabelsSelectionBox, mLabelSelectionBox;
2811 virtual QByteArray generateLabelParameterHash()
const;
2813 virtual void placeTickLabel(
QCPPainter* painter,
double position,
2814 int distanceToAxis,
const QString& text,
2815 QSize* tickLabelsSize);
2816 virtual void drawTickLabel(
QCPPainter* painter,
double x,
double y,
2819 const QString& text)
const;
2820 virtual QPointF getTickLabelDrawOffset(
const TickLabelData& labelData)
const;
2821 virtual void getMaxTickLabelSize(
const QFont& font,
const QString& text,
2822 QSize* tickLabelsSize)
const;
2855 Q_ENUMS(ScatterProperty)
2856 Q_FLAGS(ScatterProperties)
2857 Q_DECLARE_FLAGS(ScatterProperties, ScatterProperty)
2915 Q_ENUMS(ScatterShape)
2919 QCPScatterStyle(ScatterShape shape,
const QColor& color,
double size);
2920 QCPScatterStyle(ScatterShape shape,
const QColor& color,
const QColor& fill,
2922 QCPScatterStyle(ScatterShape shape,
const QPen& pen,
const QBrush& brush,
2926 const QBrush& brush = Qt::NoBrush,
double size = 6);
2929 double size()
const {
return mSize; }
2930 ScatterShape shape()
const {
return mShape; }
2931 QPen pen()
const {
return mPen; }
2932 QBrush brush()
const {
return mBrush; }
2933 QPixmap pixmap()
const {
return mPixmap; }
2934 QPainterPath customPath()
const {
return mCustomPath; }
2937 void setFromOther(
const QCPScatterStyle& other, ScatterProperties properties);
2938 void setSize(
double size);
2939 void setShape(ScatterShape shape);
2940 void setPen(
const QPen& pen);
2941 void setBrush(
const QBrush& brush);
2942 void setPixmap(
const QPixmap& pixmap);
2943 void setCustomPath(
const QPainterPath& customPath);
2946 bool isNone()
const {
return mShape == ssNone; }
2949 void applyTo(
QCPPainter* painter,
const QPen& defaultPen)
const;
2950 void drawShape(
QCPPainter* painter,
const QPointF& pos)
const;
2951 void drawShape(
QCPPainter* painter,
double x,
double y)
const;
2956 ScatterShape mShape;
2960 QPainterPath mCustomPath;
2966Q_DECLARE_OPERATORS_FOR_FLAGS(QCPScatterStyle::ScatterProperties)
2980template <
class DataType>
2982 return a.sortKey() < b.sortKey();
2985template <
class DataType>
2991 typedef typename QVector<DataType>::iterator iterator;
2996 int size()
const {
return mData.size() - mPreallocSize; }
2998 bool autoSqueeze()
const {
return mAutoSqueeze; }
3001 void setAutoSqueeze(
bool enabled);
3005 void set(
const QVector<DataType>& data,
bool alreadySorted =
false);
3007 void add(
const QVector<DataType>& data,
bool alreadySorted =
false);
3008 void add(
const DataType& data);
3009 void removeBefore(
double sortKey);
3010 void removeAfter(
double sortKey);
3011 void remove(
double sortKeyFrom,
double sortKeyTo);
3012 void remove(
double sortKey);
3015 void squeeze(
bool preAllocation =
true,
bool postAllocation =
true);
3017 const_iterator constBegin()
const {
3018 return mData.constBegin() + mPreallocSize;
3021 iterator
begin() {
return mData.begin() + mPreallocSize; }
3022 iterator
end() {
return mData.end(); }
3023 const_iterator findBegin(
double sortKey,
bool expandedRange =
true)
const;
3024 const_iterator findEnd(
double sortKey,
bool expandedRange =
true)
const;
3026 return constBegin() + qBound(0, index, size());
3029 QCPRange valueRange(
bool& foundRange,
3033 void limitIteratorsToDataRange(const_iterator& begin, const_iterator& end,
3041 QVector<DataType> mData;
3043 int mPreallocIteration;
3046 void preallocateGrow(
int minimumPreallocSize);
3047 void performAutoSqueeze();
3203template <
class DataType>
3205 : mAutoSqueeze(true), mPreallocSize(0), mPreallocIteration(0) {}
3215template <
class DataType>
3217 if (mAutoSqueeze != enabled) {
3218 mAutoSqueeze = enabled;
3220 performAutoSqueeze();
3231template <
class DataType>
3247template <
class DataType>
3249 bool alreadySorted) {
3252 mPreallocIteration = 0;
3253 if (!alreadySorted) {
3264template <
class DataType>
3270 const int n = data.
size();
3271 const int oldSize = size();
3274 !qcpLessThanSortKey<DataType>(
3279 if (mPreallocSize < n) {
3283 std::copy(data.constBegin(), data.
constEnd(), begin());
3286 mData.resize(mData.size() + n);
3287 std::copy(data.constBegin(), data.
constEnd(), end() - n);
3289 !qcpLessThanSortKey<DataType>(
3290 *(constEnd() - n - 1),
3294 std::inplace_merge(begin(), end() - n, end(),
3295 qcpLessThanSortKey<DataType>);
3309template <
class DataType>
3311 bool alreadySorted) {
3312 if (data.isEmpty()) {
3316 set(data, alreadySorted);
3320 const int n = data.size();
3321 const int oldSize = size();
3323 if (alreadySorted && oldSize > 0 &&
3324 !qcpLessThanSortKey<DataType>(
3326 *(data.constEnd() - 1)))
3329 if (mPreallocSize < n) {
3333 std::copy(data.constBegin(), data.constEnd(), begin());
3337 mData.resize(mData.size() + n);
3338 std::copy(data.constBegin(), data.constEnd(), end() - n);
3339 if (!alreadySorted) {
3340 std::sort(end() - n, end(), qcpLessThanSortKey<DataType>);
3343 !qcpLessThanSortKey<DataType>(
3344 *(constEnd() - n - 1),
3348 std::inplace_merge(begin(), end() - n, end(),
3349 qcpLessThanSortKey<DataType>);
3360template <
class DataType>
3363 !qcpLessThanSortKey<DataType>(
3364 data, *(constEnd() - 1)))
3368 }
else if (qcpLessThanSortKey<DataType>(
3369 data, *constBegin()))
3372 if (mPreallocSize < 1) {
3379 QCPDataContainer<DataType>::iterator insertionPoint =
3380 std::lower_bound(begin(), end(), data, qcpLessThanSortKey<DataType>);
3381 mData.insert(insertionPoint, data);
3390template <
class DataType>
3392 QCPDataContainer<DataType>::iterator it = begin();
3393 QCPDataContainer<DataType>::iterator itEnd =
3394 std::lower_bound(begin(), end(), DataType::fromSortKey(sortKey),
3395 qcpLessThanSortKey<DataType>);
3396 mPreallocSize += int(
3400 performAutoSqueeze();
3409template <
class DataType>
3411 QCPDataContainer<DataType>::iterator it =
3412 std::upper_bound(begin(), end(), DataType::fromSortKey(sortKey),
3413 qcpLessThanSortKey<DataType>);
3414 QCPDataContainer<DataType>::iterator itEnd = end();
3415 mData.erase(it, itEnd);
3417 performAutoSqueeze();
3429template <
class DataType>
3431 if (sortKeyFrom >= sortKeyTo || isEmpty()) {
3435 QCPDataContainer<DataType>::iterator it =
3436 std::lower_bound(begin(), end(), DataType::fromSortKey(sortKeyFrom),
3437 qcpLessThanSortKey<DataType>);
3438 QCPDataContainer<DataType>::iterator itEnd =
3439 std::upper_bound(it, end(), DataType::fromSortKey(sortKeyTo),
3440 qcpLessThanSortKey<DataType>);
3441 mData.erase(it, itEnd);
3443 performAutoSqueeze();
3456template <
class DataType>
3458 QCPDataContainer::iterator it =
3459 std::lower_bound(begin(), end(), DataType::fromSortKey(sortKey),
3460 qcpLessThanSortKey<DataType>);
3461 if (it != end() && it->sortKey() == sortKey) {
3462 if (it == begin()) {
3471 performAutoSqueeze();
3482 mPreallocIteration = 0;
3499 std::sort(begin(), end(), qcpLessThanSortKey<DataType>);
3513template <
class DataType>
3515 bool postAllocation) {
3516 if (preAllocation) {
3517 if (mPreallocSize > 0) {
3518 std::copy(begin(), end(), mData.begin());
3519 mData.resize(size());
3522 mPreallocIteration = 0;
3524 if (postAllocation) {
3545template <
class DataType>
3548 bool expandedRange)
const {
3554 std::lower_bound(constBegin(), constEnd(), DataType::fromSortKey(sortKey),
3555 qcpLessThanSortKey<DataType>);
3556 if (expandedRange &&
3557 it != constBegin()) {
3581template <
class DataType>
3589 std::upper_bound(constBegin(), constEnd(), DataType::fromSortKey(sortKey),
3590 qcpLessThanSortKey<DataType>);
3591 if (expandedRange && it != constEnd()) {
3613template <
class DataType>
3621 bool haveLower =
false;
3622 bool haveUpper =
false;
3629 if (DataType::sortKeyIsMainKey())
3636 if (!qIsNaN(it->mainValue())) {
3637 range.lower = it->mainKey();
3644 while (it != constBegin())
3647 if (!qIsNaN(it->mainValue())) {
3648 range.upper = it->mainKey();
3656 while (it != itEnd) {
3657 if (!qIsNaN(it->mainValue())) {
3658 current = it->mainKey();
3659 if (current < range.lower || !haveLower) {
3660 range.lower = current;
3663 if (current > range.upper || !haveUpper) {
3664 range.upper = current;
3671 }
else if (signDomain ==
3674 while (it != itEnd) {
3675 if (!qIsNaN(it->mainValue())) {
3676 current = it->mainKey();
3677 if ((current < range.lower || !haveLower) && current < 0) {
3678 range.lower = current;
3681 if ((current > range.upper || !haveUpper) && current < 0) {
3682 range.upper = current;
3688 }
else if (signDomain ==
3691 while (it != itEnd) {
3692 if (!qIsNaN(it->mainValue())) {
3693 current = it->mainKey();
3694 if ((current < range.lower || !haveLower) && current > 0) {
3695 range.lower = current;
3698 if ((current > range.upper || !haveUpper) && current > 0) {
3699 range.upper = current;
3707 foundRange = haveLower && haveUpper;
3731template <
class DataType>
3740 const bool restrictKeyRange = inKeyRange !=
QCPRange();
3741 bool haveLower =
false;
3742 bool haveUpper =
false;
3746 if (DataType::sortKeyIsMainKey() && restrictKeyRange) {
3747 itBegin = findBegin(inKeyRange.lower,
false);
3748 itEnd = findEnd(inKeyRange.upper,
false);
3754 if (restrictKeyRange && (it->mainKey() < inKeyRange.lower ||
3755 it->mainKey() > inKeyRange.upper)) {
3758 current = it->valueRange();
3759 if ((current.lower < range.lower || !haveLower) &&
3760 !qIsNaN(current.lower) && std::isfinite(current.lower)) {
3761 range.lower = current.lower;
3764 if ((current.upper > range.upper || !haveUpper) &&
3765 !qIsNaN(current.upper) && std::isfinite(current.upper)) {
3766 range.upper = current.upper;
3770 }
else if (signDomain ==
3775 if (restrictKeyRange && (it->mainKey() < inKeyRange.lower ||
3776 it->mainKey() > inKeyRange.upper)) {
3779 current = it->valueRange();
3780 if ((current.lower < range.lower || !haveLower) && current.lower < 0 &&
3781 !qIsNaN(current.lower) && std::isfinite(current.lower)) {
3782 range.lower = current.lower;
3785 if ((current.upper > range.upper || !haveUpper) && current.upper < 0 &&
3786 !qIsNaN(current.upper) && std::isfinite(current.upper)) {
3787 range.upper = current.upper;
3791 }
else if (signDomain ==
3796 if (restrictKeyRange && (it->mainKey() < inKeyRange.lower ||
3797 it->mainKey() > inKeyRange.upper)) {
3800 current = it->valueRange();
3801 if ((current.lower < range.lower || !haveLower) && current.lower > 0 &&
3802 !qIsNaN(current.lower) && std::isfinite(current.lower)) {
3803 range.lower = current.lower;
3806 if ((current.upper > range.upper || !haveUpper) && current.upper > 0 &&
3807 !qIsNaN(current.upper) && std::isfinite(current.upper)) {
3808 range.upper = current.upper;
3814 foundRange = haveLower && haveUpper;
3827template <
class DataType>
3832 int(end - constBegin()));
3833 iteratorRange = iteratorRange.
bounded(dataRange.
bounded(this->dataRange()));
3834 begin = constBegin() + iteratorRange.begin();
3835 end = constBegin() + iteratorRange.end();
3848template <
class DataType>
3850 if (minimumPreallocSize <= mPreallocSize) {
3854 int newPreallocSize = minimumPreallocSize;
3855 newPreallocSize += (1u << qBound(4, mPreallocIteration + 4, 15)) -
3858 ++mPreallocIteration;
3860 int sizeDifference = newPreallocSize - mPreallocSize;
3861 mData.resize(mData.size() + sizeDifference);
3862 std::copy_backward(mData.begin() + mPreallocSize,
3863 mData.end() - sizeDifference, mData.end());
3864 mPreallocSize = newPreallocSize;
3883template <
class DataType>
3885 const int totalAlloc = mData.capacity();
3886 const int postAllocSize = totalAlloc - mData.
size();
3887 const int usedSize = size();
3888 bool shrinkPostAllocation =
false;
3889 bool shrinkPreAllocation =
false;
3890 if (totalAlloc > 650000)
3893 shrinkPostAllocation =
3897 shrinkPreAllocation = mPreallocSize * 10 > usedSize;
3898 }
else if (totalAlloc >
3902 shrinkPostAllocation = postAllocSize > usedSize * 5;
3903 shrinkPreAllocation =
3904 mPreallocSize > usedSize * 1.5;
3908 if (shrinkPreAllocation || shrinkPostAllocation) {
3909 squeeze(shrinkPreAllocation, shrinkPostAllocation);
3925 QPen pen()
const {
return mPen; }
3926 QBrush brush()
const {
return mBrush; }
3928 QCPScatterStyle::ScatterProperties usedScatterProperties()
const {
3929 return mUsedScatterProperties;
3933 void setPen(
const QPen& pen);
3934 void setBrush(
const QBrush& brush);
3936 QCPScatterStyle::ScatterProperties usedProperties =
3938 void setUsedScatterProperties(
3939 const QCPScatterStyle::ScatterProperties& properties);
3956 QCPScatterStyle::ScatterProperties mUsedScatterProperties;
3972 Q_PROPERTY(QString name READ name WRITE
setName)
3974 Q_PROPERTY(
bool antialiasedScatters READ antialiasedScatters WRITE
3976 Q_PROPERTY(QPen pen READ pen WRITE
setPen)
3977 Q_PROPERTY(QBrush brush READ brush WRITE
setBrush)
3992 QString name()
const {
return mName; }
3993 bool antialiasedFill()
const {
return mAntialiasedFill; }
3994 bool antialiasedScatters()
const {
return mAntialiasedScatters; }
3995 QPen pen()
const {
return mPen; }
3996 QBrush brush()
const {
return mBrush; }
3997 QCPAxis* keyAxis()
const {
return mKeyAxis.data(); }
3998 QCPAxis* valueAxis()
const {
return mValueAxis.data(); }
4000 bool selected()
const {
return !mSelection.isEmpty(); }
4003 return mSelectionDecorator;
4007 void setName(
const QString& name);
4010 void setPen(
const QPen& pen);
4011 void setBrush(
const QBrush& brush);
4019 virtual double selectTest(
const QPointF& pos,
bool onlySelectable,
4020 QVariant* details =
nullptr) const
4021 Q_DECL_OVERRIDE = 0;
4033 void coordsToPixels(
double key,
double value,
double& x,
double& y)
const;
4035 void pixelsToCoords(
double x,
double y,
double& key,
double& value)
const;
4037 double& value)
const;
4041 bool inKeyRange =
false)
const;
4055 bool mAntialiasedFill, mAntialiasedScatters;
4058 QPointer<QCPAxis> mKeyAxis, mValueAxis;
4064 virtual QRect clipRect() const Q_DECL_OVERRIDE;
4065 virtual
void draw(
QCPPainter* painter) Q_DECL_OVERRIDE = 0;
4066 virtual
QCP::Interaction selectionCategory() const Q_DECL_OVERRIDE;
4069 virtual
void selectEvent(QMouseEvent* event,
bool additive,
4070 const QVariant& details,
4071 bool* selectionStateChanged) Q_DECL_OVERRIDE;
4072 virtual
void deselectEvent(
bool* selectionStateChanged) Q_DECL_OVERRIDE;
4076 const QRectF& rect) const = 0;
4079 void applyFillAntialiasingHint(
QCPPainter* painter) const;
4080 void applyScattersAntialiasingHint(
QCPPainter* painter) const;
4099 const QString& name,
int anchorId = -1);
4103 QString name()
const {
return mName; }
4104 virtual QPointF pixelPosition()
const;
4114 QSet<QCPItemPosition*> mChildrenX, mChildrenY;
4169 Q_ENUMS(PositionType)
4172 const QString& name);
4177 PositionType typeX()
const {
return mPositionTypeX; }
4178 PositionType typeY()
const {
return mPositionTypeY; }
4180 QCPItemAnchor* parentAnchorX()
const {
return mParentAnchorX; }
4181 QCPItemAnchor* parentAnchorY()
const {
return mParentAnchorY; }
4182 double key()
const {
return mKey; }
4183 double value()
const {
return mValue; }
4184 QPointF coords()
const {
return QPointF(mKey, mValue); }
4185 QCPAxis* keyAxis()
const {
return mKeyAxis.data(); }
4186 QCPAxis* valueAxis()
const {
return mValueAxis.data(); }
4188 virtual QPointF pixelPosition() const Q_DECL_OVERRIDE;
4191 void setType(PositionType type);
4192 void setTypeX(PositionType type);
4193 void setTypeY(PositionType type);
4195 bool keepPixelPosition = false);
4197 bool keepPixelPosition = false);
4199 bool keepPixelPosition = false);
4200 void setCoords(
double key,
double value);
4201 void setCoords(const QPointF& pos);
4204 void setPixelPosition(const QPointF& pixelPosition);
4208 PositionType mPositionTypeX, mPositionTypeY;
4209 QPointer<
QCPAxis> mKeyAxis, mValueAxis;
4211 double mKey, mValue;
4225 Q_PROPERTY(
bool clipToAxisRect READ clipToAxisRect WRITE setClipToAxisRect)
4226 Q_PROPERTY(
QCPAxisRect* clipAxisRect READ clipAxisRect WRITE setClipAxisRect)
4227 Q_PROPERTY(
bool selectable READ selectable WRITE setSelectable NOTIFY
4230 bool selected READ selected WRITE setSelected NOTIFY selectionChanged)
4237 bool clipToAxisRect()
const {
return mClipToAxisRect; }
4239 bool selectable()
const {
return mSelectable; }
4240 bool selected()
const {
return mSelected; }
4243 void setClipToAxisRect(
bool clip);
4245 Q_SLOT
void setSelectable(
bool selectable);
4246 Q_SLOT
void setSelected(
bool selected);
4251 QVariant* details =
nullptr) const Q_DECL_OVERRIDE = 0;
4255 QList<QCPItemAnchor*>
anchors()
const {
return mAnchors; }
4258 bool hasAnchor(
const QString& name)
const;
4262 void selectableChanged(
bool selectable);
4266 bool mClipToAxisRect;
4267 QPointer<QCPAxisRect> mClipAxisRect;
4268 QList<QCPItemPosition*> mPositions;
4269 QList<QCPItemAnchor*> mAnchors;
4270 bool mSelectable, mSelected;
4274 virtual QRect clipRect() const Q_DECL_OVERRIDE;
4276 applyDefaultAntialiasingHint(
QCPPainter* painter) const Q_DECL_OVERRIDE;
4277 virtual
void draw(
QCPPainter* painter) Q_DECL_OVERRIDE = 0;
4279 virtual
void selectEvent(QMouseEvent* event,
bool additive,
4280 const QVariant& details,
4281 bool* selectionStateChanged) Q_DECL_OVERRIDE;
4282 virtual
void deselectEvent(
bool* selectionStateChanged) Q_DECL_OVERRIDE;
4285 virtual QPointF anchorPixelPosition(
int anchorId) const;
4288 double rectDistance(const QRectF& rect, const QPointF& pos,
4289 bool filledRect) const;
4291 QCPItemAnchor* createAnchor(const QString& name,
int anchorId);
4308 Q_PROPERTY(QRect viewport READ viewport WRITE setViewport)
4309 Q_PROPERTY(QPixmap background READ background WRITE setBackground)
4311 bool backgroundScaled READ backgroundScaled WRITE setBackgroundScaled)
4312 Q_PROPERTY(Qt::AspectRatioMode backgroundScaledMode READ backgroundScaledMode
4313 WRITE setBackgroundScaledMode)
4315 Q_PROPERTY(
bool autoAddPlottableToLegend READ autoAddPlottableToLegend WRITE
4316 setAutoAddPlottableToLegend)
4317 Q_PROPERTY(
int selectionTolerance READ selectionTolerance WRITE
4318 setSelectionTolerance)
4319 Q_PROPERTY(
bool noAntialiasingOnDrag READ noAntialiasingOnDrag WRITE
4320 setNoAntialiasingOnDrag)
4321 Q_PROPERTY(Qt::KeyboardModifier multiSelectModifier READ multiSelectModifier
4322 WRITE setMultiSelectModifier)
4323 Q_PROPERTY(
bool openGl READ openGl WRITE setOpenGl)
4336 Q_ENUMS(LayerInsertMode)
4362 Q_ENUMS(RefreshPriority)
4368 QRect viewport()
const {
return mViewport; }
4369 double bufferDevicePixelRatio()
const {
return mBufferDevicePixelRatio; }
4370 QPixmap background()
const {
return mBackgroundPixmap; }
4371 bool backgroundScaled()
const {
return mBackgroundScaled; }
4372 Qt::AspectRatioMode backgroundScaledMode()
const {
4373 return mBackgroundScaledMode;
4376 QCP::AntialiasedElements antialiasedElements()
const {
4377 return mAntialiasedElements;
4379 QCP::AntialiasedElements notAntialiasedElements()
const {
4380 return mNotAntialiasedElements;
4382 bool autoAddPlottableToLegend()
const {
return mAutoAddPlottableToLegend; }
4383 const QCP::Interactions interactions()
const {
return mInteractions; }
4384 int selectionTolerance()
const {
return mSelectionTolerance; }
4385 bool noAntialiasingOnDrag()
const {
return mNoAntialiasingOnDrag; }
4386 QCP::PlottingHints plottingHints()
const {
return mPlottingHints; }
4387 Qt::KeyboardModifier multiSelectModifier()
const {
4388 return mMultiSelectModifier;
4391 return mSelectionRectMode;
4394 bool openGl()
const {
return mOpenGl; }
4397 void setViewport(
const QRect& rect);
4398 void setBufferDevicePixelRatio(
double ratio);
4399 void setBackground(
const QPixmap& pm);
4400 void setBackground(
const QPixmap& pm,
bool scaled,
4401 Qt::AspectRatioMode mode = Qt::KeepAspectRatioByExpanding);
4402 void setBackground(
const QBrush& brush);
4403 void setBackgroundScaled(
bool scaled);
4404 void setBackgroundScaledMode(Qt::AspectRatioMode mode);
4406 setAntialiasedElements(
const QCP::AntialiasedElements& antialiasedElements);
4408 bool enabled =
true);
4409 void setNotAntialiasedElements(
4410 const QCP::AntialiasedElements& notAntialiasedElements);
4412 bool enabled =
true);
4413 void setAutoAddPlottableToLegend(
bool on);
4414 void setInteractions(
const QCP::Interactions& interactions);
4415 void setInteraction(
const QCP::Interaction& interaction,
bool enabled =
true);
4416 void setSelectionTolerance(
int pixels);
4417 void setNoAntialiasingOnDrag(
bool enabled);
4418 void setPlottingHints(
const QCP::PlottingHints& hints);
4420 void setMultiSelectModifier(Qt::KeyboardModifier modifier);
4423 void setOpenGl(
bool enabled,
int multisampling = 16);
4430 bool removePlottable(
int index);
4431 int clearPlottables();
4432 int plottableCount()
const;
4433 QList<QCPAbstractPlottable*> selectedPlottables()
const;
4434 template <
class PlottableType>
4435 PlottableType* plottableAt(
const QPointF& pos,
bool onlySelectable =
false,
4436 int* dataIndex =
nullptr)
const;
4438 bool onlySelectable =
false,
4439 int* dataIndex =
nullptr)
const;
4447 bool removeGraph(
int index);
4449 int graphCount()
const;
4450 QList<QCPGraph*> selectedGraphs()
const;
4456 bool removeItem(
int index);
4458 int itemCount()
const;
4459 QList<QCPAbstractItem*> selectedItems()
const;
4460 template <
class ItemType>
4461 ItemType* itemAt(
const QPointF& pos,
bool onlySelectable =
false)
const;
4463 bool onlySelectable =
false)
const;
4467 QCPLayer* layer(
const QString& name)
const;
4470 bool setCurrentLayer(
const QString& name);
4471 bool setCurrentLayer(
QCPLayer* layer);
4472 int layerCount()
const;
4473 bool addLayer(
const QString& name,
QCPLayer* otherLayer =
nullptr,
4474 LayerInsertMode insertMode = limAbove);
4477 LayerInsertMode insertMode = limAbove);
4480 int axisRectCount()
const;
4482 QList<QCPAxisRect*> axisRects()
const;
4484 QCPAxisRect* axisRectAt(
const QPointF& pos)
const;
4485 Q_SLOT
void rescaleAxes(
bool onlyVisiblePlottables =
false);
4487 QList<QCPAxis*> selectedAxes()
const;
4488 QList<QCPLegend*> selectedLegends()
const;
4489 Q_SLOT
void deselectAll();
4491 bool savePdf(
const QString& fileName,
int width = 0,
int height = 0,
4493 const QString& pdfCreator = QString(),
4494 const QString& pdfTitle = QString());
4495 bool savePng(
const QString& fileName,
int width = 0,
int height = 0,
4496 double scale = 1.0,
int quality = -1,
int resolution = 96,
4498 bool saveJpg(
const QString& fileName,
int width = 0,
int height = 0,
4499 double scale = 1.0,
int quality = -1,
int resolution = 96,
4501 bool saveBmp(
const QString& fileName,
int width = 0,
int height = 0,
4502 double scale = 1.0,
int resolution = 96,
4504 bool saveRastered(
const QString& fileName,
int width,
int height,
4505 double scale,
const char* format,
int quality = -1,
4506 int resolution = 96,
4508 QPixmap toPixmap(
int width = 0,
int height = 0,
double scale = 1.0);
4509 void toPainter(
QCPPainter* painter,
int width = 0,
int height = 0);
4512 double replotTime(
bool average =
false)
const;
4525 QMouseEvent* event);
4527 QMouseEvent* event);
4531 QMouseEvent* event);
4533 QMouseEvent* event);
4535 QMouseEvent* event);
4537 QMouseEvent* event);
4547 double mBufferDevicePixelRatio;
4549 bool mAutoAddPlottableToLegend;
4550 QList<QCPAbstractPlottable*> mPlottables;
4551 QList<QCPGraph*> mGraphs;
4553 QList<QCPAbstractItem*> mItems;
4554 QList<QCPLayer*> mLayers;
4555 QCP::AntialiasedElements mAntialiasedElements, mNotAntialiasedElements;
4556 QCP::Interactions mInteractions;
4557 int mSelectionTolerance;
4558 bool mNoAntialiasingOnDrag;
4559 QBrush mBackgroundBrush;
4560 QPixmap mBackgroundPixmap;
4561 QPixmap mScaledBackgroundPixmap;
4562 bool mBackgroundScaled;
4563 Qt::AspectRatioMode mBackgroundScaledMode;
4565 QCP::PlottingHints mPlottingHints;
4566 Qt::KeyboardModifier mMultiSelectModifier;
4572 QList<QSharedPointer<QCPAbstractPaintBuffer>> mPaintBuffers;
4573 QPoint mMousePressPos;
4574 bool mMouseHasMoved;
4575 QPointer<QCPLayerable> mMouseEventLayerable;
4576 QPointer<QCPLayerable> mMouseSignalLayerable;
4577 QVariant mMouseEventLayerableDetails;
4578 QVariant mMouseSignalLayerableDetails;
4581 double mReplotTime, mReplotTimeAverage;
4582 int mOpenGlMultisamples;
4583 QCP::AntialiasedElements mOpenGlAntialiasedElementsBackup;
4584 bool mOpenGlCacheLabelsBackup;
4585#ifdef QCP_OPENGL_FBO
4586 QSharedPointer<QOpenGLContext> mGlContext;
4587 QSharedPointer<QSurface> mGlSurface;
4588 QSharedPointer<QOpenGLPaintDevice> mGlPaintDevice;
4592 virtual QSize minimumSizeHint() const Q_DECL_OVERRIDE;
4593 virtual QSize sizeHint() const Q_DECL_OVERRIDE;
4594 virtual
void paintEvent(QPaintEvent* event) Q_DECL_OVERRIDE;
4595 virtual
void resizeEvent(QResizeEvent* event) Q_DECL_OVERRIDE;
4596 virtual
void mouseDoubleClickEvent(QMouseEvent* event) Q_DECL_OVERRIDE;
4597 virtual
void mousePressEvent(QMouseEvent* event) Q_DECL_OVERRIDE;
4598 virtual
void mouseMoveEvent(QMouseEvent* event) Q_DECL_OVERRIDE;
4599 virtual
void mouseReleaseEvent(QMouseEvent* event) Q_DECL_OVERRIDE;
4600 virtual
void wheelEvent(QWheelEvent* event) Q_DECL_OVERRIDE;
4604 virtual
void updateLayout();
4605 virtual
void axisRemoved(
QCPAxis* axis);
4606 virtual
void legendRemoved(
QCPLegend* legend);
4607 Q_SLOT virtual
void processRectSelection(QRect rect, QMouseEvent* event);
4608 Q_SLOT virtual
void processRectZoom(QRect rect, QMouseEvent* event);
4609 Q_SLOT virtual
void processPointSelection(QMouseEvent* event);
4613 bool registerGraph(
QCPGraph* graph);
4615 void updateLayerIndices() const;
4616 QCPLayerable* layerableAt(const QPointF& pos,
bool onlySelectable,
4617 QVariant* selectionDetails =
nullptr) const;
4619 layerableListAt(const QPointF& pos,
bool onlySelectable,
4620 QList<QVariant>* selectionDetails =
nullptr) const;
4622 void setupPaintBuffers();
4624 bool hasInvalidatedPaintBuffers();
4660template <class PlottableType>
4661PlottableType*
QCustomPlot::plottableAt(const QPointF& pos,
bool onlySelectable,
4662 int* dataIndex)
const {
4663 PlottableType* resultPlottable = 0;
4664 QVariant resultDetails;
4665 double resultDistance =
4666 mSelectionTolerance;
4671 PlottableType* currentPlottable = qobject_cast<PlottableType*>(plottable);
4672 if (!currentPlottable ||
4681 if (currentPlottable->clipRect().contains(
4686 double currentDistance = currentPlottable->selectTest(
4687 pos,
false, dataIndex ? &details :
nullptr);
4688 if (currentDistance >= 0 && currentDistance < resultDistance) {
4689 resultPlottable = currentPlottable;
4690 resultDetails = details;
4691 resultDistance = currentDistance;
4696 if (resultPlottable && dataIndex) {
4702 return resultPlottable;
4720template <
class ItemType>
4722 ItemType* resultItem = 0;
4723 double resultDistance =
4724 mSelectionTolerance;
4729 ItemType* currentItem = qobject_cast<ItemType*>(
item);
4739 if (!currentItem->clipToAxisRect() ||
4740 currentItem->clipRect().contains(
4744 double currentDistance = currentItem->selectTest(pos,
false);
4745 if (currentDistance >= 0 && currentDistance < resultDistance) {
4746 resultItem = currentItem;
4747 resultDistance = currentDistance;
4772 bool onlySelectable)
const = 0;
4773 virtual int findBegin(
double sortKey,
bool expandedRange =
true)
const = 0;
4774 virtual int findEnd(
double sortKey,
bool expandedRange =
true)
const = 0;
4777template <
class DataType>
4800 bool expandedRange = true) const Q_DECL_OVERRIDE;
4802 bool expandedRange = true) const Q_DECL_OVERRIDE;
4805 virtual
double selectTest(const QPointF& pos,
bool onlySelectable,
4806 QVariant* details =
nullptr) const Q_DECL_OVERRIDE;
4813 QSharedPointer<QCPDataContainer<DataType>> mDataContainer;
4817 QList<QCPDataRange>& unselectedSegments)
const;
4819 const QVector<QPointF>& lineData)
const;
5034template <
class DataType>
5040template <
class DataType>
5046template <
class DataType>
5048 return mDataContainer->size();
5054template <
class DataType>
5056 if (index >= 0 && index < mDataContainer->size()) {
5057 return (mDataContainer->constBegin() + index)->mainKey();
5059 qDebug() << Q_FUNC_INFO <<
"Index out of bounds" << index;
5067template <
class DataType>
5069 if (index >= 0 && index < mDataContainer->size()) {
5070 return (mDataContainer->constBegin() + index)->sortKey();
5072 qDebug() << Q_FUNC_INFO <<
"Index out of bounds" << index;
5080template <
class DataType>
5082 if (index >= 0 && index < mDataContainer->size()) {
5083 return (mDataContainer->constBegin() + index)->mainValue();
5085 qDebug() << Q_FUNC_INFO <<
"Index out of bounds" << index;
5093template <
class DataType>
5095 if (index >= 0 && index < mDataContainer->size()) {
5096 return (mDataContainer->constBegin() + index)->valueRange();
5098 qDebug() << Q_FUNC_INFO <<
"Index out of bounds" << index;
5106template <
class DataType>
5108 if (index >= 0 && index < mDataContainer->size()) {
5110 mDataContainer->constBegin() + index;
5111 return coordsToPixels(it->mainKey(), it->mainValue());
5113 qDebug() << Q_FUNC_INFO <<
"Index out of bounds" << index;
5121template <
class DataType>
5123 return DataType::sortKeyIsMainKey();
5134template <
class DataType>
5137 bool onlySelectable)
const {
5139 if ((onlySelectable && mSelectable ==
QCP::stNone) ||
5140 mDataContainer->isEmpty()) {
5143 if (!mKeyAxis || !mValueAxis) {
5148 double key1, value1, key2, value2;
5149 pixelsToCoords(rect.topLeft(), key1, value1);
5150 pixelsToCoords(rect.bottomRight(), key2, value2);
5153 QCPRange valueRange(value1, value2);
5155 mDataContainer->constBegin();
5157 mDataContainer->constEnd();
5158 if (DataType::sortKeyIsMainKey())
5162 begin = mDataContainer->
findBegin(keyRange.lower,
false);
5163 end = mDataContainer->
findEnd(keyRange.upper,
false);
5169 int currentSegmentBegin =
5173 if (currentSegmentBegin == -1) {
5174 if (valueRange.
contains(it->mainValue()) &&
5175 keyRange.
contains(it->mainKey())) {
5176 currentSegmentBegin = int(it - mDataContainer->constBegin());
5178 }
else if (!valueRange.
contains(it->mainValue()) ||
5182 int(it - mDataContainer->constBegin())),
5184 currentSegmentBegin = -1;
5188 if (currentSegmentBegin != -1) {
5190 int(end - mDataContainer->constBegin())),
5201template <
class DataType>
5203 bool expandedRange)
const {
5204 return int(mDataContainer->findBegin(sortKey, expandedRange) -
5205 mDataContainer->constBegin());
5211template <
class DataType>
5213 bool expandedRange)
const {
5214 return int(mDataContainer->findEnd(sortKey, expandedRange) -
5215 mDataContainer->constBegin());
5229template <
class DataType>
5231 bool onlySelectable,
5232 QVariant* details)
const {
5233 if ((onlySelectable && mSelectable ==
QCP::stNone) ||
5234 mDataContainer->isEmpty()) {
5237 if (!mKeyAxis || !mValueAxis) {
5242 double minDistSqr = (std::numeric_limits<double>::max)();
5243 int minDistIndex = mDataContainer->size();
5246 mDataContainer->constBegin();
5248 mDataContainer->constEnd();
5249 if (DataType::sortKeyIsMainKey())
5255 double posKeyMin, posKeyMax, dummy;
5256 pixelsToCoords(pos - QPointF(mParentPlot->selectionTolerance(),
5257 mParentPlot->selectionTolerance()),
5259 pixelsToCoords(pos + QPointF(mParentPlot->selectionTolerance(),
5260 mParentPlot->selectionTolerance()),
5262 if (posKeyMin > posKeyMax) {
5263 qSwap(posKeyMin, posKeyMax);
5265 begin = mDataContainer->
findBegin(posKeyMin,
true);
5266 end = mDataContainer->
findEnd(posKeyMax,
true);
5271 QCPRange keyRange(mKeyAxis->range());
5272 QCPRange valueRange(mValueAxis->range());
5275 const double mainKey = it->mainKey();
5276 const double mainValue = it->mainValue();
5283 const double currentDistSqr =
5285 if (currentDistSqr < minDistSqr) {
5286 minDistSqr = currentDistSqr;
5287 minDistIndex = int(it - mDataContainer->constBegin());
5291 if (minDistIndex != mDataContainer->size()) {
5298 details->setValue(selectionResult);
5300 return qSqrt(minDistSqr);
5313template <
class DataType>
5315 QList<QCPDataRange>& selectedSegments,
5316 QList<QCPDataRange>& unselectedSegments)
const {
5317 selectedSegments.clear();
5318 unselectedSegments.clear();
5346template <
class DataType>
5348 QCPPainter* painter,
const QVector<QPointF>& lineData)
const {
5355 qFuzzyCompare(painter->pen().widthF(), 1.0)) {
5356 QPen newPen = painter->pen();
5364 painter->pen().style() == Qt::SolidLine &&
5368 bool lastIsNan =
false;
5369 const int lineDataSize = lineData.size();
5370 while (i < lineDataSize &&
5371 (qIsNaN(lineData.at(i).y()) ||
5372 qIsNaN(lineData.at(i).x()))) {
5376 while (i < lineDataSize) {
5377 if (!qIsNaN(lineData.at(i).y()) &&
5378 !qIsNaN(lineData.at(i).x()))
5381 painter->
drawLine(lineData.at(i - 1), lineData.at(i));
5391 int segmentStart = 0;
5393 const int lineDataSize = lineData.size();
5394 while (i < lineDataSize) {
5395 if (qIsNaN(lineData.at(i).y()) || qIsNaN(lineData.at(i).x()) ||
5397 lineData.at(i).y()))
5400 painter->drawPolyline(
5401 lineData.constData() + segmentStart,
5404 segmentStart = i + 1;
5409 painter->drawPolyline(lineData.constData() + segmentStart,
5410 lineDataSize - segmentStart);
5435 Q_ENUMS(ColorInterpolation)
5457 Q_ENUMS(NanHandling)
5503 Q_ENUMS(GradientPreset)
5509 return !(*
this == other);
5513 int levelCount()
const {
return mLevelCount; }
5514 QMap<double, QColor> colorStops()
const {
return mColorStops; }
5515 ColorInterpolation colorInterpolation()
const {
return mColorInterpolation; }
5516 NanHandling nanHandling()
const {
return mNanHandling; }
5517 QColor nanColor()
const {
return mNanColor; }
5518 bool periodic()
const {
return mPeriodic; }
5521 void setLevelCount(
int n);
5522 void setColorStops(
const QMap<double, QColor>& colorStops);
5523 void setColorStopAt(
double position,
const QColor& color);
5524 void setColorInterpolation(ColorInterpolation interpolation);
5525 void setNanHandling(NanHandling handling);
5526 void setNanColor(
const QColor& color);
5527 void setPeriodic(
bool enabled);
5530 void colorize(
const double* data,
const QCPRange& range, QRgb* scanLine,
5531 int n,
int dataIndexFactor = 1,
bool logarithmic =
false);
5532 void colorize(
const double* data,
const unsigned char* alpha,
5533 const QCPRange& range, QRgb* scanLine,
int n,
5534 int dataIndexFactor = 1,
bool logarithmic =
false);
5535 QRgb color(
double position,
const QCPRange& range,
bool logarithmic =
false);
5536 void loadPreset(GradientPreset preset);
5537 void clearColorStops();
5543 QMap<double, QColor> mColorStops;
5544 ColorInterpolation mColorInterpolation;
5545 NanHandling mNanHandling;
5550 QVector<QRgb> mColorBuffer;
5552 bool mColorBufferInvalidated;
5555 bool stopsUseAlpha()
const;
5556 void updateColorBuffer();
5590 Q_ENUMS(BracketStyle)
5596 QPen bracketPen()
const {
return mBracketPen; }
5597 QBrush bracketBrush()
const {
return mBracketBrush; }
5598 int bracketWidth()
const {
return mBracketWidth; }
5599 int bracketHeight()
const {
return mBracketHeight; }
5600 BracketStyle bracketStyle()
const {
return mBracketStyle; }
5601 bool tangentToData()
const {
return mTangentToData; }
5602 int tangentAverage()
const {
return mTangentAverage; }
5605 void setBracketPen(
const QPen& pen);
5606 void setBracketBrush(
const QBrush& brush);
5607 void setBracketWidth(
int width);
5608 void setBracketHeight(
int height);
5609 void setBracketStyle(BracketStyle style);
5610 void setTangentToData(
bool enabled);
5611 void setTangentAverage(
int pointCount);
5614 virtual void drawBracket(
QCPPainter* painter,
int direction)
const;
5617 virtual void drawDecoration(
QCPPainter* painter,
5623 QBrush mBracketBrush;
5626 BracketStyle mBracketStyle;
5627 bool mTangentToData;
5628 int mTangentAverage;
5632 int dataIndex,
int direction)
const;
5634 int dataIndex)
const;
5646 Q_PROPERTY(QPixmap background READ background WRITE setBackground)
5648 bool backgroundScaled READ backgroundScaled WRITE setBackgroundScaled)
5649 Q_PROPERTY(Qt::AspectRatioMode backgroundScaledMode READ backgroundScaledMode
5650 WRITE setBackgroundScaledMode)
5651 Q_PROPERTY(Qt::Orientations rangeDrag READ rangeDrag WRITE setRangeDrag)
5652 Q_PROPERTY(Qt::Orientations rangeZoom READ rangeZoom WRITE setRangeZoom)
5659 QPixmap background()
const {
return mBackgroundPixmap; }
5660 QBrush backgroundBrush()
const {
return mBackgroundBrush; }
5661 bool backgroundScaled()
const {
return mBackgroundScaled; }
5662 Qt::AspectRatioMode backgroundScaledMode()
const {
5663 return mBackgroundScaledMode;
5665 Qt::Orientations rangeDrag()
const {
return mRangeDrag; }
5666 Qt::Orientations rangeZoom()
const {
return mRangeZoom; }
5667 QCPAxis* rangeDragAxis(Qt::Orientation orientation);
5668 QCPAxis* rangeZoomAxis(Qt::Orientation orientation);
5669 QList<QCPAxis*> rangeDragAxes(Qt::Orientation orientation);
5670 QList<QCPAxis*> rangeZoomAxes(Qt::Orientation orientation);
5671 double rangeZoomFactor(Qt::Orientation orientation);
5674 void setBackground(
const QPixmap& pm);
5675 void setBackground(
const QPixmap& pm,
bool scaled,
5676 Qt::AspectRatioMode mode = Qt::KeepAspectRatioByExpanding);
5677 void setBackground(
const QBrush& brush);
5678 void setBackgroundScaled(
bool scaled);
5679 void setBackgroundScaledMode(Qt::AspectRatioMode mode);
5680 void setRangeDrag(Qt::Orientations orientations);
5681 void setRangeZoom(Qt::Orientations orientations);
5683 void setRangeDragAxes(QList<QCPAxis*> axes);
5684 void setRangeDragAxes(QList<QCPAxis*> horizontal, QList<QCPAxis*> vertical);
5686 void setRangeZoomAxes(QList<QCPAxis*> axes);
5687 void setRangeZoomAxes(QList<QCPAxis*> horizontal, QList<QCPAxis*> vertical);
5688 void setRangeZoomFactor(
double horizontalFactor,
double verticalFactor);
5689 void setRangeZoomFactor(
double factor);
5694 QList<QCPAxis*> axes(QCPAxis::AxisTypes types)
const;
5695 QList<QCPAxis*> axes()
const;
5697 QList<QCPAxis*> addAxes(QCPAxis::AxisTypes types);
5698 bool removeAxis(
QCPAxis* axis);
5701 void zoom(
const QRectF& pixelRect);
5702 void zoom(
const QRectF& pixelRect,
const QList<QCPAxis*>& affectedAxes);
5703 void setupFullAxesBox(
bool connectRanges =
false);
5704 QList<QCPAbstractPlottable*> plottables()
const;
5705 QList<QCPGraph*> graphs()
const;
5706 QList<QCPAbstractItem*> items()
const;
5709 int left()
const {
return mRect.left(); }
5710 int right()
const {
return mRect.right(); }
5711 int top()
const {
return mRect.top(); }
5712 int bottom()
const {
return mRect.bottom(); }
5713 int width()
const {
return mRect.width(); }
5714 int height()
const {
return mRect.height(); }
5715 QSize
size()
const {
return mRect.size(); }
5716 QPoint
topLeft()
const {
return mRect.topLeft(); }
5720 QPoint
center()
const {
return mRect.center(); }
5723 virtual void update(UpdatePhase phase) Q_DECL_OVERRIDE;
5724 virtual QList<QCPLayoutElement*>
5725 elements(
bool recursive)
const Q_DECL_OVERRIDE;
5729 QBrush mBackgroundBrush;
5730 QPixmap mBackgroundPixmap;
5731 QPixmap mScaledBackgroundPixmap;
5732 bool mBackgroundScaled;
5733 Qt::AspectRatioMode mBackgroundScaledMode;
5735 Qt::Orientations mRangeDrag, mRangeZoom;
5736 QList<QPointer<QCPAxis>> mRangeDragHorzAxis, mRangeDragVertAxis;
5737 QList<QPointer<QCPAxis>> mRangeZoomHorzAxis, mRangeZoomVertAxis;
5738 double mRangeZoomFactorHorz, mRangeZoomFactorVert;
5741 QList<QCPRange> mDragStartHorzRange, mDragStartVertRange;
5742 QCP::AntialiasedElements mAADragBackup, mNotAADragBackup;
5744 QHash<QCPAxis::AxisType, QList<QCPAxis*>> mAxes;
5748 applyDefaultAntialiasingHint(
QCPPainter* painter)
const Q_DECL_OVERRIDE;
5749 virtual void draw(
QCPPainter* painter) Q_DECL_OVERRIDE;
5750 virtual int calculateAutoMargin(
QCP::MarginSide side) Q_DECL_OVERRIDE;
5751 virtual void layoutChanged() Q_DECL_OVERRIDE;
5753 virtual
void mousePressEvent(QMouseEvent* event,
5754 const QVariant& details) Q_DECL_OVERRIDE;
5755 virtual
void mouseMoveEvent(QMouseEvent* event,
5756 const QPointF& startPos) Q_DECL_OVERRIDE;
5757 virtual
void mouseReleaseEvent(QMouseEvent* event,
5758 const QPointF& startPos) Q_DECL_OVERRIDE;
5759 virtual
void wheelEvent(QWheelEvent* event) Q_DECL_OVERRIDE;
5763 void updateAxesOffset(
QCPAxis::AxisType type);
5779 Q_PROPERTY(
QCPLegend* parentLegend READ parentLegend)
5780 Q_PROPERTY(QFont font READ font WRITE setFont)
5781 Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor)
5782 Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont)
5783 Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE
5784 setSelectedTextColor)
5785 Q_PROPERTY(
bool selectable READ selectable WRITE setSelectable NOTIFY
5788 bool selected READ selected WRITE setSelected NOTIFY selectableChanged)
5794 QCPLegend* parentLegend()
const {
return mParentLegend; }
5795 QFont font()
const {
return mFont; }
5796 QColor textColor()
const {
return mTextColor; }
5797 QFont selectedFont()
const {
return mSelectedFont; }
5798 QColor selectedTextColor()
const {
return mSelectedTextColor; }
5799 bool selectable()
const {
return mSelectable; }
5800 bool selected()
const {
return mSelected; }
5803 void setFont(
const QFont& font);
5804 void setTextColor(
const QColor& color);
5805 void setSelectedFont(
const QFont& font);
5806 void setSelectedTextColor(
const QColor& color);
5807 Q_SLOT
void setSelectable(
bool selectable);
5808 Q_SLOT
void setSelected(
bool selected);
5811 virtual double selectTest(
const QPointF& pos,
bool onlySelectable,
5812 QVariant* details =
nullptr)
const Q_DECL_OVERRIDE;
5816 void selectableChanged(
bool selectable);
5823 QFont mSelectedFont;
5824 QColor mSelectedTextColor;
5825 bool mSelectable, mSelected;
5830 applyDefaultAntialiasingHint(
QCPPainter* painter) const Q_DECL_OVERRIDE;
5831 virtual QRect clipRect() const Q_DECL_OVERRIDE;
5832 virtual
void draw(
QCPPainter* painter) Q_DECL_OVERRIDE = 0;
5834 virtual
void selectEvent(QMouseEvent* event,
bool additive,
5835 const QVariant& details,
5836 bool* selectionStateChanged) Q_DECL_OVERRIDE;
5837 virtual
void deselectEvent(
bool* selectionStateChanged) Q_DECL_OVERRIDE;
5858 virtual void draw(
QCPPainter* painter) Q_DECL_OVERRIDE;
5859 virtual QSize minimumOuterSizeHint()
const Q_DECL_OVERRIDE;
5862 QPen getIconBorderPen()
const;
5863 QColor getTextColor()
const;
5864 QFont getFont()
const;
5870 Q_PROPERTY(QPen borderPen READ borderPen WRITE setBorderPen)
5871 Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
5872 Q_PROPERTY(QFont font READ font WRITE setFont)
5873 Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor)
5874 Q_PROPERTY(QSize iconSize READ iconSize WRITE setIconSize)
5875 Q_PROPERTY(
int iconTextPadding READ iconTextPadding WRITE setIconTextPadding)
5876 Q_PROPERTY(QPen iconBorderPen READ iconBorderPen WRITE setIconBorderPen)
5877 Q_PROPERTY(SelectableParts selectableParts READ selectableParts WRITE
5878 setSelectableParts NOTIFY selectionChanged)
5879 Q_PROPERTY(SelectableParts selectedParts READ selectedParts WRITE
5880 setSelectedParts NOTIFY selectableChanged)
5882 QPen selectedBorderPen READ selectedBorderPen WRITE setSelectedBorderPen)
5883 Q_PROPERTY(QPen selectedIconBorderPen READ selectedIconBorderPen WRITE
5884 setSelectedIconBorderPen)
5885 Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
5886 Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont)
5887 Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE
5888 setSelectedTextColor)
5904 Q_ENUMS(SelectablePart)
5905 Q_FLAGS(SelectableParts)
5906 Q_DECLARE_FLAGS(SelectableParts, SelectablePart)
5912 QPen borderPen()
const {
return mBorderPen; }
5913 QBrush brush()
const {
return mBrush; }
5914 QFont font()
const {
return mFont; }
5915 QColor textColor()
const {
return mTextColor; }
5916 QSize iconSize()
const {
return mIconSize; }
5917 int iconTextPadding()
const {
return mIconTextPadding; }
5918 QPen iconBorderPen()
const {
return mIconBorderPen; }
5919 SelectableParts selectableParts()
const {
return mSelectableParts; }
5920 SelectableParts selectedParts()
const;
5921 QPen selectedBorderPen()
const {
return mSelectedBorderPen; }
5922 QPen selectedIconBorderPen()
const {
return mSelectedIconBorderPen; }
5923 QBrush selectedBrush()
const {
return mSelectedBrush; }
5924 QFont selectedFont()
const {
return mSelectedFont; }
5925 QColor selectedTextColor()
const {
return mSelectedTextColor; }
5928 void setBorderPen(
const QPen& pen);
5929 void setBrush(
const QBrush& brush);
5930 void setFont(
const QFont& font);
5931 void setTextColor(
const QColor& color);
5932 void setIconSize(
const QSize& size);
5933 void setIconSize(
int width,
int height);
5934 void setIconTextPadding(
int padding);
5935 void setIconBorderPen(
const QPen& pen);
5936 Q_SLOT
void setSelectableParts(
const SelectableParts& selectableParts);
5937 Q_SLOT
void setSelectedParts(
const SelectableParts& selectedParts);
5938 void setSelectedBorderPen(
const QPen& pen);
5939 void setSelectedIconBorderPen(
const QPen& pen);
5940 void setSelectedBrush(
const QBrush& brush);
5941 void setSelectedFont(
const QFont& font);
5942 void setSelectedTextColor(
const QColor& color);
5945 virtual double selectTest(
const QPointF& pos,
bool onlySelectable,
5946 QVariant* details =
nullptr) const Q_DECL_OVERRIDE;
5952 int itemCount() const;
5956 bool removeItem(
int index);
5963 void selectableChanged(
QCPLegend::SelectableParts parts);
5967 QPen mBorderPen, mIconBorderPen;
5972 int mIconTextPadding;
5973 SelectableParts mSelectedParts, mSelectableParts;
5974 QPen mSelectedBorderPen, mSelectedIconBorderPen;
5975 QBrush mSelectedBrush;
5976 QFont mSelectedFont;
5977 QColor mSelectedTextColor;
5980 virtual
void parentPlotInitialized(
QCustomPlot* parentPlot) Q_DECL_OVERRIDE;
5981 virtual
QCP::Interaction selectionCategory() const Q_DECL_OVERRIDE;
5983 applyDefaultAntialiasingHint(
QCPPainter* painter) const Q_DECL_OVERRIDE;
5984 virtual
void draw(
QCPPainter* painter) Q_DECL_OVERRIDE;
5986 virtual
void selectEvent(QMouseEvent* event,
bool additive,
5987 const QVariant& details,
5988 bool* selectionStateChanged) Q_DECL_OVERRIDE;
5989 virtual
void deselectEvent(
bool* selectionStateChanged) Q_DECL_OVERRIDE;
5992 QPen getBorderPen() const;
5993 QBrush getBrush() const;
6001Q_DECLARE_OPERATORS_FOR_FLAGS(
QCPLegend::SelectableParts)
6012 Q_PROPERTY(QString text READ text WRITE setText)
6013 Q_PROPERTY(QFont font READ font WRITE setFont)
6014 Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor)
6015 Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont)
6016 Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE
6017 setSelectedTextColor)
6018 Q_PROPERTY(
bool selectable READ selectable WRITE setSelectable NOTIFY
6021 bool selected READ selected WRITE setSelected NOTIFY selectionChanged)
6029 const QString& fontFamily,
double pointSize);
6034 QString text()
const {
return mText; }
6035 int textFlags()
const {
return mTextFlags; }
6036 QFont font()
const {
return mFont; }
6037 QColor textColor()
const {
return mTextColor; }
6038 QFont selectedFont()
const {
return mSelectedFont; }
6039 QColor selectedTextColor()
const {
return mSelectedTextColor; }
6040 bool selectable()
const {
return mSelectable; }
6041 bool selected()
const {
return mSelected; }
6044 void setText(
const QString& text);
6045 void setTextFlags(
int flags);
6046 void setFont(
const QFont& font);
6047 void setTextColor(
const QColor& color);
6048 void setSelectedFont(
const QFont& font);
6049 void setSelectedTextColor(
const QColor& color);
6050 Q_SLOT
void setSelectable(
bool selectable);
6051 Q_SLOT
void setSelected(
bool selected);
6054 virtual double selectTest(
const QPointF& pos,
bool onlySelectable,
6055 QVariant* details =
nullptr)
const Q_DECL_OVERRIDE;
6056 virtual void mousePressEvent(QMouseEvent* event,
6057 const QVariant& details) Q_DECL_OVERRIDE;
6058 virtual void mouseReleaseEvent(QMouseEvent* event,
6059 const QPointF& startPos) Q_DECL_OVERRIDE;
6060 virtual void mouseDoubleClickEvent(QMouseEvent* event,
6061 const QVariant& details) Q_DECL_OVERRIDE;
6065 void selectableChanged(
bool selectable);
6075 QFont mSelectedFont;
6076 QColor mSelectedTextColor;
6077 QRect mTextBoundingRect;
6078 bool mSelectable, mSelected;
6082 applyDefaultAntialiasingHint(
QCPPainter* painter)
const Q_DECL_OVERRIDE;
6083 virtual void draw(
QCPPainter* painter) Q_DECL_OVERRIDE;
6084 virtual QSize minimumOuterSizeHint() const Q_DECL_OVERRIDE;
6085 virtual QSize maximumOuterSizeHint() const Q_DECL_OVERRIDE;
6087 virtual
void selectEvent(QMouseEvent* event,
bool additive,
6088 const QVariant& details,
6089 bool* selectionStateChanged) Q_DECL_OVERRIDE;
6090 virtual
void deselectEvent(
bool* selectionStateChanged) Q_DECL_OVERRIDE;
6093 QFont mainFont() const;
6094 QColor mainTextColor() const;
6112 QImage mGradientImage;
6113 bool mGradientImageInvalidated;
6116 using QCPAxisRect::calculateAutoMargin;
6122 virtual void draw(
QCPPainter* painter) Q_DECL_OVERRIDE;
6123 void updateGradientImage();
6124 Q_SLOT
void axisSelectionChanged(QCPAxis::SelectableParts selectedParts);
6125 Q_SLOT
void axisSelectableChanged(QCPAxis::SelectableParts selectableParts);
6133 Q_PROPERTY(
QCPRange dataRange READ dataRange WRITE setDataRange NOTIFY
6136 setDataScaleType NOTIFY dataScaleTypeChanged)
6137 Q_PROPERTY(
QCPColorGradient gradient READ gradient WRITE setGradient NOTIFY
6139 Q_PROPERTY(QString label READ label WRITE setLabel)
6140 Q_PROPERTY(
int barWidth READ barWidth WRITE setBarWidth)
6141 Q_PROPERTY(
bool rangeDrag READ rangeDrag WRITE setRangeDrag)
6142 Q_PROPERTY(
bool rangeZoom READ rangeZoom WRITE setRangeZoom)
6151 QCPRange dataRange()
const {
return mDataRange; }
6154 QString label()
const;
6155 int barWidth()
const {
return mBarWidth; }
6156 bool rangeDrag()
const;
6157 bool rangeZoom()
const;
6161 Q_SLOT
void setDataRange(
const QCPRange& dataRange);
6164 void setLabel(
const QString& str);
6165 void setBarWidth(
int width);
6166 void setRangeDrag(
bool enabled);
6167 void setRangeZoom(
bool enabled);
6170 QList<QCPColorMap*> colorMaps()
const;
6171 void rescaleDataRange(
bool onlyVisibleMaps);
6174 virtual void update(UpdatePhase phase) Q_DECL_OVERRIDE;
6190 QPointer<QCPColorScaleAxisRectPrivate> mAxisRect;
6191 QPointer<QCPAxis> mColorAxis;
6195 applyDefaultAntialiasingHint(
QCPPainter* painter)
const Q_DECL_OVERRIDE;
6197 virtual void mousePressEvent(QMouseEvent* event,
6198 const QVariant& details) Q_DECL_OVERRIDE;
6199 virtual void mouseMoveEvent(QMouseEvent* event,
6200 const QPointF& startPos) Q_DECL_OVERRIDE;
6201 virtual void mouseReleaseEvent(QMouseEvent* event,
6202 const QPointF& startPos) Q_DECL_OVERRIDE;
6203 virtual void wheelEvent(QWheelEvent* event) Q_DECL_OVERRIDE;
6252 Q_PROPERTY(
LineStyle lineStyle READ lineStyle WRITE setLineStyle)
6255 Q_PROPERTY(
int scatterSkip READ scatterSkip WRITE setScatterSkip)
6256 Q_PROPERTY(
QCPGraph* channelFillGraph READ channelFillGraph WRITE
6257 setChannelFillGraph)
6259 bool adaptiveSampling READ adaptiveSampling WRITE setAdaptiveSampling)
6293 LineStyle lineStyle()
const {
return mLineStyle; }
6295 int scatterSkip()
const {
return mScatterSkip; }
6296 QCPGraph* channelFillGraph()
const {
return mChannelFillGraph.
data(); }
6297 bool adaptiveSampling()
const {
return mAdaptiveSampling; }
6300 void setData(QSharedPointer<QCPGraphDataContainer> data);
6301 void setData(
const QVector<double>& keys,
const QVector<double>& values,
6302 bool alreadySorted =
false);
6303 void setLineStyle(LineStyle ls);
6305 void setScatterSkip(
int skip);
6306 void setChannelFillGraph(
QCPGraph* targetGraph);
6307 void setAdaptiveSampling(
bool enabled);
6310 void addData(
const QVector<double>& keys,
const QVector<double>& values,
6311 bool alreadySorted =
false);
6312 void addData(
double key,
double value);
6315 virtual double selectTest(
const QPointF& pos,
bool onlySelectable,
6316 QVariant* details =
nullptr) const Q_DECL_OVERRIDE;
6318 getKeyRange(
bool& foundRange,
6319 QCP::SignDomain inSignDomain =
QCP::sdBoth) const Q_DECL_OVERRIDE;
6321 getValueRange(
bool& foundRange,
QCP::SignDomain inSignDomain =
QCP::sdBoth,
6326 LineStyle mLineStyle;
6329 QPointer<
QCPGraph> mChannelFillGraph;
6330 bool mAdaptiveSampling;
6333 virtual
void draw(
QCPPainter* painter) Q_DECL_OVERRIDE;
6334 virtual
void drawLegendIcon(
QCPPainter* painter,
6335 const QRectF& rect) const Q_DECL_OVERRIDE;
6338 virtual
void drawFill(
QCPPainter* painter, QVector<QPointF>* lines) const;
6339 virtual
void drawScatterPlot(
QCPPainter* painter,
6340 const QVector<QPointF>& scatters,
6342 virtual
void drawLinePlot(
QCPPainter* painter,
6343 const QVector<QPointF>& lines) const;
6344 virtual
void drawImpulsePlot(
QCPPainter* painter,
6345 const QVector<QPointF>& lines) const;
6352 getOptimizedScatterData(QVector<
QCPGraphData>* scatterData,
6360 void getLines(QVector<QPointF>* lines, const
QCPDataRange& dataRange) const;
6361 void getScatters(QVector<QPointF>* scatters,
6363 QVector<QPointF> dataToLines(const QVector<
QCPGraphData>& data) const;
6364 QVector<QPointF> dataToStepLeftLines(const QVector<
QCPGraphData>& data) const;
6366 dataToStepRightLines(const QVector<
QCPGraphData>& data) const;
6368 dataToStepCenterLines(const QVector<
QCPGraphData>& data) const;
6369 QVector<QPointF> dataToImpulseLines(const QVector<
QCPGraphData>& data) const;
6370 QVector<
QCPDataRange> getNonNanSegments(const QVector<QPointF>* lineData,
6371 Qt::Orientation keyOrientation) const;
6373 getOverlappingSegments(QVector<
QCPDataRange> thisSegments,
6374 const QVector<QPointF>* thisData,
6376 const QVector<QPointF>* otherData) const;
6377 bool segmentsIntersect(
double aLower,
double aUpper,
double bLower,
6378 double bUpper,
int& bPrecedence) const;
6379 QPointF getFillBasePoint(QPointF matchingDataPoint) const;
6380 const QPolygonF getFillPolygon(const QVector<QPointF>* lineData,
6382 const QPolygonF getChannelFillPolygon(const QVector<QPointF>* thisData,
6384 const QVector<QPointF>* otherData,
6386 int findIndexBelowX(const QVector<QPointF>* data,
double x) const;
6387 int findIndexAboveX(const QVector<QPointF>* data,
double x) const;
6388 int findIndexBelowY(const QVector<QPointF>* data,
double y) const;
6389 int findIndexAboveY(const QVector<QPointF>* data,
double y) const;
6391 pointDistance(const QPointF& pixelPoint,
6397Q_DECLARE_METATYPE(
QCPGraph::LineStyle)
6420 double t, key, value;
6443 Q_PROPERTY(
int scatterSkip READ scatterSkip WRITE setScatterSkip)
6444 Q_PROPERTY(
LineStyle lineStyle READ lineStyle WRITE setLineStyle)
6464 int scatterSkip()
const {
return mScatterSkip; }
6465 LineStyle lineStyle()
const {
return mLineStyle; }
6468 void setData(QSharedPointer<QCPCurveDataContainer> data);
6469 void setData(
const QVector<double>& t,
const QVector<double>& keys,
6470 const QVector<double>& values,
bool alreadySorted =
false);
6471 void setData(
const QVector<double>& keys,
const QVector<double>& values);
6473 void setScatterSkip(
int skip);
6474 void setLineStyle(LineStyle style);
6477 void addData(
const QVector<double>& t,
const QVector<double>& keys,
6478 const QVector<double>& values,
bool alreadySorted =
false);
6479 void addData(
const QVector<double>& keys,
const QVector<double>& values);
6480 void addData(
double t,
double key,
double value);
6481 void addData(
double key,
double value);
6484 virtual double selectTest(
const QPointF& pos,
bool onlySelectable,
6485 QVariant* details =
nullptr) const Q_DECL_OVERRIDE;
6487 getKeyRange(
bool& foundRange,
6488 QCP::SignDomain inSignDomain =
QCP::sdBoth) const Q_DECL_OVERRIDE;
6490 getValueRange(
bool& foundRange,
QCP::SignDomain inSignDomain =
QCP::sdBoth,
6497 LineStyle mLineStyle;
6500 virtual
void draw(
QCPPainter* painter) Q_DECL_OVERRIDE;
6501 virtual
void drawLegendIcon(
QCPPainter* painter,
6502 const QRectF& rect) const Q_DECL_OVERRIDE;
6505 virtual
void drawCurveLine(
QCPPainter* painter,
6506 const QVector<QPointF>& lines) const;
6507 virtual
void drawScatterPlot(
QCPPainter* painter,
6508 const QVector<QPointF>& points,
6512 void getCurveLines(QVector<QPointF>* lines, const
QCPDataRange& dataRange,
6513 double penWidth) const;
6514 void getScatters(QVector<QPointF>* scatters, const
QCPDataRange& dataRange,
6515 double scatterWidth) const;
6516 int getRegion(
double key,
double value,
double keyMin,
double valueMax,
6517 double keyMax,
double valueMin) const;
6518 QPointF getOptimizedPoint(
int otherRegion,
double otherKey,
double otherValue,
6519 double key,
double value,
double keyMin,
6520 double valueMax,
double keyMax,
6521 double valueMin) const;
6522 QVector<QPointF> getOptimizedCornerPoints(
int prevRegion,
int currentRegion,
6523 double prevKey,
double prevValue,
6524 double key,
double value,
6525 double keyMin,
double valueMax,
6527 double valueMin) const;
6528 bool mayTraverse(
int prevRegion,
int currentRegion) const;
6529 bool getTraverse(
double prevKey,
double prevValue,
double key,
double value,
6530 double keyMin,
double valueMax,
double keyMax,
6531 double valueMin, QPointF& crossA, QPointF& crossB) const;
6532 void getTraverseCornerPoints(
int prevRegion,
int currentRegion,
double keyMin,
6533 double valueMax,
double keyMax,
double valueMin,
6534 QVector<QPointF>& beforeTraverse,
6535 QVector<QPointF>& afterTraverse) const;
6537 pointDistance(const QPointF& pixelPoint,
6543Q_DECLARE_METATYPE(
QCPCurve::LineStyle)
6553 Q_PROPERTY(
SpacingType spacingType READ spacingType WRITE setSpacingType)
6554 Q_PROPERTY(
double spacing READ spacing WRITE setSpacing)
6572 Q_ENUMS(SpacingType)
6578 SpacingType spacingType()
const {
return mSpacingType; }
6579 double spacing()
const {
return mSpacing; }
6582 void setSpacingType(SpacingType spacingType);
6583 void setSpacing(
double spacing);
6586 QList<QCPBars*>
bars()
const {
return mBars; }
6587 QCPBars* bars(
int index)
const;
6588 int size()
const {
return mBars.size(); }
6593 void insert(
int i,
QCPBars* bars);
6599 SpacingType mSpacingType;
6601 QList<QCPBars*> mBars;
6604 void registerBars(
QCPBars* bars);
6605 void unregisterBars(
QCPBars* bars);
6608 double keyPixelOffset(
const QCPBars* bars,
double keyCoord);
6609 double getPixelSpacing(
const QCPBars* bars,
double keyCoord);
6657 Q_PROPERTY(
double width READ width WRITE setWidth)
6658 Q_PROPERTY(
WidthType widthType READ widthType WRITE setWidthType)
6659 Q_PROPERTY(
QCPBarsGroup* barsGroup READ barsGroup WRITE setBarsGroup)
6660 Q_PROPERTY(
double baseValue READ baseValue WRITE setBaseValue)
6661 Q_PROPERTY(
double stackingGap READ stackingGap WRITE setStackingGap)
6662 Q_PROPERTY(
QCPBars* barBelow READ barBelow)
6663 Q_PROPERTY(
QCPBars* barAbove READ barAbove)
6683 virtual ~QCPBars() Q_DECL_OVERRIDE;
6686 double width()
const {
return mWidth; }
6687 WidthType widthType()
const {
return mWidthType; }
6689 double baseValue()
const {
return mBaseValue; }
6690 double stackingGap()
const {
return mStackingGap; }
6693 QSharedPointer<QCPBarsDataContainer>
data()
const {
return mDataContainer; }
6696 void setData(QSharedPointer<QCPBarsDataContainer> data);
6697 void setData(
const QVector<double>& keys,
const QVector<double>& values,
6698 bool alreadySorted =
false);
6699 void setWidth(
double width);
6700 void setWidthType(WidthType widthType);
6702 void setBaseValue(
double baseValue);
6703 void setStackingGap(
double pixels);
6706 void addData(
const QVector<double>& keys,
const QVector<double>& values,
6707 bool alreadySorted =
false);
6708 void addData(
double key,
double value);
6709 void moveBelow(
QCPBars* bars);
6710 void moveAbove(
QCPBars* bars);
6714 selectTestRect(
const QRectF& rect,
bool onlySelectable)
const Q_DECL_OVERRIDE;
6715 virtual double selectTest(
const QPointF& pos,
bool onlySelectable,
6716 QVariant* details =
nullptr) const Q_DECL_OVERRIDE;
6718 getKeyRange(
bool& foundRange,
6719 QCP::SignDomain inSignDomain =
QCP::sdBoth) const Q_DECL_OVERRIDE;
6721 getValueRange(
bool& foundRange,
QCP::SignDomain inSignDomain =
QCP::sdBoth,
6723 virtual QPointF dataPixelPosition(
int index) const Q_DECL_OVERRIDE;
6728 WidthType mWidthType;
6731 double mStackingGap;
6732 QPointer<
QCPBars> mBarBelow, mBarAbove;
6735 virtual
void draw(
QCPPainter* painter) Q_DECL_OVERRIDE;
6736 virtual
void drawLegendIcon(
QCPPainter* painter,
6737 const QRectF& rect) const Q_DECL_OVERRIDE;
6742 QRectF getBarRect(
double key,
double value) const;
6743 void getPixelWidth(
double key,
double& lower,
double& upper) const;
6744 double getStackedBaseValue(
double key,
bool positive) const;
6751Q_DECLARE_METATYPE(
QCPBars::WidthType)
6762 double median,
double upperQuartile,
double maximum,
6763 const QVector<double>& outliers = QVector<double>());
6776 for (QVector<double>::const_iterator it = outliers.constBegin();
6777 it != outliers.constEnd(); ++it) {
6783 double key, minimum, lowerQuartile, median, upperQuartile, maximum;
6784 QVector<double> outliers;
6805 Q_PROPERTY(
double width READ width WRITE setWidth)
6806 Q_PROPERTY(
double whiskerWidth READ whiskerWidth WRITE setWhiskerWidth)
6807 Q_PROPERTY(QPen whiskerPen READ whiskerPen WRITE setWhiskerPen)
6808 Q_PROPERTY(QPen whiskerBarPen READ whiskerBarPen WRITE setWhiskerBarPen)
6809 Q_PROPERTY(
bool whiskerAntialiased READ whiskerAntialiased WRITE
6810 setWhiskerAntialiased)
6811 Q_PROPERTY(QPen medianPen READ medianPen WRITE setMedianPen)
6819 QSharedPointer<QCPStatisticalBoxDataContainer>
data()
const {
6820 return mDataContainer;
6822 double width()
const {
return mWidth; }
6823 double whiskerWidth()
const {
return mWhiskerWidth; }
6824 QPen whiskerPen()
const {
return mWhiskerPen; }
6825 QPen whiskerBarPen()
const {
return mWhiskerBarPen; }
6826 bool whiskerAntialiased()
const {
return mWhiskerAntialiased; }
6827 QPen medianPen()
const {
return mMedianPen; }
6831 void setData(QSharedPointer<QCPStatisticalBoxDataContainer> data);
6832 void setData(
const QVector<double>& keys,
const QVector<double>& minimum,
6833 const QVector<double>& lowerQuartile,
6834 const QVector<double>& median,
6835 const QVector<double>& upperQuartile,
6836 const QVector<double>& maximum,
bool alreadySorted =
false);
6837 void setWidth(
double width);
6838 void setWhiskerWidth(
double width);
6839 void setWhiskerPen(
const QPen& pen);
6840 void setWhiskerBarPen(
const QPen& pen);
6841 void setWhiskerAntialiased(
bool enabled);
6842 void setMedianPen(
const QPen& pen);
6846 void addData(
const QVector<double>& keys,
const QVector<double>& minimum,
6847 const QVector<double>& lowerQuartile,
6848 const QVector<double>& median,
6849 const QVector<double>& upperQuartile,
6850 const QVector<double>& maximum,
bool alreadySorted =
false);
6851 void addData(
double key,
double minimum,
double lowerQuartile,
double median,
6852 double upperQuartile,
double maximum,
6853 const QVector<double>& outliers = QVector<double>());
6857 selectTestRect(
const QRectF& rect,
bool onlySelectable)
const Q_DECL_OVERRIDE;
6858 virtual double selectTest(
const QPointF& pos,
bool onlySelectable,
6859 QVariant* details =
nullptr) const Q_DECL_OVERRIDE;
6861 getKeyRange(
bool& foundRange,
6862 QCP::SignDomain inSignDomain =
QCP::sdBoth) const Q_DECL_OVERRIDE;
6864 getValueRange(
bool& foundRange,
QCP::SignDomain inSignDomain =
QCP::sdBoth,
6870 double mWhiskerWidth;
6871 QPen mWhiskerPen, mWhiskerBarPen;
6872 bool mWhiskerAntialiased;
6877 virtual
void draw(
QCPPainter* painter) Q_DECL_OVERRIDE;
6878 virtual
void drawLegendIcon(
QCPPainter* painter,
6879 const QRectF& rect) const Q_DECL_OVERRIDE;
6888 void getVisibleDataBounds(
6893 QVector<QLineF> getWhiskerBackboneLines(
6916 int keySize()
const {
return mKeySize; }
6917 int valueSize()
const {
return mValueSize; }
6918 QCPRange keyRange()
const {
return mKeyRange; }
6919 QCPRange valueRange()
const {
return mValueRange; }
6920 QCPRange dataBounds()
const {
return mDataBounds; }
6921 double data(
double key,
double value);
6922 double cell(
int keyIndex,
int valueIndex);
6923 unsigned char alpha(
int keyIndex,
int valueIndex);
6926 void setSize(
int keySize,
int valueSize);
6927 void setKeySize(
int keySize);
6928 void setValueSize(
int valueSize);
6930 void setKeyRange(
const QCPRange& keyRange);
6931 void setValueRange(
const QCPRange& valueRange);
6932 void setData(
double key,
double value,
double z);
6933 void setCell(
int keyIndex,
int valueIndex,
double z);
6934 void setAlpha(
int keyIndex,
int valueIndex,
unsigned char alpha);
6937 void recalculateDataBounds();
6940 void fill(
double z);
6941 void fillAlpha(
unsigned char alpha);
6943 void coordToCell(
double key,
double value,
int* keyIndex,
6944 int* valueIndex)
const;
6945 void cellToCoord(
int keyIndex,
int valueIndex,
double* key,
6946 double* value)
const;
6950 int mKeySize, mValueSize;
6956 unsigned char* mAlpha;
6960 bool createAlpha(
bool initializeOpaque =
true);
6968 Q_PROPERTY(
QCPRange dataRange READ dataRange WRITE setDataRange NOTIFY
6971 setDataScaleType NOTIFY dataScaleTypeChanged)
6972 Q_PROPERTY(
QCPColorGradient gradient READ gradient WRITE setGradient NOTIFY
6974 Q_PROPERTY(
bool interpolate READ interpolate WRITE setInterpolate)
6975 Q_PROPERTY(
bool tightBoundary READ tightBoundary WRITE setTightBoundary)
6976 Q_PROPERTY(
QCPColorScale* colorScale READ colorScale WRITE setColorScale)
6984 QCPRange dataRange()
const {
return mDataRange; }
6986 bool interpolate()
const {
return mInterpolate; }
6987 bool tightBoundary()
const {
return mTightBoundary; }
6989 QCPColorScale* colorScale()
const {
return mColorScale.data(); }
6993 Q_SLOT
void setDataRange(
const QCPRange& dataRange);
6996 void setInterpolate(
bool enabled);
6997 void setTightBoundary(
bool enabled);
7001 void rescaleDataRange(
bool recalculateDataBounds =
false);
7002 Q_SLOT
void updateLegendIcon(
7003 Qt::TransformationMode transformMode = Qt::SmoothTransformation,
7004 const QSize& thumbSize = QSize(32, 18));
7007 virtual double selectTest(
const QPointF& pos,
bool onlySelectable,
7008 QVariant* details =
nullptr) const Q_DECL_OVERRIDE;
7010 getKeyRange(
bool& foundRange,
7011 QCP::SignDomain inSignDomain =
QCP::sdBoth) const Q_DECL_OVERRIDE;
7013 getValueRange(
bool& foundRange,
QCP::SignDomain inSignDomain =
QCP::sdBoth,
7018 void dataScaleTypeChanged(
QCPAxis::ScaleType scaleType);
7024 QCPAxis::ScaleType mDataScaleType;
7028 bool mTightBoundary;
7032 QImage mMapImage, mUndersampledMapImage;
7033 QPixmap mLegendIcon;
7034 bool mMapImageInvalidated;
7037 virtual
void updateMapImage();
7040 virtual
void draw(
QCPPainter* painter) Q_DECL_OVERRIDE;
7041 virtual
void drawLegendIcon(
QCPPainter* painter,
7042 const QRectF& rect) const Q_DECL_OVERRIDE;
7073 double key, open, high, low, close;
7094 Q_PROPERTY(
ChartStyle chartStyle READ chartStyle WRITE setChartStyle)
7095 Q_PROPERTY(
double width READ width WRITE setWidth)
7096 Q_PROPERTY(
WidthType widthType READ widthType WRITE setWidthType)
7097 Q_PROPERTY(
bool twoColored READ twoColored WRITE setTwoColored)
7098 Q_PROPERTY(QBrush brushPositive READ brushPositive WRITE setBrushPositive)
7099 Q_PROPERTY(QBrush brushNegative READ brushNegative WRITE setBrushNegative)
7100 Q_PROPERTY(QPen penPositive READ penPositive WRITE setPenPositive)
7101 Q_PROPERTY(QPen penNegative READ penNegative WRITE setPenNegative)
7137 return mDataContainer;
7139 ChartStyle chartStyle()
const {
return mChartStyle; }
7140 double width()
const {
return mWidth; }
7141 WidthType widthType()
const {
return mWidthType; }
7142 bool twoColored()
const {
return mTwoColored; }
7143 QBrush brushPositive()
const {
return mBrushPositive; }
7144 QBrush brushNegative()
const {
return mBrushNegative; }
7145 QPen penPositive()
const {
return mPenPositive; }
7146 QPen penNegative()
const {
return mPenNegative; }
7149 void setData(QSharedPointer<QCPFinancialDataContainer> data);
7150 void setData(
const QVector<double>& keys,
const QVector<double>& open,
7151 const QVector<double>& high,
const QVector<double>& low,
7152 const QVector<double>& close,
bool alreadySorted =
false);
7153 void setChartStyle(ChartStyle style);
7154 void setWidth(
double width);
7155 void setWidthType(WidthType widthType);
7156 void setTwoColored(
bool twoColored);
7157 void setBrushPositive(
const QBrush& brush);
7158 void setBrushNegative(
const QBrush& brush);
7159 void setPenPositive(
const QPen& pen);
7160 void setPenNegative(
const QPen& pen);
7163 void addData(
const QVector<double>& keys,
const QVector<double>& open,
7164 const QVector<double>& high,
const QVector<double>& low,
7165 const QVector<double>& close,
bool alreadySorted =
false);
7166 void addData(
double key,
double open,
double high,
double low,
double close);
7170 selectTestRect(
const QRectF& rect,
bool onlySelectable)
const Q_DECL_OVERRIDE;
7171 virtual double selectTest(
const QPointF& pos,
bool onlySelectable,
7172 QVariant* details =
nullptr) const Q_DECL_OVERRIDE;
7174 getKeyRange(
bool& foundRange,
7175 QCP::SignDomain inSignDomain =
QCP::sdBoth) const Q_DECL_OVERRIDE;
7177 getValueRange(
bool& foundRange,
QCP::SignDomain inSignDomain =
QCP::sdBoth,
7182 timeSeriesToOhlc(const QVector<
double>& time, const QVector<
double>& value,
7183 double timeBinSize,
double timeBinOffset = 0);
7187 ChartStyle mChartStyle;
7189 WidthType mWidthType;
7191 QBrush mBrushPositive, mBrushNegative;
7192 QPen mPenPositive, mPenNegative;
7195 virtual
void draw(
QCPPainter* painter) Q_DECL_OVERRIDE;
7196 virtual
void drawLegendIcon(
QCPPainter* painter,
7197 const QRectF& rect) const Q_DECL_OVERRIDE;
7209 double getPixelWidth(
double key,
double keyPixel) const;
7210 double ohlcSelectTest(
7215 double candlestickSelectTest(
7241 double errorMinus, errorPlus;
7261typedef QVector<QCPErrorBarsData> QCPErrorBarsDataContainer;
7268 QSharedPointer<QCPErrorBarsDataContainer> data READ data WRITE setData)
7271 Q_PROPERTY(
ErrorType errorType READ errorType WRITE setErrorType)
7272 Q_PROPERTY(
double whiskerWidth READ whiskerWidth WRITE setWhiskerWidth)
7273 Q_PROPERTY(
double symbolGap READ symbolGap WRITE setSymbolGap)
7295 QSharedPointer<QCPErrorBarsDataContainer> data()
const {
7296 return mDataContainer;
7299 ErrorType errorType()
const {
return mErrorType; }
7300 double whiskerWidth()
const {
return mWhiskerWidth; }
7301 double symbolGap()
const {
return mSymbolGap; }
7304 void setData(QSharedPointer<QCPErrorBarsDataContainer> data);
7305 void setData(
const QVector<double>& error);
7306 void setData(
const QVector<double>& errorMinus,
7307 const QVector<double>& errorPlus);
7309 void setErrorType(ErrorType type);
7310 void setWhiskerWidth(
double pixels);
7311 void setSymbolGap(
double pixels);
7314 void addData(
const QVector<double>& error);
7315 void addData(
const QVector<double>& errorMinus,
7316 const QVector<double>& errorPlus);
7317 void addData(
double error);
7318 void addData(
double errorMinus,
double errorPlus);
7321 virtual int dataCount() const Q_DECL_OVERRIDE;
7322 virtual
double dataMainKey(
int index) const Q_DECL_OVERRIDE;
7323 virtual
double dataSortKey(
int index) const Q_DECL_OVERRIDE;
7324 virtual
double dataMainValue(
int index) const Q_DECL_OVERRIDE;
7325 virtual
QCPRange dataValueRange(
int index) const Q_DECL_OVERRIDE;
7326 virtual QPointF dataPixelPosition(
int index) const Q_DECL_OVERRIDE;
7327 virtual
bool sortKeyIsMainKey() const Q_DECL_OVERRIDE;
7329 selectTestRect(const QRectF& rect,
bool onlySelectable) const Q_DECL_OVERRIDE;
7330 virtual
int findBegin(
double sortKey,
7331 bool expandedRange = true) const Q_DECL_OVERRIDE;
7332 virtual
int findEnd(
double sortKey,
7333 bool expandedRange = true) const Q_DECL_OVERRIDE;
7336 virtual
double selectTest(const QPointF& pos,
bool onlySelectable,
7337 QVariant* details =
nullptr) const Q_DECL_OVERRIDE;
7344 QSharedPointer<QCPErrorBarsDataContainer> mDataContainer;
7345 QPointer<QCPAbstractPlottable> mDataPlottable;
7346 ErrorType mErrorType;
7347 double mWhiskerWidth;
7351 virtual void draw(
QCPPainter* painter) Q_DECL_OVERRIDE;
7352 virtual void drawLegendIcon(
QCPPainter* painter,
7353 const QRectF& rect)
const Q_DECL_OVERRIDE;
7355 getKeyRange(
bool& foundRange,
7362 void getErrorBarLines(QCPErrorBarsDataContainer::const_iterator it,
7363 QVector<QLineF>& backbones,
7364 QVector<QLineF>& whiskers) const;
7365 void getVisibleDataBounds(QCPErrorBarsDataContainer::const_iterator& begin,
7366 QCPErrorBarsDataContainer::const_iterator& end,
7369 pointDistance(const QPointF& pixelPoint,
7370 QCPErrorBarsDataContainer::const_iterator& closestData) const;
7372 void getDataSegments(QList<
QCPDataRange>& selectedSegments,
7374 bool errorBarVisible(
int index) const;
7375 bool rectIntersectsLine(const QRectF& pixelRect, const QLineF& line) const;
7389 Q_PROPERTY(QPen pen READ pen WRITE setPen)
7390 Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
7397 QPen pen()
const {
return mPen; }
7398 QPen selectedPen()
const {
return mSelectedPen; }
7401 void setPen(
const QPen& pen);
7402 void setSelectedPen(
const QPen& pen);
7405 virtual double selectTest(
const QPointF& pos,
bool onlySelectable,
7406 QVariant* details =
nullptr)
const Q_DECL_OVERRIDE;
7413 QPen mPen, mSelectedPen;
7416 virtual void draw(
QCPPainter* painter) Q_DECL_OVERRIDE;
7419 QLineF getRectClippedStraightLine(
const QCPVector2D& base,
7421 const QRect& rect)
const;
7422 QPen mainPen()
const;
7433 Q_PROPERTY(QPen pen READ pen WRITE setPen)
7434 Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
7443 QPen pen()
const {
return mPen; }
7444 QPen selectedPen()
const {
return mSelectedPen; }
7449 void setPen(
const QPen& pen);
7450 void setSelectedPen(
const QPen& pen);
7455 virtual double selectTest(
const QPointF& pos,
bool onlySelectable,
7456 QVariant* details =
nullptr)
const Q_DECL_OVERRIDE;
7463 QPen mPen, mSelectedPen;
7467 virtual void draw(
QCPPainter* painter) Q_DECL_OVERRIDE;
7471 const QRect& rect)
const;
7472 QPen mainPen()
const;
7483 Q_PROPERTY(QPen pen READ pen WRITE setPen)
7484 Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
7493 QPen pen()
const {
return mPen; }
7494 QPen selectedPen()
const {
return mSelectedPen; }
7499 void setPen(
const QPen& pen);
7500 void setSelectedPen(
const QPen& pen);
7505 virtual double selectTest(
const QPointF& pos,
bool onlySelectable,
7506 QVariant* details =
nullptr)
const Q_DECL_OVERRIDE;
7515 QPen mPen, mSelectedPen;
7519 virtual void draw(
QCPPainter* painter) Q_DECL_OVERRIDE;
7522 QPen mainPen()
const;
7533 Q_PROPERTY(QPen pen READ pen WRITE setPen)
7534 Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
7535 Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
7536 Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
7543 QPen pen()
const {
return mPen; }
7544 QPen selectedPen()
const {
return mSelectedPen; }
7545 QBrush brush()
const {
return mBrush; }
7546 QBrush selectedBrush()
const {
return mSelectedBrush; }
7549 void setPen(
const QPen& pen);
7550 void setSelectedPen(
const QPen& pen);
7551 void setBrush(
const QBrush& brush);
7552 void setSelectedBrush(
const QBrush& brush);
7555 virtual double selectTest(
const QPointF& pos,
bool onlySelectable,
7556 QVariant* details =
nullptr)
const Q_DECL_OVERRIDE;
7578 QPen mPen, mSelectedPen;
7579 QBrush mBrush, mSelectedBrush;
7582 virtual void draw(
QCPPainter* painter) Q_DECL_OVERRIDE;
7583 virtual QPointF anchorPixelPosition(
int anchorId)
const Q_DECL_OVERRIDE;
7586 QPen mainPen()
const;
7587 QBrush mainBrush()
const;
7598 Q_PROPERTY(QColor color READ color WRITE setColor)
7599 Q_PROPERTY(QColor selectedColor READ selectedColor WRITE setSelectedColor)
7600 Q_PROPERTY(QPen pen READ pen WRITE setPen)
7601 Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
7602 Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
7603 Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
7604 Q_PROPERTY(QFont font READ font WRITE setFont)
7605 Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont)
7606 Q_PROPERTY(QString text READ text WRITE setText)
7607 Q_PROPERTY(Qt::Alignment positionAlignment READ positionAlignment WRITE
7608 setPositionAlignment)
7610 Qt::Alignment textAlignment READ textAlignment WRITE setTextAlignment)
7611 Q_PROPERTY(
double rotation READ rotation WRITE setRotation)
7612 Q_PROPERTY(QMargins padding READ padding WRITE setPadding)
7619 QColor color()
const {
return mColor; }
7620 QColor selectedColor()
const {
return mSelectedColor; }
7621 QPen pen()
const {
return mPen; }
7622 QPen selectedPen()
const {
return mSelectedPen; }
7623 QBrush brush()
const {
return mBrush; }
7624 QBrush selectedBrush()
const {
return mSelectedBrush; }
7625 QFont font()
const {
return mFont; }
7626 QFont selectedFont()
const {
return mSelectedFont; }
7627 QString text()
const {
return mText; }
7628 Qt::Alignment positionAlignment()
const {
return mPositionAlignment; }
7629 Qt::Alignment textAlignment()
const {
return mTextAlignment; }
7630 double rotation()
const {
return mRotation; }
7631 QMargins padding()
const {
return mPadding; }
7634 void setColor(
const QColor& color);
7635 void setSelectedColor(
const QColor& color);
7636 void setPen(
const QPen& pen);
7637 void setSelectedPen(
const QPen& pen);
7638 void setBrush(
const QBrush& brush);
7639 void setSelectedBrush(
const QBrush& brush);
7640 void setFont(
const QFont& font);
7641 void setSelectedFont(
const QFont& font);
7642 void setText(
const QString& text);
7643 void setPositionAlignment(Qt::Alignment alignment);
7644 void setTextAlignment(Qt::Alignment alignment);
7645 void setRotation(
double degrees);
7646 void setPadding(
const QMargins& padding);
7649 virtual double selectTest(
const QPointF& pos,
bool onlySelectable,
7650 QVariant* details =
nullptr)
const Q_DECL_OVERRIDE;
7675 QColor mColor, mSelectedColor;
7676 QPen mPen, mSelectedPen;
7677 QBrush mBrush, mSelectedBrush;
7678 QFont mFont, mSelectedFont;
7680 Qt::Alignment mPositionAlignment;
7681 Qt::Alignment mTextAlignment;
7686 virtual void draw(
QCPPainter* painter) Q_DECL_OVERRIDE;
7687 virtual QPointF anchorPixelPosition(
int anchorId)
const Q_DECL_OVERRIDE;
7690 QPointF getTextDrawPoint(
const QPointF& pos,
const QRectF& rect,
7691 Qt::Alignment positionAlignment)
const;
7692 QFont mainFont()
const;
7693 QColor mainColor()
const;
7694 QPen mainPen()
const;
7695 QBrush mainBrush()
const;
7706 Q_PROPERTY(QPen pen READ pen WRITE setPen)
7707 Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
7708 Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
7709 Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
7716 QPen pen()
const {
return mPen; }
7717 QPen selectedPen()
const {
return mSelectedPen; }
7718 QBrush brush()
const {
return mBrush; }
7719 QBrush selectedBrush()
const {
return mSelectedBrush; }
7722 void setPen(
const QPen& pen);
7723 void setSelectedPen(
const QPen& pen);
7724 void setBrush(
const QBrush& brush);
7725 void setSelectedBrush(
const QBrush& brush);
7728 virtual double selectTest(
const QPointF& pos,
bool onlySelectable,
7729 QVariant* details =
nullptr)
const Q_DECL_OVERRIDE;
7757 QPen mPen, mSelectedPen;
7758 QBrush mBrush, mSelectedBrush;
7761 virtual void draw(
QCPPainter* painter) Q_DECL_OVERRIDE;
7762 virtual QPointF anchorPixelPosition(
int anchorId)
const Q_DECL_OVERRIDE;
7765 QPen mainPen()
const;
7766 QBrush mainBrush()
const;
7777 Q_PROPERTY(QPixmap pixmap READ pixmap WRITE setPixmap)
7778 Q_PROPERTY(
bool scaled READ scaled WRITE setScaled)
7779 Q_PROPERTY(Qt::AspectRatioMode aspectRatioMode READ aspectRatioMode)
7780 Q_PROPERTY(Qt::TransformationMode transformationMode READ transformationMode)
7781 Q_PROPERTY(QPen pen READ pen WRITE setPen)
7782 Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
7789 QPixmap pixmap()
const {
return mPixmap; }
7790 bool scaled()
const {
return mScaled; }
7791 Qt::AspectRatioMode aspectRatioMode()
const {
return mAspectRatioMode; }
7792 Qt::TransformationMode transformationMode()
const {
7793 return mTransformationMode;
7795 QPen pen()
const {
return mPen; }
7796 QPen selectedPen()
const {
return mSelectedPen; }
7799 void setPixmap(
const QPixmap& pixmap);
7801 bool scaled, Qt::AspectRatioMode aspectRatioMode = Qt::KeepAspectRatio,
7802 Qt::TransformationMode transformationMode = Qt::SmoothTransformation);
7803 void setPen(
const QPen& pen);
7804 void setSelectedPen(
const QPen& pen);
7807 virtual double selectTest(
const QPointF& pos,
bool onlySelectable,
7808 QVariant* details =
nullptr)
const Q_DECL_OVERRIDE;
7831 QPixmap mScaledPixmap;
7833 bool mScaledPixmapInvalidated;
7834 Qt::AspectRatioMode mAspectRatioMode;
7835 Qt::TransformationMode mTransformationMode;
7836 QPen mPen, mSelectedPen;
7839 virtual void draw(
QCPPainter* painter) Q_DECL_OVERRIDE;
7840 virtual QPointF anchorPixelPosition(
int anchorId)
const Q_DECL_OVERRIDE;
7843 void updateScaledPixmap(QRect finalRect = QRect(),
bool flipHorz =
false,
7844 bool flipVert =
false);
7845 QRect getFinalRect(
bool* flippedHorz =
nullptr,
7846 bool* flippedVert =
nullptr)
const;
7847 QPen mainPen()
const;
7858 Q_PROPERTY(QPen pen READ pen WRITE setPen)
7859 Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
7860 Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
7861 Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
7862 Q_PROPERTY(
double size READ size WRITE setSize)
7863 Q_PROPERTY(
TracerStyle style READ style WRITE setStyle)
7864 Q_PROPERTY(
QCPGraph* graph READ graph WRITE setGraph)
7865 Q_PROPERTY(
double graphKey READ graphKey WRITE setGraphKey)
7866 Q_PROPERTY(
bool interpolating READ interpolating WRITE setInterpolating)
7886 Q_ENUMS(TracerStyle)
7892 QPen pen()
const {
return mPen; }
7893 QPen selectedPen()
const {
return mSelectedPen; }
7894 QBrush brush()
const {
return mBrush; }
7895 QBrush selectedBrush()
const {
return mSelectedBrush; }
7896 double size()
const {
return mSize; }
7897 TracerStyle style()
const {
return mStyle; }
7898 QCPGraph* graph()
const {
return mGraph; }
7899 double graphKey()
const {
return mGraphKey; }
7900 bool interpolating()
const {
return mInterpolating; }
7903 void setPen(
const QPen& pen);
7904 void setSelectedPen(
const QPen& pen);
7905 void setBrush(
const QBrush& brush);
7906 void setSelectedBrush(
const QBrush& brush);
7907 void setSize(
double size);
7908 void setStyle(TracerStyle style);
7910 void setGraphKey(
double key);
7911 void setInterpolating(
bool enabled);
7914 virtual double selectTest(
const QPointF& pos,
bool onlySelectable,
7915 QVariant* details =
nullptr) const Q_DECL_OVERRIDE;
7918 void updatePosition();
7924 QPen mPen, mSelectedPen;
7925 QBrush mBrush, mSelectedBrush;
7930 bool mInterpolating;
7933 virtual
void draw(
QCPPainter* painter) Q_DECL_OVERRIDE;
7936 QPen mainPen() const;
7937 QBrush mainBrush() const;
7949 Q_PROPERTY(QPen pen READ pen WRITE setPen)
7950 Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
7951 Q_PROPERTY(
double length READ length WRITE setLength)
7952 Q_PROPERTY(
BracketStyle style READ style WRITE setStyle)
7971 Q_ENUMS(BracketStyle)
7977 QPen pen()
const {
return mPen; }
7978 QPen selectedPen()
const {
return mSelectedPen; }
7979 double length()
const {
return mLength; }
7980 BracketStyle style()
const {
return mStyle; }
7983 void setPen(
const QPen& pen);
7984 void setSelectedPen(
const QPen& pen);
7985 void setLength(
double length);
7986 void setStyle(BracketStyle style);
7989 virtual double selectTest(
const QPointF& pos,
bool onlySelectable,
7990 QVariant* details =
nullptr) const Q_DECL_OVERRIDE;
7998 enum AnchorIndex { aiCenter };
7999 QPen mPen, mSelectedPen;
8001 BracketStyle mStyle;
8004 virtual void draw(
QCPPainter* painter) Q_DECL_OVERRIDE;
8005 virtual QPointF anchorPixelPosition(
int anchorId)
const Q_DECL_OVERRIDE;
8008 QPen mainPen()
const;
8035 Q_ENUMS(AngleReference)
8057 spTickLabels = 0x002
8062 Q_ENUMS(SelectablePart)
8063 Q_FLAGS(SelectableParts)
8064 Q_DECLARE_FLAGS(SelectableParts, SelectablePart)
8077 bool rangeDrag()
const {
return mRangeDrag; }
8078 bool rangeZoom()
const {
return mRangeZoom; }
8079 double rangeZoomFactor()
const {
return mRangeZoomFactor; }
8082 ScaleType scaleType()
const {
return mScaleType; }
8083 const QCPRange range()
const {
return mRange; }
8084 bool rangeReversed()
const {
return mRangeReversed; }
8085 double angle()
const {
return mAngle; }
8086 AngleReference angleReference()
const {
return mAngleReference; }
8087 QSharedPointer<QCPAxisTicker>
ticker()
const {
return mTicker; }
8088 bool ticks()
const {
return mTicks; }
8089 bool tickLabels()
const {
return mTickLabels; }
8090 int tickLabelPadding()
const {
return mLabelPainter.padding(); }
8091 QFont tickLabelFont()
const {
return mTickLabelFont; }
8092 QColor tickLabelColor()
const {
return mTickLabelColor; }
8093 double tickLabelRotation()
const {
return mLabelPainter.rotation(); }
8094 LabelMode tickLabelMode()
const;
8095 QString numberFormat()
const;
8096 int numberPrecision()
const {
return mNumberPrecision; }
8097 QVector<double> tickVector()
const {
return mTickVector; }
8098 QVector<double> subTickVector()
const {
return mSubTickVector; }
8099 QVector<QString> tickVectorLabels()
const {
return mTickVectorLabels; }
8100 int tickLengthIn()
const;
8101 int tickLengthOut()
const;
8102 bool subTicks()
const {
return mSubTicks; }
8103 int subTickLengthIn()
const;
8104 int subTickLengthOut()
const;
8105 QPen basePen()
const {
return mBasePen; }
8106 QPen tickPen()
const {
return mTickPen; }
8107 QPen subTickPen()
const {
return mSubTickPen; }
8108 QFont labelFont()
const {
return mLabelFont; }
8109 QColor labelColor()
const {
return mLabelColor; }
8110 QString label()
const {
return mLabel; }
8111 int labelPadding()
const;
8112 SelectableParts selectedParts()
const {
return mSelectedParts; }
8113 SelectableParts selectableParts()
const {
return mSelectableParts; }
8114 QFont selectedTickLabelFont()
const {
return mSelectedTickLabelFont; }
8115 QFont selectedLabelFont()
const {
return mSelectedLabelFont; }
8116 QColor selectedTickLabelColor()
const {
return mSelectedTickLabelColor; }
8117 QColor selectedLabelColor()
const {
return mSelectedLabelColor; }
8118 QPen selectedBasePen()
const {
return mSelectedBasePen; }
8119 QPen selectedTickPen()
const {
return mSelectedTickPen; }
8120 QPen selectedSubTickPen()
const {
return mSelectedSubTickPen; }
8123 void setRangeDrag(
bool enabled);
8124 void setRangeZoom(
bool enabled);
8125 void setRangeZoomFactor(
double factor);
8128 Q_SLOT
void setRange(
const QCPRange& range);
8129 void setRange(
double lower,
double upper);
8130 void setRange(
double position,
double size, Qt::AlignmentFlag alignment);
8131 void setRangeLower(
double lower);
8132 void setRangeUpper(
double upper);
8133 void setRangeReversed(
bool reversed);
8134 void setAngle(
double degrees);
8135 void setAngleReference(AngleReference reference);
8136 void setTicker(QSharedPointer<QCPAxisTicker> ticker);
8137 void setTicks(
bool show);
8138 void setTickLabels(
bool show);
8139 void setTickLabelPadding(
int padding);
8140 void setTickLabelFont(
const QFont& font);
8141 void setTickLabelColor(
const QColor& color);
8142 void setTickLabelRotation(
double degrees);
8143 void setTickLabelMode(LabelMode mode);
8144 void setNumberFormat(
const QString& formatCode);
8145 void setNumberPrecision(
int precision);
8146 void setTickLength(
int inside,
int outside = 0);
8147 void setTickLengthIn(
int inside);
8148 void setTickLengthOut(
int outside);
8149 void setSubTicks(
bool show);
8150 void setSubTickLength(
int inside,
int outside = 0);
8151 void setSubTickLengthIn(
int inside);
8152 void setSubTickLengthOut(
int outside);
8153 void setBasePen(
const QPen& pen);
8154 void setTickPen(
const QPen& pen);
8155 void setSubTickPen(
const QPen& pen);
8156 void setLabelFont(
const QFont& font);
8157 void setLabelColor(
const QColor& color);
8158 void setLabel(
const QString& str);
8159 void setLabelPadding(
int padding);
8160 void setSelectedTickLabelFont(
const QFont& font);
8161 void setSelectedLabelFont(
const QFont& font);
8162 void setSelectedTickLabelColor(
const QColor& color);
8163 void setSelectedLabelColor(
const QColor& color);
8164 void setSelectedBasePen(
const QPen& pen);
8165 void setSelectedTickPen(
const QPen& pen);
8166 void setSelectedSubTickPen(
const QPen& pen);
8167 Q_SLOT
void setSelectableParts(
8168 const QCPPolarAxisRadial::SelectableParts& selectableParts);
8170 setSelectedParts(
const QCPPolarAxisRadial::SelectableParts& selectedParts);
8173 virtual double selectTest(
const QPointF& pos,
bool onlySelectable,
8174 QVariant* details = 0) const Q_DECL_OVERRIDE;
8177 void moveRange(
double diff);
8178 void scaleRange(
double factor);
8179 void scaleRange(
double factor,
double center);
8180 void rescale(
bool onlyVisiblePlottables = false);
8181 void pixelToCoord(QPointF pixelPos,
double& angleCoord,
8182 double& radiusCoord) const;
8183 QPointF coordToPixel(
double angleCoord,
double radiusCoord) const;
8184 double coordToRadius(
double coord) const;
8185 double radiusToCoord(
double radius) const;
8186 SelectablePart getPartAt(const QPointF& pos) const;
8199 double mRangeZoomFactor;
8205 SelectableParts mSelectableParts, mSelectedParts;
8206 QPen mBasePen, mSelectedBasePen;
8210 QFont mLabelFont, mSelectedLabelFont;
8211 QColor mLabelColor, mSelectedLabelColor;
8216 QFont mTickLabelFont, mSelectedTickLabelFont;
8217 QColor mTickLabelColor, mSelectedTickLabelColor;
8218 int mNumberPrecision;
8219 QLatin1Char mNumberFormatChar;
8220 bool mNumberBeautifulPowers;
8221 bool mNumberMultiplyCross;
8225 int mTickLengthIn, mTickLengthOut, mSubTickLengthIn, mSubTickLengthOut;
8226 QPen mTickPen, mSelectedTickPen;
8227 QPen mSubTickPen, mSelectedSubTickPen;
8230 bool mRangeReversed;
8237 QVector<
double> mTickVector;
8238 QVector<QString> mTickVectorLabels;
8239 QVector<
double> mSubTickVector;
8242 QCP::AntialiasedElements mAADragBackup, mNotAADragBackup;
8247 applyDefaultAntialiasingHint(
QCPPainter* painter) const Q_DECL_OVERRIDE;
8248 virtual
void draw(
QCPPainter* painter) Q_DECL_OVERRIDE;
8249 virtual
QCP::Interaction selectionCategory() const Q_DECL_OVERRIDE;
8251 virtual
void selectEvent(QMouseEvent* event,
bool additive,
8252 const QVariant& details,
8253 bool* selectionStateChanged) Q_DECL_OVERRIDE;
8254 virtual
void deselectEvent(
bool* selectionStateChanged) Q_DECL_OVERRIDE;
8256 virtual
void mousePressEvent(QMouseEvent* event,
8257 const QVariant& details) Q_DECL_OVERRIDE;
8258 virtual
void mouseMoveEvent(QMouseEvent* event,
8259 const QPointF& startPos) Q_DECL_OVERRIDE;
8260 virtual
void mouseReleaseEvent(QMouseEvent* event,
8261 const QPointF& startPos) Q_DECL_OVERRIDE;
8262 virtual
void wheelEvent(QWheelEvent* event) Q_DECL_OVERRIDE;
8265 void updateGeometry(const QPointF& center,
double radius);
8266 void setupTickVectors();
8267 QPen getBasePen() const;
8268 QPen getTickPen() const;
8269 QPen getSubTickPen() const;
8270 QFont getTickLabelFont() const;
8271 QFont getLabelFont() const;
8272 QColor getTickLabelColor() const;
8273 QColor getLabelColor() const;
8306 spTickLabels = 0x002
8311 Q_ENUMS(SelectablePart)
8312 Q_FLAGS(SelectableParts)
8313 Q_DECLARE_FLAGS(SelectableParts, SelectablePart)
8329 QPixmap background()
const {
return mBackgroundPixmap; }
8330 QBrush backgroundBrush()
const {
return mBackgroundBrush; }
8331 bool backgroundScaled()
const {
return mBackgroundScaled; }
8332 Qt::AspectRatioMode backgroundScaledMode()
const {
8333 return mBackgroundScaledMode;
8335 bool rangeDrag()
const {
return mRangeDrag; }
8336 bool rangeZoom()
const {
return mRangeZoom; }
8337 double rangeZoomFactor()
const {
return mRangeZoomFactor; }
8339 const QCPRange range()
const {
return mRange; }
8340 bool rangeReversed()
const {
return mRangeReversed; }
8341 double angle()
const {
return mAngle; }
8342 QSharedPointer<QCPAxisTicker> ticker()
const {
return mTicker; }
8343 bool ticks()
const {
return mTicks; }
8344 bool tickLabels()
const {
return mTickLabels; }
8345 int tickLabelPadding()
const {
return mLabelPainter.padding(); }
8346 QFont tickLabelFont()
const {
return mTickLabelFont; }
8347 QColor tickLabelColor()
const {
return mTickLabelColor; }
8348 double tickLabelRotation()
const {
return mLabelPainter.rotation(); }
8349 LabelMode tickLabelMode()
const;
8350 QString numberFormat()
const;
8351 int numberPrecision()
const {
return mNumberPrecision; }
8352 QVector<double> tickVector()
const {
return mTickVector; }
8353 QVector<QString> tickVectorLabels()
const {
return mTickVectorLabels; }
8354 int tickLengthIn()
const {
return mTickLengthIn; }
8355 int tickLengthOut()
const {
return mTickLengthOut; }
8356 bool subTicks()
const {
return mSubTicks; }
8357 int subTickLengthIn()
const {
return mSubTickLengthIn; }
8358 int subTickLengthOut()
const {
return mSubTickLengthOut; }
8359 QPen basePen()
const {
return mBasePen; }
8360 QPen tickPen()
const {
return mTickPen; }
8361 QPen subTickPen()
const {
return mSubTickPen; }
8362 QFont labelFont()
const {
return mLabelFont; }
8363 QColor labelColor()
const {
return mLabelColor; }
8364 QString label()
const {
return mLabel; }
8365 int labelPadding()
const {
return mLabelPadding; }
8366 SelectableParts selectedParts()
const {
return mSelectedParts; }
8367 SelectableParts selectableParts()
const {
return mSelectableParts; }
8368 QFont selectedTickLabelFont()
const {
return mSelectedTickLabelFont; }
8369 QFont selectedLabelFont()
const {
return mSelectedLabelFont; }
8370 QColor selectedTickLabelColor()
const {
return mSelectedTickLabelColor; }
8371 QColor selectedLabelColor()
const {
return mSelectedLabelColor; }
8372 QPen selectedBasePen()
const {
return mSelectedBasePen; }
8373 QPen selectedTickPen()
const {
return mSelectedTickPen; }
8374 QPen selectedSubTickPen()
const {
return mSelectedSubTickPen; }
8378 void setBackground(
const QPixmap& pm);
8379 void setBackground(
const QPixmap& pm,
bool scaled,
8380 Qt::AspectRatioMode mode = Qt::KeepAspectRatioByExpanding);
8381 void setBackground(
const QBrush& brush);
8382 void setBackgroundScaled(
bool scaled);
8383 void setBackgroundScaledMode(Qt::AspectRatioMode mode);
8384 void setRangeDrag(
bool enabled);
8385 void setRangeZoom(
bool enabled);
8386 void setRangeZoomFactor(
double factor);
8388 Q_SLOT
void setRange(
const QCPRange& range);
8389 void setRange(
double lower,
double upper);
8390 void setRange(
double position,
double size, Qt::AlignmentFlag alignment);
8391 void setRangeLower(
double lower);
8392 void setRangeUpper(
double upper);
8393 void setRangeReversed(
bool reversed);
8394 void setAngle(
double degrees);
8395 void setTicker(QSharedPointer<QCPAxisTicker> ticker);
8396 void setTicks(
bool show);
8397 void setTickLabels(
bool show);
8398 void setTickLabelPadding(
int padding);
8399 void setTickLabelFont(
const QFont& font);
8400 void setTickLabelColor(
const QColor& color);
8401 void setTickLabelRotation(
double degrees);
8402 void setTickLabelMode(LabelMode mode);
8403 void setNumberFormat(
const QString& formatCode);
8404 void setNumberPrecision(
int precision);
8405 void setTickLength(
int inside,
int outside = 0);
8406 void setTickLengthIn(
int inside);
8407 void setTickLengthOut(
int outside);
8408 void setSubTicks(
bool show);
8409 void setSubTickLength(
int inside,
int outside = 0);
8410 void setSubTickLengthIn(
int inside);
8411 void setSubTickLengthOut(
int outside);
8412 void setBasePen(
const QPen& pen);
8413 void setTickPen(
const QPen& pen);
8414 void setSubTickPen(
const QPen& pen);
8415 void setLabelFont(
const QFont& font);
8416 void setLabelColor(
const QColor& color);
8417 void setLabel(
const QString& str);
8418 void setLabelPadding(
int padding);
8419 void setLabelPosition(Qt::AlignmentFlag position);
8420 void setSelectedTickLabelFont(
const QFont& font);
8421 void setSelectedLabelFont(
const QFont& font);
8422 void setSelectedTickLabelColor(
const QColor& color);
8423 void setSelectedLabelColor(
const QColor& color);
8424 void setSelectedBasePen(
const QPen& pen);
8425 void setSelectedTickPen(
const QPen& pen);
8426 void setSelectedSubTickPen(
const QPen& pen);
8427 Q_SLOT
void setSelectableParts(
8428 const QCPPolarAxisAngular::SelectableParts& selectableParts);
8430 setSelectedParts(
const QCPPolarAxisAngular::SelectableParts& selectedParts);
8433 virtual double selectTest(
const QPointF& pos,
bool onlySelectable,
8434 QVariant* details = 0) const Q_DECL_OVERRIDE;
8435 virtual
void update(UpdatePhase phase) Q_DECL_OVERRIDE;
8437 elements(
bool recursive) const Q_DECL_OVERRIDE;
8441 int radialAxisCount() const;
8447 QRegion exactClipRegion()
const;
8449 void moveRange(
double diff);
8450 void scaleRange(
double factor);
8451 void scaleRange(
double factor,
double center);
8452 void rescale(
bool onlyVisiblePlottables =
false);
8453 double coordToAngleRad(
double coord)
const {
8454 return mAngleRad + (coord - mRange.lower) / mRange.
size() *
8455 (mRangeReversed ? -2.0 * M_PI : 2.0 * M_PI);
8457 double angleRadToCoord(
double angleRad)
const {
8458 return mRange.lower + (angleRad - mAngleRad) /
8459 (mRangeReversed ? -2.0 * M_PI : 2.0 * M_PI) *
8462 void pixelToCoord(QPointF pixelPos,
double& angleCoord,
8463 double& radiusCoord)
const;
8464 QPointF coordToPixel(
double angleCoord,
double radiusCoord)
const;
8465 SelectablePart getPartAt(
const QPointF& pos)
const;
8468 int left()
const {
return mRect.left(); }
8469 int right()
const {
return mRect.right(); }
8470 int top()
const {
return mRect.top(); }
8471 int bottom()
const {
return mRect.bottom(); }
8472 int width()
const {
return mRect.width(); }
8473 int height()
const {
return mRect.height(); }
8474 QSize
size()
const {
return mRect.size(); }
8475 QPoint
topLeft()
const {
return mRect.topLeft(); }
8480 double radius()
const {
return mRadius; }
8483 void rangeChanged(
const QCPRange& newRange);
8485 void selectionChanged(
const QCPPolarAxisAngular::SelectableParts& parts);
8486 void selectableChanged(
const QCPPolarAxisAngular::SelectableParts& parts);
8490 QBrush mBackgroundBrush;
8491 QPixmap mBackgroundPixmap;
8492 QPixmap mScaledBackgroundPixmap;
8493 bool mBackgroundScaled;
8494 Qt::AspectRatioMode mBackgroundScaledMode;
8498 double mRangeZoomFactor;
8501 double mAngle, mAngleRad;
8502 SelectableParts mSelectableParts, mSelectedParts;
8503 QPen mBasePen, mSelectedBasePen;
8507 QFont mLabelFont, mSelectedLabelFont;
8508 QColor mLabelColor, mSelectedLabelColor;
8513 QFont mTickLabelFont, mSelectedTickLabelFont;
8514 QColor mTickLabelColor, mSelectedTickLabelColor;
8515 int mNumberPrecision;
8516 QLatin1Char mNumberFormatChar;
8517 bool mNumberBeautifulPowers;
8518 bool mNumberMultiplyCross;
8522 int mTickLengthIn, mTickLengthOut, mSubTickLengthIn, mSubTickLengthOut;
8523 QPen mTickPen, mSelectedTickPen;
8524 QPen mSubTickPen, mSelectedSubTickPen;
8527 bool mRangeReversed;
8532 QList<QCPPolarAxisRadial*> mRadialAxes;
8534 QList<QCPPolarGraph*> mGraphs;
8535 QSharedPointer<QCPAxisTicker> mTicker;
8536 QVector<double> mTickVector;
8537 QVector<QString> mTickVectorLabels;
8538 QVector<QPointF> mTickVectorCosSin;
8539 QVector<double> mSubTickVector;
8540 QVector<QPointF> mSubTickVectorCosSin;
8543 QList<QCPRange> mDragRadialStart;
8544 QCP::AntialiasedElements mAADragBackup, mNotAADragBackup;
8549 applyDefaultAntialiasingHint(
QCPPainter* painter)
const Q_DECL_OVERRIDE;
8550 virtual void draw(
QCPPainter* painter) Q_DECL_OVERRIDE;
8553 virtual
void mousePressEvent(QMouseEvent* event,
8554 const QVariant& details) Q_DECL_OVERRIDE;
8555 virtual
void mouseMoveEvent(QMouseEvent* event,
8556 const QPointF& startPos) Q_DECL_OVERRIDE;
8557 virtual
void mouseReleaseEvent(QMouseEvent* event,
8558 const QPointF& startPos) Q_DECL_OVERRIDE;
8559 virtual
void wheelEvent(QWheelEvent* event) Q_DECL_OVERRIDE;
8563 void drawBackground(
QCPPainter* painter, const QPointF& center,
8565 void setupTickVectors();
8566 QPen getBasePen() const;
8567 QPen getTickPen() const;
8568 QPen getSubTickPen() const;
8569 QFont getTickLabelFont() const;
8570 QFont getLabelFont() const;
8571 QColor getTickLabelColor() const;
8572 QColor getLabelColor() const;
8609 Q_DECLARE_FLAGS(GridTypes, GridType)
8615 GridTypes type()
const {
return mType; }
8616 GridTypes subGridType()
const {
return mSubGridType; }
8617 bool antialiasedSubGrid()
const {
return mAntialiasedSubGrid; }
8618 bool antialiasedZeroLine()
const {
return mAntialiasedZeroLine; }
8619 QPen angularPen()
const {
return mAngularPen; }
8620 QPen angularSubGridPen()
const {
return mAngularSubGridPen; }
8621 QPen radialPen()
const {
return mRadialPen; }
8622 QPen radialSubGridPen()
const {
return mRadialSubGridPen; }
8623 QPen radialZeroLinePen()
const {
return mRadialZeroLinePen; }
8627 void setType(GridTypes type);
8628 void setSubGridType(GridTypes type);
8629 void setAntialiasedSubGrid(
bool enabled);
8630 void setAntialiasedZeroLine(
bool enabled);
8631 void setAngularPen(
const QPen& pen);
8632 void setAngularSubGridPen(
const QPen& pen);
8633 void setRadialPen(
const QPen& pen);
8634 void setRadialSubGridPen(
const QPen& pen);
8635 void setRadialZeroLinePen(
const QPen& pen);
8640 GridTypes mSubGridType;
8641 bool mAntialiasedSubGrid, mAntialiasedZeroLine;
8642 QPen mAngularPen, mAngularSubGridPen;
8643 QPen mRadialPen, mRadialSubGridPen, mRadialZeroLinePen;
8647 QPointer<QCPPolarAxisRadial> mRadialAxis;
8651 applyDefaultAntialiasingHint(
QCPPainter* painter)
const Q_DECL_OVERRIDE;
8652 virtual void draw(
QCPPainter* painter) Q_DECL_OVERRIDE;
8655 void drawRadialGrid(
QCPPainter* painter,
const QPointF& center,
8656 const QVector<double>& coords,
const QPen& pen,
8657 const QPen& zeroPen = Qt::NoPen);
8658 void drawAngularGrid(
QCPPainter* painter,
const QPointF& center,
8659 double radius,
const QVector<QPointF>& ticksCosSin,
8666Q_DECLARE_OPERATORS_FOR_FLAGS(QCPPolarGrid::GridTypes)
8687 virtual void draw(
QCPPainter* painter) Q_DECL_OVERRIDE;
8688 virtual QSize minimumOuterSizeHint()
const Q_DECL_OVERRIDE;
8691 QPen getIconBorderPen()
const;
8692 QColor getTextColor()
const;
8693 QFont getFont()
const;
8719 QString name()
const {
return mName; }
8720 bool antialiasedFill()
const {
return mAntialiasedFill; }
8721 bool antialiasedScatters()
const {
return mAntialiasedScatters; }
8722 QPen pen()
const {
return mPen; }
8723 QBrush brush()
const {
return mBrush; }
8724 bool periodic()
const {
return mPeriodic; }
8728 bool selected()
const {
return !mSelection.
isEmpty(); }
8732 QSharedPointer<QCPGraphDataContainer> data()
const {
return mDataContainer; }
8733 LineStyle lineStyle()
const {
return mLineStyle; }
8737 void setName(
const QString& name);
8738 void setAntialiasedFill(
bool enabled);
8739 void setAntialiasedScatters(
bool enabled);
8740 void setPen(
const QPen& pen);
8741 void setBrush(
const QBrush& brush);
8742 void setPeriodic(
bool enabled);
8748 void setData(QSharedPointer<QCPGraphDataContainer> data);
8749 void setData(
const QVector<double>& keys,
const QVector<double>& values,
8750 bool alreadySorted =
false);
8751 void setLineStyle(LineStyle ls);
8755 void addData(
const QVector<double>& keys,
const QVector<double>& values,
8756 bool alreadySorted =
false);
8757 void addData(
double key,
double value);
8758 void coordsToPixels(
double key,
double value,
double& x,
double& y)
const;
8759 const QPointF coordsToPixels(
double key,
double value)
const;
8760 void pixelsToCoords(
double x,
double y,
double& key,
double& value)
const;
8761 void pixelsToCoords(
const QPointF& pixelPos,
double& key,
8762 double& value)
const;
8763 void rescaleAxes(
bool onlyEnlarge =
false)
const;
8764 void rescaleKeyAxis(
bool onlyEnlarge =
false)
const;
8765 void rescaleValueAxis(
bool onlyEnlarge =
false,
8766 bool inKeyRange =
false)
const;
8769 bool removeFromLegend(
QCPLegend* legend)
const;
8770 bool removeFromLegend()
const;
8773 virtual double selectTest(
const QPointF& pos,
bool onlySelectable,
8774 QVariant* details = 0)
8781 getKeyRange(
bool& foundRange,
8783 virtual QCPRange getValueRange(
bool& foundRange,
8788 void selectionChanged(
bool selected);
8794 QSharedPointer<QCPGraphDataContainer> mDataContainer;
8795 LineStyle mLineStyle;
8798 bool mAntialiasedFill, mAntialiasedScatters;
8802 QPointer<QCPPolarAxisAngular> mKeyAxis;
8803 QPointer<QCPPolarAxisRadial> mValueAxis;
8810 virtual QRect clipRect()
const;
8813 void applyDefaultAntialiasingHint(
QCPPainter* painter)
const;
8815 virtual void selectEvent(QMouseEvent* event,
bool additive,
8816 const QVariant& details,
8817 bool* selectionStateChanged);
8818 virtual void deselectEvent(
bool* selectionStateChanged);
8820 virtual void drawLinePlot(
QCPPainter* painter,
8821 const QVector<QPointF>& lines)
const;
8822 virtual void drawFill(
QCPPainter* painter, QVector<QPointF>* lines)
const;
8823 virtual void drawScatterPlot(
QCPPainter* painter,
8824 const QVector<QPointF>& scatters,
8828 virtual void drawLegendIcon(
QCPPainter* painter,
const QRectF& rect)
const;
8831 void applyFillAntialiasingHint(
QCPPainter* painter)
const;
8832 void applyScattersAntialiasingHint(
QCPPainter* painter)
const;
8834 pointDistance(
const QPointF& pixelPoint,
8837 virtual int dataCount()
const;
8838 void getDataSegments(QList<QCPDataRange>& selectedSegments,
8839 QList<QCPDataRange>& unselectedSegments)
const;
8841 const QVector<QPointF>& lineData)
const;
8845 void getLines(QVector<QPointF>* lines,
const QCPDataRange& dataRange)
const;
8846 void getScatters(QVector<QPointF>* scatters,
8849 getOptimizedLineData(QVector<QCPGraphData>* lineData,
8852 void getOptimizedScatterData(QVector<QCPGraphData>* scatterData,
8855 QVector<QPointF> dataToLines(
const QVector<QCPGraphData>& data)
const;
The abstract base class for all items in a plot.
Definition qcustomplot.h:4222
QList< QCPItemAnchor * > anchors() const
Definition qcustomplot.h:4255
void selectionChanged(bool selected)
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE=0
The abstract base class for all entries in a QCPLegend.
Definition qcustomplot.h:5776
void selectionChanged(bool selected)
The abstract base class for paint buffers, which define the rendering backend.
Definition qcustomplot.h:728
virtual void donePainting()
Definition qcustomplot.h:745
virtual void clear(const QColor &color)=0
virtual QCPPainter * startPainting()=0
virtual void reallocateBuffer()=0
virtual void draw(QCPPainter *painter) const =0
A template base class for plottables with one-dimensional data.
Definition qcustomplot.h:4782
virtual QCPDataSelection selectTestRect(const QRectF &rect, bool onlySelectable) const Q_DECL_OVERRIDE
Definition qcustomplot.h:5136
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE
Definition qcustomplot.h:5230
QCPAbstractPlottable1D(QCPAxis *keyAxis, QCPAxis *valueAxis)
Definition qcustomplot.h:5035
virtual QCPRange dataValueRange(int index) const Q_DECL_OVERRIDE
Definition qcustomplot.h:5094
virtual double dataMainValue(int index) const Q_DECL_OVERRIDE
Definition qcustomplot.h:5081
virtual QPointF dataPixelPosition(int index) const Q_DECL_OVERRIDE
Definition qcustomplot.h:5107
virtual int findEnd(double sortKey, bool expandedRange=true) const Q_DECL_OVERRIDE
Definition qcustomplot.h:5212
void drawPolyline(QCPPainter *painter, const QVector< QPointF > &lineData) const
Definition qcustomplot.h:5347
virtual double dataSortKey(int index) const Q_DECL_OVERRIDE
Definition qcustomplot.h:5068
virtual int dataCount() const Q_DECL_OVERRIDE
Definition qcustomplot.h:5047
virtual QCPPlottableInterface1D * interface1D() Q_DECL_OVERRIDE
Definition qcustomplot.h:4807
virtual int findBegin(double sortKey, bool expandedRange=true) const Q_DECL_OVERRIDE
Definition qcustomplot.h:5202
void getDataSegments(QList< QCPDataRange > &selectedSegments, QList< QCPDataRange > &unselectedSegments) const
Definition qcustomplot.h:5314
virtual double dataMainKey(int index) const Q_DECL_OVERRIDE
Definition qcustomplot.h:5055
virtual bool sortKeyIsMainKey() const Q_DECL_OVERRIDE
Definition qcustomplot.h:5122
The abstract base class for all data representing objects in a plot.
Definition qcustomplot.h:3969
QCPDataSelection selection() const
Definition qcustomplot.h:4001
void setAntialiasedFill(bool enabled)
Definition qcustomplot.cpp:12264
bool selected() const
Definition qcustomplot.h:4000
void rescaleAxes(bool onlyEnlarge=false) const
Definition qcustomplot.cpp:12517
void setSelectionDecorator(QCPSelectionDecorator *decorator)
Definition qcustomplot.cpp:12378
Q_SLOT void setSelection(QCPDataSelection selection)
Definition qcustomplot.cpp:12360
void setAntialiasedScatters(bool enabled)
Definition qcustomplot.cpp:12276
void pixelsToCoords(double x, double y, double &key, double &value) const
Definition qcustomplot.cpp:12474
void selectionChanged(bool selected)
virtual QCPRange getKeyRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth) const =0
virtual QCPRange getValueRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth, const QCPRange &inKeyRange=QCPRange()) const =0
void selectableChanged(QCP::SelectionType selectable)
bool addToLegend()
Definition qcustomplot.cpp:12666
void rescaleValueAxis(bool onlyEnlarge=false, bool inKeyRange=false) const
Definition qcustomplot.cpp:12580
void setValueAxis(QCPAxis *axis)
Definition qcustomplot.cpp:12335
QCPSelectionDecorator * selectionDecorator() const
Definition qcustomplot.h:4002
void selectionChanged(const QCPDataSelection &selection)
void setBrush(const QBrush &brush)
Definition qcustomplot.cpp:12301
void coordsToPixels(double key, double value, double &x, double &y) const
Definition qcustomplot.cpp:12425
virtual QCPPlottableInterface1D * interface1D()
Definition qcustomplot.h:4024
void setKeyAxis(QCPAxis *axis)
Definition qcustomplot.cpp:12318
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE=0
virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const =0
void setPen(const QPen &pen)
Definition qcustomplot.cpp:12288
void setName(const QString &name)
Definition qcustomplot.cpp:12253
void applyDefaultAntialiasingHint(QCPPainter *painter) const Q_DECL_OVERRIDE
Definition qcustomplot.cpp:12742
Q_SLOT void setSelectable(QCP::SelectionType selectable)
Definition qcustomplot.cpp:12402
bool removeFromLegend() const
Definition qcustomplot.cpp:12703
void rescaleKeyAxis(bool onlyEnlarge=false) const
Definition qcustomplot.cpp:12527
Definition qcustomplot.h:2753
Holds multiple axes and arranges them in a rectangular shape.
Definition qcustomplot.h:5643
int width() const
Definition qcustomplot.h:5713
QPoint bottomRight() const
Definition qcustomplot.h:5719
int right() const
Definition qcustomplot.h:5710
int top() const
Definition qcustomplot.h:5711
QPoint topLeft() const
Definition qcustomplot.h:5716
virtual void mouseReleaseEvent(QMouseEvent *event, const QPointF &startPos) Q_DECL_OVERRIDE
Definition qcustomplot.cpp:19954
QSize size() const
Definition qcustomplot.h:5715
QPoint topRight() const
Definition qcustomplot.h:5717
virtual void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE
Definition qcustomplot.cpp:19982
QCPLayoutInset * insetLayout() const
Definition qcustomplot.h:5699
virtual void mouseMoveEvent(QMouseEvent *event, const QPointF &startPos) Q_DECL_OVERRIDE
Definition qcustomplot.cpp:19891
virtual void mousePressEvent(QMouseEvent *event, const QVariant &details) Q_DECL_OVERRIDE
Definition qcustomplot.cpp:19860
QPoint bottomLeft() const
Definition qcustomplot.h:5718
int height() const
Definition qcustomplot.h:5714
int bottom() const
Definition qcustomplot.h:5712
virtual void update(UpdatePhase phase) Q_DECL_OVERRIDE
Definition qcustomplot.cpp:19275
QPoint center() const
Definition qcustomplot.h:5720
int left() const
Definition qcustomplot.h:5709
Specialized axis ticker for calendar dates and times as axis ticks.
Definition qcustomplot.h:2058
Specialized axis ticker with a fixed tick step.
Definition qcustomplot.h:2171
ScaleStrategy
Definition qcustomplot.h:2180
Specialized axis ticker suited for logarithmic axes.
Definition qcustomplot.h:2322
Specialized axis ticker to display ticks in units of an arbitrary constant, for example pi.
Definition qcustomplot.h:2258
FractionStyle
Definition qcustomplot.h:2266
Specialized axis ticker which allows arbitrary labels at specified coordinates.
Definition qcustomplot.h:2218
QMap< double, QString > & ticks()
Definition qcustomplot.h:2223
Specialized axis ticker for time spans in units of milliseconds to days.
Definition qcustomplot.h:2114
TimeUnit
Definition qcustomplot.h:2122
The base class tick generator used by QCPAxis to create tick positions and tick labels.
Definition qcustomplot.h:1984
TickStepStrategy
Definition qcustomplot.h:1993
Manages a single axis inside a QCustomPlot.
Definition qcustomplot.h:2405
void rangeChanged(const QCPRange &newRange)
LabelSide
Definition qcustomplot.h:2490
void scaleTypeChanged(QCPAxis::ScaleType scaleType)
ScaleType
Definition qcustomplot.h:2501
int pixelOrientation() const
Definition qcustomplot.h:2628
void selectionChanged(const QCPAxis::SelectableParts &parts)
QCPGrid * grid() const
Definition qcustomplot.h:2573
QSharedPointer< QCPAxisTicker > ticker() const
Definition qcustomplot.h:2536
static Qt::Orientation orientation(AxisType type)
Definition qcustomplot.h:2644
void selectableChanged(const QCPAxis::SelectableParts &parts)
void rangeChanged(const QCPRange &newRange, const QCPRange &oldRange)
SelectablePart
Definition qcustomplot.h:2513
AxisType
Definition qcustomplot.h:2469
Holds the data of one single data point (one bar) for QCPBars.
Definition qcustomplot.h:6618
double sortKey() const
Definition qcustomplot.h:6623
double mainValue() const
Definition qcustomplot.h:6630
double mainKey() const
Definition qcustomplot.h:6629
QCPRange valueRange() const
Definition qcustomplot.h:6632
static QCPBarsData fromSortKey(double sortKey)
Definition qcustomplot.h:6624
static bool sortKeyIsMainKey()
Definition qcustomplot.h:6627
Groups multiple QCPBars together so they appear side by side.
Definition qcustomplot.h:6550
int size() const
Definition qcustomplot.h:6588
SpacingType
Definition qcustomplot.h:6563
QList< QCPBars * > bars() const
Definition qcustomplot.h:6586
bool isEmpty() const
Definition qcustomplot.h:6589
bool contains(QCPBars *bars) const
Definition qcustomplot.h:6591
A plottable representing a bar chart in a plot.
Definition qcustomplot.h:6654
QCPBars * barBelow() const
Definition qcustomplot.h:6691
WidthType
Definition qcustomplot.h:6672
QSharedPointer< QCPBarsDataContainer > data() const
Definition qcustomplot.h:6693
QCPBars * barAbove() const
Definition qcustomplot.h:6692
Defines a color gradient for use with e.g. QCPColorMap.
Definition qcustomplot.h:5419
ColorInterpolation
Definition qcustomplot.h:5428
GradientPreset
Definition qcustomplot.h:5463
NanHandling
Definition qcustomplot.h:5442
Holds the two-dimensional data of a QCPColorMap plottable.
Definition qcustomplot.h:6907
bool isEmpty() const
Definition qcustomplot.h:6942
A plottable representing a two-dimensional color map in a plot.
Definition qcustomplot.h:6965
QCPColorMapData * data() const
Definition qcustomplot.h:6983
Definition qcustomplot.h:6105
A color scale for use with color coding data such as QCPColorMap.
Definition qcustomplot.h:6129
QCPAxis * axis() const
Definition qcustomplot.h:6149
void gradientChanged(const QCPColorGradient &newGradient)
void dataScaleTypeChanged(QCPAxis::ScaleType scaleType)
void dataRangeChanged(const QCPRange &newRange)
Holds the data of one single data point for QCPCurve.
Definition qcustomplot.h:6404
static bool sortKeyIsMainKey()
Definition qcustomplot.h:6413
double mainValue() const
Definition qcustomplot.h:6416
static QCPCurveData fromSortKey(double sortKey)
Definition qcustomplot.h:6410
double sortKey() const
Definition qcustomplot.h:6409
double mainKey() const
Definition qcustomplot.h:6415
QCPRange valueRange() const
Definition qcustomplot.h:6418
A plottable representing a parametric curve in a plot.
Definition qcustomplot.h:6438
LineStyle
Definition qcustomplot.h:6451
The generic data container for one-dimensional plottables.
Definition qcustomplot.h:2988
QVector< DataType >::const_iterator const_iterator
Definition qcustomplot.h:2990
void setAutoSqueeze(bool enabled)
Definition qcustomplot.h:3216
const_iterator findBegin(double sortKey, bool expandedRange=true) const
Definition qcustomplot.h:3547
QCPRange valueRange(bool &foundRange, QCP::SignDomain signDomain=QCP::sdBoth, const QCPRange &inKeyRange=QCPRange())
Definition qcustomplot.h:3732
void add(const QCPDataContainer< DataType > &data)
Definition qcustomplot.h:3265
bool qcpLessThanSortKey(const DataType &a, const DataType &b)
Definition qcustomplot.h:2981
void sort()
Definition qcustomplot.h:3498
bool isEmpty() const
Definition qcustomplot.h:2997
void clear()
Definition qcustomplot.h:3480
iterator begin()
Definition qcustomplot.h:3021
void squeeze(bool preAllocation=true, bool postAllocation=true)
Definition qcustomplot.h:3514
int size() const
Definition qcustomplot.h:2996
void limitIteratorsToDataRange(const_iterator &begin, const_iterator &end, const QCPDataRange &dataRange) const
Definition qcustomplot.h:3828
void removeBefore(double sortKey)
Definition qcustomplot.h:3391
const_iterator constEnd() const
Definition qcustomplot.h:3020
QCPRange keyRange(bool &foundRange, QCP::SignDomain signDomain=QCP::sdBoth)
Definition qcustomplot.h:3614
void removeAfter(double sortKey)
Definition qcustomplot.h:3410
iterator end()
Definition qcustomplot.h:3022
void remove(double sortKeyFrom, double sortKeyTo)
Definition qcustomplot.h:3430
void set(const QCPDataContainer< DataType > &data)
Definition qcustomplot.h:3232
const_iterator at(int index) const
Definition qcustomplot.h:3025
QCPDataRange dataRange() const
Definition qcustomplot.h:3032
QCPDataContainer()
Definition qcustomplot.h:3204
const_iterator findEnd(double sortKey, bool expandedRange=true) const
Definition qcustomplot.h:3583
Describes a data range given by begin and end index.
Definition qcustomplot.h:1116
int length() const
Definition qcustomplot.h:1130
void setEnd(int end)
Definition qcustomplot.h:1134
QCPDataRange adjusted(int changeBegin, int changeEnd) const
Definition qcustomplot.h:1142
QDebug operator<<(QDebug d, const QCPDataRange &dataRange)
Definition qcustomplot.h:1309
void setBegin(int begin)
Definition qcustomplot.h:1133
QCPDataRange bounded(const QCPDataRange &other) const
Definition qcustomplot.cpp:2322
bool isValid() const
Definition qcustomplot.h:1137
bool isEmpty() const
Definition qcustomplot.h:1138
int size() const
Definition qcustomplot.h:1129
Describes a data set by holding multiple QCPDataRange instances.
Definition qcustomplot.h:1154
void addDataRange(const QCPDataRange &dataRange, bool simplify=true)
Definition qcustomplot.cpp:2617
void simplify()
Definition qcustomplot.cpp:2645
QCPDataRange dataRange(int index=0) const
Definition qcustomplot.cpp:2588
bool isEmpty() const
Definition qcustomplot.h:1194
int dataRangeCount() const
Definition qcustomplot.h:1185
QList< QCPDataRange > dataRanges() const
Definition qcustomplot.h:1188
QCPDataSelection inverse(const QCPDataRange &outerRange) const
Definition qcustomplot.cpp:2797
QDebug operator<<(QDebug d, const QCPDataSelection &selection)
Definition qcustomplot.h:1319
Holds the data of one single error bar for QCPErrorBars.
Definition qcustomplot.h:7235
A plottable that adds a set of error bars to other plottables.
Definition qcustomplot.h:7264
ErrorType
Definition qcustomplot.h:7283
Holds the data of one single data point for QCPFinancial.
Definition qcustomplot.h:7053
static bool sortKeyIsMainKey()
Definition qcustomplot.h:7063
QCPRange valueRange() const
Definition qcustomplot.h:7068
static QCPFinancialData fromSortKey(double sortKey)
Definition qcustomplot.h:7060
double mainValue() const
Definition qcustomplot.h:7066
double sortKey() const
Definition qcustomplot.h:7059
double mainKey() const
Definition qcustomplot.h:7065
A plottable representing a financial stock chart.
Definition qcustomplot.h:7091
ChartStyle
Definition qcustomplot.h:7125
WidthType
Definition qcustomplot.h:7110
Holds the data of one single data point for QCPGraph.
Definition qcustomplot.h:6216
double mainValue() const
Definition qcustomplot.h:6228
static bool sortKeyIsMainKey()
Definition qcustomplot.h:6225
QCPRange valueRange() const
Definition qcustomplot.h:6230
static QCPGraphData fromSortKey(double sortKey)
Definition qcustomplot.h:6222
double sortKey() const
Definition qcustomplot.h:6221
double mainKey() const
Definition qcustomplot.h:6227
A plottable representing a graph in a plot.
Definition qcustomplot.h:6249
QSharedPointer< QCPGraphDataContainer > data() const
Definition qcustomplot.h:6292
LineStyle
Definition qcustomplot.h:6266
Responsible for drawing the grid of a QCPAxis.
Definition qcustomplot.h:2353
An anchor of an item to which positions can be attached to.
Definition qcustomplot.h:4095
virtual QCPItemPosition * toQCPItemPosition()
Definition qcustomplot.h:4117
A bracket for referencing/highlighting certain parts in the plot.
Definition qcustomplot.h:7946
BracketStyle
Definition qcustomplot.h:7961
A curved line from one point to another.
Definition qcustomplot.h:7480
An ellipse.
Definition qcustomplot.h:7703
A line from one point to another.
Definition qcustomplot.h:7430
An arbitrary pixmap.
Definition qcustomplot.h:7774
Manages the position of an item.
Definition qcustomplot.h:4135
QCPItemAnchor * parentAnchor() const
Definition qcustomplot.h:4179
PositionType
Definition qcustomplot.h:4144
A rectangle.
Definition qcustomplot.h:7530
A straight line that spans infinitely in both directions.
Definition qcustomplot.h:7386
A text label.
Definition qcustomplot.h:7595
Item that sticks to QCPGraph data points.
Definition qcustomplot.h:7855
TracerStyle
Definition qcustomplot.h:7875
Definition qcustomplot.h:1819
AnchorReferenceType
Definition qcustomplot.h:1837
AnchorSide
Definition qcustomplot.h:1847
AnchorMode
Definition qcustomplot.h:1825
A layer that may contain objects, to control the rendering order.
Definition qcustomplot.h:831
QList< QCPLayerable * > children() const
Definition qcustomplot.h:865
LayerMode
Definition qcustomplot.h:849
int index() const
Definition qcustomplot.h:864
Base class for all drawable objects.
Definition qcustomplot.h:902
QCPLayerable * parentLayerable() const
Definition qcustomplot.h:919
void layerChanged(QCPLayer *newLayer)
virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const =0
The abstract base class for all objects that form the layout system.
Definition qcustomplot.h:1420
SizeConstraintRect
Definition qcustomplot.h:1458
UpdatePhase
Definition qcustomplot.h:1439
QRect rect() const
Definition qcustomplot.h:1471
QRect outerRect() const
Definition qcustomplot.h:1472
A layout that arranges child elements in a grid.
Definition qcustomplot.h:1580
int columnCount() const
Definition qcustomplot.h:1617
FillOrder
Definition qcustomplot.h:1602
A layout that places child elements aligned to the border or arbitrarily positioned.
Definition qcustomplot.h:1682
InsetPlacement
Definition qcustomplot.h:1689
The abstract base class for layouts.
Definition qcustomplot.h:1539
virtual int elementCount() const =0
virtual QCPLayoutElement * takeAt(int index)=0
virtual bool take(QCPLayoutElement *element)=0
virtual QCPLayoutElement * elementAt(int index) const =0
Manages a legend inside a QCustomPlot.
Definition qcustomplot.h:5867
SelectablePart
Definition qcustomplot.h:5896
Handles the different ending decorations for line-like items.
Definition qcustomplot.h:1742
EndingStyle
Definition qcustomplot.h:1758
A margin group allows synchronization of margin sides if working with multiple layout elements.
Definition qcustomplot.h:1389
QList< QCPLayoutElement * > elements(QCP::MarginSide side) const
Definition qcustomplot.h:1396
A paint buffer based on QPixmap, using software raster rendering.
Definition qcustomplot.h:761
QPainter subclass used internally.
Definition qcustomplot.h:656
void drawLine(const QLineF &line)
Definition qcustomplot.cpp:361
PainterMode
Definition qcustomplot.h:664
@ pmNoCaching
Definition qcustomplot.h:672
@ pmVectorized
Definition qcustomplot.h:668
void setPen(const QPen &pen)
Definition qcustomplot.cpp:317
Defines an abstract interface for one-dimensional plottables.
Definition qcustomplot.h:4760
virtual int dataCount() const =0
virtual bool sortKeyIsMainKey() const =0
virtual double dataMainKey(int index) const =0
virtual int findBegin(double sortKey, bool expandedRange=true) const =0
virtual int findEnd(double sortKey, bool expandedRange=true) const =0
virtual QCPDataSelection selectTestRect(const QRectF &rect, bool onlySelectable) const =0
virtual QPointF dataPixelPosition(int index) const =0
virtual QCPRange dataValueRange(int index) const =0
virtual double dataMainValue(int index) const =0
virtual double dataSortKey(int index) const =0
A legend item representing a plottable with an icon and the plottable name.
Definition qcustomplot.h:5845
The main container for polar plots, representing the angular axis as a circle.
Definition qcustomplot.h:8291
int height() const
Definition qcustomplot.h:8473
QSize size() const
Definition qcustomplot.h:8474
QPointF center() const
Definition qcustomplot.h:8479
int left() const
Definition qcustomplot.h:8468
SelectablePart
Definition qcustomplot.h:8301
QPoint topRight() const
Definition qcustomplot.h:8476
QPoint topLeft() const
Definition qcustomplot.h:8475
QPoint bottomLeft() const
Definition qcustomplot.h:8477
int bottom() const
Definition qcustomplot.h:8471
int right() const
Definition qcustomplot.h:8469
int width() const
Definition qcustomplot.h:8472
int top() const
Definition qcustomplot.h:8470
LabelMode
Definition qcustomplot.h:8318
QPoint bottomRight() const
Definition qcustomplot.h:8478
The radial axis inside a radial plot.
Definition qcustomplot.h:8017
QSharedPointer< QCPAxisTicker > ticker() const
Definition qcustomplot.h:8087
ScaleType
Definition qcustomplot.h:8040
AngleReference
Definition qcustomplot.h:8027
SelectablePart
Definition qcustomplot.h:8052
A radial graph used to display data in polar plots.
Definition qcustomplot.h:8696
LineStyle
Definition qcustomplot.h:8706
The grid in both angular and radial dimensions for polar plots.
Definition qcustomplot.h:8589
GridType
Definition qcustomplot.h:8598
A legend item for polar plots.
Definition qcustomplot.h:8674
Represents the range an axis is encompassing.
Definition qcustomplot.h:986
void expand(const QCPRange &otherRange)
Definition qcustomplot.cpp:1994
static const double maxRange
Definition qcustomplot.h:1044
QCPRange & operator/=(const double &value)
Definition qcustomplot.h:1013
double size() const
Definition qcustomplot.h:1025
QCPRange & operator*=(const double &value)
Definition qcustomplot.h:1008
QCPRange & operator-=(const double &value)
Definition qcustomplot.h:1003
static const double minRange
Definition qcustomplot.h:1043
QDebug operator<<(QDebug d, const QCPRange &range)
Definition qcustomplot.h:1052
bool contains(double value) const
Definition qcustomplot.h:1039
double center() const
Definition qcustomplot.h:1026
void normalize()
Definition qcustomplot.h:1027
QCPRange & operator+=(const double &value)
Definition qcustomplot.h:998
Represents the visual appearance of scatter points.
Definition qcustomplot.h:2830
bool isPenDefined() const
Definition qcustomplot.h:2947
bool isNone() const
Definition qcustomplot.h:2946
ScatterProperty
Definition qcustomplot.h:2842
@ spPen
0x01 The pen property, see setPen
Definition qcustomplot.h:2845
ScatterShape
Definition qcustomplot.h:2867
A selection decorator which draws brackets around each selected data segment.
Definition qcustomplot.h:5567
BracketStyle
Definition qcustomplot.h:5576
Controls how a plottable's data selection is drawn.
Definition qcustomplot.h:3918
Provides rect/rubber-band data selection and range zoom interaction.
Definition qcustomplot.h:1336
void accepted(const QRect &rect, QMouseEvent *event)
void changed(const QRect &rect, QMouseEvent *event)
void started(QMouseEvent *event)
bool isActive() const
Definition qcustomplot.h:1347
void canceled(const QRect &rect, QInputEvent *event)
Holds the data of one single data point for QCPStatisticalBox.
Definition qcustomplot.h:6758
double mainValue() const
Definition qcustomplot.h:6772
double sortKey() const
Definition qcustomplot.h:6765
QCPRange valueRange() const
Definition qcustomplot.h:6774
static bool sortKeyIsMainKey()
Definition qcustomplot.h:6769
double mainKey() const
Definition qcustomplot.h:6771
static QCPStatisticalBoxData fromSortKey(double sortKey)
Definition qcustomplot.h:6766
A plottable representing a single statistical box in a plot.
Definition qcustomplot.h:6802
QSharedPointer< QCPStatisticalBoxDataContainer > data() const
Definition qcustomplot.h:6819
A layout element displaying a text.
Definition qcustomplot.h:6009
void selectionChanged(bool selected)
void doubleClicked(QMouseEvent *event)
void clicked(QMouseEvent *event)
Represents two doubles as a mathematical 2D vector.
Definition qcustomplot.h:563
QCPVector2D perpendicular() const
Definition qcustomplot.h:590
double length() const
Definition qcustomplot.h:581
double angle() const
Definition qcustomplot.h:583
double dot(const QCPVector2D &vec) const
Definition qcustomplot.h:591
QDebug operator<<(QDebug d, const QCPVector2D &vec)
Definition qcustomplot.h:646
double lengthSquared() const
Definition qcustomplot.h:582
void setX(double x)
Definition qcustomplot.h:577
QPointF toPointF() const
Definition qcustomplot.h:585
bool isNull() const
Definition qcustomplot.h:587
void setY(double y)
Definition qcustomplot.h:578
QPoint toPoint() const
Definition qcustomplot.h:584
The central class of the library. This is the QWidget which displays the plot and interacts with the ...
Definition qcustomplot.h:4305
void legendDoubleClick(QCPLegend *legend, QCPAbstractLegendItem *item, QMouseEvent *event)
QCPAbstractItem * item() const
Definition qcustomplot.cpp:15556
RefreshPriority
Definition qcustomplot.h:4344
@ rpRefreshHint
Definition qcustomplot.h:4353
QCPLegend * legend
Definition qcustomplot.h:4515
void selectionChangedByUser()
void axisDoubleClick(QCPAxis *axis, QCPAxis::SelectablePart part, QMouseEvent *event)
void mouseMove(QMouseEvent *event)
LayerInsertMode
Definition qcustomplot.h:4331
void legendClick(QCPLegend *legend, QCPAbstractLegendItem *item, QMouseEvent *event)
void plottableDoubleClick(QCPAbstractPlottable *plottable, int dataIndex, QMouseEvent *event)
ItemType * itemAt(const QPointF &pos, bool onlySelectable=false) const
Definition qcustomplot.h:4721
QCPAxis * xAxis
Definition qcustomplot.h:4514
void mouseDoubleClick(QMouseEvent *event)
void axisClick(QCPAxis *axis, QCPAxis::SelectablePart part, QMouseEvent *event)
void mouseWheel(QWheelEvent *event)
void itemDoubleClick(QCPAbstractItem *item, QMouseEvent *event)
void mouseRelease(QMouseEvent *event)
void mousePress(QMouseEvent *event)
QCPSelectionRect * selectionRect() const
Definition qcustomplot.h:4393
void itemClick(QCPAbstractItem *item, QMouseEvent *event)
QCPLayoutGrid * plotLayout() const
Definition qcustomplot.h:4375
void plottableClick(QCPAbstractPlottable *plottable, int dataIndex, QMouseEvent *event)
Definition qcustomplot.h:171
ExportPen
Definition qcustomplot.h:214
@ epAllowCosmetic
Definition qcustomplot.h:218
@ epNoCosmetic
Definition qcustomplot.h:215
Interaction
Definition qcustomplot.h:339
@ iSelectLegend
Definition qcustomplot.h:361
@ iRangeDrag
Definition qcustomplot.h:342
@ iSelectPlottables
Definition qcustomplot.h:354
@ iNone
0x000 None of the interactions are possible
Definition qcustomplot.h:340
@ iRangeZoom
Definition qcustomplot.h:346
@ iSelectPlottablesBeyondAxisRect
Definition qcustomplot.h:371
@ iSelectAxes
Definition qcustomplot.h:358
@ iSelectItems
Definition qcustomplot.h:364
@ iMultiSelect
Definition qcustomplot.h:350
@ iSelectOther
Definition qcustomplot.h:367
PlottingHint
Definition qcustomplot.h:309
@ phImmediateRefresh
Definition qcustomplot.h:319
@ phCacheLabels
Definition qcustomplot.h:327
@ phFastPolylines
Definition qcustomplot.h:312
@ phNone
0x000 No hints are set
Definition qcustomplot.h:310
ResolutionUnit
Definition qcustomplot.h:200
@ ruDotsPerCentimeter
Resolution is given in dots per centimeter (dpcm)
Definition qcustomplot.h:203
@ ruDotsPerMeter
Resolution is given in dots per meter (dpm)
Definition qcustomplot.h:201
@ ruDotsPerInch
Resolution is given in dots per inch (DPI/PPI)
Definition qcustomplot.h:205
MarginSide
Definition qcustomplot.h:244
@ msAll
0xFF all margins
Definition qcustomplot.h:253
@ msBottom
0x08 bottom margin
Definition qcustomplot.h:251
@ msTop
0x04 top margin
Definition qcustomplot.h:249
@ msNone
0x00 no margin
Definition qcustomplot.h:255
@ msRight
0x02 right margin
Definition qcustomplot.h:247
@ msLeft
0x01 left margin
Definition qcustomplot.h:245
SelectionType
Definition qcustomplot.h:425
@ stMultipleDataRanges
Definition qcustomplot.h:437
@ stDataRange
Definition qcustomplot.h:434
@ stNone
The plottable is not selectable.
Definition qcustomplot.h:426
@ stSingleData
One individual data point can be selected at a time.
Definition qcustomplot.h:432
@ stWhole
Definition qcustomplot.h:428
SelectionRectMode
Definition qcustomplot.h:383
@ srmCustom
Definition qcustomplot.h:398
@ srmSelect
Definition qcustomplot.h:392
@ srmZoom
Definition qcustomplot.h:387
@ srmNone
Definition qcustomplot.h:384
AntialiasedElement
Definition qcustomplot.h:270
@ aeLegendItems
0x0010 Legend items
Definition qcustomplot.h:279
@ aeZeroLine
0x0200 Zero-lines, see QCPGrid::setZeroLinePen
Definition qcustomplot.h:291
@ aePlottables
0x0020 Main lines of plottables
Definition qcustomplot.h:281
@ aeGrid
0x0002 Grid lines
Definition qcustomplot.h:273
@ aeOther
Definition qcustomplot.h:294
@ aeFills
Definition qcustomplot.h:288
@ aeLegend
0x0008 Legend box
Definition qcustomplot.h:277
@ aeAll
0xFFFF All elements
Definition qcustomplot.h:297
@ aeNone
0x0000 No elements
Definition qcustomplot.h:299
@ aeSubGrid
0x0004 Sub grid lines
Definition qcustomplot.h:275
@ aeScatters
Definition qcustomplot.h:285
@ aeAxes
0x0001 Axis base line and tick marks
Definition qcustomplot.h:271
@ aeItems
0x0040 Main lines of items
Definition qcustomplot.h:283
SignDomain
Definition qcustomplot.h:231
@ sdNegative
The negative sign domain, i.e. numbers smaller than zero.
Definition qcustomplot.h:232
@ sdPositive
The positive sign domain, i.e. numbers greater than zero.
Definition qcustomplot.h:236
@ sdBoth
Both sign domains, including zero, i.e. all numbers.
Definition qcustomplot.h:234
Definition qcustomplot.h:2796
Definition qcustomplot.h:2800
Definition qcustomplot.h:1908
Definition qcustomplot.h:1912