29 #include <QtCore/qglobal.h> 32 #ifdef QCUSTOMPLOT_USE_OPENGL 33 # if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) 34 # define QCP_OPENGL_PBUFFER 36 # define QCP_OPENGL_FBO 38 # if QT_VERSION >= QT_VERSION_CHECK(5, 3, 0) 39 # define QCP_OPENGL_OFFSCREENSURFACE 43 #if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) 44 # define QCP_DEVICEPIXELRATIO_SUPPORTED 45 # if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) 46 # define QCP_DEVICEPIXELRATIO_FLOAT 50 #include <QtCore/QObject> 51 #include <QtCore/QPointer> 52 #include <QtCore/QSharedPointer> 53 #include <QtCore/QTimer> 54 #include <QtGui/QPainter> 55 #include <QtGui/QPainterPath> 56 #include <QtGui/QPaintEvent> 57 #include <QtGui/QMouseEvent> 58 #include <QtGui/QWheelEvent> 59 #include <QtGui/QPixmap> 60 #include <QtCore/QVector> 61 #include <QtCore/QString> 62 #include <QtCore/QDateTime> 63 #include <QtCore/QMultiMap> 64 #include <QtCore/QFlags> 65 #include <QtCore/QDebug> 66 #include <QtCore/QStack> 67 #include <QtCore/QCache> 68 #include <QtCore/QMargins> 73 # include <QtGui/QOpenGLContext> 74 # if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) 75 # include <QtGui/QOpenGLFramebufferObject> 77 # include <QOpenGLFramebufferObject> 78 # include <QOpenGLPaintDevice> 80 # ifdef QCP_OPENGL_OFFSCREENSURFACE 81 # include <QtGui/QOffscreenSurface> 83 # include <QtGui/QWindow> 86 #ifdef QCP_OPENGL_PBUFFER 87 # include <QtOpenGL/QGLPixelBuffer> 89 #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) 90 # include <qnumeric.h> 91 # include <QtGui/QWidget> 92 # include <QtGui/QPrinter> 93 # include <QtGui/QPrintEngine> 96 # include <QtWidgets/QWidget> 97 # include <QtPrintSupport/QtPrintSupport> 99 #if QT_VERSION >= QT_VERSION_CHECK(4, 8, 0) 100 # include <QtCore/QElapsedTimer> 102 # if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0) 103 # include <QtCore/QTimeZone> 134 #define QCUSTOMPLOT_VERSION_STR "2.1.0" 135 #define QCUSTOMPLOT_VERSION 0x020100 138 #if defined(QT_STATIC_BUILD) 139 # define QCP_LIB_DECL 140 #elif defined(QCUSTOMPLOT_COMPILE_LIBRARY) 141 # define QCP_LIB_DECL Q_DECL_EXPORT 142 #elif defined(QCUSTOMPLOT_USE_LIBRARY) 143 # define QCP_LIB_DECL Q_DECL_IMPORT 145 # define QCP_LIB_DECL 149 #ifndef Q_DECL_OVERRIDE 150 # define Q_DECL_OVERRIDE 307 Q_FLAG_NS(MarginSides)
309 Q_FLAG_NS(AntialiasedElements)
311 Q_FLAG_NS(PlottingHints)
313 Q_FLAG_NS(Interactions)
323 inline bool isInvalidData(
double value)
325 return qIsNaN(value) || qIsInf(value);
333 inline bool isInvalidData(
double value1,
double value2)
335 return isInvalidData(value1) || isInvalidData(value2);
344 inline void setMarginValue(QMargins &margins,
QCP::MarginSide side,
int value)
350 case QCP::msTop: margins.setTop(value);
break;
352 case QCP::msAll: margins = QMargins(value, value, value, value);
break;
364 inline int getMarginValue(
const QMargins &margins,
QCP::MarginSide side)
378 Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::AntialiasedElements)
379 Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::PlottingHints)
380 Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::MarginSides)
381 Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::Interactions)
399 double x()
const {
return mX; }
400 double y()
const {
return mY; }
401 double &rx() {
return mX; }
402 double &ry() {
return mY; }
405 void setX(
double x) { mX = x; }
406 void setY(
double y) { mY = y; }
409 double length()
const {
return qSqrt(mX*mX+mY*mY); }
411 double angle()
const {
return qAtan2(mY, mX); }
412 QPoint
toPoint()
const {
return QPoint(
int(mX),
int(mY)); }
415 bool isNull()
const {
return qIsNull(mX) && qIsNull(mY); }
421 double distanceSquaredToLine(
const QLineF &line)
const;
455 d.nospace() <<
"QCPVector2D(" << vec.x() <<
", " << vec.y() <<
")";
476 ,pmNonCosmetic = 0x04
479 Q_FLAGS(PainterModes)
480 Q_DECLARE_FLAGS(PainterModes, PainterMode)
486 bool antialiasing()
const {
return testRenderHint(QPainter::Antialiasing); }
487 PainterModes modes()
const {
return mModes; }
490 void setAntialiasing(
bool enabled);
491 void setMode(PainterMode mode,
bool enabled=
true);
492 void setModes(PainterModes modes);
496 void setPen(
const QPen &pen);
497 void setPen(
const QColor &color);
498 void setPen(Qt::PenStyle penStyle);
499 void drawLine(
const QLineF &line);
505 void makeNonCosmetic();
510 bool mIsAntialiasing;
513 QStack<bool> mAntialiasingStack;
515 Q_DECLARE_OPERATORS_FOR_FLAGS(QCPPainter::PainterModes)
531 QSize size()
const {
return mSize; }
532 bool invalidated()
const {
return mInvalidated; }
533 double devicePixelRatio()
const {
return mDevicePixelRatio; }
536 void setSize(
const QSize &size);
537 void setInvalidated(
bool invalidated=
true);
538 void setDevicePixelRatio(
double ratio);
543 virtual void draw(
QCPPainter *painter)
const = 0;
544 virtual void clear(
const QColor &color) = 0;
549 double mDevicePixelRatio;
555 virtual void reallocateBuffer() = 0;
579 #ifdef QCP_OPENGL_PBUFFER 583 explicit QCPPaintBufferGlPbuffer(
const QSize &size,
double devicePixelRatio,
int multisamples);
584 virtual ~QCPPaintBufferGlPbuffer() Q_DECL_OVERRIDE;
587 virtual
QCPPainter *startPainting() Q_DECL_OVERRIDE;
588 virtual
void draw(
QCPPainter *painter) const Q_DECL_OVERRIDE;
589 void clear(const
QColor &color) Q_DECL_OVERRIDE;
597 virtual
void reallocateBuffer() Q_DECL_OVERRIDE;
599 #endif // QCP_OPENGL_PBUFFER 602 #ifdef QCP_OPENGL_FBO 606 explicit QCPPaintBufferGlFbo(
const QSize &size,
double devicePixelRatio, QWeakPointer<QOpenGLContext> glContext, QWeakPointer<QOpenGLPaintDevice> glPaintDevice);
607 virtual ~QCPPaintBufferGlFbo() Q_DECL_OVERRIDE;
610 virtual
QCPPainter *startPainting() Q_DECL_OVERRIDE;
611 virtual
void donePainting() Q_DECL_OVERRIDE;
612 virtual
void draw(
QCPPainter *painter) const Q_DECL_OVERRIDE;
613 void clear(const
QColor &color) Q_DECL_OVERRIDE;
617 QWeakPointer<QOpenGLContext> mGlContext;
618 QWeakPointer<QOpenGLPaintDevice> mGlPaintDevice;
619 QOpenGLFramebufferObject *mGlFrameBuffer;
622 virtual
void reallocateBuffer() Q_DECL_OVERRIDE;
624 #endif // QCP_OPENGL_FBO 636 Q_PROPERTY(
QCustomPlot* parentPlot READ parentPlot)
637 Q_PROPERTY(
QString name READ name)
638 Q_PROPERTY(
int index READ index)
640 Q_PROPERTY(
bool visible READ visible WRITE setVisible)
641 Q_PROPERTY(
LayerMode mode READ mode WRITE setMode)
661 QCustomPlot *parentPlot()
const {
return mParentPlot; }
662 QString name()
const {
return mName; }
663 int index()
const {
return mIndex; }
665 bool visible()
const {
return mVisible; }
666 LayerMode mode()
const {
return mMode; }
669 void setVisible(
bool visible);
670 void setMode(LayerMode mode);
685 QWeakPointer<QCPAbstractPaintBuffer> mPaintBuffer;
689 void drawToPaintBuffer();
705 Q_PROPERTY(
bool visible READ visible WRITE
setVisible)
706 Q_PROPERTY(
QCustomPlot* parentPlot READ parentPlot)
709 Q_PROPERTY(
bool antialiased READ antialiased WRITE
setAntialiased)
716 bool visible()
const {
return mVisible; }
717 QCustomPlot *parentPlot()
const {
return mParentPlot; }
719 QCPLayer *layer()
const {
return mLayer; }
720 bool antialiased()
const {
return mAntialiased; }
741 QPointer<QCPLayerable> mParentLayerable;
746 virtual void parentPlotInitialized(
QCustomPlot *parentPlot);
748 virtual QRect clipRect()
const;
749 virtual void applyDefaultAntialiasingHint(
QCPPainter *painter)
const = 0;
752 virtual void selectEvent(
QMouseEvent *event,
bool additive,
const QVariant &details,
bool *selectionStateChanged);
753 virtual void deselectEvent(
bool *selectionStateChanged);
762 void initializeParentPlot(
QCustomPlot *parentPlot);
764 bool moveToLayer(
QCPLayer *layer,
bool prepend);
787 QCPRange(
double lower,
double upper);
789 bool operator==(
const QCPRange& other)
const {
return lower == other.lower && upper == other.upper; }
790 bool operator!=(
const QCPRange& other)
const {
return !(*
this == other); }
798 friend inline const QCPRange operator-(
const QCPRange& range,
double value);
799 friend inline const QCPRange operator*(
const QCPRange& range,
double value);
800 friend inline const QCPRange operator*(
double value,
const QCPRange& range);
801 friend inline const QCPRange operator/(
const QCPRange& range,
double value);
803 double size()
const {
return upper-lower; }
804 double center()
const {
return (upper+lower)*0.5; }
805 void normalize() {
if (lower > upper) qSwap(lower, upper); }
806 void expand(
const QCPRange &otherRange);
807 void expand(
double includeCoord);
809 QCPRange expanded(
double includeCoord)
const;
810 QCPRange bounded(
double lowerBound,
double upperBound)
const;
811 QCPRange sanitizedForLogScale()
const;
812 QCPRange sanitizedForLinScale()
const;
813 bool contains(
double value)
const {
return value >= lower && value <= upper; }
815 static bool validRange(
double lower,
double upper);
816 static bool validRange(
const QCPRange &range);
821 Q_DECLARE_TYPEINFO(
QCPRange, Q_MOVABLE_TYPE);
827 inline QDebug operator<< (QDebug d,
const QCPRange &range)
829 d.nospace() <<
"QCPRange(" << range.lower <<
", " << range.upper <<
")";
905 bool operator==(
const QCPDataRange& other)
const {
return mBegin == other.mBegin && mEnd == other.mEnd; }
906 bool operator!=(
const QCPDataRange& other)
const {
return !(*
this == other); }
909 int begin()
const {
return mBegin; }
910 int end()
const {
return mEnd; }
911 int size()
const {
return mEnd-mBegin; }
919 bool isValid()
const {
return (mEnd >= mBegin) && (mBegin >= 0); }
920 bool isEmpty()
const {
return length() == 0; }
943 bool operator!=(
const QCPDataSelection& other)
const {
return !(*
this == other); }
959 int dataPointCount()
const;
965 void addDataRange(
const QCPDataRange &dataRange,
bool simplify=
true);
967 bool isEmpty()
const {
return mDataRanges.isEmpty(); }
979 inline static bool lessThanDataRangeBegin(
const QCPDataRange &a,
const QCPDataRange &b) {
return a.begin() < b.begin(); }
1074 d.nospace() <<
"QCPDataRange(" << dataRange.begin() <<
", " << dataRange.end() <<
")";
1084 d.nospace() <<
"QCPDataSelection(";
1111 QRect rect()
const {
return mRect; }
1113 QPen pen()
const {
return mPen; }
1114 QBrush brush()
const {
return mBrush; }
1118 void setPen(
const QPen &pen);
1119 void setBrush(
const QBrush &brush);
1122 Q_SLOT
void cancel();
1126 void changed(
const QRect &rect,
QMouseEvent *event);
1127 void canceled(
const QRect &rect,
QInputEvent *event);
1128 void accepted(
const QRect &rect,
QMouseEvent *event);
1142 virtual void keyPressEvent(
QKeyEvent *event);
1145 virtual void applyDefaultAntialiasingHint(
QCPPainter *painter)
const Q_DECL_OVERRIDE;
1146 virtual void draw(
QCPPainter *painter) Q_DECL_OVERRIDE;
1166 bool isEmpty()
const;
1192 Q_PROPERTY(
QCPLayout* layout READ layout)
1193 Q_PROPERTY(QRect rect READ rect)
1194 Q_PROPERTY(QRect outerRect READ outerRect WRITE setOuterRect)
1195 Q_PROPERTY(QMargins margins READ margins WRITE setMargins)
1196 Q_PROPERTY(QMargins minimumMargins READ minimumMargins WRITE setMinimumMargins)
1197 Q_PROPERTY(QSize minimumSize READ minimumSize WRITE setMinimumSize)
1198 Q_PROPERTY(QSize maximumSize READ maximumSize WRITE setMaximumSize)
1199 Q_PROPERTY(
SizeConstraintRect sizeConstraintRect READ sizeConstraintRect WRITE setSizeConstraintRect)
1210 Q_ENUMS(UpdatePhase)
1223 Q_ENUMS(SizeConstraintRect)
1230 QRect
rect()
const {
return mRect; }
1232 QMargins margins()
const {
return mMargins; }
1233 QMargins minimumMargins()
const {
return mMinimumMargins; }
1234 QCP::MarginSides autoMargins()
const {
return mAutoMargins; }
1235 QSize minimumSize()
const {
return mMinimumSize; }
1236 QSize maximumSize()
const {
return mMaximumSize; }
1237 SizeConstraintRect sizeConstraintRect()
const {
return mSizeConstraintRect; }
1242 void setOuterRect(
const QRect &rect);
1243 void setMargins(
const QMargins &margins);
1244 void setMinimumMargins(
const QMargins &margins);
1245 void setAutoMargins(QCP::MarginSides sides);
1246 void setMinimumSize(
const QSize &size);
1247 void setMinimumSize(
int width,
int height);
1248 void setMaximumSize(
const QSize &size);
1249 void setMaximumSize(
int width,
int height);
1250 void setSizeConstraintRect(SizeConstraintRect constraintRect);
1251 void setMarginGroup(QCP::MarginSides sides,
QCPMarginGroup *group);
1254 virtual void update(UpdatePhase phase);
1255 virtual QSize minimumOuterSizeHint()
const;
1256 virtual QSize maximumOuterSizeHint()
const;
1265 QSize mMinimumSize, mMaximumSize;
1266 SizeConstraintRect mSizeConstraintRect;
1267 QRect mRect, mOuterRect;
1268 QMargins mMargins, mMinimumMargins;
1269 QCP::MarginSides mAutoMargins;
1273 virtual
int calculateAutoMargin(
QCP::MarginSide side);
1274 virtual
void layoutChanged();
1277 virtual
void applyDefaultAntialiasingHint(
QCPPainter *painter) const Q_DECL_OVERRIDE { Q_UNUSED(painter) }
1278 virtual void draw(
QCPPainter *painter) Q_DECL_OVERRIDE { Q_UNUSED(painter) }
1279 virtual void parentPlotInitialized(
QCustomPlot *parentPlot) Q_DECL_OVERRIDE;
1298 virtual void update(
UpdatePhase phase) Q_DECL_OVERRIDE;
1302 virtual int elementCount()
const = 0;
1306 virtual void simplify();
1309 bool removeAt(
int index);
1315 virtual void updateLayout();
1318 void sizeConstraintsChanged()
const;
1335 Q_PROPERTY(
int rowCount READ rowCount)
1336 Q_PROPERTY(
int columnCount READ columnCount)
1337 Q_PROPERTY(
QList<double> columnStretchFactors READ columnStretchFactors WRITE setColumnStretchFactors)
1338 Q_PROPERTY(
QList<double> rowStretchFactors READ rowStretchFactors WRITE setRowStretchFactors)
1339 Q_PROPERTY(
int columnSpacing READ columnSpacing WRITE setColumnSpacing)
1340 Q_PROPERTY(
int rowSpacing READ rowSpacing WRITE setRowSpacing)
1341 Q_PROPERTY(
FillOrder fillOrder READ fillOrder WRITE setFillOrder)
1342 Q_PROPERTY(
int wrap READ wrap WRITE setWrap)
1362 int rowCount()
const {
return mElements.size(); }
1363 int columnCount()
const {
return mElements.size() > 0 ? mElements.first().size() : 0; }
1364 QList<double> columnStretchFactors()
const {
return mColumnStretchFactors; }
1365 QList<double> rowStretchFactors()
const {
return mRowStretchFactors; }
1366 int columnSpacing()
const {
return mColumnSpacing; }
1367 int rowSpacing()
const {
return mRowSpacing; }
1368 int wrap()
const {
return mWrap; }
1369 FillOrder fillOrder()
const {
return mFillOrder; }
1372 void setColumnStretchFactor(
int column,
double factor);
1374 void setRowStretchFactor(
int row,
double factor);
1376 void setColumnSpacing(
int pixels);
1377 void setRowSpacing(
int pixels);
1378 void setWrap(
int count);
1379 void setFillOrder(FillOrder order,
bool rearrange=
true);
1382 virtual void updateLayout() Q_DECL_OVERRIDE;
1383 virtual
int elementCount() const Q_DECL_OVERRIDE {
return rowCount()*columnCount(); }
1388 virtual void simplify() Q_DECL_OVERRIDE;
1389 virtual QSize minimumOuterSizeHint() const Q_DECL_OVERRIDE;
1390 virtual QSize maximumOuterSizeHint() const Q_DECL_OVERRIDE;
1396 bool hasElement(
int row,
int column);
1397 void expandTo(
int newRowCount,
int newColumnCount);
1398 void insertRow(
int newIndex);
1399 void insertColumn(
int newIndex);
1400 int rowColToIndex(
int row,
int column) const;
1401 void indexToRowCol(
int index,
int &row,
int &column) const;
1406 QList<
double> mColumnStretchFactors;
1407 QList<
double> mRowStretchFactors;
1408 int mColumnSpacing, mRowSpacing;
1410 FillOrder mFillOrder;
1413 void getMinimumRowColSizes(
QVector<
int> *minColWidths,
QVector<
int> *minRowHeights) const;
1414 void getMaximumRowColSizes(
QVector<
int> *maxColWidths,
QVector<
int> *maxRowHeights) const;
1432 Q_ENUMS(InsetPlacement)
1438 InsetPlacement insetPlacement(
int index) const;
1439 Qt::Alignment insetAlignment(
int index) const;
1440 QRectF insetRect(
int index) const;
1443 void setInsetPlacement(
int index, InsetPlacement placement);
1444 void setInsetAlignment(
int index,
Qt::Alignment alignment);
1445 void setInsetRect(
int index, const
QRectF &rect);
1448 virtual
void updateLayout() Q_DECL_OVERRIDE;
1449 virtual
int elementCount() const Q_DECL_OVERRIDE;
1453 virtual
void simplify() Q_DECL_OVERRIDE {}
1463 QList<InsetPlacement> mInsetPlacement;
1464 QList<
Qt::Alignment> mInsetAlignment;
1504 Q_ENUMS(EndingStyle)
1507 QCPLineEnding(EndingStyle style,
double width=8,
double length=10,
bool inverted=
false);
1510 EndingStyle style()
const {
return mStyle; }
1511 double width()
const {
return mWidth; }
1512 double length()
const {
return mLength; }
1513 bool inverted()
const {
return mInverted; }
1516 void setStyle(EndingStyle style);
1517 void setWidth(
double width);
1518 void setLength(
double length);
1519 void setInverted(
bool inverted);
1522 double boundingDistance()
const;
1523 double realLength()
const;
1530 double mWidth, mLength;
1561 Q_ENUMS(AnchorReferenceType)
1581 void setAnchorSide(AnchorSide side);
1582 void setAnchorMode(AnchorMode mode);
1583 void setAnchorReference(
const QPointF &pixelPoint);
1584 void setAnchorReferenceType(AnchorReferenceType type);
1585 void setFont(
const QFont &font);
1586 void setColor(
const QColor &color);
1587 void setPadding(
int padding);
1588 void setRotation(
double rotation);
1589 void setSubstituteExponent(
bool enabled);
1590 void setMultiplicationSymbol(
QChar symbol);
1591 void setAbbreviateDecimalPowers(
bool enabled);
1592 void setCacheSize(
int labelCount);
1595 AnchorMode anchorMode()
const {
return mAnchorMode; }
1596 AnchorSide anchorSide()
const {
return mAnchorSide; }
1597 QPointF anchorReference()
const {
return mAnchorReference; }
1598 AnchorReferenceType anchorReferenceType()
const {
return mAnchorReferenceType; }
1599 QFont font()
const {
return mFont; }
1600 QColor color()
const {
return mColor; }
1601 int padding()
const {
return mPadding; }
1602 double rotation()
const {
return mRotation; }
1603 bool substituteExponent()
const {
return mSubstituteExponent; }
1604 QChar multiplicationSymbol()
const {
return mMultiplicationSymbol; }
1605 bool abbreviateDecimalPowers()
const {
return mAbbreviateDecimalPowers; }
1606 int cacheSize()
const;
1615 static const QChar SymbolDot;
1616 static const QChar SymbolCross;
1629 QString basePart, expPart, suffixPart;
1630 QRect baseBounds, expBounds, suffixBounds;
1632 QRect rotatedTotalBounds;
1633 QFont baseFont, expFont;
1646 bool mSubstituteExponent;
1647 QChar mMultiplicationSymbol;
1648 bool mAbbreviateDecimalPowers;
1653 QRect mAxisSelectionBox, mTickLabelsSelectionBox, mLabelSelectionBox;
1654 int mLetterCapHeight, mLetterDescent;
1658 virtual QByteArray generateLabelParameterHash()
const;
1664 void applyAnchorTransform(
LabelData &labelData)
const;
1668 AnchorSide skewedAnchorSide(
const QPointF &tickPos,
double sideExpandHorz,
double sideExpandVert)
const;
1670 void analyzeFontMetrics();
1696 Q_ENUMS(TickStepStrategy)
1702 TickStepStrategy tickStepStrategy()
const {
return mTickStepStrategy; }
1703 int tickCount()
const {
return mTickCount; }
1704 double tickOrigin()
const {
return mTickOrigin; }
1707 void setTickStepStrategy(TickStepStrategy strategy);
1708 void setTickCount(
int count);
1709 void setTickOrigin(
double origin);
1716 TickStepStrategy mTickStepStrategy;
1721 virtual double getTickStep(
const QCPRange &range);
1722 virtual int getSubTickCount(
double tickStep);
1723 virtual QString getTickLabel(
double tick,
const QLocale &locale,
QChar formatChar,
int precision);
1730 double pickClosest(
double target,
const QVector<double> &candidates)
const;
1731 double getMantissa(
double input,
double *magnitude=
nullptr)
const;
1732 double cleanMantissa(
double input)
const;
1739 Q_DECLARE_METATYPE(QSharedPointer<QCPAxisTicker>)
1753 QString dateTimeFormat()
const {
return mDateTimeFormat; }
1754 Qt::TimeSpec dateTimeSpec()
const {
return mDateTimeSpec; }
1755 # if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0) 1756 QTimeZone timeZone()
const {
return mTimeZone; }
1760 void setDateTimeFormat(
const QString &format);
1761 void setDateTimeSpec(Qt::TimeSpec spec);
1762 # if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0) 1763 void setTimeZone(
const QTimeZone &zone);
1765 void setTickOrigin(
double origin);
1766 void setTickOrigin(
const QDateTime &origin);
1769 static QDateTime keyToDateTime(
double key);
1770 static double dateTimeToKey(
const QDateTime &dateTime);
1771 static double dateTimeToKey(
const QDate &date, Qt::TimeSpec timeSpec=Qt::LocalTime);
1776 Qt::TimeSpec mDateTimeSpec;
1777 # if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0) 1778 QTimeZone mTimeZone;
1781 enum DateStrategy {dsNone, dsUniformTimeInDay, dsUniformDayInMonth} mDateStrategy;
1784 virtual double getTickStep(
const QCPRange &range) Q_DECL_OVERRIDE;
1785 virtual int getSubTickCount(
double tickStep) Q_DECL_OVERRIDE;
1786 virtual QString getTickLabel(
double tick,
const QLocale &locale,
QChar formatChar,
int precision) Q_DECL_OVERRIDE;
1816 QString timeFormat()
const {
return mTimeFormat; }
1817 int fieldWidth(TimeUnit unit)
const {
return mFieldWidth.value(unit); }
1820 void setTimeFormat(
const QString &format);
1821 void setFieldWidth(TimeUnit unit,
int width);
1829 TimeUnit mSmallestUnit, mBiggestUnit;
1833 virtual double getTickStep(
const QCPRange &range) Q_DECL_OVERRIDE;
1834 virtual int getSubTickCount(
double tickStep) Q_DECL_OVERRIDE;
1835 virtual QString getTickLabel(
double tick,
const QLocale &locale,
QChar formatChar,
int precision) Q_DECL_OVERRIDE;
1838 void replaceUnit(
QString &text, TimeUnit unit,
int value)
const;
1862 Q_ENUMS(ScaleStrategy)
1867 double tickStep()
const {
return mTickStep; }
1868 ScaleStrategy scaleStrategy()
const {
return mScaleStrategy; }
1871 void setTickStep(
double step);
1872 void setScaleStrategy(ScaleStrategy strategy);
1877 ScaleStrategy mScaleStrategy;
1880 virtual double getTickStep(
const QCPRange &range) Q_DECL_OVERRIDE;
1897 int subTickCount()
const {
return mSubTickCount; }
1902 void setSubTickCount(
int subTicks);
1906 void addTick(
double position,
const QString &label);
1916 virtual double getTickStep(
const QCPRange &range) Q_DECL_OVERRIDE;
1917 virtual int getSubTickCount(
double tickStep) Q_DECL_OVERRIDE;
1918 virtual QString getTickLabel(
double tick,
const QLocale &locale,
QChar formatChar,
int precision) Q_DECL_OVERRIDE;
1941 Q_ENUMS(FractionStyle)
1946 QString piSymbol()
const {
return mPiSymbol; }
1947 double piValue()
const {
return mPiValue; }
1948 bool periodicity()
const {
return mPeriodicity; }
1949 FractionStyle fractionStyle()
const {
return mFractionStyle; }
1952 void setPiSymbol(
QString symbol);
1953 void setPiValue(
double pi);
1954 void setPeriodicity(
int multiplesOfPi);
1955 void setFractionStyle(FractionStyle style);
1962 FractionStyle mFractionStyle;
1968 virtual double getTickStep(
const QCPRange &range) Q_DECL_OVERRIDE;
1969 virtual int getSubTickCount(
double tickStep) Q_DECL_OVERRIDE;
1970 virtual QString getTickLabel(
double tick,
const QLocale &locale,
QChar formatChar,
int precision) Q_DECL_OVERRIDE;
1973 void simplifyFraction(
int &numerator,
int &denominator)
const;
1974 QString fractionToString(
int numerator,
int denominator)
const;
1975 QString unicodeFraction(
int numerator,
int denominator)
const;
1976 QString unicodeSuperscript(
int number)
const;
1977 QString unicodeSubscript(
int number)
const;
1993 double logBase()
const {
return mLogBase; }
1994 int subTickCount()
const {
return mSubTickCount; }
1997 void setLogBase(
double base);
1998 void setSubTickCount(
int subTicks);
2006 double mLogBaseLnInv;
2009 virtual int getSubTickCount(
double tickStep) Q_DECL_OVERRIDE;
2023 Q_PROPERTY(
bool subGridVisible READ subGridVisible WRITE setSubGridVisible)
2024 Q_PROPERTY(
bool antialiasedSubGrid READ antialiasedSubGrid WRITE setAntialiasedSubGrid)
2025 Q_PROPERTY(
bool antialiasedZeroLine READ antialiasedZeroLine WRITE setAntialiasedZeroLine)
2026 Q_PROPERTY(
QPen pen READ pen WRITE setPen)
2027 Q_PROPERTY(
QPen subGridPen READ subGridPen WRITE setSubGridPen)
2028 Q_PROPERTY(
QPen zeroLinePen READ zeroLinePen WRITE setZeroLinePen)
2034 bool subGridVisible()
const {
return mSubGridVisible; }
2035 bool antialiasedSubGrid()
const {
return mAntialiasedSubGrid; }
2036 bool antialiasedZeroLine()
const {
return mAntialiasedZeroLine; }
2037 QPen pen()
const {
return mPen; }
2038 QPen subGridPen()
const {
return mSubGridPen; }
2039 QPen zeroLinePen()
const {
return mZeroLinePen; }
2042 void setSubGridVisible(
bool visible);
2043 void setAntialiasedSubGrid(
bool enabled);
2044 void setAntialiasedZeroLine(
bool enabled);
2045 void setPen(
const QPen &pen);
2046 void setSubGridPen(
const QPen &pen);
2047 void setZeroLinePen(
const QPen &pen);
2051 bool mSubGridVisible;
2052 bool mAntialiasedSubGrid, mAntialiasedZeroLine;
2053 QPen mPen, mSubGridPen, mZeroLinePen;
2059 virtual void applyDefaultAntialiasingHint(
QCPPainter *painter)
const Q_DECL_OVERRIDE;
2060 virtual void draw(
QCPPainter *painter) Q_DECL_OVERRIDE;
2063 void drawGridLines(
QCPPainter *painter)
const;
2064 void drawSubGridLines(
QCPPainter *painter)
const;
2074 Q_PROPERTY(
AxisType axisType READ axisType)
2076 Q_PROPERTY(
ScaleType scaleType READ scaleType WRITE setScaleType NOTIFY scaleTypeChanged)
2077 Q_PROPERTY(
QCPRange range READ range WRITE setRange NOTIFY rangeChanged)
2078 Q_PROPERTY(
bool rangeReversed READ rangeReversed WRITE setRangeReversed)
2079 Q_PROPERTY(QSharedPointer<QCPAxisTicker> ticker READ ticker WRITE setTicker)
2080 Q_PROPERTY(
bool ticks READ ticks WRITE setTicks)
2081 Q_PROPERTY(
bool tickLabels READ tickLabels WRITE setTickLabels)
2082 Q_PROPERTY(
int tickLabelPadding READ tickLabelPadding WRITE setTickLabelPadding)
2083 Q_PROPERTY(
QFont tickLabelFont READ tickLabelFont WRITE setTickLabelFont)
2084 Q_PROPERTY(
QColor tickLabelColor READ tickLabelColor WRITE setTickLabelColor)
2085 Q_PROPERTY(
double tickLabelRotation READ tickLabelRotation WRITE setTickLabelRotation)
2086 Q_PROPERTY(
LabelSide tickLabelSide READ tickLabelSide WRITE setTickLabelSide)
2087 Q_PROPERTY(
QString numberFormat READ numberFormat WRITE setNumberFormat)
2088 Q_PROPERTY(
int numberPrecision READ numberPrecision WRITE setNumberPrecision)
2091 Q_PROPERTY(
int tickLengthIn READ tickLengthIn WRITE setTickLengthIn)
2092 Q_PROPERTY(
int tickLengthOut READ tickLengthOut WRITE setTickLengthOut)
2093 Q_PROPERTY(
bool subTicks READ subTicks WRITE setSubTicks)
2094 Q_PROPERTY(
int subTickLengthIn READ subTickLengthIn WRITE setSubTickLengthIn)
2095 Q_PROPERTY(
int subTickLengthOut READ subTickLengthOut WRITE setSubTickLengthOut)
2096 Q_PROPERTY(
QPen basePen READ basePen WRITE setBasePen)
2097 Q_PROPERTY(
QPen tickPen READ tickPen WRITE setTickPen)
2098 Q_PROPERTY(
QPen subTickPen READ subTickPen WRITE setSubTickPen)
2099 Q_PROPERTY(
QFont labelFont READ labelFont WRITE setLabelFont)
2100 Q_PROPERTY(
QColor labelColor READ labelColor WRITE setLabelColor)
2101 Q_PROPERTY(
QString label READ label WRITE setLabel)
2102 Q_PROPERTY(
int labelPadding READ labelPadding WRITE setLabelPadding)
2103 Q_PROPERTY(
int padding READ padding WRITE setPadding)
2104 Q_PROPERTY(
int offset READ offset WRITE setOffset)
2105 Q_PROPERTY(SelectableParts selectedParts READ selectedParts WRITE setSelectedParts NOTIFY selectionChanged)
2106 Q_PROPERTY(SelectableParts selectableParts READ selectableParts WRITE setSelectableParts NOTIFY selectableChanged)
2107 Q_PROPERTY(
QFont selectedTickLabelFont READ selectedTickLabelFont WRITE setSelectedTickLabelFont)
2108 Q_PROPERTY(
QFont selectedLabelFont READ selectedLabelFont WRITE setSelectedLabelFont)
2109 Q_PROPERTY(
QColor selectedTickLabelColor READ selectedTickLabelColor WRITE setSelectedTickLabelColor)
2110 Q_PROPERTY(
QColor selectedLabelColor READ selectedLabelColor WRITE setSelectedLabelColor)
2111 Q_PROPERTY(
QPen selectedBasePen READ selectedBasePen WRITE setSelectedBasePen)
2112 Q_PROPERTY(
QPen selectedTickPen READ selectedTickPen WRITE setSelectedTickPen)
2113 Q_PROPERTY(
QPen selectedSubTickPen READ selectedSubTickPen WRITE setSelectedSubTickPen)
2114 Q_PROPERTY(
QCPLineEnding lowerEnding READ lowerEnding WRITE setLowerEnding)
2115 Q_PROPERTY(
QCPLineEnding upperEnding READ upperEnding WRITE setUpperEnding)
2116 Q_PROPERTY(
QCPGrid* grid READ grid)
2130 Q_DECLARE_FLAGS(AxisTypes, AxisType)
2154 ,spTickLabels = 0x002
2155 ,spAxisLabel = 0x004
2157 Q_ENUMS(SelectablePart)
2158 Q_FLAGS(SelectableParts)
2159 Q_DECLARE_FLAGS(SelectableParts, SelectablePart)
2162 virtual ~
QCPAxis() Q_DECL_OVERRIDE;
2165 AxisType axisType()
const {
return mAxisType; }
2166 QCPAxisRect *axisRect()
const {
return mAxisRect; }
2167 ScaleType scaleType()
const {
return mScaleType; }
2168 const QCPRange range()
const {
return mRange; }
2169 bool rangeReversed()
const {
return mRangeReversed; }
2170 QSharedPointer<QCPAxisTicker>
ticker()
const {
return mTicker; }
2171 bool ticks()
const {
return mTicks; }
2172 bool tickLabels()
const {
return mTickLabels; }
2173 int tickLabelPadding()
const;
2174 QFont tickLabelFont()
const {
return mTickLabelFont; }
2175 QColor tickLabelColor()
const {
return mTickLabelColor; }
2176 double tickLabelRotation()
const;
2177 LabelSide tickLabelSide()
const;
2179 int numberPrecision()
const {
return mNumberPrecision; }
2182 int tickLengthIn()
const;
2183 int tickLengthOut()
const;
2184 bool subTicks()
const {
return mSubTicks; }
2185 int subTickLengthIn()
const;
2186 int subTickLengthOut()
const;
2187 QPen basePen()
const {
return mBasePen; }
2188 QPen tickPen()
const {
return mTickPen; }
2189 QPen subTickPen()
const {
return mSubTickPen; }
2190 QFont labelFont()
const {
return mLabelFont; }
2191 QColor labelColor()
const {
return mLabelColor; }
2192 QString label()
const {
return mLabel; }
2193 int labelPadding()
const;
2194 int padding()
const {
return mPadding; }
2196 SelectableParts selectedParts()
const {
return mSelectedParts; }
2197 SelectableParts selectableParts()
const {
return mSelectableParts; }
2198 QFont selectedTickLabelFont()
const {
return mSelectedTickLabelFont; }
2199 QFont selectedLabelFont()
const {
return mSelectedLabelFont; }
2200 QColor selectedTickLabelColor()
const {
return mSelectedTickLabelColor; }
2201 QColor selectedLabelColor()
const {
return mSelectedLabelColor; }
2202 QPen selectedBasePen()
const {
return mSelectedBasePen; }
2203 QPen selectedTickPen()
const {
return mSelectedTickPen; }
2204 QPen selectedSubTickPen()
const {
return mSelectedSubTickPen; }
2211 Q_SLOT
void setRange(
const QCPRange &range);
2212 void setRange(
double lower,
double upper);
2213 void setRange(
double position,
double size, Qt::AlignmentFlag alignment);
2214 void setRangeLower(
double lower);
2215 void setRangeUpper(
double upper);
2216 void setRangeReversed(
bool reversed);
2217 void setTicker(QSharedPointer<QCPAxisTicker> ticker);
2218 void setTicks(
bool show);
2219 void setTickLabels(
bool show);
2220 void setTickLabelPadding(
int padding);
2221 void setTickLabelFont(
const QFont &font);
2222 void setTickLabelColor(
const QColor &color);
2223 void setTickLabelRotation(
double degrees);
2224 void setTickLabelSide(LabelSide side);
2225 void setNumberFormat(
const QString &formatCode);
2226 void setNumberPrecision(
int precision);
2227 void setTickLength(
int inside,
int outside=0);
2228 void setTickLengthIn(
int inside);
2229 void setTickLengthOut(
int outside);
2230 void setSubTicks(
bool show);
2231 void setSubTickLength(
int inside,
int outside=0);
2232 void setSubTickLengthIn(
int inside);
2233 void setSubTickLengthOut(
int outside);
2234 void setBasePen(
const QPen &pen);
2235 void setTickPen(
const QPen &pen);
2236 void setSubTickPen(
const QPen &pen);
2237 void setLabelFont(
const QFont &font);
2238 void setLabelColor(
const QColor &color);
2239 void setLabel(
const QString &str);
2240 void setLabelPadding(
int padding);
2241 void setPadding(
int padding);
2242 void setOffset(
int offset);
2243 void setSelectedTickLabelFont(
const QFont &font);
2244 void setSelectedLabelFont(
const QFont &font);
2245 void setSelectedTickLabelColor(
const QColor &color);
2246 void setSelectedLabelColor(
const QColor &color);
2247 void setSelectedBasePen(
const QPen &pen);
2248 void setSelectedTickPen(
const QPen &pen);
2249 void setSelectedSubTickPen(
const QPen &pen);
2250 Q_SLOT
void setSelectableParts(
const QCPAxis::SelectableParts &selectableParts);
2251 Q_SLOT
void setSelectedParts(
const QCPAxis::SelectableParts &selectedParts);
2259 Qt::Orientation orientation()
const {
return mOrientation; }
2260 int pixelOrientation()
const {
return rangeReversed() != (orientation()==Qt::Vertical) ? -1 : 1; }
2261 void moveRange(
double diff);
2262 void scaleRange(
double factor);
2263 void scaleRange(
double factor,
double center);
2264 void setScaleRatio(
const QCPAxis *otherAxis,
double ratio=1.0);
2265 void rescale(
bool onlyVisiblePlottables=
false);
2266 double pixelToCoord(
double value)
const;
2267 double coordToPixel(
double value)
const;
2268 SelectablePart getPartAt(
const QPointF &pos)
const;
2274 static Qt::Orientation
orientation(
AxisType type) {
return type==atBottom || type==atTop ? Qt::Horizontal : Qt::Vertical; }
2275 static AxisType opposite(AxisType type);
2278 void rangeChanged(
const QCPRange &newRange);
2281 void selectionChanged(
const QCPAxis::SelectableParts &parts);
2282 void selectableChanged(
const QCPAxis::SelectableParts &parts);
2291 Qt::Orientation mOrientation;
2292 SelectableParts mSelectableParts, mSelectedParts;
2293 QPen mBasePen, mSelectedBasePen;
2298 QFont mLabelFont, mSelectedLabelFont;
2299 QColor mLabelColor, mSelectedLabelColor;
2304 QFont mTickLabelFont, mSelectedTickLabelFont;
2305 QColor mTickLabelColor, mSelectedTickLabelColor;
2306 int mNumberPrecision;
2307 QLatin1Char mNumberFormatChar;
2308 bool mNumberBeautifulPowers;
2314 QPen mTickPen, mSelectedTickPen;
2315 QPen mSubTickPen, mSelectedSubTickPen;
2318 bool mRangeReversed;
2319 ScaleType mScaleType;
2324 QSharedPointer<QCPAxisTicker> mTicker;
2328 bool mCachedMarginValid;
2332 QCP::AntialiasedElements mAADragBackup, mNotAADragBackup;
2335 virtual int calculateMargin();
2338 virtual void applyDefaultAntialiasingHint(
QCPPainter *painter)
const Q_DECL_OVERRIDE;
2339 virtual void draw(
QCPPainter *painter) Q_DECL_OVERRIDE;
2342 virtual
void selectEvent(
QMouseEvent *event,
bool additive, const
QVariant &details,
bool *selectionStateChanged) Q_DECL_OVERRIDE;
2343 virtual
void deselectEvent(
bool *selectionStateChanged) Q_DECL_OVERRIDE;
2345 virtual
void mousePressEvent(
QMouseEvent *event, const
QVariant &details) Q_DECL_OVERRIDE;
2346 virtual
void mouseMoveEvent(
QMouseEvent *event, const
QPointF &startPos) Q_DECL_OVERRIDE;
2347 virtual
void mouseReleaseEvent(
QMouseEvent *event, const
QPointF &startPos) Q_DECL_OVERRIDE;
2348 virtual
void wheelEvent(
QWheelEvent *event) Q_DECL_OVERRIDE;
2351 void setupTickVectors();
2352 QPen getBasePen() const;
2353 QPen getTickPen() const;
2354 QPen getSubTickPen() const;
2355 QFont getTickLabelFont() const;
2356 QFont getLabelFont() const;
2357 QColor getTickLabelColor() const;
2358 QColor getLabelColor() const;
2367 Q_DECLARE_OPERATORS_FOR_FLAGS(
QCPAxis::SelectableParts)
2368 Q_DECLARE_OPERATORS_FOR_FLAGS(
QCPAxis::AxisTypes)
2369 Q_DECLARE_METATYPE(
QCPAxis::AxisType)
2370 Q_DECLARE_METATYPE(
QCPAxis::LabelSide)
2371 Q_DECLARE_METATYPE(
QCPAxis::ScaleType)
2372 Q_DECLARE_METATYPE(
QCPAxis::SelectablePart)
2385 QRect axisSelectionBox()
const {
return mAxisSelectionBox; }
2386 QRect tickLabelsSelectionBox()
const {
return mTickLabelsSelectionBox; }
2387 QRect labelSelectionBox()
const {
return mLabelSelectionBox; }
2397 int tickLabelPadding;
2398 double tickLabelRotation;
2400 bool substituteExponent;
2401 bool numberMultiplyCross;
2402 int tickLengthIn, tickLengthOut, subTickLengthIn, subTickLengthOut;
2403 QPen tickPen, subTickPen;
2404 QFont tickLabelFont;
2406 QRect axisRect, viewportRect;
2408 bool abbreviateDecimalPowers;
2409 bool reversedEndings;
2423 QString basePart, expPart, suffixPart;
2424 QRect baseBounds, expBounds, suffixBounds, totalBounds, rotatedTotalBounds;
2425 QFont baseFont, expFont;
2430 QRect mAxisSelectionBox, mTickLabelsSelectionBox, mLabelSelectionBox;
2432 virtual QByteArray generateLabelParameterHash()
const;
2434 virtual void placeTickLabel(
QCPPainter *painter,
double position,
int distanceToAxis,
const QString &text, QSize *tickLabelsSize);
2438 virtual void getMaxTickLabelSize(
const QFont &font,
const QString &text, QSize *tickLabelsSize)
const;
2466 Q_ENUMS(ScatterProperty)
2467 Q_FLAGS(ScatterProperties)
2468 Q_DECLARE_FLAGS(ScatterProperties, ScatterProperty)
2496 Q_ENUMS(ScatterShape)
2507 double size()
const {
return mSize; }
2508 ScatterShape shape()
const {
return mShape; }
2509 QPen pen()
const {
return mPen; }
2510 QBrush brush()
const {
return mBrush; }
2511 QPixmap pixmap()
const {
return mPixmap; }
2512 QPainterPath customPath()
const {
return mCustomPath; }
2515 void setFromOther(
const QCPScatterStyle &other, ScatterProperties properties);
2516 void setSize(
double size);
2517 void setShape(ScatterShape shape);
2518 void setPen(
const QPen &pen);
2519 void setBrush(
const QBrush &brush);
2520 void setPixmap(
const QPixmap &pixmap);
2524 bool isNone()
const {
return mShape == ssNone; }
2529 void drawShape(
QCPPainter *painter,
double x,
double y)
const;
2534 ScatterShape mShape;
2544 Q_DECLARE_OPERATORS_FOR_FLAGS(QCPScatterStyle::ScatterProperties)
2559 template <
class DataType>
2560 inline bool qcpLessThanSortKey(
const DataType &a,
const DataType &b) {
return a.sortKey() < b.sortKey(); }
2562 template <
class DataType>
2572 int size()
const {
return mData.size()-mPreallocSize; }
2574 bool autoSqueeze()
const {
return mAutoSqueeze; }
2577 void setAutoSqueeze(
bool enabled);
2584 void add(
const DataType &data);
2585 void removeBefore(
double sortKey);
2586 void removeAfter(
double sortKey);
2587 void remove(
double sortKeyFrom,
double sortKeyTo);
2588 void remove(
double sortKey);
2591 void squeeze(
bool preAllocation=
true,
bool postAllocation=
true);
2593 const_iterator
constBegin()
const {
return mData.constBegin()+mPreallocSize; }
2594 const_iterator
constEnd()
const {
return mData.constEnd(); }
2595 iterator
begin() {
return mData.begin()+mPreallocSize; }
2596 iterator
end() {
return mData.end(); }
2597 const_iterator findBegin(
double sortKey,
bool expandedRange=
true)
const;
2598 const_iterator findEnd(
double sortKey,
bool expandedRange=
true)
const;
2599 const_iterator
at(
int index)
const {
return constBegin()+qBound(0, index, size()); }
2603 void limitIteratorsToDataRange(const_iterator &begin, const_iterator &end,
const QCPDataRange &dataRange)
const;
2612 int mPreallocIteration;
2615 void preallocateGrow(
int minimumPreallocSize);
2616 void performAutoSqueeze();
2755 template <
class DataType>
2759 mPreallocIteration(0)
2771 template <
class DataType>
2774 if (mAutoSqueeze != enabled)
2776 mAutoSqueeze = enabled;
2778 performAutoSqueeze();
2788 template <
class DataType>
2804 template <
class DataType>
2809 mPreallocIteration = 0;
2820 template <
class DataType>
2826 const int n = data.
size();
2827 const int oldSize = size();
2829 if (oldSize > 0 && !qcpLessThanSortKey<DataType>(*constBegin(), *(data.
constEnd()-1)))
2831 if (mPreallocSize < n)
2837 mData.resize(mData.size()+n);
2839 if (oldSize > 0 && !qcpLessThanSortKey<DataType>(*(constEnd()-n-1), *(constEnd()-n)))
2840 std::inplace_merge(begin(), end()-n, end(), qcpLessThanSortKey<DataType>);
2852 template <
class DataType>
2859 set(data, alreadySorted);
2863 const int n = data.size();
2864 const int oldSize = size();
2866 if (alreadySorted && oldSize > 0 && !qcpLessThanSortKey<DataType>(*constBegin(), *(data.constEnd()-1)))
2868 if (mPreallocSize < n)
2871 std::copy(data.constBegin(), data.constEnd(), begin());
2874 mData.resize(mData.size()+n);
2875 std::copy(data.constBegin(), data.constEnd(), end()-n);
2877 std::sort(end()-n, end(), qcpLessThanSortKey<DataType>);
2878 if (oldSize > 0 && !qcpLessThanSortKey<DataType>(*(constEnd()-n-1), *(constEnd()-n)))
2879 std::inplace_merge(begin(), end()-n, end(), qcpLessThanSortKey<DataType>);
2889 template <
class DataType>
2892 if (isEmpty() || !qcpLessThanSortKey<DataType>(data, *(constEnd()-1)))
2895 }
else if (qcpLessThanSortKey<DataType>(data, *constBegin()))
2897 if (mPreallocSize < 1)
2903 QCPDataContainer<DataType>::iterator insertionPoint = std::lower_bound(begin(), end(), data, qcpLessThanSortKey<DataType>);
2904 mData.insert(insertionPoint, data);
2913 template <
class DataType>
2916 QCPDataContainer<DataType>::iterator it = begin();
2917 QCPDataContainer<DataType>::iterator itEnd = std::lower_bound(begin(), end(), DataType::fromSortKey(sortKey), qcpLessThanSortKey<DataType>);
2918 mPreallocSize += int(itEnd-it);
2920 performAutoSqueeze();
2928 template <
class DataType>
2931 QCPDataContainer<DataType>::iterator it = std::upper_bound(begin(), end(), DataType::fromSortKey(sortKey), qcpLessThanSortKey<DataType>);
2932 QCPDataContainer<DataType>::iterator itEnd = end();
2933 mData.erase(it, itEnd);
2935 performAutoSqueeze();
2945 template <
class DataType>
2948 if (sortKeyFrom >= sortKeyTo || isEmpty())
2951 QCPDataContainer<DataType>::iterator it = std::lower_bound(begin(), end(), DataType::fromSortKey(sortKeyFrom), qcpLessThanSortKey<DataType>);
2952 QCPDataContainer<DataType>::iterator itEnd = std::upper_bound(it, end(), DataType::fromSortKey(sortKeyTo), qcpLessThanSortKey<DataType>);
2953 mData.erase(it, itEnd);
2955 performAutoSqueeze();
2967 template <
class DataType>
2970 QCPDataContainer::iterator it = std::lower_bound(begin(), end(), DataType::fromSortKey(sortKey), qcpLessThanSortKey<DataType>);
2971 if (it != end() && it->sortKey() == sortKey)
2979 performAutoSqueeze();
2987 template <
class DataType>
2991 mPreallocIteration = 0;
3006 template <
class DataType>
3009 std::sort(begin(), end(), qcpLessThanSortKey<DataType>);
3022 template <
class DataType>
3027 if (mPreallocSize > 0)
3029 std::copy(begin(), end(), mData.begin());
3030 mData.resize(size());
3033 mPreallocIteration = 0;
3054 template <
class DataType>
3060 QCPDataContainer<DataType>::const_iterator it = std::lower_bound(constBegin(), constEnd(), DataType::fromSortKey(sortKey), qcpLessThanSortKey<DataType>);
3061 if (expandedRange && it != constBegin())
3081 template <
class DataType>
3087 QCPDataContainer<DataType>::const_iterator it = std::upper_bound(constBegin(), constEnd(), DataType::fromSortKey(sortKey), qcpLessThanSortKey<DataType>);
3088 if (expandedRange && it != constEnd())
3108 template <
class DataType>
3117 bool haveLower =
false;
3118 bool haveUpper =
false;
3121 QCPDataContainer<DataType>::const_iterator it = constBegin();
3122 QCPDataContainer<DataType>::const_iterator itEnd = constEnd();
3125 if (DataType::sortKeyIsMainKey())
3129 if (!qIsNaN(it->mainValue()))
3131 range.lower = it->mainKey();
3138 while (it != constBegin())
3141 if (!qIsNaN(it->mainValue()))
3143 range.upper = it->mainKey();
3152 if (!qIsNaN(it->mainValue()))
3154 current = it->mainKey();
3155 if (current < range.lower || !haveLower)
3157 range.lower = current;
3160 if (current > range.upper || !haveUpper)
3162 range.upper = current;
3173 if (!qIsNaN(it->mainValue()))
3175 current = it->mainKey();
3176 if ((current < range.lower || !haveLower) && current < 0)
3178 range.lower = current;
3181 if ((current > range.upper || !haveUpper) && current < 0)
3183 range.upper = current;
3193 if (!qIsNaN(it->mainValue()))
3195 current = it->mainKey();
3196 if ((current < range.lower || !haveLower) && current > 0)
3198 range.lower = current;
3201 if ((current > range.upper || !haveUpper) && current > 0)
3203 range.upper = current;
3211 foundRange = haveLower && haveUpper;
3231 template <
class DataType>
3240 const bool restrictKeyRange = inKeyRange !=
QCPRange();
3241 bool haveLower =
false;
3242 bool haveUpper =
false;
3244 QCPDataContainer<DataType>::const_iterator itBegin = constBegin();
3245 QCPDataContainer<DataType>::const_iterator itEnd = constEnd();
3246 if (DataType::sortKeyIsMainKey() && restrictKeyRange)
3248 itBegin = findBegin(inKeyRange.lower,
false);
3249 itEnd = findEnd(inKeyRange.upper,
false);
3253 for (QCPDataContainer<DataType>::const_iterator it = itBegin; it != itEnd; ++it)
3255 if (restrictKeyRange && (it->mainKey() < inKeyRange.lower || it->mainKey() > inKeyRange.upper))
3257 current = it->valueRange();
3258 if ((current.lower < range.lower || !haveLower) && !qIsNaN(current.lower))
3260 range.lower = current.lower;
3263 if ((current.upper > range.upper || !haveUpper) && !qIsNaN(current.upper))
3265 range.upper = current.upper;
3271 for (QCPDataContainer<DataType>::const_iterator it = itBegin; it != itEnd; ++it)
3273 if (restrictKeyRange && (it->mainKey() < inKeyRange.lower || it->mainKey() > inKeyRange.upper))
3275 current = it->valueRange();
3276 if ((current.lower < range.lower || !haveLower) && current.lower < 0 && !qIsNaN(current.lower))
3278 range.lower = current.lower;
3281 if ((current.upper > range.upper || !haveUpper) && current.upper < 0 && !qIsNaN(current.upper))
3283 range.upper = current.upper;
3289 for (QCPDataContainer<DataType>::const_iterator it = itBegin; it != itEnd; ++it)
3291 if (restrictKeyRange && (it->mainKey() < inKeyRange.lower || it->mainKey() > inKeyRange.upper))
3293 current = it->valueRange();
3294 if ((current.lower < range.lower || !haveLower) && current.lower > 0 && !qIsNaN(current.lower))
3296 range.lower = current.lower;
3299 if ((current.upper > range.upper || !haveUpper) && current.upper > 0 && !qIsNaN(current.upper))
3301 range.upper = current.upper;
3307 foundRange = haveLower && haveUpper;
3319 template <
class DataType>
3322 QCPDataRange iteratorRange(
int(begin-constBegin()),
int(end-constBegin()));
3323 iteratorRange = iteratorRange.
bounded(dataRange.
bounded(this->dataRange()));
3324 begin = constBegin()+iteratorRange.begin();
3325 end = constBegin()+iteratorRange.end();
3337 template <
class DataType>
3340 if (minimumPreallocSize <= mPreallocSize)
3343 int newPreallocSize = minimumPreallocSize;
3344 newPreallocSize += (1u<<qBound(4, mPreallocIteration+4, 15)) - 12;
3345 ++mPreallocIteration;
3347 int sizeDifference = newPreallocSize-mPreallocSize;
3348 mData.resize(mData.size()+sizeDifference);
3349 std::copy_backward(mData.begin()+mPreallocSize, mData.end()-sizeDifference, mData.end());
3350 mPreallocSize = newPreallocSize;
3367 template <
class DataType>
3370 const int totalAlloc = mData.capacity();
3371 const int postAllocSize = totalAlloc-mData.
size();
3372 const int usedSize = size();
3373 bool shrinkPostAllocation =
false;
3374 bool shrinkPreAllocation =
false;
3375 if (totalAlloc > 650000)
3377 shrinkPostAllocation = postAllocSize > usedSize*1.5;
3378 shrinkPreAllocation = mPreallocSize*10 > usedSize;
3379 }
else if (totalAlloc > 1000)
3381 shrinkPostAllocation = postAllocSize > usedSize*5;
3382 shrinkPreAllocation = mPreallocSize > usedSize*1.5;
3385 if (shrinkPreAllocation || shrinkPostAllocation)
3386 squeeze(shrinkPreAllocation, shrinkPostAllocation);
3404 QPen pen()
const {
return mPen; }
3405 QBrush brush()
const {
return mBrush; }
3407 QCPScatterStyle::ScatterProperties usedScatterProperties()
const {
return mUsedScatterProperties; }
3410 void setPen(
const QPen &pen);
3411 void setBrush(
const QBrush &brush);
3413 void setUsedScatterProperties(
const QCPScatterStyle::ScatterProperties &properties);
3429 QCPScatterStyle::ScatterProperties mUsedScatterProperties;
3463 QString name()
const {
return mName; }
3464 bool antialiasedFill()
const {
return mAntialiasedFill; }
3465 bool antialiasedScatters()
const {
return mAntialiasedScatters; }
3466 QPen pen()
const {
return mPen; }
3467 QBrush brush()
const {
return mBrush; }
3468 QCPAxis *keyAxis()
const {
return mKeyAxis.data(); }
3469 QCPAxis *valueAxis()
const {
return mValueAxis.data(); }
3471 bool selected()
const {
return !mSelection.isEmpty(); }
3488 virtual double selectTest(
const QPointF &pos,
bool onlySelectable,
QVariant *details=
nullptr) const Q_DECL_OVERRIDE = 0;
3494 void coordsToPixels(
double key,
double value,
double &x,
double &y)
const;
3496 void pixelsToCoords(
double x,
double y,
double &key,
double &value)
const;
3500 void rescaleValueAxis(
bool onlyEnlarge=
false,
bool inKeyRange=
false)
const;
3514 bool mAntialiasedFill, mAntialiasedScatters;
3517 QPointer<QCPAxis> mKeyAxis, mValueAxis;
3523 virtual QRect clipRect() const Q_DECL_OVERRIDE;
3524 virtual
void draw(
QCPPainter *painter) Q_DECL_OVERRIDE = 0;
3525 virtual
QCP::Interaction selectionCategory() const Q_DECL_OVERRIDE;
3526 void applyDefaultAntialiasingHint(
QCPPainter *painter) const Q_DECL_OVERRIDE;
3528 virtual
void selectEvent(
QMouseEvent *event,
bool additive, const
QVariant &details,
bool *selectionStateChanged) Q_DECL_OVERRIDE;
3529 virtual
void deselectEvent(
bool *selectionStateChanged) Q_DECL_OVERRIDE;
3532 virtual
void drawLegendIcon(
QCPPainter *painter, const
QRectF &rect) const = 0;
3535 void applyFillAntialiasingHint(
QCPPainter *painter) const;
3536 void applyScattersAntialiasingHint(
QCPPainter *painter) const;
3561 QString name()
const {
return mName; }
3562 virtual QPointF pixelPosition()
const;
3572 QSet<QCPItemPosition*> mChildrenX, mChildrenY;
3610 Q_ENUMS(PositionType)
3617 PositionType typeX()
const {
return mPositionTypeX; }
3618 PositionType typeY()
const {
return mPositionTypeY; }
3620 QCPItemAnchor *parentAnchorX()
const {
return mParentAnchorX; }
3621 QCPItemAnchor *parentAnchorY()
const {
return mParentAnchorY; }
3622 double key()
const {
return mKey; }
3623 double value()
const {
return mValue; }
3625 QCPAxis *keyAxis()
const {
return mKeyAxis.data(); }
3626 QCPAxis *valueAxis()
const {
return mValueAxis.data(); }
3631 void setType(PositionType type);
3632 void setTypeX(PositionType type);
3633 void setTypeY(PositionType type);
3634 bool setParentAnchor(
QCPItemAnchor *parentAnchor,
bool keepPixelPosition=false);
3635 bool setParentAnchorX(
QCPItemAnchor *parentAnchor,
bool keepPixelPosition=false);
3636 bool setParentAnchorY(
QCPItemAnchor *parentAnchor,
bool keepPixelPosition=false);
3637 void setCoords(
double key,
double value);
3638 void setCoords(const
QPointF &pos);
3641 void setPixelPosition(const
QPointF &pixelPosition);
3645 PositionType mPositionTypeX, mPositionTypeY;
3646 QPointer<
QCPAxis> mKeyAxis, mValueAxis;
3648 double mKey, mValue;
3665 Q_PROPERTY(
bool clipToAxisRect READ clipToAxisRect WRITE setClipToAxisRect)
3666 Q_PROPERTY(
QCPAxisRect* clipAxisRect READ clipAxisRect WRITE setClipAxisRect)
3667 Q_PROPERTY(
bool selectable READ selectable WRITE setSelectable NOTIFY selectableChanged)
3668 Q_PROPERTY(
bool selected READ selected WRITE setSelected NOTIFY selectionChanged)
3675 bool clipToAxisRect()
const {
return mClipToAxisRect; }
3677 bool selectable()
const {
return mSelectable; }
3678 bool selected()
const {
return mSelected; }
3681 void setClipToAxisRect(
bool clip);
3683 Q_SLOT
void setSelectable(
bool selectable);
3684 Q_SLOT
void setSelected(
bool selected);
3687 virtual double selectTest(
const QPointF &pos,
bool onlySelectable,
QVariant *details=
nullptr)
const Q_DECL_OVERRIDE = 0;
3694 bool hasAnchor(
const QString &name)
const;
3697 void selectionChanged(
bool selected);
3698 void selectableChanged(
bool selectable);
3702 bool mClipToAxisRect;
3703 QPointer<QCPAxisRect> mClipAxisRect;
3706 bool mSelectable, mSelected;
3710 virtual QRect clipRect() const Q_DECL_OVERRIDE;
3711 virtual
void applyDefaultAntialiasingHint(
QCPPainter *painter) const Q_DECL_OVERRIDE;
3712 virtual
void draw(
QCPPainter *painter) Q_DECL_OVERRIDE = 0;
3714 virtual
void selectEvent(
QMouseEvent *event,
bool additive, const
QVariant &details,
bool *selectionStateChanged) Q_DECL_OVERRIDE;
3715 virtual
void deselectEvent(
bool *selectionStateChanged) Q_DECL_OVERRIDE;
3718 virtual
QPointF anchorPixelPosition(
int anchorId) const;
3721 double rectDistance(const
QRectF &rect, const
QPointF &pos,
bool filledRect) const;
3742 Q_PROPERTY(QRect viewport READ viewport WRITE setViewport)
3743 Q_PROPERTY(
QPixmap background READ background WRITE setBackground)
3744 Q_PROPERTY(
bool backgroundScaled READ backgroundScaled WRITE setBackgroundScaled)
3745 Q_PROPERTY(Qt::AspectRatioMode backgroundScaledMode READ backgroundScaledMode WRITE setBackgroundScaledMode)
3747 Q_PROPERTY(
bool autoAddPlottableToLegend READ autoAddPlottableToLegend WRITE setAutoAddPlottableToLegend)
3748 Q_PROPERTY(
int selectionTolerance READ selectionTolerance WRITE setSelectionTolerance)
3749 Q_PROPERTY(
bool noAntialiasingOnDrag READ noAntialiasingOnDrag WRITE setNoAntialiasingOnDrag)
3750 Q_PROPERTY(Qt::KeyboardModifier multiSelectModifier READ multiSelectModifier WRITE setMultiSelectModifier)
3751 Q_PROPERTY(
bool openGl READ openGl WRITE setOpenGl)
3762 Q_ENUMS(LayerInsertMode)
3774 Q_ENUMS(RefreshPriority)
3780 QRect viewport()
const {
return mViewport; }
3781 double bufferDevicePixelRatio()
const {
return mBufferDevicePixelRatio; }
3782 QPixmap background()
const {
return mBackgroundPixmap; }
3783 bool backgroundScaled()
const {
return mBackgroundScaled; }
3784 Qt::AspectRatioMode backgroundScaledMode()
const {
return mBackgroundScaledMode; }
3786 QCP::AntialiasedElements antialiasedElements()
const {
return mAntialiasedElements; }
3787 QCP::AntialiasedElements notAntialiasedElements()
const {
return mNotAntialiasedElements; }
3788 bool autoAddPlottableToLegend()
const {
return mAutoAddPlottableToLegend; }
3789 const QCP::Interactions interactions()
const {
return mInteractions; }
3790 int selectionTolerance()
const {
return mSelectionTolerance; }
3791 bool noAntialiasingOnDrag()
const {
return mNoAntialiasingOnDrag; }
3792 QCP::PlottingHints plottingHints()
const {
return mPlottingHints; }
3793 Qt::KeyboardModifier multiSelectModifier()
const {
return mMultiSelectModifier; }
3796 bool openGl()
const {
return mOpenGl; }
3799 void setViewport(
const QRect &rect);
3800 void setBufferDevicePixelRatio(
double ratio);
3801 void setBackground(
const QPixmap &pm);
3802 void setBackground(
const QPixmap &pm,
bool scaled, Qt::AspectRatioMode mode=Qt::KeepAspectRatioByExpanding);
3803 void setBackground(
const QBrush &brush);
3804 void setBackgroundScaled(
bool scaled);
3805 void setBackgroundScaledMode(Qt::AspectRatioMode mode);
3806 void setAntialiasedElements(
const QCP::AntialiasedElements &antialiasedElements);
3808 void setNotAntialiasedElements(
const QCP::AntialiasedElements ¬AntialiasedElements);
3810 void setAutoAddPlottableToLegend(
bool on);
3811 void setInteractions(
const QCP::Interactions &interactions);
3812 void setInteraction(
const QCP::Interaction &interaction,
bool enabled=
true);
3813 void setSelectionTolerance(
int pixels);
3814 void setNoAntialiasingOnDrag(
bool enabled);
3815 void setPlottingHints(
const QCP::PlottingHints &hints);
3817 void setMultiSelectModifier(Qt::KeyboardModifier modifier);
3820 void setOpenGl(
bool enabled,
int multisampling=16);
3827 bool removePlottable(
int index);
3828 int clearPlottables();
3829 int plottableCount()
const;
3831 template<
class PlottableType>
3832 PlottableType *plottableAt(
const QPointF &pos,
bool onlySelectable=
false,
int *dataIndex=
nullptr)
const;
3841 bool removeGraph(
int index);
3843 int graphCount()
const;
3850 bool removeItem(
int index);
3852 int itemCount()
const;
3854 template<
class ItemType>
3855 ItemType *itemAt(
const QPointF &pos,
bool onlySelectable=
false)
const;
3863 bool setCurrentLayer(
const QString &name);
3864 bool setCurrentLayer(
QCPLayer *layer);
3865 int layerCount()
const;
3866 bool addLayer(
const QString &name,
QCPLayer *otherLayer=
nullptr, LayerInsertMode insertMode=limAbove);
3868 bool moveLayer(
QCPLayer *layer,
QCPLayer *otherLayer, LayerInsertMode insertMode=limAbove);
3871 int axisRectCount()
const;
3876 Q_SLOT
void rescaleAxes(
bool onlyVisiblePlottables=
false);
3880 Q_SLOT
void deselectAll();
3887 QPixmap toPixmap(
int width=0,
int height=0,
double scale=1.0);
3888 void toPainter(
QCPPainter *painter,
int width=0,
int height=0);
3890 double replotTime(
bool average=
false)
const;
3911 void selectionChangedByUser();
3912 void beforeReplot();
3919 double mBufferDevicePixelRatio;
3921 bool mAutoAddPlottableToLegend;
3926 QCP::AntialiasedElements mAntialiasedElements, mNotAntialiasedElements;
3927 QCP::Interactions mInteractions;
3928 int mSelectionTolerance;
3929 bool mNoAntialiasingOnDrag;
3932 QPixmap mScaledBackgroundPixmap;
3933 bool mBackgroundScaled;
3934 Qt::AspectRatioMode mBackgroundScaledMode;
3936 QCP::PlottingHints mPlottingHints;
3937 Qt::KeyboardModifier mMultiSelectModifier;
3944 QPoint mMousePressPos;
3945 bool mMouseHasMoved;
3946 QPointer<QCPLayerable> mMouseEventLayerable;
3947 QPointer<QCPLayerable> mMouseSignalLayerable;
3948 QVariant mMouseEventLayerableDetails;
3949 QVariant mMouseSignalLayerableDetails;
3952 double mReplotTime, mReplotTimeAverage;
3953 int mOpenGlMultisamples;
3954 QCP::AntialiasedElements mOpenGlAntialiasedElementsBackup;
3955 bool mOpenGlCacheLabelsBackup;
3956 #ifdef QCP_OPENGL_FBO 3957 QSharedPointer<QOpenGLContext> mGlContext;
3958 QSharedPointer<QSurface> mGlSurface;
3959 QSharedPointer<QOpenGLPaintDevice> mGlPaintDevice;
3963 virtual QSize minimumSizeHint() const Q_DECL_OVERRIDE;
3964 virtual QSize sizeHint() const Q_DECL_OVERRIDE;
3965 virtual
void paintEvent(
QPaintEvent *event) Q_DECL_OVERRIDE;
3966 virtual
void resizeEvent(
QResizeEvent *event) Q_DECL_OVERRIDE;
3967 virtual
void mouseDoubleClickEvent(
QMouseEvent *event) Q_DECL_OVERRIDE;
3968 virtual
void mousePressEvent(
QMouseEvent *event) Q_DECL_OVERRIDE;
3969 virtual
void mouseMoveEvent(
QMouseEvent *event) Q_DECL_OVERRIDE;
3970 virtual
void mouseReleaseEvent(
QMouseEvent *event) Q_DECL_OVERRIDE;
3971 virtual
void wheelEvent(
QWheelEvent *event) Q_DECL_OVERRIDE;
3975 virtual
void updateLayout();
3976 virtual
void axisRemoved(
QCPAxis *axis);
3977 virtual
void legendRemoved(
QCPLegend *legend);
3978 Q_SLOT virtual
void processRectSelection(QRect rect,
QMouseEvent *event);
3979 Q_SLOT virtual
void processRectZoom(QRect rect,
QMouseEvent *event);
3980 Q_SLOT virtual
void processPointSelection(
QMouseEvent *event);
3984 bool registerGraph(
QCPGraph *graph);
3986 void updateLayerIndices() const;
3990 void setupPaintBuffers();
3992 bool hasInvalidatedPaintBuffers();
4028 template<class PlottableType>
4031 PlottableType *resultPlottable = 0;
4033 double resultDistance = mSelectionTolerance;
4037 PlottableType *currentPlottable = qobject_cast<PlottableType*>(plottable);
4038 if (!currentPlottable || (onlySelectable && !currentPlottable->selectable()))
4040 if (currentPlottable->clipRect().contains(pos.toPoint()))
4043 double currentDistance = currentPlottable->selectTest(pos,
false, dataIndex ? &details :
nullptr);
4044 if (currentDistance >= 0 && currentDistance < resultDistance)
4046 resultPlottable = currentPlottable;
4047 resultDetails = details;
4048 resultDistance = currentDistance;
4053 if (resultPlottable && dataIndex)
4059 return resultPlottable;
4075 template<
class ItemType>
4078 ItemType *resultItem = 0;
4079 double resultDistance = mSelectionTolerance;
4083 ItemType *currentItem = qobject_cast<ItemType*>(
item);
4084 if (!currentItem || (onlySelectable && !currentItem->selectable()))
4086 if (!currentItem->clipToAxisRect() || currentItem->clipRect().contains(pos.toPoint()))
4088 double currentDistance = currentItem->selectTest(pos,
false);
4089 if (currentDistance >= 0 && currentDistance < resultDistance)
4091 resultItem = currentItem;
4092 resultDistance = currentDistance;
4121 virtual int findBegin(
double sortKey,
bool expandedRange=
true)
const = 0;
4122 virtual int findEnd(
double sortKey,
bool expandedRange=
true)
const = 0;
4125 template <
class DataType>
4135 virtual int dataCount()
const Q_DECL_OVERRIDE;
4136 virtual double dataMainKey(
int index)
const Q_DECL_OVERRIDE;
4137 virtual double dataSortKey(
int index)
const Q_DECL_OVERRIDE;
4138 virtual double dataMainValue(
int index)
const Q_DECL_OVERRIDE;
4143 virtual int findBegin(
double sortKey,
bool expandedRange=
true)
const Q_DECL_OVERRIDE;
4144 virtual int findEnd(
double sortKey,
bool expandedRange=
true)
const Q_DECL_OVERRIDE;
4152 QSharedPointer<QCPDataContainer<DataType> > mDataContainer;
4351 template <
class DataType>
4358 template <
class DataType>
4366 template <
class DataType>
4369 return mDataContainer->size();
4375 template <
class DataType>
4378 if (index >= 0 && index < mDataContainer->size())
4380 return (mDataContainer->constBegin()+index)->mainKey();
4383 qDebug() << Q_FUNC_INFO <<
"Index out of bounds" << index;
4391 template <
class DataType>
4394 if (index >= 0 && index < mDataContainer->size())
4396 return (mDataContainer->constBegin()+index)->sortKey();
4399 qDebug() << Q_FUNC_INFO <<
"Index out of bounds" << index;
4407 template <
class DataType>
4410 if (index >= 0 && index < mDataContainer->size())
4412 return (mDataContainer->constBegin()+index)->mainValue();
4415 qDebug() << Q_FUNC_INFO <<
"Index out of bounds" << index;
4423 template <
class DataType>
4426 if (index >= 0 && index < mDataContainer->size())
4428 return (mDataContainer->constBegin()+index)->valueRange();
4431 qDebug() << Q_FUNC_INFO <<
"Index out of bounds" << index;
4439 template <
class DataType>
4442 if (index >= 0 && index < mDataContainer->size())
4444 const typename QCPDataContainer<DataType>::const_iterator it = mDataContainer->constBegin()+index;
4445 return coordsToPixels(it->mainKey(), it->mainValue());
4448 qDebug() << Q_FUNC_INFO <<
"Index out of bounds" << index;
4456 template <
class DataType>
4459 return DataType::sortKeyIsMainKey();
4469 template <
class DataType>
4473 if ((onlySelectable && mSelectable ==
QCP::stNone) || mDataContainer->isEmpty())
4475 if (!mKeyAxis || !mValueAxis)
4479 double key1, value1, key2, value2;
4480 pixelsToCoords(rect.topLeft(), key1, value1);
4481 pixelsToCoords(rect.bottomRight(), key2, value2);
4483 QCPRange valueRange(value1, value2);
4484 typename QCPDataContainer<DataType>::const_iterator begin = mDataContainer->constBegin();
4485 typename QCPDataContainer<DataType>::const_iterator end = mDataContainer->constEnd();
4486 if (DataType::sortKeyIsMainKey())
4488 begin = mDataContainer->
findBegin(keyRange.lower,
false);
4489 end = mDataContainer->
findEnd(keyRange.upper,
false);
4494 int currentSegmentBegin = -1;
4495 for (
typename QCPDataContainer<DataType>::const_iterator it=begin; it!=end; ++it)
4497 if (currentSegmentBegin == -1)
4499 if (valueRange.
contains(it->mainValue()) && keyRange.contains(it->mainKey()))
4500 currentSegmentBegin = int(it-mDataContainer->constBegin());
4501 }
else if (!valueRange.
contains(it->mainValue()) || !keyRange.contains(it->mainKey()))
4504 currentSegmentBegin = -1;
4508 if (currentSegmentBegin != -1)
4518 template <
class DataType>
4521 return int(mDataContainer->findBegin(sortKey, expandedRange)-mDataContainer->constBegin());
4527 template <
class DataType>
4530 return int(mDataContainer->findEnd(sortKey, expandedRange)-mDataContainer->constBegin());
4543 template <
class DataType>
4546 if ((onlySelectable && mSelectable ==
QCP::stNone) || mDataContainer->isEmpty())
4548 if (!mKeyAxis || !mValueAxis)
4552 double minDistSqr = (std::numeric_limits<double>::max)();
4553 int minDistIndex = mDataContainer->size();
4555 typename QCPDataContainer<DataType>::const_iterator begin = mDataContainer->constBegin();
4556 typename QCPDataContainer<DataType>::const_iterator end = mDataContainer->constEnd();
4557 if (DataType::sortKeyIsMainKey())
4560 double posKeyMin, posKeyMax, dummy;
4561 pixelsToCoords(pos-
QPointF(mParentPlot->selectionTolerance(), mParentPlot->selectionTolerance()), posKeyMin, dummy);
4562 pixelsToCoords(pos+
QPointF(mParentPlot->selectionTolerance(), mParentPlot->selectionTolerance()), posKeyMax, dummy);
4563 if (posKeyMin > posKeyMax)
4564 qSwap(posKeyMin, posKeyMax);
4565 begin = mDataContainer->
findBegin(posKeyMin,
true);
4566 end = mDataContainer->
findEnd(posKeyMax,
true);
4570 QCPRange keyRange(mKeyAxis->range());
4571 QCPRange valueRange(mValueAxis->range());
4572 for (
typename QCPDataContainer<DataType>::const_iterator it=begin; it!=end; ++it)
4574 const double mainKey = it->mainKey();
4575 const double mainValue = it->mainValue();
4576 if (keyRange.contains(mainKey) && valueRange.contains(mainValue))
4579 if (currentDistSqr < minDistSqr)
4581 minDistSqr = currentDistSqr;
4582 minDistIndex = int(it-mDataContainer->constBegin());
4586 if (minDistIndex != mDataContainer->size())
4591 details->setValue(selectionResult);
4592 return qSqrt(minDistSqr);
4605 template <
class DataType>
4608 selectedSegments.clear();
4609 unselectedSegments.clear();
4635 template <
class DataType>
4643 qFuzzyCompare(painter->pen().widthF(), 1.0))
4645 QPen newPen = painter->pen();
4652 painter->pen().style() == Qt::SolidLine &&
4657 bool lastIsNan =
false;
4658 const int lineDataSize = lineData.size();
4659 while (i < lineDataSize && (qIsNaN(lineData.at(i).y()) || qIsNaN(lineData.at(i).x())))
4662 while (i < lineDataSize)
4664 if (!qIsNaN(lineData.at(i).y()) && !qIsNaN(lineData.at(i).x()))
4667 painter->
drawLine(lineData.at(i-1), lineData.at(i));
4676 int segmentStart = 0;
4678 const int lineDataSize = lineData.size();
4679 while (i < lineDataSize)
4681 if (qIsNaN(lineData.at(i).y()) || qIsNaN(lineData.at(i).x()) || qIsInf(lineData.at(i).y()))
4683 painter->drawPolyline(lineData.constData()+segmentStart, i-segmentStart);
4689 painter->drawPolyline(lineData.constData()+segmentStart, lineDataSize-segmentStart);
4712 Q_ENUMS(ColorInterpolation)
4725 Q_ENUMS(NanHandling)
4744 Q_ENUMS(GradientPreset)
4749 bool operator!=(
const QCPColorGradient &other)
const {
return !(*
this == other); }
4752 int levelCount()
const {
return mLevelCount; }
4754 ColorInterpolation colorInterpolation()
const {
return mColorInterpolation; }
4755 NanHandling nanHandling()
const {
return mNanHandling; }
4756 QColor nanColor()
const {
return mNanColor; }
4757 bool periodic()
const {
return mPeriodic; }
4760 void setLevelCount(
int n);
4762 void setColorStopAt(
double position,
const QColor &color);
4763 void setColorInterpolation(ColorInterpolation interpolation);
4764 void setNanHandling(NanHandling handling);
4765 void setNanColor(
const QColor &color);
4766 void setPeriodic(
bool enabled);
4769 void colorize(
const double *data,
const QCPRange &range, QRgb *scanLine,
int n,
int dataIndexFactor=1,
bool logarithmic=
false);
4770 void colorize(
const double *data,
const unsigned char *alpha,
const QCPRange &range, QRgb *scanLine,
int n,
int dataIndexFactor=1,
bool logarithmic=
false);
4771 QRgb color(
double position,
const QCPRange &range,
bool logarithmic=
false);
4772 void loadPreset(GradientPreset preset);
4773 void clearColorStops();
4780 ColorInterpolation mColorInterpolation;
4781 NanHandling mNanHandling;
4787 bool mColorBufferInvalidated;
4790 bool stopsUseAlpha()
const;
4791 void updateColorBuffer();
4820 Q_ENUMS(BracketStyle)
4826 QPen bracketPen()
const {
return mBracketPen; }
4827 QBrush bracketBrush()
const {
return mBracketBrush; }
4828 int bracketWidth()
const {
return mBracketWidth; }
4829 int bracketHeight()
const {
return mBracketHeight; }
4830 BracketStyle bracketStyle()
const {
return mBracketStyle; }
4831 bool tangentToData()
const {
return mTangentToData; }
4832 int tangentAverage()
const {
return mTangentAverage; }
4835 void setBracketPen(
const QPen &pen);
4836 void setBracketBrush(
const QBrush &brush);
4837 void setBracketWidth(
int width);
4838 void setBracketHeight(
int height);
4839 void setBracketStyle(BracketStyle style);
4840 void setTangentToData(
bool enabled);
4841 void setTangentAverage(
int pointCount);
4844 virtual void drawBracket(
QCPPainter *painter,
int direction)
const;
4855 BracketStyle mBracketStyle;
4856 bool mTangentToData;
4857 int mTangentAverage;
4876 Q_PROPERTY(
QPixmap background READ background WRITE setBackground)
4877 Q_PROPERTY(
bool backgroundScaled READ backgroundScaled WRITE setBackgroundScaled)
4878 Q_PROPERTY(Qt::AspectRatioMode backgroundScaledMode READ backgroundScaledMode WRITE setBackgroundScaledMode)
4879 Q_PROPERTY(Qt::Orientations rangeDrag READ rangeDrag WRITE setRangeDrag)
4880 Q_PROPERTY(Qt::Orientations rangeZoom READ rangeZoom WRITE setRangeZoom)
4887 QPixmap background()
const {
return mBackgroundPixmap; }
4888 QBrush backgroundBrush()
const {
return mBackgroundBrush; }
4889 bool backgroundScaled()
const {
return mBackgroundScaled; }
4890 Qt::AspectRatioMode backgroundScaledMode()
const {
return mBackgroundScaledMode; }
4891 Qt::Orientations rangeDrag()
const {
return mRangeDrag; }
4892 Qt::Orientations rangeZoom()
const {
return mRangeZoom; }
4893 QCPAxis *rangeDragAxis(Qt::Orientation orientation);
4894 QCPAxis *rangeZoomAxis(Qt::Orientation orientation);
4897 double rangeZoomFactor(Qt::Orientation orientation);
4900 void setBackground(
const QPixmap &pm);
4901 void setBackground(
const QPixmap &pm,
bool scaled, Qt::AspectRatioMode mode=Qt::KeepAspectRatioByExpanding);
4902 void setBackground(
const QBrush &brush);
4903 void setBackgroundScaled(
bool scaled);
4904 void setBackgroundScaledMode(Qt::AspectRatioMode mode);
4905 void setRangeDrag(Qt::Orientations orientations);
4906 void setRangeZoom(Qt::Orientations orientations);
4913 void setRangeZoomFactor(
double horizontalFactor,
double verticalFactor);
4914 void setRangeZoomFactor(
double factor);
4923 bool removeAxis(
QCPAxis *axis);
4926 void zoom(
const QRectF &pixelRect);
4928 void setupFullAxesBox(
bool connectRanges=
false);
4934 int left()
const {
return mRect.left(); }
4935 int right()
const {
return mRect.right(); }
4936 int top()
const {
return mRect.top(); }
4937 int bottom()
const {
return mRect.bottom(); }
4938 int width()
const {
return mRect.width(); }
4939 int height()
const {
return mRect.height(); }
4940 QSize
size()
const {
return mRect.size(); }
4941 QPoint
topLeft()
const {
return mRect.topLeft(); }
4945 QPoint
center()
const {
return mRect.center(); }
4948 virtual void update(UpdatePhase phase) Q_DECL_OVERRIDE;
4955 QPixmap mScaledBackgroundPixmap;
4956 bool mBackgroundScaled;
4957 Qt::AspectRatioMode mBackgroundScaledMode;
4959 Qt::Orientations mRangeDrag, mRangeZoom;
4962 double mRangeZoomFactorHorz, mRangeZoomFactorVert;
4966 QCP::AntialiasedElements mAADragBackup, mNotAADragBackup;
4971 virtual void applyDefaultAntialiasingHint(
QCPPainter *painter)
const Q_DECL_OVERRIDE;
4972 virtual void draw(
QCPPainter *painter) Q_DECL_OVERRIDE;
4973 virtual int calculateAutoMargin(
QCP::MarginSide side) Q_DECL_OVERRIDE;
4974 virtual void layoutChanged() Q_DECL_OVERRIDE;
4976 virtual
void mousePressEvent(
QMouseEvent *event, const
QVariant &details) Q_DECL_OVERRIDE;
4977 virtual
void mouseMoveEvent(
QMouseEvent *event, const
QPointF &startPos) Q_DECL_OVERRIDE;
4978 virtual
void mouseReleaseEvent(
QMouseEvent *event, const
QPointF &startPos) Q_DECL_OVERRIDE;
4979 virtual
void wheelEvent(
QWheelEvent *event) Q_DECL_OVERRIDE;
4983 void updateAxesOffset(
QCPAxis::AxisType type);
5002 Q_PROPERTY(
QCPLegend* parentLegend READ parentLegend)
5003 Q_PROPERTY(
QFont font READ font WRITE setFont)
5004 Q_PROPERTY(
QColor textColor READ textColor WRITE setTextColor)
5005 Q_PROPERTY(
QFont selectedFont READ selectedFont WRITE setSelectedFont)
5006 Q_PROPERTY(
QColor selectedTextColor READ selectedTextColor WRITE setSelectedTextColor)
5007 Q_PROPERTY(
bool selectable READ selectable WRITE setSelectable NOTIFY selectionChanged)
5008 Q_PROPERTY(
bool selected READ selected WRITE setSelected NOTIFY selectableChanged)
5014 QCPLegend *parentLegend()
const {
return mParentLegend; }
5015 QFont font()
const {
return mFont; }
5016 QColor textColor()
const {
return mTextColor; }
5017 QFont selectedFont()
const {
return mSelectedFont; }
5018 QColor selectedTextColor()
const {
return mSelectedTextColor; }
5019 bool selectable()
const {
return mSelectable; }
5020 bool selected()
const {
return mSelected; }
5023 void setFont(
const QFont &font);
5024 void setTextColor(
const QColor &color);
5025 void setSelectedFont(
const QFont &font);
5026 void setSelectedTextColor(
const QColor &color);
5027 Q_SLOT
void setSelectable(
bool selectable);
5028 Q_SLOT
void setSelected(
bool selected);
5031 virtual double selectTest(
const QPointF &pos,
bool onlySelectable,
QVariant *details=
nullptr)
const Q_DECL_OVERRIDE;
5034 void selectionChanged(
bool selected);
5035 void selectableChanged(
bool selectable);
5042 QFont mSelectedFont;
5043 QColor mSelectedTextColor;
5044 bool mSelectable, mSelected;
5048 virtual void applyDefaultAntialiasingHint(
QCPPainter *painter)
const Q_DECL_OVERRIDE;
5049 virtual QRect clipRect()
const Q_DECL_OVERRIDE;
5050 virtual void draw(
QCPPainter *painter) Q_DECL_OVERRIDE = 0;
5052 virtual void selectEvent(
QMouseEvent *event,
bool additive,
const QVariant &details,
bool *selectionStateChanged) Q_DECL_OVERRIDE;
5053 virtual void deselectEvent(
bool *selectionStateChanged) Q_DECL_OVERRIDE;
5076 virtual void draw(
QCPPainter *painter) Q_DECL_OVERRIDE;
5080 QPen getIconBorderPen()
const;
5081 QColor getTextColor()
const;
5082 QFont getFont()
const;
5090 Q_PROPERTY(
QPen borderPen READ borderPen WRITE setBorderPen)
5091 Q_PROPERTY(
QBrush brush READ brush WRITE setBrush)
5092 Q_PROPERTY(
QFont font READ font WRITE setFont)
5093 Q_PROPERTY(
QColor textColor READ textColor WRITE setTextColor)
5094 Q_PROPERTY(QSize iconSize READ iconSize WRITE setIconSize)
5095 Q_PROPERTY(
int iconTextPadding READ iconTextPadding WRITE setIconTextPadding)
5096 Q_PROPERTY(
QPen iconBorderPen READ iconBorderPen WRITE setIconBorderPen)
5097 Q_PROPERTY(SelectableParts selectableParts READ selectableParts WRITE setSelectableParts NOTIFY selectionChanged)
5098 Q_PROPERTY(SelectableParts selectedParts READ selectedParts WRITE setSelectedParts NOTIFY selectableChanged)
5099 Q_PROPERTY(
QPen selectedBorderPen READ selectedBorderPen WRITE setSelectedBorderPen)
5100 Q_PROPERTY(
QPen selectedIconBorderPen READ selectedIconBorderPen WRITE setSelectedIconBorderPen)
5101 Q_PROPERTY(
QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
5102 Q_PROPERTY(
QFont selectedFont READ selectedFont WRITE setSelectedFont)
5103 Q_PROPERTY(
QColor selectedTextColor READ selectedTextColor WRITE setSelectedTextColor)
5112 ,spLegendBox = 0x001
5115 Q_ENUMS(SelectablePart)
5116 Q_FLAGS(SelectableParts)
5117 Q_DECLARE_FLAGS(SelectableParts, SelectablePart)
5123 QPen borderPen()
const {
return mBorderPen; }
5124 QBrush brush()
const {
return mBrush; }
5125 QFont font()
const {
return mFont; }
5126 QColor textColor()
const {
return mTextColor; }
5127 QSize iconSize()
const {
return mIconSize; }
5128 int iconTextPadding()
const {
return mIconTextPadding; }
5129 QPen iconBorderPen()
const {
return mIconBorderPen; }
5130 SelectableParts selectableParts()
const {
return mSelectableParts; }
5131 SelectableParts selectedParts()
const;
5132 QPen selectedBorderPen()
const {
return mSelectedBorderPen; }
5133 QPen selectedIconBorderPen()
const {
return mSelectedIconBorderPen; }
5134 QBrush selectedBrush()
const {
return mSelectedBrush; }
5135 QFont selectedFont()
const {
return mSelectedFont; }
5136 QColor selectedTextColor()
const {
return mSelectedTextColor; }
5139 void setBorderPen(
const QPen &pen);
5140 void setBrush(
const QBrush &brush);
5141 void setFont(
const QFont &font);
5142 void setTextColor(
const QColor &color);
5143 void setIconSize(
const QSize &size);
5144 void setIconSize(
int width,
int height);
5145 void setIconTextPadding(
int padding);
5146 void setIconBorderPen(
const QPen &pen);
5147 Q_SLOT
void setSelectableParts(
const SelectableParts &selectableParts);
5148 Q_SLOT
void setSelectedParts(
const SelectableParts &selectedParts);
5149 void setSelectedBorderPen(
const QPen &pen);
5150 void setSelectedIconBorderPen(
const QPen &pen);
5151 void setSelectedBrush(
const QBrush &brush);
5152 void setSelectedFont(
const QFont &font);
5153 void setSelectedTextColor(
const QColor &color);
5161 int itemCount() const;
5165 bool removeItem(
int index);
5171 void selectionChanged(
QCPLegend::SelectableParts parts);
5172 void selectableChanged(
QCPLegend::SelectableParts parts);
5176 QPen mBorderPen, mIconBorderPen;
5181 int mIconTextPadding;
5182 SelectableParts mSelectedParts, mSelectableParts;
5183 QPen mSelectedBorderPen, mSelectedIconBorderPen;
5185 QFont mSelectedFont;
5186 QColor mSelectedTextColor;
5189 virtual
void parentPlotInitialized(
QCustomPlot *parentPlot) Q_DECL_OVERRIDE;
5190 virtual
QCP::Interaction selectionCategory() const Q_DECL_OVERRIDE;
5191 virtual
void applyDefaultAntialiasingHint(
QCPPainter *painter) const Q_DECL_OVERRIDE;
5192 virtual
void draw(
QCPPainter *painter) Q_DECL_OVERRIDE;
5194 virtual
void selectEvent(
QMouseEvent *event,
bool additive, const
QVariant &details,
bool *selectionStateChanged) Q_DECL_OVERRIDE;
5195 virtual
void deselectEvent(
bool *selectionStateChanged) Q_DECL_OVERRIDE;
5198 QPen getBorderPen() const;
5207 Q_DECLARE_OPERATORS_FOR_FLAGS(
QCPLegend::SelectableParts)
5208 Q_DECLARE_METATYPE(
QCPLegend::SelectablePart)
5220 Q_PROPERTY(
QString text READ text WRITE setText)
5221 Q_PROPERTY(
QFont font READ font WRITE setFont)
5222 Q_PROPERTY(
QColor textColor READ textColor WRITE setTextColor)
5223 Q_PROPERTY(
QFont selectedFont READ selectedFont WRITE setSelectedFont)
5224 Q_PROPERTY(
QColor selectedTextColor READ selectedTextColor WRITE setSelectedTextColor)
5225 Q_PROPERTY(
bool selectable READ selectable WRITE setSelectable NOTIFY selectableChanged)
5226 Q_PROPERTY(
bool selected READ selected WRITE setSelected NOTIFY selectionChanged)
5236 QString text()
const {
return mText; }
5237 int textFlags()
const {
return mTextFlags; }
5238 QFont font()
const {
return mFont; }
5239 QColor textColor()
const {
return mTextColor; }
5240 QFont selectedFont()
const {
return mSelectedFont; }
5241 QColor selectedTextColor()
const {
return mSelectedTextColor; }
5242 bool selectable()
const {
return mSelectable; }
5243 bool selected()
const {
return mSelected; }
5246 void setText(
const QString &text);
5247 void setTextFlags(
int flags);
5248 void setFont(
const QFont &font);
5249 void setTextColor(
const QColor &color);
5250 void setSelectedFont(
const QFont &font);
5251 void setSelectedTextColor(
const QColor &color);
5252 Q_SLOT
void setSelectable(
bool selectable);
5253 Q_SLOT
void setSelected(
bool selected);
5262 void selectionChanged(
bool selected);
5263 void selectableChanged(
bool selectable);
5273 QFont mSelectedFont;
5274 QColor mSelectedTextColor;
5275 QRect mTextBoundingRect;
5276 bool mSelectable, mSelected;
5279 virtual void applyDefaultAntialiasingHint(
QCPPainter *painter)
const Q_DECL_OVERRIDE;
5280 virtual void draw(
QCPPainter *painter) Q_DECL_OVERRIDE;
5284 virtual void selectEvent(
QMouseEvent *event,
bool additive,
const QVariant &details,
bool *selectionStateChanged) Q_DECL_OVERRIDE;
5285 virtual void deselectEvent(
bool *selectionStateChanged) Q_DECL_OVERRIDE;
5288 QFont mainFont()
const;
5289 QColor mainTextColor()
const;
5312 bool mGradientImageInvalidated;
5314 using QCPAxisRect::calculateAutoMargin;
5320 virtual void draw(
QCPPainter *painter) Q_DECL_OVERRIDE;
5321 void updateGradientImage();
5322 Q_SLOT
void axisSelectionChanged(QCPAxis::SelectableParts selectedParts);
5323 Q_SLOT
void axisSelectableChanged(QCPAxis::SelectableParts selectableParts);
5333 Q_PROPERTY(
QCPRange dataRange READ dataRange WRITE setDataRange NOTIFY dataRangeChanged)
5334 Q_PROPERTY(
QCPAxis::ScaleType dataScaleType READ dataScaleType WRITE setDataScaleType NOTIFY dataScaleTypeChanged)
5335 Q_PROPERTY(
QCPColorGradient gradient READ gradient WRITE setGradient NOTIFY gradientChanged)
5336 Q_PROPERTY(
QString label READ label WRITE setLabel)
5337 Q_PROPERTY(
int barWidth READ barWidth WRITE setBarWidth)
5338 Q_PROPERTY(
bool rangeDrag READ rangeDrag WRITE setRangeDrag)
5339 Q_PROPERTY(
bool rangeZoom READ rangeZoom WRITE setRangeZoom)
5348 QCPRange dataRange()
const {
return mDataRange; }
5352 int barWidth ()
const {
return mBarWidth; }
5353 bool rangeDrag()
const;
5354 bool rangeZoom()
const;
5358 Q_SLOT
void setDataRange(
const QCPRange &dataRange);
5361 void setLabel(
const QString &str);
5362 void setBarWidth(
int width);
5363 void setRangeDrag(
bool enabled);
5364 void setRangeZoom(
bool enabled);
5368 void rescaleDataRange(
bool onlyVisibleMaps);
5371 virtual void update(UpdatePhase phase) Q_DECL_OVERRIDE;
5374 void dataRangeChanged(
const QCPRange &newRange);
5387 QPointer<QCPColorScaleAxisRectPrivate> mAxisRect;
5388 QPointer<QCPAxis> mColorAxis;
5391 virtual void applyDefaultAntialiasingHint(
QCPPainter *painter)
const Q_DECL_OVERRIDE;
5446 Q_PROPERTY(
LineStyle lineStyle READ lineStyle WRITE setLineStyle)
5447 Q_PROPERTY(
QCPScatterStyle scatterStyle READ scatterStyle WRITE setScatterStyle)
5448 Q_PROPERTY(
int scatterSkip READ scatterSkip WRITE setScatterSkip)
5449 Q_PROPERTY(
QCPGraph* channelFillGraph READ channelFillGraph WRITE setChannelFillGraph)
5450 Q_PROPERTY(
bool adaptiveSampling READ adaptiveSampling WRITE setAdaptiveSampling)
5469 virtual ~
QCPGraph() Q_DECL_OVERRIDE;
5473 LineStyle lineStyle()
const {
return mLineStyle; }
5475 int scatterSkip()
const {
return mScatterSkip; }
5476 QCPGraph *channelFillGraph()
const {
return mChannelFillGraph.
data(); }
5477 bool adaptiveSampling()
const {
return mAdaptiveSampling; }
5480 void setData(QSharedPointer<QCPGraphDataContainer> data);
5482 void setLineStyle(LineStyle ls);
5484 void setScatterSkip(
int skip);
5485 void setChannelFillGraph(
QCPGraph *targetGraph);
5486 void setAdaptiveSampling(
bool enabled);
5490 void addData(
double key,
double value);
5494 virtual
QCPRange getKeyRange(
bool &foundRange,
QCP::SignDomain inSignDomain=
QCP::sdBoth) const Q_DECL_OVERRIDE;
5495 virtual
QCPRange getValueRange(
bool &foundRange,
QCP::SignDomain inSignDomain=
QCP::sdBoth, const
QCPRange &inKeyRange=
QCPRange()) const Q_DECL_OVERRIDE;
5499 LineStyle mLineStyle;
5502 QPointer<
QCPGraph> mChannelFillGraph;
5503 bool mAdaptiveSampling;
5506 virtual
void draw(
QCPPainter *painter) Q_DECL_OVERRIDE;
5507 virtual
void drawLegendIcon(
QCPPainter *painter, const
QRectF &rect) const Q_DECL_OVERRIDE;
5529 bool segmentsIntersect(
double aLower,
double aUpper,
double bLower,
double bUpper,
int &bPrecedence) const;
5533 int findIndexBelowX(const
QVector<
QPointF> *data,
double x) const;
5534 int findIndexAboveX(const
QVector<
QPointF> *data,
double x) const;
5535 int findIndexBelowY(const
QVector<
QPointF> *data,
double y) const;
5536 int findIndexAboveY(const
QVector<
QPointF> *data,
double y) const;
5542 Q_DECLARE_METATYPE(
QCPGraph::LineStyle)
5565 double t, key, value;
5586 Q_PROPERTY(
QCPScatterStyle scatterStyle READ scatterStyle WRITE setScatterStyle)
5587 Q_PROPERTY(
int scatterSkip READ scatterSkip WRITE setScatterSkip)
5588 Q_PROPERTY(
LineStyle lineStyle READ lineStyle WRITE setLineStyle)
5602 virtual ~
QCPCurve() Q_DECL_OVERRIDE;
5607 int scatterSkip()
const {
return mScatterSkip; }
5608 LineStyle lineStyle()
const {
return mLineStyle; }
5611 void setData(QSharedPointer<QCPCurveDataContainer> data);
5615 void setScatterSkip(
int skip);
5616 void setLineStyle(LineStyle style);
5621 void addData(
double t,
double key,
double value);
5622 void addData(
double key,
double value);
5626 virtual
QCPRange getKeyRange(
bool &foundRange,
QCP::SignDomain inSignDomain=
QCP::sdBoth) const Q_DECL_OVERRIDE;
5627 virtual
QCPRange getValueRange(
bool &foundRange,
QCP::SignDomain inSignDomain=
QCP::sdBoth, const
QCPRange &inKeyRange=
QCPRange()) const Q_DECL_OVERRIDE;
5633 LineStyle mLineStyle;
5636 virtual
void draw(
QCPPainter *painter) Q_DECL_OVERRIDE;
5637 virtual
void drawLegendIcon(
QCPPainter *painter, const
QRectF &rect) const Q_DECL_OVERRIDE;
5646 int getRegion(
double key,
double value,
double keyMin,
double valueMax,
double keyMax,
double valueMin) const;
5647 QPointF getOptimizedPoint(
int otherRegion,
double otherKey,
double otherValue,
double key,
double value,
double keyMin,
double valueMax,
double keyMax,
double valueMin) const;
5648 QVector<
QPointF> getOptimizedCornerPoints(
int prevRegion,
int currentRegion,
double prevKey,
double prevValue,
double key,
double value,
double keyMin,
double valueMax,
double keyMax,
double valueMin) const;
5649 bool mayTraverse(
int prevRegion,
int currentRegion) const;
5650 bool getTraverse(
double prevKey,
double prevValue,
double key,
double value,
double keyMin,
double valueMax,
double keyMax,
double valueMin,
QPointF &crossA,
QPointF &crossB) const;
5651 void getTraverseCornerPoints(
int prevRegion,
int currentRegion,
double keyMin,
double valueMax,
double keyMax,
double valueMin,
QVector<
QPointF> &beforeTraverse,
QVector<
QPointF> &afterTraverse) const;
5657 Q_DECLARE_METATYPE(
QCPCurve::LineStyle)
5669 Q_PROPERTY(
SpacingType spacingType READ spacingType WRITE setSpacingType)
5670 Q_PROPERTY(
double spacing READ spacing WRITE setSpacing)
5683 Q_ENUMS(SpacingType)
5689 SpacingType spacingType()
const {
return mSpacingType; }
5690 double spacing()
const {
return mSpacing; }
5693 void setSpacingType(SpacingType spacingType);
5694 void setSpacing(
double spacing);
5698 QCPBars* bars(
int index)
const;
5699 int size()
const {
return mBars.size(); }
5704 void insert(
int i,
QCPBars *bars);
5710 SpacingType mSpacingType;
5715 void registerBars(
QCPBars *bars);
5716 void unregisterBars(
QCPBars *bars);
5719 double keyPixelOffset(
const QCPBars *bars,
double keyCoord);
5720 double getPixelSpacing(
const QCPBars *bars,
double keyCoord);
5747 Q_DECLARE_TYPEINFO(
QCPBarsData, Q_PRIMITIVE_TYPE);
5765 Q_PROPERTY(
double width READ width WRITE setWidth)
5766 Q_PROPERTY(
WidthType widthType READ widthType WRITE setWidthType)
5767 Q_PROPERTY(
QCPBarsGroup* barsGroup READ barsGroup WRITE setBarsGroup)
5768 Q_PROPERTY(
double baseValue READ baseValue WRITE setBaseValue)
5769 Q_PROPERTY(
double stackingGap READ stackingGap WRITE setStackingGap)
5770 Q_PROPERTY(
QCPBars* barBelow READ barBelow)
5771 Q_PROPERTY(
QCPBars* barAbove READ barAbove)
5787 virtual ~
QCPBars() Q_DECL_OVERRIDE;
5790 double width()
const {
return mWidth; }
5791 WidthType widthType()
const {
return mWidthType; }
5793 double baseValue()
const {
return mBaseValue; }
5794 double stackingGap()
const {
return mStackingGap; }
5797 QSharedPointer<QCPBarsDataContainer>
data()
const {
return mDataContainer; }
5800 void setData(QSharedPointer<QCPBarsDataContainer> data);
5802 void setWidth(
double width);
5803 void setWidthType(WidthType widthType);
5805 void setBaseValue(
double baseValue);
5806 void setStackingGap(
double pixels);
5810 void addData(
double key,
double value);
5811 void moveBelow(
QCPBars *bars);
5812 void moveAbove(
QCPBars *bars);
5817 virtual
QCPRange getKeyRange(
bool &foundRange,
QCP::SignDomain inSignDomain=
QCP::sdBoth) const Q_DECL_OVERRIDE;
5818 virtual
QCPRange getValueRange(
bool &foundRange,
QCP::SignDomain inSignDomain=
QCP::sdBoth, const
QCPRange &inKeyRange=
QCPRange()) const Q_DECL_OVERRIDE;
5819 virtual
QPointF dataPixelPosition(
int index) const Q_DECL_OVERRIDE;
5824 WidthType mWidthType;
5827 double mStackingGap;
5828 QPointer<
QCPBars> mBarBelow, mBarAbove;
5831 virtual
void draw(
QCPPainter *painter) Q_DECL_OVERRIDE;
5832 virtual
void drawLegendIcon(
QCPPainter *painter, const
QRectF &rect) const Q_DECL_OVERRIDE;
5836 QRectF getBarRect(
double key,
double value) const;
5837 void getPixelWidth(
double key,
double &lower,
double &upper) const;
5838 double getStackedBaseValue(
double key,
bool positive) const;
5845 Q_DECLARE_METATYPE(
QCPBars::WidthType)
5874 double key, minimum, lowerQuartile, median, upperQuartile, maximum;
5896 Q_PROPERTY(
double width READ width WRITE setWidth)
5897 Q_PROPERTY(
double whiskerWidth READ whiskerWidth WRITE setWhiskerWidth)
5898 Q_PROPERTY(
QPen whiskerPen READ whiskerPen WRITE setWhiskerPen)
5899 Q_PROPERTY(
QPen whiskerBarPen READ whiskerBarPen WRITE setWhiskerBarPen)
5900 Q_PROPERTY(
bool whiskerAntialiased READ whiskerAntialiased WRITE setWhiskerAntialiased)
5901 Q_PROPERTY(
QPen medianPen READ medianPen WRITE setMedianPen)
5902 Q_PROPERTY(
QCPScatterStyle outlierStyle READ outlierStyle WRITE setOutlierStyle)
5908 QSharedPointer<QCPStatisticalBoxDataContainer>
data()
const {
return mDataContainer; }
5909 double width()
const {
return mWidth; }
5910 double whiskerWidth()
const {
return mWhiskerWidth; }
5911 QPen whiskerPen()
const {
return mWhiskerPen; }
5912 QPen whiskerBarPen()
const {
return mWhiskerBarPen; }
5913 bool whiskerAntialiased()
const {
return mWhiskerAntialiased; }
5914 QPen medianPen()
const {
return mMedianPen; }
5918 void setData(QSharedPointer<QCPStatisticalBoxDataContainer> data);
5920 void setWidth(
double width);
5921 void setWhiskerWidth(
double width);
5922 void setWhiskerPen(
const QPen &pen);
5923 void setWhiskerBarPen(
const QPen &pen);
5924 void setWhiskerAntialiased(
bool enabled);
5925 void setMedianPen(
const QPen &pen);
5930 void addData(
double key,
double minimum,
double lowerQuartile,
double median,
double upperQuartile,
double maximum,
const QVector<double> &outliers=
QVector<double>());
5935 virtual
QCPRange getKeyRange(
bool &foundRange,
QCP::SignDomain inSignDomain=
QCP::sdBoth) const Q_DECL_OVERRIDE;
5936 virtual
QCPRange getValueRange(
bool &foundRange,
QCP::SignDomain inSignDomain=
QCP::sdBoth, const
QCPRange &inKeyRange=
QCPRange()) const Q_DECL_OVERRIDE;
5941 double mWhiskerWidth;
5942 QPen mWhiskerPen, mWhiskerBarPen;
5943 bool mWhiskerAntialiased;
5948 virtual
void draw(
QCPPainter *painter) Q_DECL_OVERRIDE;
5949 virtual
void drawLegendIcon(
QCPPainter *painter, const
QRectF &rect) const Q_DECL_OVERRIDE;
5979 int keySize()
const {
return mKeySize; }
5980 int valueSize()
const {
return mValueSize; }
5981 QCPRange keyRange()
const {
return mKeyRange; }
5982 QCPRange valueRange()
const {
return mValueRange; }
5983 QCPRange dataBounds()
const {
return mDataBounds; }
5984 double data(
double key,
double value);
5985 double cell(
int keyIndex,
int valueIndex);
5986 unsigned char alpha(
int keyIndex,
int valueIndex);
5989 void setSize(
int keySize,
int valueSize);
5990 void setKeySize(
int keySize);
5991 void setValueSize(
int valueSize);
5993 void setKeyRange(
const QCPRange &keyRange);
5994 void setValueRange(
const QCPRange &valueRange);
5995 void setData(
double key,
double value,
double z);
5996 void setCell(
int keyIndex,
int valueIndex,
double z);
5997 void setAlpha(
int keyIndex,
int valueIndex,
unsigned char alpha);
6000 void recalculateDataBounds();
6003 void fill(
double z);
6004 void fillAlpha(
unsigned char alpha);
6006 void coordToCell(
double key,
double value,
int *keyIndex,
int *valueIndex)
const;
6007 void cellToCoord(
int keyIndex,
int valueIndex,
double *key,
double *value)
const;
6011 int mKeySize, mValueSize;
6017 unsigned char *mAlpha;
6021 bool createAlpha(
bool initializeOpaque=
true);
6031 Q_PROPERTY(
QCPRange dataRange READ dataRange WRITE setDataRange NOTIFY dataRangeChanged)
6032 Q_PROPERTY(
QCPAxis::ScaleType dataScaleType READ dataScaleType WRITE setDataScaleType NOTIFY dataScaleTypeChanged)
6033 Q_PROPERTY(
QCPColorGradient gradient READ gradient WRITE setGradient NOTIFY gradientChanged)
6034 Q_PROPERTY(
bool interpolate READ interpolate WRITE setInterpolate)
6035 Q_PROPERTY(
bool tightBoundary READ tightBoundary WRITE setTightBoundary)
6036 Q_PROPERTY(
QCPColorScale* colorScale READ colorScale WRITE setColorScale)
6044 QCPRange dataRange()
const {
return mDataRange; }
6046 bool interpolate()
const {
return mInterpolate; }
6047 bool tightBoundary()
const {
return mTightBoundary; }
6049 QCPColorScale *colorScale()
const {
return mColorScale.data(); }
6053 Q_SLOT
void setDataRange(
const QCPRange &dataRange);
6056 void setInterpolate(
bool enabled);
6057 void setTightBoundary(
bool enabled);
6061 void rescaleDataRange(
bool recalculateDataBounds=
false);
6062 Q_SLOT
void updateLegendIcon(Qt::TransformationMode transformMode=Qt::SmoothTransformation,
const QSize &thumbSize=QSize(32, 18));
6066 virtual
QCPRange getKeyRange(
bool &foundRange,
QCP::SignDomain inSignDomain=
QCP::sdBoth) const Q_DECL_OVERRIDE;
6067 virtual
QCPRange getValueRange(
bool &foundRange,
QCP::SignDomain inSignDomain=
QCP::sdBoth, const
QCPRange &inKeyRange=
QCPRange()) const Q_DECL_OVERRIDE;
6070 void dataRangeChanged(const
QCPRange &newRange);
6071 void dataScaleTypeChanged(
QCPAxis::ScaleType scaleType);
6077 QCPAxis::ScaleType mDataScaleType;
6081 bool mTightBoundary;
6085 QImage mMapImage, mUndersampledMapImage;
6087 bool mMapImageInvalidated;
6090 virtual
void updateMapImage();
6093 virtual
void draw(
QCPPainter *painter) Q_DECL_OVERRIDE;
6094 virtual
void drawLegendIcon(
QCPPainter *painter, const
QRectF &rect) const Q_DECL_OVERRIDE;
6110 QCPFinancialData(
double key,
double open,
double high,
double low,
double close);
6121 double key, open, high, low, close;
6141 Q_PROPERTY(
ChartStyle chartStyle READ chartStyle WRITE setChartStyle)
6142 Q_PROPERTY(
double width READ width WRITE setWidth)
6143 Q_PROPERTY(
WidthType widthType READ widthType WRITE setWidthType)
6144 Q_PROPERTY(
bool twoColored READ twoColored WRITE setTwoColored)
6145 Q_PROPERTY(
QBrush brushPositive READ brushPositive WRITE setBrushPositive)
6146 Q_PROPERTY(
QBrush brushNegative READ brushNegative WRITE setBrushNegative)
6147 Q_PROPERTY(
QPen penPositive READ penPositive WRITE setPenPositive)
6148 Q_PROPERTY(
QPen penNegative READ penNegative WRITE setPenNegative)
6178 ChartStyle chartStyle()
const {
return mChartStyle; }
6179 double width()
const {
return mWidth; }
6180 WidthType widthType()
const {
return mWidthType; }
6181 bool twoColored()
const {
return mTwoColored; }
6182 QBrush brushPositive()
const {
return mBrushPositive; }
6183 QBrush brushNegative()
const {
return mBrushNegative; }
6184 QPen penPositive()
const {
return mPenPositive; }
6185 QPen penNegative()
const {
return mPenNegative; }
6188 void setData(QSharedPointer<QCPFinancialDataContainer> data);
6190 void setChartStyle(ChartStyle style);
6191 void setWidth(
double width);
6192 void setWidthType(WidthType widthType);
6193 void setTwoColored(
bool twoColored);
6194 void setBrushPositive(
const QBrush &brush);
6195 void setBrushNegative(
const QBrush &brush);
6196 void setPenPositive(
const QPen &pen);
6197 void setPenNegative(
const QPen &pen);
6201 void addData(
double key,
double open,
double high,
double low,
double close);
6206 virtual
QCPRange getKeyRange(
bool &foundRange,
QCP::SignDomain inSignDomain=
QCP::sdBoth) const Q_DECL_OVERRIDE;
6207 virtual
QCPRange getValueRange(
bool &foundRange,
QCP::SignDomain inSignDomain=
QCP::sdBoth, const
QCPRange &inKeyRange=
QCPRange()) const Q_DECL_OVERRIDE;
6214 ChartStyle mChartStyle;
6216 WidthType mWidthType;
6218 QBrush mBrushPositive, mBrushNegative;
6219 QPen mPenPositive, mPenNegative;
6222 virtual
void draw(
QCPPainter *painter) Q_DECL_OVERRIDE;
6223 virtual
void drawLegendIcon(
QCPPainter *painter, const
QRectF &rect) const Q_DECL_OVERRIDE;
6228 double getPixelWidth(
double key,
double keyPixel) const;
6252 double errorMinus, errorPlus;
6278 Q_PROPERTY(QSharedPointer<QCPErrorBarsDataContainer> data READ data WRITE setData)
6280 Q_PROPERTY(
ErrorType errorType READ errorType WRITE setErrorType)
6281 Q_PROPERTY(
double whiskerWidth READ whiskerWidth WRITE setWhiskerWidth)
6282 Q_PROPERTY(
double symbolGap READ symbolGap WRITE setSymbolGap)
6302 ErrorType errorType()
const {
return mErrorType; }
6303 double whiskerWidth()
const {
return mWhiskerWidth; }
6304 double symbolGap()
const {
return mSymbolGap; }
6307 void setData(QSharedPointer<QCPErrorBarsDataContainer> data);
6311 void setErrorType(ErrorType type);
6312 void setWhiskerWidth(
double pixels);
6313 void setSymbolGap(
double pixels);
6318 void addData(
double error);
6319 void addData(
double errorMinus,
double errorPlus);
6322 virtual int dataCount() const Q_DECL_OVERRIDE;
6323 virtual
double dataMainKey(
int index) const Q_DECL_OVERRIDE;
6324 virtual
double dataSortKey(
int index) const Q_DECL_OVERRIDE;
6325 virtual
double dataMainValue(
int index) const Q_DECL_OVERRIDE;
6326 virtual
QCPRange dataValueRange(
int index) const Q_DECL_OVERRIDE;
6327 virtual
QPointF dataPixelPosition(
int index) const Q_DECL_OVERRIDE;
6328 virtual
bool sortKeyIsMainKey() const Q_DECL_OVERRIDE;
6330 virtual
int findBegin(
double sortKey,
bool expandedRange=true) const Q_DECL_OVERRIDE;
6331 virtual
int findEnd(
double sortKey,
bool expandedRange=true) const Q_DECL_OVERRIDE;
6334 virtual
double selectTest(const
QPointF &pos,
bool onlySelectable,
QVariant *details=
nullptr) const Q_DECL_OVERRIDE;
6339 QSharedPointer<QCPErrorBarsDataContainer> mDataContainer;
6340 QPointer<QCPAbstractPlottable> mDataPlottable;
6341 ErrorType mErrorType;
6342 double mWhiskerWidth;
6346 virtual void draw(
QCPPainter *painter) Q_DECL_OVERRIDE;
6347 virtual void drawLegendIcon(
QCPPainter *painter,
const QRectF &rect)
const Q_DECL_OVERRIDE;
6357 bool errorBarVisible(
int index) const;
6358 bool rectIntersectsLine(const
QRectF &pixelRect, const
QLineF &line) const;
6374 Q_PROPERTY(
QPen pen READ pen WRITE setPen)
6375 Q_PROPERTY(
QPen selectedPen READ selectedPen WRITE setSelectedPen)
6382 QPen pen()
const {
return mPen; }
6383 QPen selectedPen()
const {
return mSelectedPen; }
6387 void setSelectedPen(
const QPen &pen);
6397 QPen mPen, mSelectedPen;
6400 virtual void draw(
QCPPainter *painter) Q_DECL_OVERRIDE;
6404 QPen mainPen()
const;
6417 Q_PROPERTY(
QPen pen READ pen WRITE setPen)
6418 Q_PROPERTY(
QPen selectedPen READ selectedPen WRITE setSelectedPen)
6427 QPen pen()
const {
return mPen; }
6428 QPen selectedPen()
const {
return mSelectedPen; }
6433 void setPen(
const QPen &pen);
6434 void setSelectedPen(
const QPen &pen);
6446 QPen mPen, mSelectedPen;
6450 virtual void draw(
QCPPainter *painter) Q_DECL_OVERRIDE;
6454 QPen mainPen()
const;
6467 Q_PROPERTY(
QPen pen READ pen WRITE setPen)
6468 Q_PROPERTY(
QPen selectedPen READ selectedPen WRITE setSelectedPen)
6477 QPen pen()
const {
return mPen; }
6478 QPen selectedPen()
const {
return mSelectedPen; }
6483 void setPen(
const QPen &pen);
6484 void setSelectedPen(
const QPen &pen);
6498 QPen mPen, mSelectedPen;
6502 virtual void draw(
QCPPainter *painter) Q_DECL_OVERRIDE;
6505 QPen mainPen()
const;
6518 Q_PROPERTY(
QPen pen READ pen WRITE setPen)
6519 Q_PROPERTY(
QPen selectedPen READ selectedPen WRITE setSelectedPen)
6520 Q_PROPERTY(
QBrush brush READ brush WRITE setBrush)
6521 Q_PROPERTY(
QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
6528 QPen pen()
const {
return mPen; }
6529 QPen selectedPen()
const {
return mSelectedPen; }
6530 QBrush brush()
const {
return mBrush; }
6531 QBrush selectedBrush()
const {
return mSelectedBrush; }
6534 void setPen(
const QPen &pen);
6535 void setSelectedPen(
const QPen &pen);
6536 void setBrush(
const QBrush &brush);
6537 void setSelectedBrush(
const QBrush &brush);
6552 enum AnchorIndex {aiTop, aiTopRight, aiRight, aiBottom, aiBottomLeft, aiLeft};
6555 QPen mPen, mSelectedPen;
6556 QBrush mBrush, mSelectedBrush;
6559 virtual void draw(
QCPPainter *painter) Q_DECL_OVERRIDE;
6560 virtual QPointF anchorPixelPosition(
int anchorId)
const Q_DECL_OVERRIDE;
6563 QPen mainPen()
const;
6564 QBrush mainBrush()
const;
6577 Q_PROPERTY(
QColor color READ color WRITE setColor)
6578 Q_PROPERTY(
QColor selectedColor READ selectedColor WRITE setSelectedColor)
6579 Q_PROPERTY(
QPen pen READ pen WRITE setPen)
6580 Q_PROPERTY(
QPen selectedPen READ selectedPen WRITE setSelectedPen)
6581 Q_PROPERTY(
QBrush brush READ brush WRITE setBrush)
6582 Q_PROPERTY(
QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
6583 Q_PROPERTY(
QFont font READ font WRITE setFont)
6584 Q_PROPERTY(
QFont selectedFont READ selectedFont WRITE setSelectedFont)
6585 Q_PROPERTY(
QString text READ text WRITE setText)
6586 Q_PROPERTY(Qt::Alignment positionAlignment READ positionAlignment WRITE setPositionAlignment)
6587 Q_PROPERTY(Qt::Alignment textAlignment READ textAlignment WRITE setTextAlignment)
6588 Q_PROPERTY(
double rotation READ rotation WRITE setRotation)
6589 Q_PROPERTY(QMargins padding READ padding WRITE setPadding)
6596 QColor color()
const {
return mColor; }
6597 QColor selectedColor()
const {
return mSelectedColor; }
6598 QPen pen()
const {
return mPen; }
6599 QPen selectedPen()
const {
return mSelectedPen; }
6600 QBrush brush()
const {
return mBrush; }
6601 QBrush selectedBrush()
const {
return mSelectedBrush; }
6602 QFont font()
const {
return mFont; }
6603 QFont selectedFont()
const {
return mSelectedFont; }
6604 QString text()
const {
return mText; }
6605 Qt::Alignment positionAlignment()
const {
return mPositionAlignment; }
6606 Qt::Alignment textAlignment()
const {
return mTextAlignment; }
6607 double rotation()
const {
return mRotation; }
6608 QMargins padding()
const {
return mPadding; }
6611 void setColor(
const QColor &color);
6612 void setSelectedColor(
const QColor &color);
6613 void setPen(
const QPen &pen);
6614 void setSelectedPen(
const QPen &pen);
6615 void setBrush(
const QBrush &brush);
6616 void setSelectedBrush(
const QBrush &brush);
6617 void setFont(
const QFont &font);
6618 void setSelectedFont(
const QFont &font);
6619 void setText(
const QString &text);
6620 void setPositionAlignment(Qt::Alignment alignment);
6621 void setTextAlignment(Qt::Alignment alignment);
6622 void setRotation(
double degrees);
6623 void setPadding(
const QMargins &padding);
6639 enum AnchorIndex {aiTopLeft, aiTop, aiTopRight, aiRight, aiBottomRight, aiBottom, aiBottomLeft, aiLeft};
6642 QColor mColor, mSelectedColor;
6643 QPen mPen, mSelectedPen;
6644 QBrush mBrush, mSelectedBrush;
6645 QFont mFont, mSelectedFont;
6647 Qt::Alignment mPositionAlignment;
6648 Qt::Alignment mTextAlignment;
6653 virtual void draw(
QCPPainter *painter) Q_DECL_OVERRIDE;
6654 virtual QPointF anchorPixelPosition(
int anchorId)
const Q_DECL_OVERRIDE;
6657 QPointF getTextDrawPoint(
const QPointF &pos,
const QRectF &rect, Qt::Alignment positionAlignment)
const;
6658 QFont mainFont()
const;
6659 QColor mainColor()
const;
6660 QPen mainPen()
const;
6661 QBrush mainBrush()
const;
6674 Q_PROPERTY(
QPen pen READ pen WRITE setPen)
6675 Q_PROPERTY(
QPen selectedPen READ selectedPen WRITE setSelectedPen)
6676 Q_PROPERTY(
QBrush brush READ brush WRITE setBrush)
6677 Q_PROPERTY(
QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
6684 QPen pen()
const {
return mPen; }
6685 QPen selectedPen()
const {
return mSelectedPen; }
6686 QBrush brush()
const {
return mBrush; }
6687 QBrush selectedBrush()
const {
return mSelectedBrush; }
6690 void setPen(
const QPen &pen);
6691 void setSelectedPen(
const QPen &pen);
6692 void setBrush(
const QBrush &brush);
6693 void setSelectedBrush(
const QBrush &brush);
6711 enum AnchorIndex {aiTopLeftRim, aiTop, aiTopRightRim, aiRight, aiBottomRightRim, aiBottom, aiBottomLeftRim, aiLeft, aiCenter};
6714 QPen mPen, mSelectedPen;
6715 QBrush mBrush, mSelectedBrush;
6718 virtual void draw(
QCPPainter *painter) Q_DECL_OVERRIDE;
6719 virtual QPointF anchorPixelPosition(
int anchorId)
const Q_DECL_OVERRIDE;
6722 QPen mainPen()
const;
6723 QBrush mainBrush()
const;
6736 Q_PROPERTY(
QPixmap pixmap READ pixmap WRITE setPixmap)
6737 Q_PROPERTY(
bool scaled READ scaled WRITE setScaled)
6738 Q_PROPERTY(Qt::AspectRatioMode aspectRatioMode READ aspectRatioMode)
6739 Q_PROPERTY(Qt::TransformationMode transformationMode READ transformationMode)
6740 Q_PROPERTY(
QPen pen READ pen WRITE setPen)
6741 Q_PROPERTY(
QPen selectedPen READ selectedPen WRITE setSelectedPen)
6748 QPixmap pixmap()
const {
return mPixmap; }
6749 bool scaled()
const {
return mScaled; }
6750 Qt::AspectRatioMode aspectRatioMode()
const {
return mAspectRatioMode; }
6751 Qt::TransformationMode transformationMode()
const {
return mTransformationMode; }
6752 QPen pen()
const {
return mPen; }
6753 QPen selectedPen()
const {
return mSelectedPen; }
6756 void setPixmap(
const QPixmap &pixmap);
6757 void setScaled(
bool scaled, Qt::AspectRatioMode aspectRatioMode=Qt::KeepAspectRatio, Qt::TransformationMode transformationMode=Qt::SmoothTransformation);
6758 void setPen(
const QPen &pen);
6759 void setSelectedPen(
const QPen &pen);
6774 enum AnchorIndex {aiTop, aiTopRight, aiRight, aiBottom, aiBottomLeft, aiLeft};
6780 bool mScaledPixmapInvalidated;
6781 Qt::AspectRatioMode mAspectRatioMode;
6782 Qt::TransformationMode mTransformationMode;
6783 QPen mPen, mSelectedPen;
6786 virtual void draw(
QCPPainter *painter) Q_DECL_OVERRIDE;
6787 virtual QPointF anchorPixelPosition(
int anchorId)
const Q_DECL_OVERRIDE;
6790 void updateScaledPixmap(QRect finalRect=QRect(),
bool flipHorz=
false,
bool flipVert=
false);
6791 QRect getFinalRect(
bool *flippedHorz=
nullptr,
bool *flippedVert=
nullptr)
const;
6792 QPen mainPen()
const;
6805 Q_PROPERTY(
QPen pen READ pen WRITE setPen)
6806 Q_PROPERTY(
QPen selectedPen READ selectedPen WRITE setSelectedPen)
6807 Q_PROPERTY(
QBrush brush READ brush WRITE setBrush)
6808 Q_PROPERTY(
QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
6809 Q_PROPERTY(
double size READ size WRITE setSize)
6810 Q_PROPERTY(
TracerStyle style READ style WRITE setStyle)
6811 Q_PROPERTY(
QCPGraph* graph READ graph WRITE setGraph)
6812 Q_PROPERTY(
double graphKey READ graphKey WRITE setGraphKey)
6813 Q_PROPERTY(
bool interpolating READ interpolating WRITE setInterpolating)
6827 Q_ENUMS(TracerStyle)
6833 QPen pen()
const {
return mPen; }
6834 QPen selectedPen()
const {
return mSelectedPen; }
6835 QBrush brush()
const {
return mBrush; }
6836 QBrush selectedBrush()
const {
return mSelectedBrush; }
6837 double size()
const {
return mSize; }
6838 TracerStyle style()
const {
return mStyle; }
6839 QCPGraph *graph()
const {
return mGraph; }
6840 double graphKey()
const {
return mGraphKey; }
6841 bool interpolating()
const {
return mInterpolating; }
6844 void setPen(
const QPen &pen);
6845 void setSelectedPen(
const QPen &pen);
6846 void setBrush(
const QBrush &brush);
6847 void setSelectedBrush(
const QBrush &brush);
6848 void setSize(
double size);
6849 void setStyle(TracerStyle style);
6851 void setGraphKey(
double key);
6852 void setInterpolating(
bool enabled);
6858 void updatePosition();
6864 QPen mPen, mSelectedPen;
6865 QBrush mBrush, mSelectedBrush;
6870 bool mInterpolating;
6873 virtual
void draw(
QCPPainter *painter) Q_DECL_OVERRIDE;
6876 QPen mainPen() const;
6877 QBrush mainBrush() const;
6891 Q_PROPERTY(
QPen pen READ pen WRITE setPen)
6892 Q_PROPERTY(
QPen selectedPen READ selectedPen WRITE setSelectedPen)
6893 Q_PROPERTY(
double length READ length WRITE setLength)
6894 Q_PROPERTY(
BracketStyle style READ style WRITE setStyle)
6908 Q_ENUMS(BracketStyle)
6914 QPen pen()
const {
return mPen; }
6915 QPen selectedPen()
const {
return mSelectedPen; }
6916 double length()
const {
return mLength; }
6917 BracketStyle style()
const {
return mStyle; }
6920 void setPen(
const QPen &pen);
6921 void setSelectedPen(
const QPen &pen);
6922 void setLength(
double length);
6923 void setStyle(BracketStyle style);
6934 enum AnchorIndex {aiCenter};
6935 QPen mPen, mSelectedPen;
6937 BracketStyle mStyle;
6940 virtual void draw(
QCPPainter *painter) Q_DECL_OVERRIDE;
6941 virtual QPointF anchorPixelPosition(
int anchorId)
const Q_DECL_OVERRIDE;
6944 QPen mainPen()
const;
6968 Q_ENUMS(AngleReference)
6983 ,spTickLabels = 0x002
6984 ,spAxisLabel = 0x004
6986 Q_ENUMS(SelectablePart)
6987 Q_FLAGS(SelectableParts)
6988 Q_DECLARE_FLAGS(SelectableParts, SelectablePart)
6990 enum LabelMode { lmUpright
6999 bool rangeDrag()
const {
return mRangeDrag; }
7000 bool rangeZoom()
const {
return mRangeZoom; }
7001 double rangeZoomFactor()
const {
return mRangeZoomFactor; }
7004 ScaleType scaleType()
const {
return mScaleType; }
7005 const QCPRange range()
const {
return mRange; }
7006 bool rangeReversed()
const {
return mRangeReversed; }
7007 double angle()
const {
return mAngle; }
7008 AngleReference angleReference()
const {
return mAngleReference; }
7009 QSharedPointer<QCPAxisTicker>
ticker()
const {
return mTicker; }
7010 bool ticks()
const {
return mTicks; }
7011 bool tickLabels()
const {
return mTickLabels; }
7012 int tickLabelPadding()
const {
return mLabelPainter.padding(); }
7013 QFont tickLabelFont()
const {
return mTickLabelFont; }
7014 QColor tickLabelColor()
const {
return mTickLabelColor; }
7015 double tickLabelRotation()
const {
return mLabelPainter.rotation(); }
7016 LabelMode tickLabelMode()
const;
7018 int numberPrecision()
const {
return mNumberPrecision; }
7022 int tickLengthIn()
const;
7023 int tickLengthOut()
const;
7024 bool subTicks()
const {
return mSubTicks; }
7025 int subTickLengthIn()
const;
7026 int subTickLengthOut()
const;
7027 QPen basePen()
const {
return mBasePen; }
7028 QPen tickPen()
const {
return mTickPen; }
7029 QPen subTickPen()
const {
return mSubTickPen; }
7030 QFont labelFont()
const {
return mLabelFont; }
7031 QColor labelColor()
const {
return mLabelColor; }
7032 QString label()
const {
return mLabel; }
7033 int labelPadding()
const;
7034 SelectableParts selectedParts()
const {
return mSelectedParts; }
7035 SelectableParts selectableParts()
const {
return mSelectableParts; }
7036 QFont selectedTickLabelFont()
const {
return mSelectedTickLabelFont; }
7037 QFont selectedLabelFont()
const {
return mSelectedLabelFont; }
7038 QColor selectedTickLabelColor()
const {
return mSelectedTickLabelColor; }
7039 QColor selectedLabelColor()
const {
return mSelectedLabelColor; }
7040 QPen selectedBasePen()
const {
return mSelectedBasePen; }
7041 QPen selectedTickPen()
const {
return mSelectedTickPen; }
7042 QPen selectedSubTickPen()
const {
return mSelectedSubTickPen; }
7045 void setRangeDrag(
bool enabled);
7046 void setRangeZoom(
bool enabled);
7047 void setRangeZoomFactor(
double factor);
7050 Q_SLOT
void setRange(
const QCPRange &range);
7051 void setRange(
double lower,
double upper);
7052 void setRange(
double position,
double size, Qt::AlignmentFlag alignment);
7053 void setRangeLower(
double lower);
7054 void setRangeUpper(
double upper);
7055 void setRangeReversed(
bool reversed);
7056 void setAngle(
double degrees);
7057 void setAngleReference(AngleReference reference);
7058 void setTicker(QSharedPointer<QCPAxisTicker> ticker);
7059 void setTicks(
bool show);
7060 void setTickLabels(
bool show);
7061 void setTickLabelPadding(
int padding);
7062 void setTickLabelFont(
const QFont &font);
7063 void setTickLabelColor(
const QColor &color);
7064 void setTickLabelRotation(
double degrees);
7065 void setTickLabelMode(LabelMode mode);
7066 void setNumberFormat(
const QString &formatCode);
7067 void setNumberPrecision(
int precision);
7068 void setTickLength(
int inside,
int outside=0);
7069 void setTickLengthIn(
int inside);
7070 void setTickLengthOut(
int outside);
7071 void setSubTicks(
bool show);
7072 void setSubTickLength(
int inside,
int outside=0);
7073 void setSubTickLengthIn(
int inside);
7074 void setSubTickLengthOut(
int outside);
7075 void setBasePen(
const QPen &pen);
7076 void setTickPen(
const QPen &pen);
7077 void setSubTickPen(
const QPen &pen);
7078 void setLabelFont(
const QFont &font);
7079 void setLabelColor(
const QColor &color);
7080 void setLabel(
const QString &str);
7081 void setLabelPadding(
int padding);
7082 void setSelectedTickLabelFont(
const QFont &font);
7083 void setSelectedLabelFont(
const QFont &font);
7084 void setSelectedTickLabelColor(
const QColor &color);
7085 void setSelectedLabelColor(
const QColor &color);
7086 void setSelectedBasePen(
const QPen &pen);
7087 void setSelectedTickPen(
const QPen &pen);
7088 void setSelectedSubTickPen(
const QPen &pen);
7089 Q_SLOT
void setSelectableParts(
const QCPPolarAxisRadial::SelectableParts &selectableParts);
7090 Q_SLOT
void setSelectedParts(
const QCPPolarAxisRadial::SelectableParts &selectedParts);
7096 void moveRange(
double diff);
7097 void scaleRange(
double factor);
7098 void scaleRange(
double factor,
double center);
7099 void rescale(
bool onlyVisiblePlottables=false);
7100 void pixelToCoord(
QPointF pixelPos,
double &angleCoord,
double &radiusCoord) const;
7101 QPointF coordToPixel(
double angleCoord,
double radiusCoord) const;
7102 double coordToRadius(
double coord) const;
7103 double radiusToCoord(
double radius) const;
7104 SelectablePart getPartAt(const
QPointF &pos) const;
7107 void rangeChanged(const
QCPRange &newRange);
7117 double mRangeZoomFactor;
7122 AngleReference mAngleReference;
7123 SelectableParts mSelectableParts, mSelectedParts;
7124 QPen mBasePen, mSelectedBasePen;
7128 QFont mLabelFont, mSelectedLabelFont;
7129 QColor mLabelColor, mSelectedLabelColor;
7134 QFont mTickLabelFont, mSelectedTickLabelFont;
7135 QColor mTickLabelColor, mSelectedTickLabelColor;
7136 int mNumberPrecision;
7137 QLatin1Char mNumberFormatChar;
7138 bool mNumberBeautifulPowers;
7139 bool mNumberMultiplyCross;
7143 int mTickLengthIn, mTickLengthOut, mSubTickLengthIn, mSubTickLengthOut;
7144 QPen mTickPen, mSelectedTickPen;
7145 QPen mSubTickPen, mSelectedSubTickPen;
7148 bool mRangeReversed;
7149 ScaleType mScaleType;
7157 QVector<
double> mSubTickVector;
7160 QCP::AntialiasedElements mAADragBackup, mNotAADragBackup;
7164 virtual
void applyDefaultAntialiasingHint(
QCPPainter *painter) const Q_DECL_OVERRIDE;
7165 virtual
void draw(
QCPPainter *painter) Q_DECL_OVERRIDE;
7166 virtual
QCP::Interaction selectionCategory() const Q_DECL_OVERRIDE;
7168 virtual
void selectEvent(
QMouseEvent *event,
bool additive, const
QVariant &details,
bool *selectionStateChanged) Q_DECL_OVERRIDE;
7169 virtual
void deselectEvent(
bool *selectionStateChanged) Q_DECL_OVERRIDE;
7171 virtual
void mousePressEvent(
QMouseEvent *event, const
QVariant &details) Q_DECL_OVERRIDE;
7172 virtual
void mouseMoveEvent(
QMouseEvent *event, const
QPointF &startPos) Q_DECL_OVERRIDE;
7173 virtual
void mouseReleaseEvent(
QMouseEvent *event, const
QPointF &startPos) Q_DECL_OVERRIDE;
7174 virtual
void wheelEvent(
QWheelEvent *event) Q_DECL_OVERRIDE;
7177 void updateGeometry(const
QPointF ¢er,
double radius);
7178 void setupTickVectors();
7179 QPen getBasePen() const;
7180 QPen getTickPen() const;
7181 QPen getSubTickPen() const;
7182 QFont getTickLabelFont() const;
7183 QFont getLabelFont() const;
7184 QColor getTickLabelColor() const;
7185 QColor getLabelColor() const;
7219 ,spTickLabels = 0x002
7220 ,spAxisLabel = 0x004
7222 Q_ENUMS(SelectablePart)
7223 Q_FLAGS(SelectableParts)
7224 Q_DECLARE_FLAGS(SelectableParts, SelectablePart)
7238 QPixmap background()
const {
return mBackgroundPixmap; }
7239 QBrush backgroundBrush()
const {
return mBackgroundBrush; }
7240 bool backgroundScaled()
const {
return mBackgroundScaled; }
7241 Qt::AspectRatioMode backgroundScaledMode()
const {
return mBackgroundScaledMode; }
7242 bool rangeDrag()
const {
return mRangeDrag; }
7243 bool rangeZoom()
const {
return mRangeZoom; }
7244 double rangeZoomFactor()
const {
return mRangeZoomFactor; }
7246 const QCPRange range()
const {
return mRange; }
7247 bool rangeReversed()
const {
return mRangeReversed; }
7248 double angle()
const {
return mAngle; }
7249 QSharedPointer<QCPAxisTicker> ticker()
const {
return mTicker; }
7250 bool ticks()
const {
return mTicks; }
7251 bool tickLabels()
const {
return mTickLabels; }
7252 int tickLabelPadding()
const {
return mLabelPainter.padding(); }
7253 QFont tickLabelFont()
const {
return mTickLabelFont; }
7254 QColor tickLabelColor()
const {
return mTickLabelColor; }
7255 double tickLabelRotation()
const {
return mLabelPainter.rotation(); }
7256 LabelMode tickLabelMode()
const;
7258 int numberPrecision()
const {
return mNumberPrecision; }
7261 int tickLengthIn()
const {
return mTickLengthIn; }
7262 int tickLengthOut()
const {
return mTickLengthOut; }
7263 bool subTicks()
const {
return mSubTicks; }
7264 int subTickLengthIn()
const {
return mSubTickLengthIn; }
7265 int subTickLengthOut()
const {
return mSubTickLengthOut; }
7266 QPen basePen()
const {
return mBasePen; }
7267 QPen tickPen()
const {
return mTickPen; }
7268 QPen subTickPen()
const {
return mSubTickPen; }
7269 QFont labelFont()
const {
return mLabelFont; }
7270 QColor labelColor()
const {
return mLabelColor; }
7271 QString label()
const {
return mLabel; }
7272 int labelPadding()
const {
return mLabelPadding; }
7273 SelectableParts selectedParts()
const {
return mSelectedParts; }
7274 SelectableParts selectableParts()
const {
return mSelectableParts; }
7275 QFont selectedTickLabelFont()
const {
return mSelectedTickLabelFont; }
7276 QFont selectedLabelFont()
const {
return mSelectedLabelFont; }
7277 QColor selectedTickLabelColor()
const {
return mSelectedTickLabelColor; }
7278 QColor selectedLabelColor()
const {
return mSelectedLabelColor; }
7279 QPen selectedBasePen()
const {
return mSelectedBasePen; }
7280 QPen selectedTickPen()
const {
return mSelectedTickPen; }
7281 QPen selectedSubTickPen()
const {
return mSelectedSubTickPen; }
7285 void setBackground(
const QPixmap &pm);
7286 void setBackground(
const QPixmap &pm,
bool scaled, Qt::AspectRatioMode mode=Qt::KeepAspectRatioByExpanding);
7287 void setBackground(
const QBrush &brush);
7288 void setBackgroundScaled(
bool scaled);
7289 void setBackgroundScaledMode(Qt::AspectRatioMode mode);
7290 void setRangeDrag(
bool enabled);
7291 void setRangeZoom(
bool enabled);
7292 void setRangeZoomFactor(
double factor);
7294 Q_SLOT
void setRange(
const QCPRange &range);
7295 void setRange(
double lower,
double upper);
7296 void setRange(
double position,
double size, Qt::AlignmentFlag alignment);
7297 void setRangeLower(
double lower);
7298 void setRangeUpper(
double upper);
7299 void setRangeReversed(
bool reversed);
7300 void setAngle(
double degrees);
7301 void setTicker(QSharedPointer<QCPAxisTicker> ticker);
7302 void setTicks(
bool show);
7303 void setTickLabels(
bool show);
7304 void setTickLabelPadding(
int padding);
7305 void setTickLabelFont(
const QFont &font);
7306 void setTickLabelColor(
const QColor &color);
7307 void setTickLabelRotation(
double degrees);
7308 void setTickLabelMode(LabelMode mode);
7309 void setNumberFormat(
const QString &formatCode);
7310 void setNumberPrecision(
int precision);
7311 void setTickLength(
int inside,
int outside=0);
7312 void setTickLengthIn(
int inside);
7313 void setTickLengthOut(
int outside);
7314 void setSubTicks(
bool show);
7315 void setSubTickLength(
int inside,
int outside=0);
7316 void setSubTickLengthIn(
int inside);
7317 void setSubTickLengthOut(
int outside);
7318 void setBasePen(
const QPen &pen);
7319 void setTickPen(
const QPen &pen);
7320 void setSubTickPen(
const QPen &pen);
7321 void setLabelFont(
const QFont &font);
7322 void setLabelColor(
const QColor &color);
7323 void setLabel(
const QString &str);
7324 void setLabelPadding(
int padding);
7325 void setLabelPosition(Qt::AlignmentFlag position);
7326 void setSelectedTickLabelFont(
const QFont &font);
7327 void setSelectedLabelFont(
const QFont &font);
7328 void setSelectedTickLabelColor(
const QColor &color);
7329 void setSelectedLabelColor(
const QColor &color);
7330 void setSelectedBasePen(
const QPen &pen);
7331 void setSelectedTickPen(
const QPen &pen);
7332 void setSelectedSubTickPen(
const QPen &pen);
7333 Q_SLOT
void setSelectableParts(
const QCPPolarAxisAngular::SelectableParts &selectableParts);
7334 Q_SLOT
void setSelectedParts(
const QCPPolarAxisAngular::SelectableParts &selectedParts);
7338 virtual
void update(UpdatePhase phase) Q_DECL_OVERRIDE;
7343 int radialAxisCount() const;
7349 QRegion exactClipRegion()
const;
7351 void moveRange(
double diff);
7352 void scaleRange(
double factor);
7353 void scaleRange(
double factor,
double center);
7354 void rescale(
bool onlyVisiblePlottables=
false);
7355 double coordToAngleRad(
double coord)
const {
return mAngleRad+(coord-mRange.lower)/mRange.
size()*(mRangeReversed ? -2.0*M_PI : 2.0*M_PI); }
7356 double angleRadToCoord(
double angleRad)
const {
return mRange.lower+(angleRad-mAngleRad)/(mRangeReversed ? -2.0*M_PI : 2.0*M_PI)*mRange.
size(); }
7357 void pixelToCoord(
QPointF pixelPos,
double &angleCoord,
double &radiusCoord)
const;
7358 QPointF coordToPixel(
double angleCoord,
double radiusCoord)
const;
7359 SelectablePart getPartAt(
const QPointF &pos)
const;
7362 int left()
const {
return mRect.left(); }
7363 int right()
const {
return mRect.right(); }
7364 int top()
const {
return mRect.top(); }
7365 int bottom()
const {
return mRect.bottom(); }
7366 int width()
const {
return mRect.width(); }
7367 int height()
const {
return mRect.height(); }
7368 QSize
size()
const {
return mRect.size(); }
7369 QPoint
topLeft()
const {
return mRect.topLeft(); }
7374 double radius()
const {
return mRadius; }
7377 void rangeChanged(
const QCPRange &newRange);
7380 void selectableChanged(
const QCPPolarAxisAngular::SelectableParts &parts);
7386 QPixmap mScaledBackgroundPixmap;
7387 bool mBackgroundScaled;
7388 Qt::AspectRatioMode mBackgroundScaledMode;
7392 double mRangeZoomFactor;
7395 double mAngle, mAngleRad;
7396 SelectableParts mSelectableParts, mSelectedParts;
7397 QPen mBasePen, mSelectedBasePen;
7401 QFont mLabelFont, mSelectedLabelFont;
7402 QColor mLabelColor, mSelectedLabelColor;
7407 QFont mTickLabelFont, mSelectedTickLabelFont;
7408 QColor mTickLabelColor, mSelectedTickLabelColor;
7409 int mNumberPrecision;
7410 QLatin1Char mNumberFormatChar;
7411 bool mNumberBeautifulPowers;
7412 bool mNumberMultiplyCross;
7416 int mTickLengthIn, mTickLengthOut, mSubTickLengthIn, mSubTickLengthOut;
7417 QPen mTickPen, mSelectedTickPen;
7418 QPen mSubTickPen, mSelectedSubTickPen;
7421 bool mRangeReversed;
7429 QSharedPointer<QCPAxisTicker> mTicker;
7438 QCP::AntialiasedElements mAADragBackup, mNotAADragBackup;
7442 virtual void applyDefaultAntialiasingHint(
QCPPainter *painter)
const Q_DECL_OVERRIDE;
7443 virtual void draw(
QCPPainter *painter) Q_DECL_OVERRIDE;
7446 virtual
void mousePressEvent(
QMouseEvent *event, const
QVariant &details) Q_DECL_OVERRIDE;
7447 virtual
void mouseMoveEvent(
QMouseEvent *event, const
QPointF &startPos) Q_DECL_OVERRIDE;
7448 virtual
void mouseReleaseEvent(
QMouseEvent *event, const
QPointF &startPos) Q_DECL_OVERRIDE;
7449 virtual
void wheelEvent(
QWheelEvent *event) Q_DECL_OVERRIDE;
7454 void setupTickVectors();
7455 QPen getBasePen() const;
7456 QPen getTickPen() const;
7457 QPen getSubTickPen() const;
7458 QFont getTickLabelFont() const;
7459 QFont getLabelFont() const;
7460 QColor getTickLabelColor() const;
7461 QColor getLabelColor() const;
7496 Q_DECLARE_FLAGS(GridTypes, GridType)
7502 GridTypes type()
const {
return mType; }
7503 GridTypes subGridType()
const {
return mSubGridType; }
7504 bool antialiasedSubGrid()
const {
return mAntialiasedSubGrid; }
7505 bool antialiasedZeroLine()
const {
return mAntialiasedZeroLine; }
7506 QPen angularPen()
const {
return mAngularPen; }
7507 QPen angularSubGridPen()
const {
return mAngularSubGridPen; }
7508 QPen radialPen()
const {
return mRadialPen; }
7509 QPen radialSubGridPen()
const {
return mRadialSubGridPen; }
7510 QPen radialZeroLinePen()
const {
return mRadialZeroLinePen; }
7514 void setType(GridTypes type);
7515 void setSubGridType(GridTypes type);
7516 void setAntialiasedSubGrid(
bool enabled);
7517 void setAntialiasedZeroLine(
bool enabled);
7518 void setAngularPen(
const QPen &pen);
7519 void setAngularSubGridPen(
const QPen &pen);
7520 void setRadialPen(
const QPen &pen);
7521 void setRadialSubGridPen(
const QPen &pen);
7522 void setRadialZeroLinePen(
const QPen &pen);
7527 GridTypes mSubGridType;
7528 bool mAntialiasedSubGrid, mAntialiasedZeroLine;
7529 QPen mAngularPen, mAngularSubGridPen;
7530 QPen mRadialPen, mRadialSubGridPen, mRadialZeroLinePen;
7534 QPointer<QCPPolarAxisRadial> mRadialAxis;
7537 virtual void applyDefaultAntialiasingHint(
QCPPainter *painter)
const Q_DECL_OVERRIDE;
7538 virtual void draw(
QCPPainter *painter) Q_DECL_OVERRIDE;
7549 Q_DECLARE_OPERATORS_FOR_FLAGS(QCPPolarGrid::GridTypes)
7574 virtual void draw(
QCPPainter *painter) Q_DECL_OVERRIDE;
7575 virtual QSize minimumOuterSizeHint()
const Q_DECL_OVERRIDE;
7578 QPen getIconBorderPen()
const;
7579 QColor getTextColor()
const;
7580 QFont getFont()
const;
7606 QString name()
const {
return mName; }
7607 bool antialiasedFill()
const {
return mAntialiasedFill; }
7608 bool antialiasedScatters()
const {
return mAntialiasedScatters; }
7609 QPen pen()
const {
return mPen; }
7610 QBrush brush()
const {
return mBrush; }
7611 bool periodic()
const {
return mPeriodic; }
7615 bool selected()
const {
return !mSelection.
isEmpty(); }
7618 QSharedPointer<QCPGraphDataContainer> data()
const {
return mDataContainer; }
7619 LineStyle lineStyle()
const {
return mLineStyle; }
7623 void setName(
const QString &name);
7624 void setAntialiasedFill(
bool enabled);
7625 void setAntialiasedScatters(
bool enabled);
7626 void setPen(
const QPen &pen);
7627 void setBrush(
const QBrush &brush);
7628 void setPeriodic(
bool enabled);
7634 void setData(QSharedPointer<QCPGraphDataContainer> data);
7636 void setLineStyle(LineStyle ls);
7641 void addData(
double key,
double value);
7642 void coordsToPixels(
double key,
double value,
double &x,
double &y)
const;
7643 const QPointF coordsToPixels(
double key,
double value)
const;
7644 void pixelsToCoords(
double x,
double y,
double &key,
double &value)
const;
7645 void pixelsToCoords(
const QPointF &pixelPos,
double &key,
double &value)
const;
7646 void rescaleAxes(
bool onlyEnlarge=
false)
const;
7647 void rescaleKeyAxis(
bool onlyEnlarge=
false)
const;
7648 void rescaleValueAxis(
bool onlyEnlarge=
false,
bool inKeyRange=
false)
const;
7651 bool removeFromLegend(
QCPLegend *legend)
const;
7652 bool removeFromLegend()
const;
7661 void selectionChanged(
bool selected);
7667 QSharedPointer<QCPGraphDataContainer> mDataContainer;
7668 LineStyle mLineStyle;
7671 bool mAntialiasedFill, mAntialiasedScatters;
7675 QPointer<QCPPolarAxisAngular> mKeyAxis;
7676 QPointer<QCPPolarAxisRadial> mValueAxis;
7682 virtual QRect clipRect()
const;
7685 void applyDefaultAntialiasingHint(
QCPPainter *painter)
const;
7687 virtual void selectEvent(
QMouseEvent *event,
bool additive,
const QVariant &details,
bool *selectionStateChanged);
7688 virtual void deselectEvent(
bool *selectionStateChanged);
7695 virtual void drawLegendIcon(
QCPPainter *painter,
const QRectF &rect)
const;
7698 void applyFillAntialiasingHint(
QCPPainter *painter)
const;
7699 void applyScattersAntialiasingHint(
QCPPainter *painter)
const;
7700 double pointDistance(
const QPointF &pixelPoint, QCPGraphDataContainer::const_iterator &closestData)
const;
7702 virtual int dataCount()
const;
7705 void getVisibleDataBounds(QCPGraphDataContainer::const_iterator &begin, QCPGraphDataContainer::const_iterator &end,
const QCPDataRange &rangeRestriction)
const;
7708 void getOptimizedLineData(
QVector<QCPGraphData> *lineData,
const QCPGraphDataContainer::const_iterator &begin,
const QCPGraphDataContainer::const_iterator &end)
const;
7709 void getOptimizedScatterData(
QVector<QCPGraphData> *scatterData, QCPGraphDataContainer::const_iterator begin, QCPGraphDataContainer::const_iterator end)
const;
7721 #endif // QCUSTOMPLOT_H 0x02 right margin
Definition: qcustomplot.h:200
LineStyle
Definition: qcustomplot.h:7596
ColorInterpolation
Definition: qcustomplot.h:4709
virtual QSize minimumOuterSizeHint() const
Definition: qcustomplot.cpp:3477
QPointF center() const
Definition: qcustomplot.h:7373
void setBrush(const QBrush &brush)
Definition: qcustomplot.cpp:11497
bool isEmpty() const
Definition: qcustomplot.h:6005
BracketStyle
Definition: qcustomplot.h:6903
const_iterator constBegin() const
Definition: qcustomplot.h:2593
bool addToLegend()
Definition: qcustomplot.cpp:11833
The base class tick generator used by QCPAxis to create tick positions and tick labels.
Definition: qcustomplot.h:1682
0x001 Axis ranges are draggable (see QCPAxisRect::setRangeDrag, QCPAxisRect::setRangeDragAxes) ...
Definition: qcustomplot.h:255
int right() const
Definition: qcustomplot.h:7363
double mainValue() const
Definition: qcustomplot.h:5561
QCPRange valueRange() const
Definition: qcustomplot.h:5424
Manages the position of an item.
Definition: qcustomplot.h:3591
EndingStyle
Definition: qcustomplot.h:1493
QCPRange & operator/=(const double &value)
Definition: qcustomplot.h:795
virtual int findBegin(double sortKey, bool expandedRange=true) const Q_DECL_OVERRIDE
Definition: qcustomplot.h:4519
A text label.
Definition: qcustomplot.h:6573
int size() const
Definition: qcustomplot.h:2572
Definition: qcustomplot.h:2421
QCPDataRange dataRange() const
Definition: qcustomplot.h:2602
double mainValue() const
Definition: qcustomplot.h:5422
0x0200 Zero-lines, see QCPGrid::setZeroLinePen
Definition: qcustomplot.h:226
SelectablePart
Definition: qcustomplot.h:6981
int top() const
Definition: qcustomplot.h:4936
void setName(const QString &name)
Definition: qcustomplot.cpp:11448
void setX(double x)
Definition: qcustomplot.h:405
int dataRangeCount() const
Definition: qcustomplot.h:958
bool isEmpty() const
Definition: qcustomplot.h:967
Any combination of data points/ranges can be selected.
Definition: qcustomplot.h:300
The abstract base class for layouts.
Definition: qcustomplot.h:1291
Resolution is given in dots per inch (DPI/PPI)
Definition: qcustomplot.h:170
bool realVisibility() const
Definition: qcustomplot.cpp:1459
void selectionChanged(bool selected)
int height() const
Definition: qcustomplot.h:7367
Specialized axis ticker to display ticks in units of an arbitrary constant, for example pi...
Definition: qcustomplot.h:1928
void setBegin(int begin)
Definition: qcustomplot.h:915
void setKeyAxis(QCPAxis *axis)
Definition: qcustomplot.cpp:11513
QPoint topRight() const
Definition: qcustomplot.h:7370
QCPLayerable * parentLayerable() const
Definition: qcustomplot.h:718
Cosmetic pens are converted to pens with pixel width 1 when exporting.
Definition: qcustomplot.h:178
A curved line from one point to another.
Definition: qcustomplot.h:6463
QList< QCPDataRange > dataRanges() const
Definition: qcustomplot.h:961
int length() const
Definition: qcustomplot.h:912
virtual double dataMainValue(int index) const =0
Controls how a plottable's data selection is drawn.
Definition: qcustomplot.h:3396
void remove(double sortKeyFrom, double sortKeyTo)
Definition: qcustomplot.h:2946
Represents the range an axis is encompassing.
Definition: qcustomplot.h:781
virtual QCPItemPosition * toQCPItemPosition()
Definition: qcustomplot.h:3575
QSize size() const
Definition: qcustomplot.h:7368
An arbitrary pixmap.
Definition: qcustomplot.h:6732
LineStyle
Definition: qcustomplot.h:5458
LayerMode
Definition: qcustomplot.h:652
void setPen(const QPen &pen)
Definition: qcustomplot.cpp:328
A straight line that spans infinitely in both directions.
Definition: qcustomplot.h:6370
virtual void mousePressEvent(QMouseEvent *event, const QVariant &details)
Definition: qcustomplot.cpp:1740
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE
Definition: qcustomplot.h:4544
const_iterator at(int index) const
Definition: qcustomplot.h:2599
static bool sortKeyIsMainKey()
Definition: qcustomplot.h:5738
bool isActive() const
Definition: qcustomplot.h:1115
Definition: qcustomplot.h:159
AngleReference
Definition: qcustomplot.h:6965
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE=0
Holds the data of one single data point for QCPCurve.
Definition: qcustomplot.h:5550
QCPLayerable(QCustomPlot *plot, QString targetLayer=QString(), QCPLayerable *parentLayerable=nullptr)
Definition: qcustomplot.cpp:1366
int index() const
Definition: qcustomplot.h:663
0x004 axis (tick) labels will be cached as pixmaps, increasing replot performance.
Definition: qcustomplot.h:243
GridType
Definition: qcustomplot.h:7489
bool contains(QCPBars *bars) const
Definition: qcustomplot.h:5702
QCPRange & operator+=(const double &value)
Definition: qcustomplot.h:792
Holds the data of one single data point (one bar) for QCPBars.
Definition: qcustomplot.h:5730
InsetPlacement
Definition: qcustomplot.h:1429
QCPRange valueRange(bool &foundRange, QCP::SignDomain signDomain=QCP::sdBoth, const QCPRange &inKeyRange=QCPRange())
Definition: qcustomplot.h:3232
Provides rect/rubber-band data selection and range zoom interaction.
Definition: qcustomplot.h:1103
0x0000 No elements
Definition: qcustomplot.h:229
ErrorType
Definition: qcustomplot.h:6292
int size() const
Definition: qcustomplot.h:911
Definition: qcustomplot.h:5304
Represents the visual appearance of scatter points.
Definition: qcustomplot.h:2447
static QCPStatisticalBoxData fromSortKey(double sortKey)
Definition: qcustomplot.h:5860
QSharedPointer< QCPAxisTicker > ticker() const
Definition: qcustomplot.h:2170
void removeBefore(double sortKey)
Definition: qcustomplot.h:2914
double sortKey() const
Definition: qcustomplot.h:5859
QRect outerRect() const
Definition: qcustomplot.h:1231
void set(const QCPDataContainer< DataType > &data)
Definition: qcustomplot.h:2789
Specialized axis ticker for calendar dates and times as axis ticks.
Definition: qcustomplot.h:1747
Defines an abstract interface for one-dimensional plottables.
Definition: qcustomplot.h:4108
ResolutionUnit
Definition: qcustomplot.h:168
virtual QSize maximumOuterSizeHint() const Q_DECL_OVERRIDE
Definition: qcustomplot.cpp:4765
0x000 None of the interactions are possible
Definition: qcustomplot.h:254
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE
Definition: qcustomplot.cpp:3525
Specialized axis ticker suited for logarithmic axes.
Definition: qcustomplot.h:1987
0x04 top margin
Definition: qcustomplot.h:201
A plottable representing a single statistical box in a plot.
Definition: qcustomplot.h:5892
SignDomain
Definition: qcustomplot.h:189
0x0020 Main lines of plottables
Definition: qcustomplot.h:222
virtual void update(UpdatePhase phase) Q_DECL_OVERRIDE
Definition: qcustomplot.cpp:17972
void simplify()
Definition: qcustomplot.cpp:2600
QCPLayoutInset * insetLayout() const
Definition: qcustomplot.h:4924
ScaleType
Definition: qcustomplot.h:6973
A rectangle.
Definition: qcustomplot.h:6514
int top() const
Definition: qcustomplot.h:7364
static bool sortKeyIsMainKey()
Definition: qcustomplot.h:5861
bool isEmpty() const
Definition: qcustomplot.h:920
QCPGrid * grid() const
Definition: qcustomplot.h:2207
QSharedPointer< QCPStatisticalBoxDataContainer > data() const
Definition: qcustomplot.h:5908
virtual QCPRange dataValueRange(int index) const Q_DECL_OVERRIDE
Definition: qcustomplot.h:4424
void drawPolyline(QCPPainter *painter, const QVector< QPointF > &lineData) const
Definition: qcustomplot.h:4636
When dragging the mouse, a selection rect becomes active. Upon releasing, the axes that are currently...
Definition: qcustomplot.h:273
RefreshPriority
Definition: qcustomplot.h:3769
QMap< double, QString > & ticks()
Definition: qcustomplot.h:1896
A layout element displaying a text.
Definition: qcustomplot.h:5216
Q_SLOT void setSelection(QCPDataSelection selection)
Definition: qcustomplot.cpp:11553
const_iterator constEnd() const
Definition: qcustomplot.h:2594
virtual void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE
Definition: qcustomplot.cpp:18642
void setY(double y)
Definition: qcustomplot.h:406
A layer that may contain objects, to control the rendering order.
Definition: qcustomplot.h:632
QPoint bottomRight() const
Definition: qcustomplot.h:4944
0x02 Mode for all sorts of exports (e.g. PNG, PDF,...). For example, this prevents using cached pixma...
Definition: qcustomplot.h:475
double lengthSquared() const
Definition: qcustomplot.h:410
double mainKey() const
Definition: qcustomplot.h:5863
Handles the different ending decorations for line-like items.
Definition: qcustomplot.h:1478
The positive sign domain, i.e. numbers greater than zero.
Definition: qcustomplot.h:191
Responsible for drawing the grid of a QCPAxis.
Definition: qcustomplot.h:2019
double mainKey() const
Definition: qcustomplot.h:5560
TickStepStrategy
Definition: qcustomplot.h:1691
const_iterator findEnd(double sortKey, bool expandedRange=true) const
Definition: qcustomplot.h:3082
Describes a data set by holding multiple QCPDataRange instances.
Definition: qcustomplot.h:936
void sort()
Definition: qcustomplot.h:3007
0x004 The user can select multiple objects by holding the modifier set by QCustomPlot::setMultiSelect...
Definition: qcustomplot.h:257
0xFF all margins
Definition: qcustomplot.h:203
void expand(const QCPRange &otherRange)
Definition: qcustomplot.cpp:1959
double length() const
Definition: qcustomplot.h:409
void layerChanged(QCPLayer *newLayer)
QCPRange valueRange() const
Definition: qcustomplot.h:6119
ExportPen
Definition: qcustomplot.h:178
QCPDataRange adjusted(int changeBegin, int changeEnd) const
Definition: qcustomplot.h:924
QSharedPointer< QCPBarsDataContainer > data() const
Definition: qcustomplot.h:5797
QPoint bottomLeft() const
Definition: qcustomplot.h:4943
virtual int dataCount() const Q_DECL_OVERRIDE
Definition: qcustomplot.h:4367
Definition: qcustomplot.h:2375
Definition: qcustomplot.h:1619
0x020 Legends are selectable (or their child items, see QCPLegend::setSelectableParts) ...
Definition: qcustomplot.h:260
virtual QCPRange getValueRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth, const QCPRange &inKeyRange=QCPRange()) const =0
Q_SLOT bool setLayer(QCPLayer *layer)
Definition: qcustomplot.cpp:1411
Defines a color gradient for use with e.g. QCPColorMap.
Definition: qcustomplot.h:4700
ScatterShape
Definition: qcustomplot.h:2477
AntialiasedElement
Definition: qcustomplot.h:217
QList< QCPBars * > bars() const
Definition: qcustomplot.h:5697
Q_SLOT void setSelectable(QCP::SelectionType selectable)
Definition: qcustomplot.cpp:11599
virtual bool sortKeyIsMainKey() const =0
bool qcpLessThanSortKey(const DataType &a, const DataType &b)
Definition: qcustomplot.h:2560
An ellipse.
Definition: qcustomplot.h:6670
Holds the data of one single data point for QCPStatisticalBox.
Definition: qcustomplot.h:5853
int left() const
Definition: qcustomplot.h:4934
double mainValue() const
Definition: qcustomplot.h:5741
A radial graph used to display data in polar plots.
Definition: qcustomplot.h:7584
QSize size() const
Definition: qcustomplot.h:4940
virtual QCPLayoutElement * takeAt(int index)=0
The central class of the library. This is the QWidget which displays the plot and interacts with the ...
Definition: qcustomplot.h:3738
virtual void mouseDoubleClickEvent(QMouseEvent *event, const QVariant &details)
Definition: qcustomplot.cpp:1808
One individual data point can be selected at a time.
Definition: qcustomplot.h:298
LabelSide
Definition: qcustomplot.h:2136
virtual double dataSortKey(int index) const Q_DECL_OVERRIDE
Definition: qcustomplot.h:4392
void removeAfter(double sortKey)
Definition: qcustomplot.h:2929
QCPVector2D perpendicular() const
Definition: qcustomplot.h:418
QSharedPointer< QCPAxisTicker > ticker() const
Definition: qcustomplot.h:7009
QCPBars * barAbove() const
Definition: qcustomplot.h:5796
0x0002 Grid lines
Definition: qcustomplot.h:218
void squeeze(bool preAllocation=true, bool postAllocation=true)
Definition: qcustomplot.h:3023
Represents two doubles as a mathematical 2D vector.
Definition: qcustomplot.h:390
virtual QCPPlottableInterface1D * interface1D() Q_DECL_OVERRIDE
Definition: qcustomplot.h:4148
QCPDataSelection inverse(const QCPDataRange &outerRange) const
Definition: qcustomplot.cpp:2739
QRect rect() const
Definition: qcustomplot.h:1230
SelectablePart
Definition: qcustomplot.h:2152
ScatterProperty
Definition: qcustomplot.h:2459
The generic data container for one-dimensional plottables.
Definition: qcustomplot.h:2563
BracketStyle
Definition: qcustomplot.h:4814
Manages a legend inside a QCustomPlot.
Definition: qcustomplot.h:5086
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE=0
virtual int dataCount() const =0
QPointF toPointF() const
Definition: qcustomplot.h:413
QPoint bottomLeft() const
Definition: qcustomplot.h:7371
void setAntialiased(bool enabled)
Definition: qcustomplot.cpp:1444
double mainKey() const
Definition: qcustomplot.h:6116
QCPDataRange bounded(const QCPDataRange &other) const
Definition: qcustomplot.cpp:2283
QCPAxis * yAxis2
Definition: qcustomplot.h:3892
virtual void mouseReleaseEvent(QMouseEvent *event, const QPointF &startPos) Q_DECL_OVERRIDE
Definition: qcustomplot.cpp:18616
The selection rect is disabled, and all mouse events are forwarded to the underlying objects...
Definition: qcustomplot.h:272
virtual void clear(const QColor &color)=0
void setValueAxis(QCPAxis *axis)
Definition: qcustomplot.cpp:11529
double center() const
Definition: qcustomplot.h:804
virtual void mousePressEvent(QMouseEvent *event, const QVariant &details) Q_DECL_OVERRIDE
Definition: qcustomplot.cpp:18524
A layout that arranges child elements in a grid.
Definition: qcustomplot.h:1331
double sortKey() const
Definition: qcustomplot.h:6112
virtual QPointF dataPixelPosition(int index) const =0
static QCPGraphData fromSortKey(double sortKey)
Definition: qcustomplot.h:5418
QPainter subclass used internally.
Definition: qcustomplot.h:465
The abstract base class for all objects that form the layout system.
Definition: qcustomplot.h:1188
bool isNone() const
Definition: qcustomplot.h:2524
QCPItemPosition * position(const QString &name) const
Definition: qcustomplot.cpp:13032
Holds the data of one single data point for QCPGraph.
Definition: qcustomplot.h:5411
const_iterator findBegin(double sortKey, bool expandedRange=true) const
Definition: qcustomplot.h:3055
0x000 No hints are set
Definition: qcustomplot.h:238
virtual void mouseReleaseEvent(QMouseEvent *event, const QPointF &startPos)
Definition: qcustomplot.cpp:1776
Multiple contiguous data points (a data range) can be selected.
Definition: qcustomplot.h:299
Holds multiple axes and arranges them in a rectangular shape.
Definition: qcustomplot.h:4872
virtual QCPDataSelection selectTestRect(const QRectF &rect, bool onlySelectable) const Q_DECL_OVERRIDE
Definition: qcustomplot.h:4470
void setPen(const QPen &pen)
Definition: qcustomplot.cpp:11483
void rescaleKeyAxis(bool onlyEnlarge=false) const
Definition: qcustomplot.cpp:11717
virtual double dataMainValue(int index) const Q_DECL_OVERRIDE
Definition: qcustomplot.h:4408
double mainValue() const
Definition: qcustomplot.h:6117
When dragging the mouse, a selection rect becomes active. It is the programmer's responsibility to co...
Definition: qcustomplot.h:275
Both sign domains, including zero, i.e. all numbers.
Definition: qcustomplot.h:190
0x00 no margin
Definition: qcustomplot.h:204
A color scale for use with color coding data such as QCPColorMap.
Definition: qcustomplot.h:5328
virtual int findEnd(double sortKey, bool expandedRange=true) const Q_DECL_OVERRIDE
Definition: qcustomplot.h:4528
void pixelsToCoords(double x, double y, double &key, double &value) const
Definition: qcustomplot.cpp:11667
0x010 Axes are selectable (or parts of them, see QCPAxis::setSelectableParts)
Definition: qcustomplot.h:259
double angle() const
Definition: qcustomplot.h:411
Groups multiple QCPBars together so they appear side by side.
Definition: qcustomplot.h:5665
QCPBars * barBelow() const
Definition: qcustomplot.h:5795
virtual QCPDataSelection selectTestRect(const QRectF &rect, bool onlySelectable) const =0
double sortKey() const
Definition: qcustomplot.h:5736
virtual QPointF pixelPosition() const
Definition: qcustomplot.cpp:12067
void rescaleValueAxis(bool onlyEnlarge=false, bool inKeyRange=false) const
Definition: qcustomplot.cpp:11759
bool removeFromLegend() const
Definition: qcustomplot.cpp:11871
void clear()
Definition: qcustomplot.h:2988
int columnCount() const
Definition: qcustomplot.h:1363
int pixelOrientation() const
Definition: qcustomplot.h:2260
A legend item for polar plots.
Definition: qcustomplot.h:7560
0x0004 Sub grid lines
Definition: qcustomplot.h:219
A bracket for referencing/highlighting certain parts in the plot.
Definition: qcustomplot.h:6887
virtual QCPRange getKeyRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth) const =0
LayerInsertMode
Definition: qcustomplot.h:3759
The abstract base class for all entries in a QCPLegend.
Definition: qcustomplot.h:4998
SelectionRectMode
Definition: qcustomplot.h:272
Definition: qcustomplot.h:1542
WidthType
Definition: qcustomplot.h:6157
int bottom() const
Definition: qcustomplot.h:4937
Describes a data range given by begin and end index.
Definition: qcustomplot.h:899
void normalize()
Definition: qcustomplot.h:805
virtual double dataMainKey(int index) const Q_DECL_OVERRIDE
Definition: qcustomplot.h:4376
UpdatePhase
Definition: qcustomplot.h:1206
static QCPCurveData fromSortKey(double sortKey)
Definition: qcustomplot.h:5557
virtual QSize minimumOuterSizeHint() const Q_DECL_OVERRIDE
Definition: qcustomplot.cpp:4748
0x008 Plottables are selectable (e.g. graphs, curves, bars,... see QCPAbstractPlottable) ...
Definition: qcustomplot.h:258
PositionType
Definition: qcustomplot.h:3601
The abstract base class for paint buffers, which define the rendering backend.
Definition: qcustomplot.h:524
static QCPFinancialData fromSortKey(double sortKey)
Definition: qcustomplot.h:6113
A plottable representing a parametric curve in a plot.
Definition: qcustomplot.h:5582
QCPLegend * legend
Definition: qcustomplot.h:3893
void addDataRange(const QCPDataRange &dataRange, bool simplify=true)
Definition: qcustomplot.cpp:2574
static bool sortKeyIsMainKey()
Definition: qcustomplot.h:6114
A legend item representing a plottable with an icon and the plottable name.
Definition: qcustomplot.h:5062
bool isPenDefined() const
Definition: qcustomplot.h:2525
virtual double dataSortKey(int index) const =0
QPoint topLeft() const
Definition: qcustomplot.h:7369
bool selected() const
Definition: qcustomplot.h:3471
QCPRange valueRange() const
Definition: qcustomplot.h:5743
bool contains(double value) const
Definition: qcustomplot.h:813
QCPRange valueRange() const
Definition: qcustomplot.h:5866
0x0040 Main lines of items
Definition: qcustomplot.h:223
bool isEmpty() const
Definition: qcustomplot.h:2573
Manages a single axis inside a QCustomPlot.
Definition: qcustomplot.h:2070
void selectionChanged(bool selected)
void setAntialiasedFill(bool enabled)
Definition: qcustomplot.cpp:11459
Definition: qcustomplot.h:241
FractionStyle
Definition: qcustomplot.h:1937
TracerStyle
Definition: qcustomplot.h:6821
int width() const
Definition: qcustomplot.h:7366
void rescaleAxes(bool onlyEnlarge=false) const
Definition: qcustomplot.cpp:11706
virtual void draw(QCPPainter *painter) const =0
A template base class for plottables with one-dimensional data.
Definition: qcustomplot.h:4126
0x01 The pen property, see setPen
Definition: qcustomplot.h:2460
Item that sticks to QCPGraph data points.
Definition: qcustomplot.h:6801
Definition: qcustomplot.h:239
Definition: qcustomplot.h:1624
GradientPreset
Definition: qcustomplot.h:4731
int size() const
Definition: qcustomplot.h:5699
A margin group allows synchronization of margin sides if working with multiple layout elements...
Definition: qcustomplot.h:1157
QCPRange & operator-=(const double &value)
Definition: qcustomplot.h:793
LabelMode
Definition: qcustomplot.h:7229
virtual void mouseMoveEvent(QMouseEvent *event, const QPointF &startPos) Q_DECL_OVERRIDE
Definition: qcustomplot.cpp:18556
QList< QCPItemPosition * > positions() const
Definition: qcustomplot.h:3690
QCPRange keyRange(bool &foundRange, QCP::SignDomain signDomain=QCP::sdBoth)
Definition: qcustomplot.h:3109
void setVisible(bool on)
Definition: qcustomplot.cpp:1397
0x08 bottom margin
Definition: qcustomplot.h:202
virtual int findEnd(double sortKey, bool expandedRange=true) const =0
QList< QCPLayerable * > children() const
Definition: qcustomplot.h:664
An anchor of an item to which positions can be attached to.
Definition: qcustomplot.h:3553
double mainValue() const
Definition: qcustomplot.h:5864
0x0100 Borders of fills (e.g. under or between graphs)
Definition: qcustomplot.h:225
The abstract base class for all items in a plot.
Definition: qcustomplot.h:3661
QList< QCPItemAnchor * > anchors() const
Definition: qcustomplot.h:3691
static const double minRange
Definition: qcustomplot.h:817
WidthType
Definition: qcustomplot.h:5780
virtual void simplify()
Definition: qcustomplot.cpp:3724
Selection behaves like stMultipleDataRanges, but if there are any data points selected, the entire plottable is drawn as selected.
Definition: qcustomplot.h:297
QPoint toPoint() const
Definition: qcustomplot.h:412
QPoint topLeft() const
Definition: qcustomplot.h:4941
SelectionType
Definition: qcustomplot.h:296
QPoint bottomRight() const
Definition: qcustomplot.h:7372
QCPRange valueRange() const
Definition: qcustomplot.h:5563
Specialized axis ticker for time spans in units of milliseconds to days.
Definition: qcustomplot.h:1796
int width() const
Definition: qcustomplot.h:4938
A paint buffer based on QPixmap, using software raster rendering.
Definition: qcustomplot.h:559
double sortKey() const
Definition: qcustomplot.h:5556
ScaleStrategy
Definition: qcustomplot.h:1858
static bool sortKeyIsMainKey()
Definition: qcustomplot.h:5419
virtual QCPPainter * startPainting()=0
static QCPBarsData fromSortKey(double sortKey)
Definition: qcustomplot.h:5737
TimeUnit
Definition: qcustomplot.h:1805
0x0080 Scatter symbols of plottables (excluding scatter symbols of type ssPixmap) ...
Definition: qcustomplot.h:224
AnchorReferenceType
Definition: qcustomplot.h:1558
Specialized axis ticker which allows arbitrary labels at specified coordinates.
Definition: qcustomplot.h:1890
QCPSelectionRect * selectionRect() const
Definition: qcustomplot.h:3795
A layout that places child elements aligned to the border or arbitrarily positioned.
Definition: qcustomplot.h:1422
0x100 When performing plottable selection/hit tests, this flag extends the sensitive area beyond the ...
Definition: qcustomplot.h:263
double mainKey() const
Definition: qcustomplot.h:5421
0x080 All other objects are selectable (e.g. your own derived layerables, other layout elements...
Definition: qcustomplot.h:262
virtual QList< QCPLayoutElement * > elements(bool recursive) const Q_DECL_OVERRIDE
Definition: qcustomplot.cpp:3697
Whether to use immediate or queued refresh depends on whether the plotting hint QCP::phImmediateRefre...
Definition: qcustomplot.h:3771
0x002 Axis ranges are zoomable with the mouse wheel (see QCPAxisRect::setRangeZoom, QCPAxisRect::setRangeZoomAxes)
Definition: qcustomplot.h:256
The radial axis inside a radial plot.
Definition: qcustomplot.h:6955
QCPAbstractItem * item() const
Definition: qcustomplot.cpp:14542
void coordsToPixels(double key, double value, double &x, double &y) const
Definition: qcustomplot.cpp:11625
virtual int findBegin(double sortKey, bool expandedRange=true) const =0
A plottable representing a bar chart in a plot.
Definition: qcustomplot.h:5761
bool isNull() const
Definition: qcustomplot.h:415
AxisType
Definition: qcustomplot.h:2123
QCPLayoutGrid * plotLayout() const
Definition: qcustomplot.h:3785
SelectablePart
Definition: qcustomplot.h:7217
0x8000 Other elements that don't fit into any of the existing categories
Definition: qcustomplot.h:227
QDebug operator<<(QDebug d, const QCPVector2D &vec)
Definition: qcustomplot.h:453
double size() const
Definition: qcustomplot.h:803
virtual double dataMainKey(int index) const =0
void add(const QCPDataContainer< DataType > &data)
Definition: qcustomplot.h:2821
iterator end()
Definition: qcustomplot.h:2596
A selection decorator which draws brackets around each selected data segment.
Definition: qcustomplot.h:4803
0x01 Mode for vectorized painting (e.g. PDF export). For example, this prevents some antialiasing fix...
Definition: qcustomplot.h:474
virtual QPointF dataPixelPosition(int index) const Q_DECL_OVERRIDE
Definition: qcustomplot.h:4440
Base class for all drawable objects.
Definition: qcustomplot.h:701
Specialized axis ticker with a fixed tick step.
Definition: qcustomplot.h:1848
0x0008 Legend box
Definition: qcustomplot.h:220
QCPDataSelection selection() const
Definition: qcustomplot.h:3472
AnchorMode
Definition: qcustomplot.h:1549
virtual void reallocateBuffer()=0
static bool sortKeyIsMainKey()
Definition: qcustomplot.h:5558
QCPAbstractPlottable1D(QCPAxis *keyAxis, QCPAxis *valueAxis)
Definition: qcustomplot.h:4352
QCPAxis * axis() const
Definition: qcustomplot.h:5346
SelectablePart
Definition: qcustomplot.h:5111
The plottable is not selectable.
Definition: qcustomplot.h:296
Resolution is given in dots per centimeter (dpcm)
Definition: qcustomplot.h:169
QPoint topRight() const
Definition: qcustomplot.h:4942
ScaleType
Definition: qcustomplot.h:2144
virtual bool take(QCPLayoutElement *element)=0
bool isValid() const
Definition: qcustomplot.h:919
0xFFFF All elements
Definition: qcustomplot.h:228
NanHandling
Definition: qcustomplot.h:4719
QList< QCPLayoutElement * > elements(QCP::MarginSide side) const
Definition: qcustomplot.h:1165
int left() const
Definition: qcustomplot.h:7362
void setEnd(int end)
Definition: qcustomplot.h:916
SizeConstraintRect
Definition: qcustomplot.h:1220
A plottable representing a graph in a plot.
Definition: qcustomplot.h:5442
QCPAbstractPlottable(QCPAxis *keyAxis, QCPAxis *valueAxis)
Definition: qcustomplot.cpp:11414
FillOrder
Definition: qcustomplot.h:1353
The negative sign domain, i.e. numbers smaller than zero.
Definition: qcustomplot.h:189
void selectableChanged(QCP::SelectionType selectable)
0x040 Items are selectable (Rectangles, Arrows, Textitems, etc. see QCPAbstractItem) ...
Definition: qcustomplot.h:261
Holds the two-dimensional data of a QCPColorMap plottable.
Definition: qcustomplot.h:5970
virtual void donePainting()
Definition: qcustomplot.h:542
int height() const
Definition: qcustomplot.h:4939
The abstract base class for all data representing objects in a plot.
Definition: qcustomplot.h:3443
SpacingType
Definition: qcustomplot.h:5679
QCPDataContainer()
Definition: qcustomplot.h:2756
QCPDataRange dataRange(int index=0) const
Definition: qcustomplot.cpp:2544
iterator begin()
Definition: qcustomplot.h:2595
The grid in both angular and radial dimensions for polar plots.
Definition: qcustomplot.h:7479
void drawLine(const QLineF &line)
Definition: qcustomplot.cpp:371
ChartStyle
Definition: qcustomplot.h:6168
0x0001 Axis base line and tick marks
Definition: qcustomplot.h:217
void setAntialiasedScatters(bool enabled)
Definition: qcustomplot.cpp:11470
PainterMode
Definition: qcustomplot.h:473
static Qt::Orientation orientation(AxisType type)
Definition: qcustomplot.h:2274
void clear()
Definition: qcustomplot.cpp:3076
int right() const
Definition: qcustomplot.h:4935
QPoint center() const
Definition: qcustomplot.h:4945
Holds the data of one single error bar for QCPErrorBars.
Definition: qcustomplot.h:6245
Definition: qcustomplot.h:2416
PlottingHint
Definition: qcustomplot.h:238
AnchorSide
Definition: qcustomplot.h:1566
Cosmetic pens are exported normally (e.g. in PDF exports, cosmetic pens always appear as 1 pixel on s...
Definition: qcustomplot.h:179
0x01 left margin
Definition: qcustomplot.h:199
double mainKey() const
Definition: qcustomplot.h:5740
MarginSide
Definition: qcustomplot.h:199
0x0010 Legend items
Definition: qcustomplot.h:221
A plottable representing a financial stock chart.
Definition: qcustomplot.h:6137
void getDataSegments(QList< QCPDataRange > &selectedSegments, QList< QCPDataRange > &unselectedSegments) const
Definition: qcustomplot.h:4606
void setAutoSqueeze(bool enabled)
Definition: qcustomplot.h:2772
QCPSelectionDecorator * selectionDecorator() const
Definition: qcustomplot.h:3473
A plottable representing a two-dimensional color map in a plot.
Definition: qcustomplot.h:6027
The main container for polar plots, representing the angular axis as a circle.
Definition: qcustomplot.h:7206
double sortKey() const
Definition: qcustomplot.h:5417
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const
Definition: qcustomplot.cpp:1503
int bottom() const
Definition: qcustomplot.h:7365
QCPItemAnchor * parentAnchor() const
Definition: qcustomplot.h:3619
QCPRange & operator*=(const double &value)
Definition: qcustomplot.h:794
virtual QCPPlottableInterface1D * interface1D()
Definition: qcustomplot.h:3489
static const double maxRange
Definition: qcustomplot.h:818
virtual bool sortKeyIsMainKey() const Q_DECL_OVERRIDE
Definition: qcustomplot.h:4457
virtual QCPLayoutElement * elementAt(int index) const =0
LineStyle
Definition: qcustomplot.h:5596
A line from one point to another.
Definition: qcustomplot.h:6413
Holds the data of one single data point for QCPFinancial.
Definition: qcustomplot.h:6106
When dragging the mouse, a selection rect becomes active. Upon releasing, plottable data points that ...
Definition: qcustomplot.h:274
Resolution is given in dots per meter (dpm)
Definition: qcustomplot.h:168
virtual void update(UpdatePhase phase)
Definition: qcustomplot.cpp:3436
QSharedPointer< QCPGraphDataContainer > data() const
Definition: qcustomplot.h:5472
void limitIteratorsToDataRange(const_iterator &begin, const_iterator &end, const QCPDataRange &dataRange) const
Definition: qcustomplot.h:3320
A plottable that adds a set of error bars to other plottables.
Definition: qcustomplot.h:6274
virtual void wheelEvent(QWheelEvent *event)
Definition: qcustomplot.cpp:1831
ItemType * itemAt(const QPointF &pos, bool onlySelectable=false) const
Definition: qcustomplot.h:4076
virtual QCPRange dataValueRange(int index) const =0
virtual void mouseMoveEvent(QMouseEvent *event, const QPointF &startPos)
Definition: qcustomplot.cpp:1758
double dot(const QCPVector2D &vec) const
Definition: qcustomplot.h:419
Interaction
Definition: qcustomplot.h:254
void setSelectionDecorator(QCPSelectionDecorator *decorator)
Definition: qcustomplot.cpp:11573
bool isEmpty() const
Definition: qcustomplot.h:5700
QCPColorMapData * data() const
Definition: qcustomplot.h:6043