29 #include <QtCore/qglobal.h> 32 #ifdef QCUSTOMPLOT_USE_OPENGL 33 # if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) 34 # define QCP_OPENGL_PBUFFER 36 # define QCP_OPENGL_FBO 38 # if QT_VERSION >= QT_VERSION_CHECK(5, 3, 0) 39 # define QCP_OPENGL_OFFSCREENSURFACE 43 #if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) 44 # define QCP_DEVICEPIXELRATIO_SUPPORTED 45 # if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) 46 # define QCP_DEVICEPIXELRATIO_FLOAT 50 #include <QtCore/QObject> 51 #include <QtCore/QPointer> 52 #include <QtCore/QSharedPointer> 53 #include <QtCore/QTimer> 54 #include <QtGui/QPainter> 55 #include <QtGui/QPaintEvent> 56 #include <QtGui/QMouseEvent> 57 #include <QtGui/QWheelEvent> 58 #include <QtGui/QPixmap> 59 #include <QtCore/QVector> 60 #include <QtCore/QString> 61 #include <QtCore/QDateTime> 62 #include <QtCore/QMultiMap> 63 #include <QtCore/QFlags> 64 #include <QtCore/QDebug> 65 #include <QtCore/QStack> 66 #include <QtCore/QCache> 67 #include <QtCore/QMargins> 72 # include <QtGui/QOpenGLContext> 73 # include <QtGui/QOpenGLFramebufferObject> 74 # ifdef QCP_OPENGL_OFFSCREENSURFACE 75 # include <QtGui/QOffscreenSurface> 77 # include <QtGui/QWindow> 80 #ifdef QCP_OPENGL_PBUFFER 81 # include <QtOpenGL/QGLPixelBuffer> 83 #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) 84 # include <qnumeric.h> 85 # include <QtGui/QWidget> 86 # include <QtGui/QPrinter> 87 # include <QtGui/QPrintEngine> 90 # include <QtWidgets/QWidget> 91 # include <QtPrintSupport/QtPrintSupport> 118 #define QCUSTOMPLOT_VERSION_STR "2.0.1" 119 #define QCUSTOMPLOT_VERSION 0x020001 122 #if defined(QT_STATIC_BUILD) 123 # define QCP_LIB_DECL 124 #elif defined(QCUSTOMPLOT_COMPILE_LIBRARY) 125 # define QCP_LIB_DECL Q_DECL_EXPORT 126 #elif defined(QCUSTOMPLOT_USE_LIBRARY) 127 # define QCP_LIB_DECL Q_DECL_IMPORT 129 # define QCP_LIB_DECL 133 #ifndef Q_DECL_OVERRIDE 134 # define Q_DECL_OVERRIDE 154 Q_FLAGS(AntialiasedElements)
156 Q_FLAGS(PlottingHints)
158 Q_FLAGS(Interactions)
311 return qIsNaN(value) || qIsInf(value);
336 case QCP::msTop: margins.setTop(value);
break;
338 case QCP::msAll: margins = QMargins(value, value, value, value);
break;
367 Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::AntialiasedElements)
368 Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::PlottingHints)
369 Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::MarginSides)
370 Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::Interactions)
391 QCPVector2D(
double x,
double y);
392 QCPVector2D(
const QPoint &point);
393 QCPVector2D(
const QPointF &point);
396 double x()
const {
return mX; }
397 double y()
const {
return mY; }
398 double &
rx() {
return mX; }
399 double &
ry() {
return mY; }
402 void setX(
double x) { mX = x; }
403 void setY(
double y) { mY = y; }
406 double length()
const {
return qSqrt(mX*mX+mY*mY); }
408 QPoint
toPoint()
const {
return QPoint(mX, mY); }
409 QPointF
toPointF()
const {
return QPointF(mX, mY); }
411 bool isNull()
const {
return qIsNull(mX) && qIsNull(mY); }
413 QCPVector2D normalized()
const;
415 double dot(
const QCPVector2D &vec)
const {
return mX*vec.
mX+mY*vec.
mY; }
416 double distanceSquaredToLine(
const QCPVector2D &
start,
const QCPVector2D &end)
const;
417 double distanceSquaredToLine(
const QLineF &line)
const;
418 double distanceToStraightLine(
const QCPVector2D &base,
const QCPVector2D &direction)
const;
420 QCPVector2D &operator*=(
double factor);
421 QCPVector2D &operator/=(
double divisor);
422 QCPVector2D &operator+=(
const QCPVector2D &vector);
423 QCPVector2D &operator-=(
const QCPVector2D &vector);
429 friend inline const QCPVector2D
operator*(
double factor,
const QCPVector2D &vec);
430 friend inline const QCPVector2D
operator*(
const QCPVector2D &vec,
double factor);
431 friend inline const QCPVector2D
operator/(
const QCPVector2D &vec,
double divisor);
432 friend inline const QCPVector2D
operator+(
const QCPVector2D &vec1,
const QCPVector2D &vec2);
433 friend inline const QCPVector2D
operator-(
const QCPVector2D &vec1,
const QCPVector2D &vec2);
434 friend inline const QCPVector2D
operator-(
const QCPVector2D &vec);
451 d.nospace() <<
"QCPVector2D(" << vec.
x() <<
", " << vec.
y() <<
")";
472 ,pmNonCosmetic = 0x04
475 Q_FLAGS(PainterModes)
482 bool antialiasing()
const {
return testRenderHint(QPainter::Antialiasing); }
483 PainterModes
modes()
const {
return mModes; }
486 void setAntialiasing(
bool enabled);
488 void setModes(PainterModes modes);
491 bool begin(QPaintDevice *device);
492 void setPen(
const QPen &pen);
493 void setPen(
const QColor &color);
494 void setPen(Qt::PenStyle penStyle);
495 void drawLine(
const QLineF &line);
501 void makeNonCosmetic();
511 Q_DECLARE_OPERATORS_FOR_FLAGS(QCPPainter::PainterModes)
523 explicit QCPAbstractPaintBuffer(
const QSize &size,
double devicePixelRatio);
524 virtual ~QCPAbstractPaintBuffer();
527 QSize
size()
const {
return mSize; }
532 void setSize(
const QSize &size);
533 void setInvalidated(
bool invalidated=
true);
534 void setDevicePixelRatio(
double ratio);
539 virtual void draw(
QCPPainter *painter)
const = 0;
540 virtual void clear(
const QColor &color) = 0;
551 virtual void reallocateBuffer() = 0;
571 virtual void reallocateBuffer() Q_DECL_OVERRIDE;
575 #ifdef QCP_OPENGL_PBUFFER 579 explicit QCPPaintBufferGlPbuffer(
const QSize &size,
double devicePixelRatio,
int multisamples);
580 virtual ~QCPPaintBufferGlPbuffer();
589 QGLPixelBuffer *mGlPBuffer;
595 #endif // QCP_OPENGL_PBUFFER 598 #ifdef QCP_OPENGL_FBO 602 explicit QCPPaintBufferGlFbo(
const QSize &size,
double devicePixelRatio, QWeakPointer<QOpenGLContext> glContext, QWeakPointer<QOpenGLPaintDevice> glPaintDevice);
603 virtual ~QCPPaintBufferGlFbo();
613 QWeakPointer<QOpenGLContext> mGlContext;
614 QWeakPointer<QOpenGLPaintDevice> mGlPaintDevice;
615 QOpenGLFramebufferObject *mGlFrameBuffer;
620 #endif // QCP_OPENGL_FBO 632 Q_PROPERTY(
QCustomPlot* parentPlot READ parentPlot)
633 Q_PROPERTY(QString name READ name)
634 Q_PROPERTY(
int index READ index)
635 Q_PROPERTY(QList<QCPLayerable*> children READ children)
636 Q_PROPERTY(
bool visible READ visible WRITE
setVisible)
637 Q_PROPERTY(
LayerMode mode READ mode WRITE setMode)
658 QString
name()
const {
return mName; }
659 int index()
const {
return mIndex; }
660 QList<QCPLayerable*>
children()
const {
return mChildren; }
665 void setVisible(
bool visible);
685 void drawToPaintBuffer();
701 Q_PROPERTY(
bool visible READ visible WRITE setVisible)
702 Q_PROPERTY(QCustomPlot* parentPlot READ parentPlot)
703 Q_PROPERTY(QCPLayerable* parentLayerable READ parentLayerable)
704 Q_PROPERTY(
QCPLayer* layer READ layer WRITE setLayer NOTIFY layerChanged)
705 Q_PROPERTY(
bool antialiased READ antialiased WRITE setAntialiased)
708 QCPLayerable(QCustomPlot *plot, QString targetLayer=QString(), QCPLayerable *parentLayerable=0);
709 virtual ~QCPLayerable();
719 void setVisible(
bool on);
720 Q_SLOT
bool setLayer(
QCPLayer *layer);
721 bool setLayer(
const QString &layerName);
722 void setAntialiased(
bool enabled);
725 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0)
const;
728 bool realVisibility()
const;
731 void layerChanged(
QCPLayer *newLayer);
742 virtual void parentPlotInitialized(QCustomPlot *parentPlot);
744 virtual QRect clipRect()
const;
745 virtual void applyDefaultAntialiasingHint(
QCPPainter *painter)
const = 0;
748 virtual void selectEvent(QMouseEvent *event,
bool additive,
const QVariant &details,
bool *selectionStateChanged);
749 virtual void deselectEvent(
bool *selectionStateChanged);
751 virtual void mousePressEvent(QMouseEvent *event,
const QVariant &details);
752 virtual void mouseMoveEvent(QMouseEvent *event,
const QPointF &startPos);
753 virtual void mouseReleaseEvent(QMouseEvent *event,
const QPointF &startPos);
754 virtual void mouseDoubleClickEvent(QMouseEvent *event,
const QVariant &details);
755 virtual void wheelEvent(QWheelEvent *event);
758 void initializeParentPlot(QCustomPlot *parentPlot);
759 void setParentLayerable(QCPLayerable* parentLayerable);
760 bool moveToLayer(
QCPLayer *layer,
bool prepend);
764 Q_DISABLE_COPY(QCPLayerable)
766 friend class QCustomPlot;
783 QCPRange(
double lower,
double upper);
786 bool operator!=(
const QCPRange& other)
const {
return !(*
this == other); }
788 QCPRange &
operator+=(
const double& value) { lower+=value; upper+=value;
return *
this; }
789 QCPRange &
operator-=(
const double& value) { lower-=value; upper-=value;
return *
this; }
790 QCPRange &
operator*=(
const double& value) { lower*=value; upper*=value;
return *
this; }
791 QCPRange &
operator/=(
const double& value) { lower/=value; upper/=value;
return *
this; }
792 friend inline const QCPRange
operator+(
const QCPRange&,
double);
793 friend inline const QCPRange
operator+(
double,
const QCPRange&);
794 friend inline const QCPRange
operator-(
const QCPRange& range,
double value);
795 friend inline const QCPRange
operator*(
const QCPRange& range,
double value);
796 friend inline const QCPRange
operator*(
double value,
const QCPRange& range);
797 friend inline const QCPRange
operator/(
const QCPRange& range,
double value);
799 double size()
const {
return upper-lower; }
800 double center()
const {
return (upper+lower)*0.5; }
801 void normalize() {
if (lower > upper) qSwap(lower, upper); }
802 void expand(
const QCPRange &otherRange);
803 void expand(
double includeCoord);
804 QCPRange expanded(
const QCPRange &otherRange)
const;
805 QCPRange expanded(
double includeCoord)
const;
806 QCPRange bounded(
double lowerBound,
double upperBound)
const;
807 QCPRange sanitizedForLogScale()
const;
808 QCPRange sanitizedForLinScale()
const;
809 bool contains(
double value)
const {
return value >= lower && value <= upper; }
811 static bool validRange(
double lower,
double upper);
812 static bool validRange(
const QCPRange &range);
823 inline QDebug operator<< (QDebug d,
const QCPRange &range)
825 d.nospace() <<
"QCPRange(" << range.
lower <<
", " << range.
upper <<
")";
905 int begin()
const {
return mBegin; }
906 int end()
const {
return mEnd; }
907 int size()
const {
return mEnd-mBegin; }
915 bool isValid()
const {
return (mEnd >= mBegin) && (mBegin >= 0); }
955 int dataPointCount()
const;
957 QList<QCPDataRange>
dataRanges()
const {
return mDataRanges; }
961 void addDataRange(
const QCPDataRange &dataRange,
bool simplify=
true);
963 bool isEmpty()
const {
return mDataRanges.isEmpty(); }
1070 d.nospace() <<
"QCPDataRange(" << dataRange.
begin() <<
", " << dataRange.
end() <<
")";
1080 d.nospace() <<
"QCPDataSelection(";
1107 QRect
rect()
const {
return mRect; }
1109 QPen
pen()
const {
return mPen; }
1114 void setPen(
const QPen &pen);
1115 void setBrush(
const QBrush &brush);
1118 Q_SLOT
void cancel();
1121 void started(QMouseEvent *event);
1122 void changed(
const QRect &rect, QMouseEvent *event);
1123 void canceled(
const QRect &rect, QInputEvent *event);
1124 void accepted(
const QRect &rect, QMouseEvent *event);
1135 virtual void startSelection(QMouseEvent *event);
1136 virtual void moveSelection(QMouseEvent *event);
1137 virtual void endSelection(QMouseEvent *event);
1138 virtual void keyPressEvent(QKeyEvent *event);
1162 bool isEmpty()
const;
1168 QHash<QCP::MarginSide, QList<QCPLayoutElement*> >
mChildren;
1188 Q_PROPERTY(
QCPLayout* layout READ layout)
1189 Q_PROPERTY(QRect rect READ rect)
1190 Q_PROPERTY(QRect outerRect READ outerRect WRITE setOuterRect)
1191 Q_PROPERTY(QMargins margins READ margins WRITE setMargins)
1192 Q_PROPERTY(QMargins minimumMargins READ minimumMargins WRITE setMinimumMargins)
1193 Q_PROPERTY(QSize minimumSize READ minimumSize WRITE setMinimumSize)
1194 Q_PROPERTY(QSize maximumSize READ maximumSize WRITE setMaximumSize)
1195 Q_PROPERTY(
SizeConstraintRect sizeConstraintRect READ sizeConstraintRect WRITE setSizeConstraintRect)
1221 explicit QCPLayoutElement(
QCustomPlot *parentPlot=0);
1222 virtual ~QCPLayoutElement();
1226 QRect
rect()
const {
return mRect; }
1235 QHash<QCP::MarginSide, QCPMarginGroup*>
marginGroups()
const {
return mMarginGroups; }
1238 void setOuterRect(
const QRect &rect);
1239 void setMargins(
const QMargins &margins);
1240 void setMinimumMargins(
const QMargins &margins);
1241 void setAutoMargins(QCP::MarginSides sides);
1242 void setMinimumSize(
const QSize &size);
1243 void setMinimumSize(
int width,
int height);
1244 void setMaximumSize(
const QSize &size);
1245 void setMaximumSize(
int width,
int height);
1247 void setMarginGroup(QCP::MarginSides sides,
QCPMarginGroup *group);
1251 virtual QSize minimumOuterSizeHint()
const;
1252 virtual QSize maximumOuterSizeHint()
const;
1253 virtual QList<QCPLayoutElement*> elements(
bool recursive)
const;
1256 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0)
const Q_DECL_OVERRIDE;
1270 virtual void layoutChanged();
1278 Q_DISABLE_COPY(QCPLayoutElement)
1291 explicit QCPLayout();
1295 virtual QList<QCPLayoutElement*> elements(
bool recursive)
const Q_DECL_OVERRIDE;
1298 virtual int elementCount()
const = 0;
1299 virtual QCPLayoutElement* elementAt(
int index)
const = 0;
1300 virtual QCPLayoutElement* takeAt(
int index) = 0;
1301 virtual bool take(QCPLayoutElement* element) = 0;
1302 virtual void simplify();
1305 bool removeAt(
int index);
1306 bool remove(QCPLayoutElement* element);
1311 virtual void updateLayout();
1314 void sizeConstraintsChanged()
const;
1315 void adoptElement(QCPLayoutElement *el);
1316 void releaseElement(QCPLayoutElement *el);
1317 QVector<int> getSectionSizes(QVector<int> maxSizes, QVector<int> minSizes, QVector<double> stretchFactors,
int totalSize)
const;
1318 static QSize getFinalMinimumOuterSize(
const QCPLayoutElement *el);
1319 static QSize getFinalMaximumOuterSize(
const QCPLayoutElement *el);
1322 Q_DISABLE_COPY(QCPLayout)
1323 friend class QCPLayoutElement;
1331 Q_PROPERTY(
int rowCount READ rowCount)
1332 Q_PROPERTY(
int columnCount READ columnCount)
1333 Q_PROPERTY(QList<double> columnStretchFactors READ columnStretchFactors WRITE setColumnStretchFactors)
1334 Q_PROPERTY(QList<double> rowStretchFactors READ rowStretchFactors WRITE setRowStretchFactors)
1335 Q_PROPERTY(
int columnSpacing READ columnSpacing WRITE setColumnSpacing)
1336 Q_PROPERTY(
int rowSpacing READ rowSpacing WRITE setRowSpacing)
1337 Q_PROPERTY(
FillOrder fillOrder READ fillOrder WRITE setFillOrder)
1338 Q_PROPERTY(
int wrap READ wrap WRITE setWrap)
1359 int columnCount()
const {
return mElements.size() > 0 ? mElements.first().size() : 0; }
1368 void setColumnStretchFactor(
int column,
double factor);
1369 void setColumnStretchFactors(
const QList<double> &factors);
1370 void setRowStretchFactor(
int row,
double factor);
1371 void setRowStretchFactors(
const QList<double> &factors);
1372 void setColumnSpacing(
int pixels);
1373 void setRowSpacing(
int pixels);
1374 void setWrap(
int count);
1375 void setFillOrder(
FillOrder order,
bool rearrange=
true);
1379 virtual int elementCount() const Q_DECL_OVERRIDE {
return rowCount()*columnCount(); }
1383 virtual QList<QCPLayoutElement*> elements(
bool recursive)
const Q_DECL_OVERRIDE;
1389 QCPLayoutElement *element(
int row,
int column)
const;
1390 bool addElement(
int row,
int column, QCPLayoutElement *element);
1391 bool addElement(QCPLayoutElement *element);
1392 bool hasElement(
int row,
int column);
1393 void expandTo(
int newRowCount,
int newColumnCount);
1394 void insertRow(
int newIndex);
1395 void insertColumn(
int newIndex);
1396 int rowColToIndex(
int row,
int column)
const;
1397 void indexToRowCol(
int index,
int &row,
int &column)
const;
1409 void getMinimumRowColSizes(QVector<int> *minColWidths, QVector<int> *minRowHeights)
const;
1410 void getMaximumRowColSizes(QVector<int> *maxColWidths, QVector<int> *maxRowHeights)
const;
1435 Qt::Alignment insetAlignment(
int index)
const;
1436 QRectF insetRect(
int index)
const;
1440 void setInsetAlignment(
int index, Qt::Alignment alignment);
1441 void setInsetRect(
int index,
const QRectF &rect);
1444 virtual void updateLayout() Q_DECL_OVERRIDE;
1445 virtual
int elementCount() const Q_DECL_OVERRIDE;
1449 virtual
void simplify() Q_DECL_OVERRIDE {}
1450 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0)
const Q_DECL_OVERRIDE;
1503 QCPLineEnding(
EndingStyle style,
double width=8,
double length=10,
bool inverted=
false);
1513 void setWidth(
double width);
1514 void setLength(
double length);
1515 void setInverted(
bool inverted);
1518 double boundingDistance()
const;
1519 double realLength()
const;
1555 virtual ~QCPAxisTicker();
1564 void setTickCount(
int count);
1565 void setTickOrigin(
double origin);
1568 virtual void generate(
const QCPRange &range,
const QLocale &locale, QChar formatChar,
int precision, QVector<double> &ticks, QVector<double> *subTicks, QVector<QString> *tickLabels);
1577 virtual double getTickStep(
const QCPRange &range);
1578 virtual int getSubTickCount(
double tickStep);
1579 virtual QString getTickLabel(
double tick,
const QLocale &locale, QChar formatChar,
int precision);
1580 virtual QVector<double> createTickVector(
double tickStep,
const QCPRange &range);
1581 virtual QVector<double> createSubTickVector(
int subTickCount,
const QVector<double> &ticks);
1582 virtual QVector<QString> createLabelVector(
const QVector<double> &ticks,
const QLocale &locale, QChar formatChar,
int precision);
1585 void trimTicks(
const QCPRange &range, QVector<double> &ticks,
bool keepOneOutlier)
const;
1586 double pickClosest(
double target,
const QVector<double> &candidates)
const;
1587 double getMantissa(
double input,
double *magnitude=0)
const;
1588 double cleanMantissa(
double input)
const;
1591 Q_DISABLE_COPY(QCPAxisTicker)
1613 void setDateTimeFormat(
const QString &format);
1614 void setDateTimeSpec(Qt::TimeSpec spec);
1615 void setTickOrigin(
double origin);
1616 void setTickOrigin(
const QDateTime &origin);
1619 static QDateTime keyToDateTime(
double key);
1620 static double dateTimeToKey(
const QDateTime dateTime);
1621 static double dateTimeToKey(
const QDate date);
1634 virtual QString getTickLabel(
double tick,
const QLocale &locale, QChar formatChar,
int precision)
Q_DECL_OVERRIDE;
1668 void setTimeFormat(
const QString &format);
1669 void setFieldWidth(
TimeUnit unit,
int width);
1683 virtual QString getTickLabel(
double tick,
const QLocale &locale, QChar formatChar,
int precision)
Q_DECL_OVERRIDE;
1686 void replaceUnit(QString &text,
TimeUnit unit,
int value)
const;
1719 void setTickStep(
double step);
1744 QMap<double, QString> &
ticks() {
return mTicks; }
1748 void setTicks(
const QMap<double, QString> &ticks);
1749 void setTicks(
const QVector<double> &positions,
const QVector<QString> &labels);
1750 void setSubTickCount(
int subTicks);
1754 void addTick(
double position,
const QString &label);
1755 void addTicks(
const QMap<double, QString> &ticks);
1756 void addTicks(
const QVector<double> &positions,
const QVector<QString> &labels);
1766 virtual QString getTickLabel(
double tick,
const QLocale &locale, QChar formatChar,
int precision)
Q_DECL_OVERRIDE;
1800 void setPiSymbol(QString symbol);
1801 void setPiValue(
double pi);
1802 void setPeriodicity(
int multiplesOfPi);
1818 virtual QString getTickLabel(
double tick,
const QLocale &locale, QChar formatChar,
int precision)
Q_DECL_OVERRIDE;
1821 void simplifyFraction(
int &numerator,
int &denominator)
const;
1822 QString fractionToString(
int numerator,
int denominator)
const;
1823 QString unicodeFraction(
int numerator,
int denominator)
const;
1824 QString unicodeSuperscript(
int number)
const;
1825 QString unicodeSubscript(
int number)
const;
1845 void setLogBase(
double base);
1846 void setSubTickCount(
int subTicks);
1872 Q_PROPERTY(
bool subGridVisible READ subGridVisible WRITE setSubGridVisible)
1873 Q_PROPERTY(
bool antialiasedSubGrid READ antialiasedSubGrid WRITE setAntialiasedSubGrid)
1874 Q_PROPERTY(
bool antialiasedZeroLine READ antialiasedZeroLine WRITE setAntialiasedZeroLine)
1875 Q_PROPERTY(QPen pen READ pen WRITE setPen)
1876 Q_PROPERTY(QPen subGridPen READ subGridPen WRITE setSubGridPen)
1877 Q_PROPERTY(QPen zeroLinePen READ zeroLinePen WRITE setZeroLinePen)
1886 QPen
pen()
const {
return mPen; }
1891 void setSubGridVisible(
bool visible);
1892 void setAntialiasedSubGrid(
bool enabled);
1893 void setAntialiasedZeroLine(
bool enabled);
1894 void setPen(
const QPen &pen);
1895 void setSubGridPen(
const QPen &pen);
1896 void setZeroLinePen(
const QPen &pen);
1912 void drawGridLines(
QCPPainter *painter)
const;
1913 void drawSubGridLines(
QCPPainter *painter)
const;
1923 Q_PROPERTY(
AxisType axisType READ axisType)
1925 Q_PROPERTY(
ScaleType scaleType READ scaleType WRITE setScaleType NOTIFY scaleTypeChanged)
1926 Q_PROPERTY(
QCPRange range READ range WRITE setRange NOTIFY rangeChanged)
1927 Q_PROPERTY(
bool rangeReversed READ rangeReversed WRITE setRangeReversed)
1928 Q_PROPERTY(QSharedPointer<QCPAxisTicker> ticker READ ticker WRITE setTicker)
1929 Q_PROPERTY(
bool ticks READ ticks WRITE setTicks)
1930 Q_PROPERTY(
bool tickLabels READ tickLabels WRITE setTickLabels)
1931 Q_PROPERTY(
int tickLabelPadding READ tickLabelPadding WRITE setTickLabelPadding)
1932 Q_PROPERTY(QFont tickLabelFont READ tickLabelFont WRITE setTickLabelFont)
1933 Q_PROPERTY(QColor tickLabelColor READ tickLabelColor WRITE setTickLabelColor)
1934 Q_PROPERTY(
double tickLabelRotation READ tickLabelRotation WRITE setTickLabelRotation)
1935 Q_PROPERTY(
LabelSide tickLabelSide READ tickLabelSide WRITE setTickLabelSide)
1936 Q_PROPERTY(QString numberFormat READ numberFormat WRITE setNumberFormat)
1937 Q_PROPERTY(
int numberPrecision READ numberPrecision WRITE setNumberPrecision)
1938 Q_PROPERTY(QVector<double> tickVector READ tickVector)
1939 Q_PROPERTY(QVector<QString> tickVectorLabels READ tickVectorLabels)
1940 Q_PROPERTY(
int tickLengthIn READ tickLengthIn WRITE setTickLengthIn)
1941 Q_PROPERTY(
int tickLengthOut READ tickLengthOut WRITE setTickLengthOut)
1942 Q_PROPERTY(
bool subTicks READ subTicks WRITE setSubTicks)
1943 Q_PROPERTY(
int subTickLengthIn READ subTickLengthIn WRITE setSubTickLengthIn)
1944 Q_PROPERTY(
int subTickLengthOut READ subTickLengthOut WRITE setSubTickLengthOut)
1945 Q_PROPERTY(QPen basePen READ basePen WRITE setBasePen)
1946 Q_PROPERTY(QPen tickPen READ tickPen WRITE setTickPen)
1947 Q_PROPERTY(QPen subTickPen READ subTickPen WRITE setSubTickPen)
1948 Q_PROPERTY(QFont labelFont READ labelFont WRITE setLabelFont)
1949 Q_PROPERTY(QColor labelColor READ labelColor WRITE setLabelColor)
1950 Q_PROPERTY(QString label READ label WRITE setLabel)
1951 Q_PROPERTY(
int labelPadding READ labelPadding WRITE setLabelPadding)
1952 Q_PROPERTY(
int padding READ padding WRITE setPadding)
1953 Q_PROPERTY(
int offset READ offset WRITE setOffset)
1954 Q_PROPERTY(SelectableParts selectedParts READ selectedParts WRITE setSelectedParts NOTIFY selectionChanged)
1955 Q_PROPERTY(SelectableParts selectableParts READ selectableParts WRITE setSelectableParts NOTIFY selectableChanged)
1956 Q_PROPERTY(QFont selectedTickLabelFont READ selectedTickLabelFont WRITE setSelectedTickLabelFont)
1957 Q_PROPERTY(QFont selectedLabelFont READ selectedLabelFont WRITE setSelectedLabelFont)
1958 Q_PROPERTY(QColor selectedTickLabelColor READ selectedTickLabelColor WRITE setSelectedTickLabelColor)
1959 Q_PROPERTY(QColor selectedLabelColor READ selectedLabelColor WRITE setSelectedLabelColor)
1960 Q_PROPERTY(QPen selectedBasePen READ selectedBasePen WRITE setSelectedBasePen)
1961 Q_PROPERTY(QPen selectedTickPen READ selectedTickPen WRITE setSelectedTickPen)
1962 Q_PROPERTY(QPen selectedSubTickPen READ selectedSubTickPen WRITE setSelectedSubTickPen)
1963 Q_PROPERTY(
QCPLineEnding lowerEnding READ lowerEnding WRITE setLowerEnding)
1964 Q_PROPERTY(
QCPLineEnding upperEnding READ upperEnding WRITE setUpperEnding)
1965 Q_PROPERTY(
QCPGrid* grid READ grid)
1979 Q_DECLARE_FLAGS(AxisTypes,
AxisType)
2003 ,spTickLabels = 0x002
2004 ,spAxisLabel = 0x004
2007 Q_FLAGS(SelectableParts)
2019 QSharedPointer<QCPAxisTicker>
ticker()
const {
return mTicker; }
2022 int tickLabelPadding()
const;
2025 double tickLabelRotation()
const;
2027 QString numberFormat()
const;
2031 int tickLengthIn()
const;
2032 int tickLengthOut()
const;
2034 int subTickLengthIn()
const;
2035 int subTickLengthOut()
const;
2041 QString
label()
const {
return mLabel; }
2042 int labelPadding()
const;
2060 Q_SLOT
void setRange(
const QCPRange &range);
2061 void setRange(
double lower,
double upper);
2062 void setRange(
double position,
double size, Qt::AlignmentFlag alignment);
2063 void setRangeLower(
double lower);
2064 void setRangeUpper(
double upper);
2065 void setRangeReversed(
bool reversed);
2066 void setTicker(QSharedPointer<QCPAxisTicker> ticker);
2067 void setTicks(
bool show);
2068 void setTickLabels(
bool show);
2069 void setTickLabelPadding(
int padding);
2070 void setTickLabelFont(
const QFont &font);
2071 void setTickLabelColor(
const QColor &color);
2072 void setTickLabelRotation(
double degrees);
2074 void setNumberFormat(
const QString &formatCode);
2075 void setNumberPrecision(
int precision);
2076 void setTickLength(
int inside,
int outside=0);
2077 void setTickLengthIn(
int inside);
2078 void setTickLengthOut(
int outside);
2079 void setSubTicks(
bool show);
2080 void setSubTickLength(
int inside,
int outside=0);
2081 void setSubTickLengthIn(
int inside);
2082 void setSubTickLengthOut(
int outside);
2083 void setBasePen(
const QPen &pen);
2084 void setTickPen(
const QPen &pen);
2085 void setSubTickPen(
const QPen &pen);
2086 void setLabelFont(
const QFont &font);
2087 void setLabelColor(
const QColor &color);
2088 void setLabel(
const QString &str);
2089 void setLabelPadding(
int padding);
2090 void setPadding(
int padding);
2091 void setOffset(
int offset);
2092 void setSelectedTickLabelFont(
const QFont &font);
2093 void setSelectedLabelFont(
const QFont &font);
2094 void setSelectedTickLabelColor(
const QColor &color);
2095 void setSelectedLabelColor(
const QColor &color);
2096 void setSelectedBasePen(
const QPen &pen);
2097 void setSelectedTickPen(
const QPen &pen);
2098 void setSelectedSubTickPen(
const QPen &pen);
2099 Q_SLOT
void setSelectableParts(
const QCPAxis::SelectableParts &selectableParts);
2100 Q_SLOT
void setSelectedParts(
const QCPAxis::SelectableParts &selectedParts);
2105 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0)
const Q_DECL_OVERRIDE;
2109 int pixelOrientation()
const {
return rangeReversed() != (orientation()==Qt::Vertical) ? -1 : 1; }
2110 void moveRange(
double diff);
2111 void scaleRange(
double factor);
2112 void scaleRange(
double factor,
double center);
2113 void setScaleRatio(
const QCPAxis *otherAxis,
double ratio=1.0);
2114 void rescale(
bool onlyVisiblePlottables=
false);
2115 double pixelToCoord(
double value)
const;
2116 double coordToPixel(
double value)
const;
2118 QList<QCPAbstractPlottable*> plottables()
const;
2119 QList<QCPGraph*> graphs()
const;
2120 QList<QCPAbstractItem*> items()
const;
2123 static Qt::Orientation
orientation(
AxisType type) {
return type==atBottom||type==atTop ? Qt::Horizontal : Qt::Vertical; }
2127 void rangeChanged(
const QCPRange &newRange);
2130 void selectionChanged(
const QCPAxis::SelectableParts &parts);
2131 void selectableChanged(
const QCPAxis::SelectableParts &parts);
2184 virtual int calculateMargin();
2191 virtual
void selectEvent(QMouseEvent *event,
bool additive, const QVariant &details,
bool *selectionStateChanged) Q_DECL_OVERRIDE;
2192 virtual
void deselectEvent(
bool *selectionStateChanged) Q_DECL_OVERRIDE;
2194 virtual
void mousePressEvent(QMouseEvent *event, const QVariant &details) Q_DECL_OVERRIDE;
2195 virtual
void mouseMoveEvent(QMouseEvent *event, const QPointF &startPos) Q_DECL_OVERRIDE;
2196 virtual
void mouseReleaseEvent(QMouseEvent *event, const QPointF &startPos) Q_DECL_OVERRIDE;
2197 virtual
void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE;
2200 void setupTickVectors();
2201 QPen getBasePen() const;
2202 QPen getTickPen() const;
2203 QPen getSubTickPen() const;
2204 QFont getTickLabelFont() const;
2205 QFont getLabelFont() const;
2206 QColor getTickLabelColor() const;
2207 QColor getLabelColor() const;
2216 Q_DECLARE_OPERATORS_FOR_FLAGS(
QCPAxis::SelectableParts)
2217 Q_DECLARE_OPERATORS_FOR_FLAGS(
QCPAxis::AxisTypes)
2227 explicit QCPAxisPainterPrivate(QCustomPlot *parentPlot);
2228 virtual ~QCPAxisPainterPrivate();
2231 virtual int size()
const;
2273 QRect baseBounds, expBounds, suffixBounds,
totalBounds, rotatedTotalBounds;
2281 virtual QByteArray generateLabelParameterHash()
const;
2283 virtual void placeTickLabel(
QCPPainter *painter,
double position,
int distanceToAxis,
const QString &text, QSize *tickLabelsSize);
2285 virtual TickLabelData getTickLabelData(
const QFont &font,
const QString &text)
const;
2286 virtual QPointF getTickLabelDrawOffset(
const TickLabelData &labelData)
const;
2287 virtual void getMaxTickLabelSize(
const QFont &font,
const QString &text, QSize *tickLabelsSize)
const;
2316 Q_FLAGS(ScatterProperties)
2353 QCPScatterStyle(
const QPainterPath &customPath,
const QPen &pen,
const QBrush &brush=Qt::NoBrush,
double size=6);
2356 double size()
const {
return mSize; }
2358 QPen
pen()
const {
return mPen; }
2364 void setFromOther(
const QCPScatterStyle &other, ScatterProperties properties);
2365 void setSize(
double size);
2367 void setPen(
const QPen &pen);
2368 void setBrush(
const QBrush &brush);
2369 void setPixmap(
const QPixmap &pixmap);
2370 void setCustomPath(
const QPainterPath &customPath);
2373 bool isNone()
const {
return mShape == ssNone; }
2376 void applyTo(
QCPPainter *painter,
const QPen &defaultPen)
const;
2377 void drawShape(
QCPPainter *painter,
const QPointF &pos)
const;
2378 void drawShape(
QCPPainter *painter,
double x,
double y)
const;
2393 Q_DECLARE_OPERATORS_FOR_FLAGS(QCPScatterStyle::ScatterProperties)
2408 template <
class DataType>
2409 inline bool qcpLessThanSortKey(
const DataType &a,
const DataType &b) {
return a.sortKey() < b.sortKey(); }
2411 template <
class DataType>
2421 int size()
const {
return mData.size()-mPreallocSize; }
2426 void setAutoSqueeze(
bool enabled);
2430 void set(
const QVector<DataType> &data,
bool alreadySorted=
false);
2432 void add(
const QVector<DataType> &data,
bool alreadySorted=
false);
2433 void add(
const DataType &data);
2434 void removeBefore(
double sortKey);
2435 void removeAfter(
double sortKey);
2436 void remove(
double sortKeyFrom,
double sortKeyTo);
2437 void remove(
double sortKey);
2440 void squeeze(
bool preAllocation=
true,
bool postAllocation=
true);
2442 const_iterator
constBegin()
const {
return mData.constBegin()+mPreallocSize; }
2443 const_iterator
constEnd()
const {
return mData.constEnd(); }
2444 iterator
begin() {
return mData.begin()+mPreallocSize; }
2445 iterator
end() {
return mData.end(); }
2446 const_iterator findBegin(
double sortKey,
bool expandedRange=
true)
const;
2447 const_iterator findEnd(
double sortKey,
bool expandedRange=
true)
const;
2448 const_iterator
at(
int index)
const {
return constBegin()+qBound(0, index, size()); }
2452 void limitIteratorsToDataRange(const_iterator &begin, const_iterator &end,
const QCPDataRange &dataRange)
const;
2464 void preallocateGrow(
int minimumPreallocSize);
2465 void performAutoSqueeze();
2606 template <
class DataType>
2610 mPreallocIteration(0)
2622 template <
class DataType>
2639 template <
class DataType>
2655 template <
class DataType>
2671 template <
class DataType>
2677 const int n = data.
size();
2678 const int oldSize =
size();
2680 if (oldSize > 0 && !qcpLessThanSortKey<DataType>(*
constBegin(), *(data.
constEnd()-1)))
2690 if (oldSize > 0 && !qcpLessThanSortKey<DataType>(*(
constEnd()-n-1), *(
constEnd()-n)))
2691 std::inplace_merge(
begin(),
end()-n,
end(), qcpLessThanSortKey<DataType>);
2703 template <
class DataType>
2710 set(data, alreadySorted);
2714 const int n = data.size();
2715 const int oldSize =
size();
2717 if (alreadySorted && oldSize > 0 && !qcpLessThanSortKey<DataType>(*
constBegin(), *(data.constEnd()-1)))
2722 std::copy(data.constBegin(), data.constEnd(),
begin());
2726 std::copy(data.constBegin(), data.constEnd(),
end()-n);
2728 std::sort(
end()-n,
end(), qcpLessThanSortKey<DataType>);
2729 if (oldSize > 0 && !qcpLessThanSortKey<DataType>(*(
constEnd()-n-1), *(
constEnd()-n)))
2730 std::inplace_merge(
begin(),
end()-n,
end(), qcpLessThanSortKey<DataType>);
2740 template <
class DataType>
2743 if (
isEmpty() || !qcpLessThanSortKey<DataType>(data, *(
constEnd()-1)))
2746 }
else if (qcpLessThanSortKey<DataType>(data, *
constBegin()))
2755 mData.insert(insertionPoint, data);
2764 template <
class DataType>
2779 template <
class DataType>
2784 mData.erase(it, itEnd);
2796 template <
class DataType>
2799 if (sortKeyFrom >= sortKeyTo ||
isEmpty())
2804 mData.erase(it, itEnd);
2818 template <
class DataType>
2822 if (it !=
end() && it->sortKey() == sortKey)
2838 template <
class DataType>
2857 template <
class DataType>
2860 std::sort(
begin(),
end(), qcpLessThanSortKey<DataType>);
2873 template <
class DataType>
2905 template <
class DataType>
2932 template <
class DataType>
2939 if (expandedRange && it !=
constEnd())
2959 template <
class DataType>
2968 bool haveLower =
false;
2969 bool haveUpper =
false;
2976 if (DataType::sortKeyIsMainKey())
2980 if (!qIsNaN(it->mainValue()))
2982 range.
lower = it->mainKey();
2992 if (!qIsNaN(it->mainValue()))
2994 range.
upper = it->mainKey();
3003 if (!qIsNaN(it->mainValue()))
3005 current = it->mainKey();
3006 if (current < range.
lower || !haveLower)
3008 range.
lower = current;
3011 if (current > range.
upper || !haveUpper)
3013 range.
upper = current;
3024 if (!qIsNaN(it->mainValue()))
3026 current = it->mainKey();
3027 if ((current < range.
lower || !haveLower) && current < 0)
3029 range.
lower = current;
3032 if ((current > range.
upper || !haveUpper) && current < 0)
3034 range.
upper = current;
3044 if (!qIsNaN(it->mainValue()))
3046 current = it->mainKey();
3047 if ((current < range.
lower || !haveLower) && current > 0)
3049 range.
lower = current;
3052 if ((current > range.
upper || !haveUpper) && current > 0)
3054 range.
upper = current;
3062 foundRange = haveLower && haveUpper;
3082 template <
class DataType>
3091 const bool restrictKeyRange = inKeyRange !=
QCPRange();
3092 bool haveLower =
false;
3093 bool haveUpper =
false;
3097 if (DataType::sortKeyIsMainKey() && restrictKeyRange)
3106 if (restrictKeyRange && (it->mainKey() < inKeyRange.
lower || it->mainKey() > inKeyRange.
upper))
3108 current = it->valueRange();
3109 if ((current.
lower < range.
lower || !haveLower) && !qIsNaN(current.
lower))
3114 if ((current.
upper > range.
upper || !haveUpper) && !qIsNaN(current.
upper))
3124 if (restrictKeyRange && (it->mainKey() < inKeyRange.
lower || it->mainKey() > inKeyRange.
upper))
3126 current = it->valueRange();
3127 if ((current.
lower < range.
lower || !haveLower) && current.
lower < 0 && !qIsNaN(current.
lower))
3132 if ((current.
upper > range.
upper || !haveUpper) && current.
upper < 0 && !qIsNaN(current.
upper))
3142 if (restrictKeyRange && (it->mainKey() < inKeyRange.
lower || it->mainKey() > inKeyRange.
upper))
3144 current = it->valueRange();
3145 if ((current.
lower < range.
lower || !haveLower) && current.
lower > 0 && !qIsNaN(current.
lower))
3150 if ((current.
upper > range.
upper || !haveUpper) && current.
upper > 0 && !qIsNaN(current.
upper))
3158 foundRange = haveLower && haveUpper;
3170 template <
class DataType>
3174 iteratorRange = iteratorRange.
bounded(dataRange.
bounded(this->dataRange()));
3188 template <
class DataType>
3194 int newPreallocSize = minimumPreallocSize;
3201 mPreallocSize = newPreallocSize;
3218 template <
class DataType>
3221 const int totalAlloc =
mData.capacity();
3222 const int postAllocSize = totalAlloc-
mData.size();
3223 const int usedSize =
size();
3224 bool shrinkPostAllocation =
false;
3225 bool shrinkPreAllocation =
false;
3226 if (totalAlloc > 650000)
3228 shrinkPostAllocation = postAllocSize > usedSize*1.5;
3230 }
else if (totalAlloc > 1000)
3232 shrinkPostAllocation = postAllocSize > usedSize*5;
3236 if (shrinkPreAllocation || shrinkPostAllocation)
3237 squeeze(shrinkPreAllocation, shrinkPostAllocation);
3256 QPen
pen()
const {
return mPen; }
3262 void setPen(
const QPen &pen);
3263 void setBrush(
const QBrush &brush);
3265 void setUsedScatterProperties(
const QCPScatterStyle::ScatterProperties &properties);
3299 Q_PROPERTY(QString name READ name WRITE setName)
3300 Q_PROPERTY(
bool antialiasedFill READ antialiasedFill WRITE setAntialiasedFill)
3301 Q_PROPERTY(
bool antialiasedScatters READ antialiasedScatters WRITE setAntialiasedScatters)
3302 Q_PROPERTY(QPen pen READ pen WRITE setPen)
3303 Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
3304 Q_PROPERTY(
QCPAxis* keyAxis READ keyAxis WRITE setKeyAxis)
3305 Q_PROPERTY(
QCPAxis* valueAxis READ valueAxis WRITE setValueAxis)
3306 Q_PROPERTY(
QCP::SelectionType selectable READ selectable WRITE setSelectable NOTIFY selectableChanged)
3307 Q_PROPERTY(
QCPDataSelection selection READ selection WRITE setSelection NOTIFY selectionChanged)
3308 Q_PROPERTY(
QCPSelectionDecorator* selectionDecorator READ selectionDecorator WRITE setSelectionDecorator)
3312 virtual ~QCPAbstractPlottable();
3315 QString
name()
const {
return mName; }
3318 QPen
pen()
const {
return mPen; }
3323 bool selected()
const {
return !mSelection.isEmpty(); }
3328 void setName(
const QString &name);
3329 void setAntialiasedFill(
bool enabled);
3330 void setAntialiasedScatters(
bool enabled);
3331 void setPen(
const QPen &pen);
3332 void setBrush(
const QBrush &brush);
3333 void setKeyAxis(
QCPAxis *axis);
3334 void setValueAxis(
QCPAxis *axis);
3340 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0)
const Q_DECL_OVERRIDE = 0;
3346 void coordsToPixels(
double key,
double value,
double &x,
double &y)
const;
3347 const QPointF coordsToPixels(
double key,
double value)
const;
3348 void pixelsToCoords(
double x,
double y,
double &key,
double &value)
const;
3349 void pixelsToCoords(
const QPointF &pixelPos,
double &key,
double &value)
const;
3350 void rescaleAxes(
bool onlyEnlarge=
false)
const;
3351 void rescaleKeyAxis(
bool onlyEnlarge=
false)
const;
3352 void rescaleValueAxis(
bool onlyEnlarge=
false,
bool inKeyRange=
false)
const;
3355 bool removeFromLegend(
QCPLegend *legend)
const;
3356 bool removeFromLegend()
const;
3359 void selectionChanged(
bool selected);
3375 virtual QRect clipRect() const Q_DECL_OVERRIDE;
3376 virtual
void draw(
QCPPainter *painter) Q_DECL_OVERRIDE = 0;
3377 virtual
QCP::
Interaction selectionCategory() const Q_DECL_OVERRIDE;
3378 void applyDefaultAntialiasingHint(
QCPPainter *painter) const Q_DECL_OVERRIDE;
3380 virtual
void selectEvent(QMouseEvent *event,
bool additive, const QVariant &details,
bool *selectionStateChanged) Q_DECL_OVERRIDE;
3381 virtual
void deselectEvent(
bool *selectionStateChanged) Q_DECL_OVERRIDE;
3384 virtual
void drawLegendIcon(
QCPPainter *painter, const QRectF &rect) const = 0;
3387 void applyFillAntialiasingHint(
QCPPainter *painter) const;
3388 void applyScattersAntialiasingHint(
QCPPainter *painter) const;
3391 Q_DISABLE_COPY(QCPAbstractPlottable)
3409 QCPItemAnchor(QCustomPlot *parentPlot,
QCPAbstractItem *parentItem,
const QString &name,
int anchorId=-1);
3410 virtual ~QCPItemAnchor();
3413 QString
name()
const {
return mName; }
3414 virtual QPointF pixelPosition()
const;
3436 Q_DISABLE_COPY(QCPItemAnchor)
3464 QCPItemPosition(QCustomPlot *parentPlot,
QCPAbstractItem *parentItem,
const QString &name);
3465 virtual ~QCPItemPosition();
3474 double key()
const {
return mKey; }
3476 QPointF
coords()
const {
return QPointF(mKey, mValue); }
3477 QCPAxis *
keyAxis()
const {
return mKeyAxis.data(); }
3486 bool setParentAnchor(QCPItemAnchor *parentAnchor,
bool keepPixelPosition=
false);
3487 bool setParentAnchorX(QCPItemAnchor *parentAnchor,
bool keepPixelPosition=
false);
3488 bool setParentAnchorY(QCPItemAnchor *parentAnchor,
bool keepPixelPosition=
false);
3489 void setCoords(
double key,
double value);
3490 void setCoords(
const QPointF &coords);
3491 void setAxes(QCPAxis* keyAxis, QCPAxis* valueAxis);
3493 void setPixelPosition(
const QPointF &pixelPosition);
3507 Q_DISABLE_COPY(QCPItemPosition)
3517 Q_PROPERTY(
bool clipToAxisRect READ clipToAxisRect WRITE setClipToAxisRect)
3518 Q_PROPERTY(
QCPAxisRect* clipAxisRect READ clipAxisRect WRITE setClipAxisRect)
3519 Q_PROPERTY(
bool selectable READ selectable WRITE setSelectable NOTIFY selectableChanged)
3520 Q_PROPERTY(
bool selected READ selected WRITE setSelected NOTIFY selectionChanged)
3533 void setClipToAxisRect(
bool clip);
3535 Q_SLOT
void setSelectable(
bool selectable);
3536 Q_SLOT
void setSelected(
bool selected);
3539 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0)
const Q_DECL_OVERRIDE = 0;
3542 QList<QCPItemPosition*>
positions()
const {
return mPositions; }
3543 QList<QCPItemAnchor*>
anchors()
const {
return mAnchors; }
3546 bool hasAnchor(
const QString &name)
const;
3549 void selectionChanged(
bool selected);
3550 void selectableChanged(
bool selectable);
3562 virtual QRect clipRect() const Q_DECL_OVERRIDE;
3563 virtual
void applyDefaultAntialiasingHint(
QCPPainter *painter) const Q_DECL_OVERRIDE;
3564 virtual
void draw(
QCPPainter *painter) Q_DECL_OVERRIDE = 0;
3566 virtual
void selectEvent(QMouseEvent *event,
bool additive, const QVariant &details,
bool *selectionStateChanged) Q_DECL_OVERRIDE;
3567 virtual
void deselectEvent(
bool *selectionStateChanged) Q_DECL_OVERRIDE;
3570 virtual QPointF anchorPixelPosition(
int anchorId) const;
3573 double rectDistance(const QRectF &rect, const QPointF &pos,
bool filledRect) const;
3575 QCPItemAnchor *createAnchor(const QString &name,
int anchorId);
3594 Q_PROPERTY(QRect viewport READ viewport WRITE setViewport)
3595 Q_PROPERTY(QPixmap background READ background WRITE setBackground)
3596 Q_PROPERTY(
bool backgroundScaled READ backgroundScaled WRITE setBackgroundScaled)
3597 Q_PROPERTY(Qt::AspectRatioMode backgroundScaledMode READ backgroundScaledMode WRITE setBackgroundScaledMode)
3599 Q_PROPERTY(
bool autoAddPlottableToLegend READ autoAddPlottableToLegend WRITE setAutoAddPlottableToLegend)
3600 Q_PROPERTY(
int selectionTolerance READ selectionTolerance WRITE setSelectionTolerance)
3601 Q_PROPERTY(
bool noAntialiasingOnDrag READ noAntialiasingOnDrag WRITE setNoAntialiasingOnDrag)
3602 Q_PROPERTY(Qt::KeyboardModifier multiSelectModifier READ multiSelectModifier WRITE setMultiSelectModifier)
3603 Q_PROPERTY(
bool openGl READ openGl WRITE setOpenGl)
3628 explicit QCustomPlot(QWidget *parent = 0);
3629 virtual ~QCustomPlot();
3651 void setViewport(
const QRect &rect);
3652 void setBufferDevicePixelRatio(
double ratio);
3653 void setBackground(
const QPixmap &pm);
3654 void setBackground(
const QPixmap &pm,
bool scaled, Qt::AspectRatioMode mode=Qt::KeepAspectRatioByExpanding);
3655 void setBackground(
const QBrush &brush);
3656 void setBackgroundScaled(
bool scaled);
3657 void setBackgroundScaledMode(Qt::AspectRatioMode mode);
3658 void setAntialiasedElements(
const QCP::AntialiasedElements &antialiasedElements);
3660 void setNotAntialiasedElements(
const QCP::AntialiasedElements ¬AntialiasedElements);
3662 void setAutoAddPlottableToLegend(
bool on);
3663 void setInteractions(
const QCP::Interactions &interactions);
3664 void setInteraction(
const QCP::Interaction &interaction,
bool enabled=
true);
3665 void setSelectionTolerance(
int pixels);
3666 void setNoAntialiasingOnDrag(
bool enabled);
3667 void setPlottingHints(
const QCP::PlottingHints &hints);
3669 void setMultiSelectModifier(Qt::KeyboardModifier modifier);
3672 void setOpenGl(
bool enabled,
int multisampling=16);
3676 QCPAbstractPlottable *plottable(
int index);
3677 QCPAbstractPlottable *plottable();
3678 bool removePlottable(QCPAbstractPlottable *plottable);
3679 bool removePlottable(
int index);
3680 int clearPlottables();
3681 int plottableCount()
const;
3682 QList<QCPAbstractPlottable*> selectedPlottables()
const;
3683 QCPAbstractPlottable *plottableAt(
const QPointF &pos,
bool onlySelectable=
false)
const;
3684 bool hasPlottable(QCPAbstractPlottable *plottable)
const;
3691 bool removeGraph(
int index);
3693 int graphCount()
const;
3694 QList<QCPGraph*> selectedGraphs()
const;
3700 bool removeItem(
int index);
3702 int itemCount()
const;
3703 QList<QCPAbstractItem*> selectedItems()
const;
3704 QCPAbstractItem *itemAt(
const QPointF &pos,
bool onlySelectable=
false)
const;
3708 QCPLayer *layer(
const QString &name)
const;
3711 bool setCurrentLayer(
const QString &name);
3712 bool setCurrentLayer(
QCPLayer *layer);
3713 int layerCount()
const;
3719 int axisRectCount()
const;
3721 QList<QCPAxisRect*> axisRects()
const;
3723 QCPAxisRect* axisRectAt(
const QPointF &pos)
const;
3724 Q_SLOT
void rescaleAxes(
bool onlyVisiblePlottables=
false);
3726 QList<QCPAxis*> selectedAxes()
const;
3727 QList<QCPLegend*> selectedLegends()
const;
3728 Q_SLOT
void deselectAll();
3730 bool savePdf(
const QString &fileName,
int width=0,
int height=0,
QCP::ExportPen exportPen=
QCP::epAllowCosmetic,
const QString &pdfCreator=QString(),
const QString &pdfTitle=QString());
3734 bool saveRastered(
const QString &fileName,
int width,
int height,
double scale,
const char *format,
int quality=-1,
int resolution=96,
QCP::ResolutionUnit resolutionUnit=
QCP::ruDotsPerInch);
3735 QPixmap toPixmap(
int width=0,
int height=0,
double scale=1.0);
3736 void toPainter(
QCPPainter *painter,
int width=0,
int height=0);
3743 void mouseDoubleClick(QMouseEvent *event);
3744 void mousePress(QMouseEvent *event);
3745 void mouseMove(QMouseEvent *event);
3746 void mouseRelease(QMouseEvent *event);
3747 void mouseWheel(QWheelEvent *event);
3749 void plottableClick(QCPAbstractPlottable *plottable,
int dataIndex, QMouseEvent *event);
3750 void plottableDoubleClick(QCPAbstractPlottable *plottable,
int dataIndex, QMouseEvent *event);
3758 void selectionChangedByUser();
3759 void beforeReplot();
3801 #ifdef QCP_OPENGL_FBO 3802 QSharedPointer<QOpenGLContext> mGlContext;
3803 QSharedPointer<QSurface> mGlSurface;
3804 QSharedPointer<QOpenGLPaintDevice> mGlPaintDevice;
3808 virtual QSize minimumSizeHint() const Q_DECL_OVERRIDE;
3809 virtual QSize sizeHint() const Q_DECL_OVERRIDE;
3810 virtual
void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
3811 virtual
void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
3812 virtual
void mouseDoubleClickEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
3813 virtual
void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
3814 virtual
void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
3815 virtual
void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
3816 virtual
void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE;
3820 virtual
void updateLayout();
3821 virtual
void axisRemoved(
QCPAxis *axis);
3822 virtual
void legendRemoved(
QCPLegend *legend);
3823 Q_SLOT virtual
void processRectSelection(QRect rect, QMouseEvent *event);
3824 Q_SLOT virtual
void processRectZoom(QRect rect, QMouseEvent *event);
3825 Q_SLOT virtual
void processPointSelection(QMouseEvent *event);
3828 bool registerPlottable(QCPAbstractPlottable *plottable);
3829 bool registerGraph(
QCPGraph *graph);
3831 void updateLayerIndices() const;
3832 QCPLayerable *layerableAt(const QPointF &pos,
bool onlySelectable, QVariant *selectionDetails=0) const;
3833 QList<QCPLayerable*> layerableListAt(const QPointF &pos,
bool onlySelectable, QList<QVariant> *selectionDetails=0) const;
3835 void setupPaintBuffers();
3837 bool hasInvalidatedPaintBuffers();
3845 friend class QCPAbstractPlottable;
3863 virtual int dataCount()
const = 0;
3864 virtual double dataMainKey(
int index)
const = 0;
3865 virtual double dataSortKey(
int index)
const = 0;
3866 virtual double dataMainValue(
int index)
const = 0;
3867 virtual QCPRange dataValueRange(
int index)
const = 0;
3868 virtual QPointF dataPixelPosition(
int index)
const = 0;
3869 virtual bool sortKeyIsMainKey()
const = 0;
3870 virtual QCPDataSelection selectTestRect(
const QRectF &rect,
bool onlySelectable)
const = 0;
3871 virtual int findBegin(
double sortKey,
bool expandedRange=
true)
const = 0;
3872 virtual int findEnd(
double sortKey,
bool expandedRange=
true)
const = 0;
3875 template <
class DataType>
3897 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0)
const Q_DECL_OVERRIDE;
3905 void getDataSegments(QList<QCPDataRange> &selectedSegments, QList<QCPDataRange> &unselectedSegments)
const;
3906 void drawPolyline(
QCPPainter *painter,
const QVector<QPointF> &lineData)
const;
4103 template <
class DataType>
4105 QCPAbstractPlottable(keyAxis, valueAxis),
4110 template <
class DataType>
4118 template <
class DataType>
4127 template <
class DataType>
4130 if (index >= 0 && index < mDataContainer->size())
4135 qDebug() << Q_FUNC_INFO <<
"Index out of bounds" << index;
4143 template <
class DataType>
4146 if (index >= 0 && index < mDataContainer->size())
4151 qDebug() << Q_FUNC_INFO <<
"Index out of bounds" << index;
4159 template <
class DataType>
4162 if (index >= 0 && index < mDataContainer->size())
4167 qDebug() << Q_FUNC_INFO <<
"Index out of bounds" << index;
4175 template <
class DataType>
4178 if (index >= 0 && index < mDataContainer->size())
4183 qDebug() << Q_FUNC_INFO <<
"Index out of bounds" << index;
4191 template <
class DataType>
4194 if (index >= 0 && index < mDataContainer->size())
4200 qDebug() << Q_FUNC_INFO <<
"Index out of bounds" << index;
4208 template <
class DataType>
4211 return DataType::sortKeyIsMainKey();
4221 template <
class DataType>
4227 if (!mKeyAxis || !mValueAxis)
4231 double key1, value1, key2, value2;
4235 QCPRange valueRange(value1, value2);
4238 if (DataType::sortKeyIsMainKey())
4246 int currentSegmentBegin = -1;
4249 if (currentSegmentBegin == -1)
4251 if (valueRange.
contains(it->mainValue()) && keyRange.contains(it->mainKey()))
4253 }
else if (!valueRange.
contains(it->mainValue()) || !keyRange.contains(it->mainKey()))
4256 currentSegmentBegin = -1;
4260 if (currentSegmentBegin != -1)
4270 template <
class DataType>
4279 template <
class DataType>
4295 template <
class DataType>
4300 if (!mKeyAxis || !mValueAxis)
4304 double minDistSqr = (std::numeric_limits<double>::max)();
4309 if (DataType::sortKeyIsMainKey())
4312 double posKeyMin, posKeyMax, dummy;
4315 if (posKeyMin > posKeyMax)
4316 qSwap(posKeyMin, posKeyMax);
4322 QCPRange keyRange(mKeyAxis->range());
4323 QCPRange valueRange(mValueAxis->range());
4326 const double mainKey = it->mainKey();
4327 const double mainValue = it->mainValue();
4328 if (keyRange.contains(mainKey) && valueRange.contains(mainValue))
4331 if (currentDistSqr < minDistSqr)
4333 minDistSqr = currentDistSqr;
4343 details->setValue(selectionResult);
4344 return qSqrt(minDistSqr);
4357 template <
class DataType>
4360 selectedSegments.clear();
4361 unselectedSegments.clear();
4367 unselectedSegments << QCPDataRange(0,
dataCount());
4387 template <
class DataType>
4392 painter->pen().style() == Qt::SolidLine &&
4397 bool lastIsNan =
false;
4398 const int lineDataSize = lineData.size();
4399 while (i < lineDataSize && (qIsNaN(lineData.at(i).y()) || qIsNaN(lineData.at(i).x())))
4402 while (i < lineDataSize)
4404 if (!qIsNaN(lineData.at(i).y()) && !qIsNaN(lineData.at(i).x()))
4407 painter->
drawLine(lineData.at(i-1), lineData.at(i));
4416 int segmentStart = 0;
4418 const int lineDataSize = lineData.size();
4419 while (i < lineDataSize)
4421 if (qIsNaN(lineData.at(i).y()) || qIsNaN(lineData.at(i).x()) || qIsInf(lineData.at(i).y()))
4423 painter->drawPolyline(lineData.constData()+segmentStart, i-segmentStart);
4429 painter->drawPolyline(lineData.constData()+segmentStart, lineDataSize-segmentStart);
4486 void setLevelCount(
int n);
4487 void setColorStops(
const QMap<double, QColor> &colorStops);
4488 void setColorStopAt(
double position,
const QColor &color);
4490 void setPeriodic(
bool enabled);
4493 void colorize(
const double *data,
const QCPRange &range, QRgb *scanLine,
int n,
int dataIndexFactor=1,
bool logarithmic=
false);
4494 void colorize(
const double *data,
const unsigned char *alpha,
const QCPRange &range, QRgb *scanLine,
int n,
int dataIndexFactor=1,
bool logarithmic=
false);
4495 QRgb color(
double position,
const QCPRange &range,
bool logarithmic=
false);
4497 void clearColorStops();
4512 bool stopsUseAlpha()
const;
4513 void updateColorBuffer();
4556 void setBracketPen(
const QPen &pen);
4557 void setBracketBrush(
const QBrush &brush);
4558 void setBracketWidth(
int width);
4559 void setBracketHeight(
int height);
4561 void setTangentToData(
bool enabled);
4562 void setTangentAverage(
int pointCount);
4565 virtual void drawBracket(
QCPPainter *painter,
int direction)
const;
4597 Q_PROPERTY(QPixmap background READ background WRITE setBackground)
4598 Q_PROPERTY(
bool backgroundScaled READ backgroundScaled WRITE setBackgroundScaled)
4599 Q_PROPERTY(Qt::AspectRatioMode backgroundScaledMode READ backgroundScaledMode WRITE setBackgroundScaledMode)
4600 Q_PROPERTY(Qt::Orientations rangeDrag READ rangeDrag WRITE setRangeDrag)
4601 Q_PROPERTY(Qt::Orientations rangeZoom READ rangeZoom WRITE setRangeZoom)
4604 explicit QCPAxisRect(QCustomPlot *parentPlot,
bool setupDefaultAxes=
true);
4614 QCPAxis *rangeDragAxis(Qt::Orientation orientation);
4615 QCPAxis *rangeZoomAxis(Qt::Orientation orientation);
4616 QList<QCPAxis*> rangeDragAxes(Qt::Orientation orientation);
4617 QList<QCPAxis*> rangeZoomAxes(Qt::Orientation orientation);
4618 double rangeZoomFactor(Qt::Orientation orientation);
4621 void setBackground(
const QPixmap &pm);
4622 void setBackground(
const QPixmap &pm,
bool scaled, Qt::AspectRatioMode mode=Qt::KeepAspectRatioByExpanding);
4623 void setBackground(
const QBrush &brush);
4624 void setBackgroundScaled(
bool scaled);
4625 void setBackgroundScaledMode(Qt::AspectRatioMode mode);
4626 void setRangeDrag(Qt::Orientations orientations);
4627 void setRangeZoom(Qt::Orientations orientations);
4629 void setRangeDragAxes(QList<QCPAxis*> axes);
4630 void setRangeDragAxes(QList<QCPAxis*> horizontal, QList<QCPAxis*> vertical);
4632 void setRangeZoomAxes(QList<QCPAxis*> axes);
4633 void setRangeZoomAxes(QList<QCPAxis*> horizontal, QList<QCPAxis*> vertical);
4634 void setRangeZoomFactor(
double horizontalFactor,
double verticalFactor);
4635 void setRangeZoomFactor(
double factor);
4640 QList<QCPAxis*> axes(QCPAxis::AxisTypes types)
const;
4641 QList<QCPAxis*> axes()
const;
4643 QList<QCPAxis*> addAxes(QCPAxis::AxisTypes types);
4644 bool removeAxis(
QCPAxis *axis);
4647 void zoom(
const QRectF &pixelRect);
4648 void zoom(
const QRectF &pixelRect,
const QList<QCPAxis*> &affectedAxes);
4649 void setupFullAxesBox(
bool connectRanges=
false);
4650 QList<QCPAbstractPlottable*> plottables()
const;
4651 QList<QCPGraph*> graphs()
const;
4652 QList<QCPAbstractItem*> items()
const;
4655 int left()
const {
return mRect.left(); }
4656 int right()
const {
return mRect.right(); }
4657 int top()
const {
return mRect.top(); }
4658 int bottom()
const {
return mRect.bottom(); }
4659 int width()
const {
return mRect.width(); }
4660 int height()
const {
return mRect.height(); }
4661 QSize
size()
const {
return mRect.size(); }
4662 QPoint
topLeft()
const {
return mRect.topLeft(); }
4666 QPoint
center()
const {
return mRect.center(); }
4670 virtual QList<QCPLayoutElement*> elements(
bool recursive)
const Q_DECL_OVERRIDE;
4689 QHash<QCPAxis::AxisType, QList<QCPAxis*> >
mAxes;
4695 virtual void layoutChanged() Q_DECL_OVERRIDE;
4697 virtual
void mousePressEvent(QMouseEvent *event, const QVariant &details) Q_DECL_OVERRIDE;
4698 virtual
void mouseMoveEvent(QMouseEvent *event, const QPointF &startPos) Q_DECL_OVERRIDE;
4699 virtual
void mouseReleaseEvent(QMouseEvent *event, const QPointF &startPos) Q_DECL_OVERRIDE;
4700 virtual
void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE;
4704 void updateAxesOffset(
QCPAxis::AxisType type);
4709 friend class QCustomPlot;
4723 Q_PROPERTY(
QCPLegend* parentLegend READ parentLegend)
4724 Q_PROPERTY(QFont font READ font WRITE setFont)
4725 Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor)
4726 Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont)
4727 Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE setSelectedTextColor)
4728 Q_PROPERTY(
bool selectable READ selectable WRITE setSelectable NOTIFY selectionChanged)
4729 Q_PROPERTY(
bool selected READ selected WRITE setSelected NOTIFY selectableChanged)
4736 QFont
font()
const {
return mFont; }
4744 void setFont(
const QFont &font);
4745 void setTextColor(
const QColor &color);
4746 void setSelectedFont(
const QFont &font);
4747 void setSelectedTextColor(
const QColor &color);
4749 Q_SLOT
void setSelected(
bool selected);
4770 virtual QRect
clipRect() const Q_DECL_OVERRIDE;
4773 virtual
void selectEvent(QMouseEvent *event,
bool additive, const QVariant &details,
bool *selectionStateChanged) Q_DECL_OVERRIDE;
4774 virtual
void deselectEvent(
bool *selectionStateChanged) Q_DECL_OVERRIDE;
4798 virtual QSize minimumOuterSizeHint() const Q_DECL_OVERRIDE;
4801 QPen getIconBorderPen() const;
4802 QColor getTextColor() const;
4803 QFont getFont() const;
4811 Q_PROPERTY(QPen borderPen READ borderPen WRITE setBorderPen)
4812 Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
4813 Q_PROPERTY(QFont font READ font WRITE setFont)
4814 Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor)
4815 Q_PROPERTY(QSize iconSize READ iconSize WRITE setIconSize)
4816 Q_PROPERTY(
int iconTextPadding READ iconTextPadding WRITE setIconTextPadding)
4817 Q_PROPERTY(QPen iconBorderPen READ iconBorderPen WRITE setIconBorderPen)
4818 Q_PROPERTY(SelectableParts selectableParts READ selectableParts WRITE setSelectableParts NOTIFY selectionChanged)
4819 Q_PROPERTY(SelectableParts selectedParts READ selectedParts WRITE setSelectedParts NOTIFY selectableChanged)
4820 Q_PROPERTY(QPen selectedBorderPen READ selectedBorderPen WRITE setSelectedBorderPen)
4821 Q_PROPERTY(QPen selectedIconBorderPen READ selectedIconBorderPen WRITE setSelectedIconBorderPen)
4822 Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
4823 Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont)
4824 Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE setSelectedTextColor)
4833 ,spLegendBox = 0x001
4837 Q_FLAGS(SelectableParts)
4840 explicit QCPLegend();
4841 virtual ~QCPLegend();
4846 QFont
font()
const {
return mFont; }
4852 SelectableParts selectedParts()
const;
4860 void setBorderPen(
const QPen &pen);
4861 void setBrush(
const QBrush &brush);
4862 void setFont(
const QFont &font);
4863 void setTextColor(
const QColor &color);
4864 void setIconSize(
const QSize &size);
4865 void setIconSize(
int width,
int height);
4866 void setIconTextPadding(
int padding);
4867 void setIconBorderPen(
const QPen &pen);
4868 Q_SLOT
void setSelectableParts(
const SelectableParts &selectableParts);
4869 Q_SLOT
void setSelectedParts(
const SelectableParts &selectedParts);
4870 void setSelectedBorderPen(
const QPen &pen);
4871 void setSelectedIconBorderPen(
const QPen &pen);
4872 void setSelectedBrush(
const QBrush &brush);
4873 void setSelectedFont(
const QFont &font);
4874 void setSelectedTextColor(
const QColor &color);
4880 QCPAbstractLegendItem *item(
int index)
const;
4882 int itemCount()
const;
4883 bool hasItem(QCPAbstractLegendItem *item)
const;
4884 bool hasItemWithPlottable(
const QCPAbstractPlottable *plottable)
const;
4885 bool addItem(QCPAbstractLegendItem *item);
4886 bool removeItem(
int index);
4887 bool removeItem(QCPAbstractLegendItem *item);
4889 QList<QCPAbstractLegendItem*> selectedItems()
const;
4915 virtual
void selectEvent(QMouseEvent *event,
bool additive, const QVariant &details,
bool *selectionStateChanged) Q_DECL_OVERRIDE;
4916 virtual
void deselectEvent(
bool *selectionStateChanged) Q_DECL_OVERRIDE;
4919 QPen getBorderPen() const;
4920 QBrush getBrush() const;
4923 Q_DISABLE_COPY(QCPLegend)
4925 friend class QCustomPlot;
4926 friend class QCPAbstractLegendItem;
4928 Q_DECLARE_OPERATORS_FOR_FLAGS(QCPLegend::SelectableParts)
4941 Q_PROPERTY(QString text READ text WRITE setText)
4942 Q_PROPERTY(QFont font READ font WRITE setFont)
4943 Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor)
4944 Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont)
4945 Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE setSelectedTextColor)
4946 Q_PROPERTY(
bool selectable READ selectable WRITE setSelectable NOTIFY selectableChanged)
4947 Q_PROPERTY(
bool selected READ selected WRITE setSelected NOTIFY selectionChanged)
4952 QCPTextElement(QCustomPlot *parentPlot,
const QString &text,
double pointSize);
4953 QCPTextElement(QCustomPlot *parentPlot,
const QString &text,
const QString &fontFamily,
double pointSize);
4954 QCPTextElement(QCustomPlot *parentPlot,
const QString &text,
const QFont &font);
4957 QString
text()
const {
return mText; }
4959 QFont
font()
const {
return mFont; }
4967 void setText(
const QString &text);
4968 void setTextFlags(
int flags);
4969 void setFont(
const QFont &font);
4970 void setTextColor(
const QColor &color);
4971 void setSelectedFont(
const QFont &font);
4972 void setSelectedTextColor(
const QColor &color);
4974 Q_SLOT
void setSelected(
bool selected);
4985 void clicked(QMouseEvent *event);
4986 void doubleClicked(QMouseEvent *event);
5002 virtual QSize minimumOuterSizeHint() const Q_DECL_OVERRIDE;
5003 virtual QSize maximumOuterSizeHint() const Q_DECL_OVERRIDE;
5005 virtual
void selectEvent(QMouseEvent *event,
bool additive, const QVariant &details,
bool *selectionStateChanged) Q_DECL_OVERRIDE;
5006 virtual
void deselectEvent(
bool *selectionStateChanged) Q_DECL_OVERRIDE;
5009 QFont mainFont() const;
5010 QColor mainTextColor() const;
5042 void updateGradientImage();
5043 Q_SLOT
void axisSelectionChanged(QCPAxis::SelectableParts selectedParts);
5044 Q_SLOT
void axisSelectableChanged(QCPAxis::SelectableParts selectableParts);
5054 Q_PROPERTY(
QCPRange dataRange READ dataRange WRITE setDataRange NOTIFY dataRangeChanged)
5055 Q_PROPERTY(
QCPAxis::ScaleType dataScaleType READ dataScaleType WRITE setDataScaleType NOTIFY dataScaleTypeChanged)
5056 Q_PROPERTY(
QCPColorGradient gradient READ gradient WRITE setGradient NOTIFY gradientChanged)
5057 Q_PROPERTY(QString label READ label WRITE setLabel)
5058 Q_PROPERTY(
int barWidth READ barWidth WRITE setBarWidth)
5059 Q_PROPERTY(
bool rangeDrag READ rangeDrag WRITE setRangeDrag)
5060 Q_PROPERTY(
bool rangeZoom READ rangeZoom WRITE setRangeZoom)
5072 QString label()
const;
5074 bool rangeDrag()
const;
5075 bool rangeZoom()
const;
5079 Q_SLOT
void setDataRange(
const QCPRange &dataRange);
5082 void setLabel(
const QString &str);
5083 void setBarWidth(
int width);
5084 void setRangeDrag(
bool enabled);
5085 void setRangeZoom(
bool enabled);
5088 QList<QCPColorMap*> colorMaps()
const;
5089 void rescaleDataRange(
bool onlyVisibleMaps);
5095 void dataRangeChanged(
const QCPRange &newRange);
5136 QCPGraphData(
double key,
double value);
5139 inline static QCPGraphData
fromSortKey(
double sortKey) {
return QCPGraphData(sortKey, 0); }
5167 Q_PROPERTY(
LineStyle lineStyle READ lineStyle WRITE setLineStyle)
5168 Q_PROPERTY(
QCPScatterStyle scatterStyle READ scatterStyle WRITE setScatterStyle)
5169 Q_PROPERTY(
int scatterSkip READ scatterSkip WRITE setScatterSkip)
5170 Q_PROPERTY(
QCPGraph* channelFillGraph READ channelFillGraph WRITE setChannelFillGraph)
5171 Q_PROPERTY(
bool adaptiveSampling READ adaptiveSampling WRITE setAdaptiveSampling)
5201 void setData(QSharedPointer<QCPGraphDataContainer> data);
5202 void setData(
const QVector<double> &keys,
const QVector<double> &
values,
bool alreadySorted=
false);
5205 void setScatterSkip(
int skip);
5206 void setChannelFillGraph(
QCPGraph *targetGraph);
5207 void setAdaptiveSampling(
bool enabled);
5210 void addData(
const QVector<double> &keys,
const QVector<double> &values,
bool alreadySorted=
false);
5211 void addData(
double key,
double value);
5231 virtual void drawFill(
QCPPainter *painter, QVector<QPointF> *lines)
const;
5232 virtual void drawScatterPlot(
QCPPainter *painter,
const QVector<QPointF> &scatters,
const QCPScatterStyle &style)
const;
5233 virtual void drawLinePlot(
QCPPainter *painter,
const QVector<QPointF> &lines)
const;
5234 virtual void drawImpulsePlot(
QCPPainter *painter,
const QVector<QPointF> &lines)
const;
5241 void getLines(QVector<QPointF> *lines,
const QCPDataRange &dataRange)
const;
5242 void getScatters(QVector<QPointF> *scatters,
const QCPDataRange &dataRange)
const;
5243 QVector<QPointF> dataToLines(
const QVector<QCPGraphData> &data)
const;
5244 QVector<QPointF> dataToStepLeftLines(
const QVector<QCPGraphData> &data)
const;
5245 QVector<QPointF> dataToStepRightLines(
const QVector<QCPGraphData> &data)
const;
5246 QVector<QPointF> dataToStepCenterLines(
const QVector<QCPGraphData> &data)
const;
5247 QVector<QPointF> dataToImpulseLines(
const QVector<QCPGraphData> &data)
const;
5248 QVector<QCPDataRange> getNonNanSegments(
const QVector<QPointF> *lineData, Qt::Orientation keyOrientation)
const;
5249 QVector<QPair<QCPDataRange, QCPDataRange> > getOverlappingSegments(QVector<QCPDataRange> thisSegments,
const QVector<QPointF> *thisData, QVector<QCPDataRange> otherSegments,
const QVector<QPointF> *otherData)
const;
5250 bool segmentsIntersect(
double aLower,
double aUpper,
double bLower,
double bUpper,
int &bPrecedence)
const;
5251 QPointF getFillBasePoint(QPointF matchingDataPoint)
const;
5252 const QPolygonF getFillPolygon(
const QVector<QPointF> *lineData,
QCPDataRange segment)
const;
5253 const QPolygonF getChannelFillPolygon(
const QVector<QPointF> *lineData,
QCPDataRange thisSegment,
const QVector<QPointF> *otherData,
QCPDataRange otherSegment)
const;
5254 int findIndexBelowX(
const QVector<QPointF> *data,
double x)
const;
5255 int findIndexAboveX(
const QVector<QPointF> *data,
double x)
const;
5256 int findIndexBelowY(
const QVector<QPointF> *data,
double y)
const;
5257 int findIndexAboveY(
const QVector<QPointF> *data,
double y)
const;
5260 friend class QCustomPlot;
5261 friend class QCPLegend;
5275 QCPCurveData(
double t,
double key,
double value);
5278 inline static QCPCurveData
fromSortKey(
double sortKey) {
return QCPCurveData(sortKey, 0, 0); }
5307 Q_PROPERTY(
QCPScatterStyle scatterStyle READ scatterStyle WRITE setScatterStyle)
5308 Q_PROPERTY(
int scatterSkip READ scatterSkip WRITE setScatterSkip)
5309 Q_PROPERTY(
LineStyle lineStyle READ lineStyle WRITE setLineStyle)
5332 void setData(QSharedPointer<QCPCurveDataContainer> data);
5333 void setData(
const QVector<double> &
t,
const QVector<double> &keys,
const QVector<double> &
values,
bool alreadySorted=
false);
5334 void setData(
const QVector<double> &keys,
const QVector<double> &values);
5336 void setScatterSkip(
int skip);
5340 void addData(
const QVector<double> &t,
const QVector<double> &keys,
const QVector<double> &values,
bool alreadySorted=
false);
5341 void addData(
const QVector<double> &keys,
const QVector<double> &values);
5342 void addData(
double t,
double key,
double value);
5343 void addData(
double key,
double value);
5361 virtual void drawCurveLine(
QCPPainter *painter,
const QVector<QPointF> &lines)
const;
5365 void getCurveLines(QVector<QPointF> *lines,
const QCPDataRange &dataRange,
double penWidth)
const;
5366 void getScatters(QVector<QPointF> *scatters,
const QCPDataRange &dataRange,
double scatterWidth)
const;
5367 int getRegion(
double key,
double value,
double keyMin,
double valueMax,
double keyMax,
double valueMin)
const;
5368 QPointF getOptimizedPoint(
int prevRegion,
double prevKey,
double prevValue,
double key,
double value,
double keyMin,
double valueMax,
double keyMax,
double valueMin)
const;
5369 QVector<QPointF> getOptimizedCornerPoints(
int prevRegion,
int currentRegion,
double prevKey,
double prevValue,
double key,
double value,
double keyMin,
double valueMax,
double keyMax,
double valueMin)
const;
5370 bool mayTraverse(
int prevRegion,
int currentRegion)
const;
5371 bool getTraverse(
double prevKey,
double prevValue,
double key,
double value,
double keyMin,
double valueMax,
double keyMax,
double valueMin, QPointF &crossA, QPointF &crossB)
const;
5372 void getTraverseCornerPoints(
int prevRegion,
int currentRegion,
double keyMin,
double valueMax,
double keyMax,
double valueMin, QVector<QPointF> &beforeTraverse, QVector<QPointF> &afterTraverse)
const;
5375 friend class QCustomPlot;
5376 friend class QCPLegend;
5390 Q_PROPERTY(
SpacingType spacingType READ spacingType WRITE setSpacingType)
5391 Q_PROPERTY(
double spacing READ spacing WRITE setSpacing)
5415 void setSpacing(
double spacing);
5418 QList<QCPBars*>
bars()
const {
return mBars; }
5419 QCPBars* bars(
int index)
const;
5420 int size()
const {
return mBars.size(); }
5425 void insert(
int i,
QCPBars *bars);
5436 void registerBars(
QCPBars *bars);
5437 void unregisterBars(
QCPBars *bars);
5440 double keyPixelOffset(
const QCPBars *bars,
double keyCoord);
5441 double getPixelSpacing(
const QCPBars *bars,
double keyCoord);
5455 QCPBarsData(
double key,
double value);
5458 inline static QCPBarsData
fromSortKey(
double sortKey) {
return QCPBarsData(sortKey, 0); }
5486 Q_PROPERTY(
double width READ width WRITE setWidth)
5487 Q_PROPERTY(
WidthType widthType READ widthType WRITE setWidthType)
5488 Q_PROPERTY(
QCPBarsGroup* barsGroup READ barsGroup WRITE setBarsGroup)
5489 Q_PROPERTY(
double baseValue READ baseValue WRITE setBaseValue)
5490 Q_PROPERTY(
double stackingGap READ stackingGap WRITE setStackingGap)
5491 Q_PROPERTY(
QCPBars* barBelow READ barBelow)
5492 Q_PROPERTY(
QCPBars* barAbove READ barAbove)
5521 void setData(QSharedPointer<QCPBarsDataContainer> data);
5522 void setData(
const QVector<double> &keys,
const QVector<double> &
values,
bool alreadySorted=
false);
5523 void setWidth(
double width);
5526 void setBaseValue(
double baseValue);
5527 void setStackingGap(
double pixels);
5530 void addData(
const QVector<double> &keys,
const QVector<double> &values,
bool alreadySorted=
false);
5531 void addData(
double key,
double value);
5532 void moveBelow(
QCPBars *bars);
5533 void moveAbove(
QCPBars *bars);
5557 QRectF getBarRect(
double key,
double value)
const;
5558 void getPixelWidth(
double key,
double &lower,
double &upper)
const;
5559 double getStackedBaseValue(
double key,
bool positive)
const;
5562 friend class QCustomPlot;
5563 friend class QCPLegend;
5577 QCPStatisticalBoxData();
5578 QCPStatisticalBoxData(
double key,
double minimum,
double lowerQuartile,
double median,
double upperQuartile,
double maximum,
const QVector<double>& outliers=QVector<double>());
5581 inline static QCPStatisticalBoxData
fromSortKey(
double sortKey) {
return QCPStatisticalBoxData(sortKey, 0, 0, 0, 0, 0); }
5590 for (QVector<double>::const_iterator it = outliers.constBegin(); it != outliers.constEnd(); ++it)
5617 Q_PROPERTY(
double width READ width WRITE setWidth)
5618 Q_PROPERTY(
double whiskerWidth READ whiskerWidth WRITE setWhiskerWidth)
5619 Q_PROPERTY(QPen whiskerPen READ whiskerPen WRITE setWhiskerPen)
5620 Q_PROPERTY(QPen whiskerBarPen READ whiskerBarPen WRITE setWhiskerBarPen)
5621 Q_PROPERTY(
bool whiskerAntialiased READ whiskerAntialiased WRITE setWhiskerAntialiased)
5622 Q_PROPERTY(QPen medianPen READ medianPen WRITE setMedianPen)
5623 Q_PROPERTY(
QCPScatterStyle outlierStyle READ outlierStyle WRITE setOutlierStyle)
5639 void setData(QSharedPointer<QCPStatisticalBoxDataContainer> data);
5640 void setData(
const QVector<double> &keys,
const QVector<double> &minimum,
const QVector<double> &lowerQuartile,
const QVector<double> &median,
const QVector<double> &upperQuartile,
const QVector<double> &maximum,
bool alreadySorted=
false);
5641 void setWidth(
double width);
5642 void setWhiskerWidth(
double width);
5643 void setWhiskerPen(
const QPen &pen);
5644 void setWhiskerBarPen(
const QPen &pen);
5645 void setWhiskerAntialiased(
bool enabled);
5646 void setMedianPen(
const QPen &pen);
5650 void addData(
const QVector<double> &keys,
const QVector<double> &minimum,
const QVector<double> &lowerQuartile,
const QVector<double> &median,
const QVector<double> &upperQuartile,
const QVector<double> &maximum,
bool alreadySorted=
false);
5651 void addData(
double key,
double minimum,
double lowerQuartile,
double median,
double upperQuartile,
double maximum,
const QVector<double> &outliers=QVector<double>());
5681 friend class QCustomPlot;
5682 friend class QCPLegend;
5705 double data(
double key,
double value);
5706 double cell(
int keyIndex,
int valueIndex);
5707 unsigned char alpha(
int keyIndex,
int valueIndex);
5710 void setSize(
int keySize,
int valueSize);
5711 void setKeySize(
int keySize);
5712 void setValueSize(
int valueSize);
5714 void setKeyRange(
const QCPRange &keyRange);
5715 void setValueRange(
const QCPRange &valueRange);
5716 void setData(
double key,
double value,
double z);
5717 void setCell(
int keyIndex,
int valueIndex,
double z);
5718 void setAlpha(
int keyIndex,
int valueIndex,
unsigned char alpha);
5721 void recalculateDataBounds();
5724 void fill(
double z);
5725 void fillAlpha(
unsigned char alpha);
5727 void coordToCell(
double key,
double value,
int *keyIndex,
int *valueIndex)
const;
5728 void cellToCoord(
int keyIndex,
int valueIndex,
double *key,
double *value)
const;
5742 bool createAlpha(
bool initializeOpaque=
true);
5752 Q_PROPERTY(
QCPRange dataRange READ dataRange WRITE setDataRange NOTIFY dataRangeChanged)
5753 Q_PROPERTY(
QCPAxis::ScaleType dataScaleType READ dataScaleType WRITE setDataScaleType NOTIFY dataScaleTypeChanged)
5754 Q_PROPERTY(
QCPColorGradient gradient READ gradient WRITE setGradient NOTIFY gradientChanged)
5755 Q_PROPERTY(
bool interpolate READ interpolate WRITE setInterpolate)
5756 Q_PROPERTY(
bool tightBoundary READ tightBoundary WRITE setTightBoundary)
5757 Q_PROPERTY(
QCPColorScale* colorScale READ colorScale WRITE setColorScale)
5774 Q_SLOT
void setDataRange(
const QCPRange &dataRange);
5777 void setInterpolate(
bool enabled);
5778 void setTightBoundary(
bool enabled);
5782 void rescaleDataRange(
bool recalculateDataBounds=
false);
5783 Q_SLOT
void updateLegendIcon(Qt::TransformationMode transformMode=Qt::SmoothTransformation,
const QSize &thumbSize=QSize(32, 18));
5791 void dataRangeChanged(
const QCPRange &newRange);
5811 virtual void updateMapImage();
5817 friend class QCustomPlot;
5818 friend class QCPLegend;
5831 QCPFinancialData(
double key,
double open,
double high,
double low,
double close);
5842 double key,
open, high, low, close;
5862 Q_PROPERTY(
ChartStyle chartStyle READ chartStyle WRITE setChartStyle)
5863 Q_PROPERTY(
double width READ width WRITE setWidth)
5864 Q_PROPERTY(
WidthType widthType READ widthType WRITE setWidthType)
5865 Q_PROPERTY(
bool twoColored READ twoColored WRITE setTwoColored)
5866 Q_PROPERTY(QBrush brushPositive READ brushPositive WRITE setBrushPositive)
5867 Q_PROPERTY(QBrush brushNegative READ brushNegative WRITE setBrushNegative)
5868 Q_PROPERTY(QPen penPositive READ penPositive WRITE setPenPositive)
5869 Q_PROPERTY(QPen penNegative READ penNegative WRITE setPenNegative)
5909 void setData(QSharedPointer<QCPFinancialDataContainer> data);
5910 void setData(
const QVector<double> &keys,
const QVector<double> &open,
const QVector<double> &high,
const QVector<double> &low,
const QVector<double> &close,
bool alreadySorted=
false);
5912 void setWidth(
double width);
5914 void setTwoColored(
bool twoColored);
5915 void setBrushPositive(
const QBrush &brush);
5916 void setBrushNegative(
const QBrush &brush);
5917 void setPenPositive(
const QPen &pen);
5918 void setPenNegative(
const QPen &pen);
5921 void addData(
const QVector<double> &keys,
const QVector<double> &open,
const QVector<double> &high,
const QVector<double> &low,
const QVector<double> &close,
bool alreadySorted=
false);
5922 void addData(
double key,
double open,
double high,
double low,
double close);
5931 static QCPFinancialDataContainer timeSeriesToOhlc(
const QVector<double> &time,
const QVector<double> &value,
double timeBinSize,
double timeBinOffset = 0);
5949 double getPixelWidth(
double key,
double keyPixel)
const;
5955 friend class QCustomPlot;
5956 friend class QCPLegend;
5970 explicit QCPErrorBarsData(
double error);
5971 QCPErrorBarsData(
double errorMinus,
double errorPlus);
5999 Q_PROPERTY(QSharedPointer<QCPErrorBarsDataContainer> data READ data WRITE setData)
6000 Q_PROPERTY(QCPAbstractPlottable* dataPlottable READ dataPlottable WRITE setDataPlottable)
6001 Q_PROPERTY(
ErrorType errorType READ errorType WRITE setErrorType)
6002 Q_PROPERTY(
double whiskerWidth READ whiskerWidth WRITE setWhiskerWidth)
6003 Q_PROPERTY(
double symbolGap READ symbolGap WRITE setSymbolGap)
6028 void setData(QSharedPointer<QCPErrorBarsDataContainer> data);
6029 void setData(
const QVector<double> &error);
6030 void setData(
const QVector<double> &errorMinus,
const QVector<double> &errorPlus);
6031 void setDataPlottable(QCPAbstractPlottable* plottable);
6033 void setWhiskerWidth(
double pixels);
6034 void setSymbolGap(
double pixels);
6037 void addData(
const QVector<double> &error);
6038 void addData(
const QVector<double> &errorMinus,
const QVector<double> &errorPlus);
6039 void addData(
double error);
6040 void addData(
double errorMinus,
double errorPlus);
6073 void getErrorBarLines(QCPErrorBarsDataContainer::const_iterator it, QVector<QLineF> &backbones, QVector<QLineF> &whiskers) const;
6074 void getVisibleDataBounds(QCPErrorBarsDataContainer::const_iterator &begin, QCPErrorBarsDataContainer::const_iterator &end, const
QCPDataRange &rangeRestriction) const;
6075 double pointDistance(const QPointF &pixelPoint, QCPErrorBarsDataContainer::const_iterator &closestData) const;
6078 bool errorBarVisible(
int index) const;
6079 bool rectIntersectsLine(const QRectF &pixelRect, const QLineF &line) const;
6081 friend class QCustomPlot;
6082 friend class QCPLegend;
6095 Q_PROPERTY(QPen pen READ pen WRITE setPen)
6096 Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
6107 void setPen(
const QPen &pen);
6108 void setSelectedPen(
const QPen &pen);
6124 QLineF getRectClippedStraightLine(
const QCPVector2D &point1,
const QCPVector2D &vec,
const QRect &rect)
const;
6125 QPen mainPen()
const;
6138 Q_PROPERTY(QPen pen READ pen WRITE setPen)
6139 Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
6154 void setPen(
const QPen &pen);
6155 void setSelectedPen(
const QPen &pen);
6175 QPen mainPen()
const;
6188 Q_PROPERTY(QPen pen READ pen WRITE setPen)
6189 Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
6204 void setPen(
const QPen &pen);
6205 void setSelectedPen(
const QPen &pen);
6226 QPen mainPen()
const;
6239 Q_PROPERTY(QPen pen READ pen WRITE setPen)
6240 Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
6241 Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
6242 Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
6255 void setPen(
const QPen &pen);
6256 void setSelectedPen(
const QPen &pen);
6257 void setBrush(
const QBrush &brush);
6258 void setSelectedBrush(
const QBrush &brush);
6273 enum AnchorIndex {aiTop, aiTopRight, aiRight, aiBottom, aiBottomLeft, aiLeft};
6281 virtual QPointF anchorPixelPosition(
int anchorId)
const Q_DECL_OVERRIDE;
6284 QPen mainPen()
const;
6285 QBrush mainBrush()
const;
6298 Q_PROPERTY(QColor color READ color WRITE setColor)
6299 Q_PROPERTY(QColor selectedColor READ selectedColor WRITE setSelectedColor)
6300 Q_PROPERTY(QPen pen READ pen WRITE setPen)
6301 Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
6302 Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
6303 Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
6304 Q_PROPERTY(QFont font READ font WRITE setFont)
6305 Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont)
6306 Q_PROPERTY(QString text READ text WRITE setText)
6307 Q_PROPERTY(Qt::Alignment positionAlignment READ positionAlignment WRITE setPositionAlignment)
6308 Q_PROPERTY(Qt::Alignment textAlignment READ textAlignment WRITE setTextAlignment)
6309 Q_PROPERTY(
double rotation READ rotation WRITE setRotation)
6310 Q_PROPERTY(QMargins padding READ padding WRITE setPadding)
6323 QFont
font()
const {
return mFont; }
6325 QString
text()
const {
return mText; }
6332 void setColor(
const QColor &color);
6333 void setSelectedColor(
const QColor &color);
6334 void setPen(
const QPen &pen);
6335 void setSelectedPen(
const QPen &pen);
6336 void setBrush(
const QBrush &brush);
6337 void setSelectedBrush(
const QBrush &brush);
6338 void setFont(
const QFont &font);
6339 void setSelectedFont(
const QFont &font);
6340 void setText(
const QString &text);
6341 void setPositionAlignment(Qt::Alignment alignment);
6342 void setTextAlignment(Qt::Alignment alignment);
6343 void setRotation(
double degrees);
6344 void setPadding(
const QMargins &padding);
6360 enum AnchorIndex {aiTopLeft, aiTop, aiTopRight, aiRight, aiBottomRight, aiBottom, aiBottomLeft, aiLeft};
6375 virtual QPointF anchorPixelPosition(
int anchorId)
const Q_DECL_OVERRIDE;
6378 QPointF getTextDrawPoint(
const QPointF &pos,
const QRectF &rect, Qt::Alignment positionAlignment)
const;
6379 QFont mainFont()
const;
6380 QColor mainColor()
const;
6381 QPen mainPen()
const;
6382 QBrush mainBrush()
const;
6395 Q_PROPERTY(QPen pen READ pen WRITE setPen)
6396 Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
6397 Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
6398 Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
6411 void setPen(
const QPen &pen);
6412 void setSelectedPen(
const QPen &pen);
6413 void setBrush(
const QBrush &brush);
6414 void setSelectedBrush(
const QBrush &brush);
6432 enum AnchorIndex {aiTopLeftRim, aiTop, aiTopRightRim, aiRight, aiBottomRightRim, aiBottom, aiBottomLeftRim, aiLeft, aiCenter};
6440 virtual QPointF anchorPixelPosition(
int anchorId)
const Q_DECL_OVERRIDE;
6443 QPen mainPen()
const;
6444 QBrush mainBrush()
const;
6457 Q_PROPERTY(QPixmap pixmap READ pixmap WRITE setPixmap)
6458 Q_PROPERTY(
bool scaled READ scaled WRITE setScaled)
6459 Q_PROPERTY(Qt::AspectRatioMode aspectRatioMode READ aspectRatioMode)
6460 Q_PROPERTY(Qt::TransformationMode transformationMode READ transformationMode)
6461 Q_PROPERTY(QPen pen READ pen WRITE setPen)
6462 Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
6477 void setPixmap(
const QPixmap &pixmap);
6478 void setScaled(
bool scaled, Qt::AspectRatioMode aspectRatioMode=Qt::KeepAspectRatio, Qt::TransformationMode transformationMode=Qt::SmoothTransformation);
6479 void setPen(
const QPen &pen);
6480 void setSelectedPen(
const QPen &pen);
6495 enum AnchorIndex {aiTop, aiTopRight, aiRight, aiBottom, aiBottomLeft, aiLeft};
6508 virtual QPointF anchorPixelPosition(
int anchorId)
const Q_DECL_OVERRIDE;
6511 void updateScaledPixmap(QRect finalRect=QRect(),
bool flipHorz=
false,
bool flipVert=
false);
6512 QRect getFinalRect(
bool *flippedHorz=0,
bool *flippedVert=0)
const;
6513 QPen mainPen()
const;
6526 Q_PROPERTY(QPen pen READ pen WRITE setPen)
6527 Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
6528 Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
6529 Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
6530 Q_PROPERTY(
double size READ size WRITE setSize)
6531 Q_PROPERTY(
TracerStyle style READ style WRITE setStyle)
6532 Q_PROPERTY(
QCPGraph* graph READ graph WRITE setGraph)
6533 Q_PROPERTY(
double graphKey READ graphKey WRITE setGraphKey)
6534 Q_PROPERTY(
bool interpolating READ interpolating WRITE setInterpolating)
6558 double size()
const {
return mSize; }
6565 void setPen(
const QPen &pen);
6566 void setSelectedPen(
const QPen &pen);
6567 void setBrush(
const QBrush &brush);
6568 void setSelectedBrush(
const QBrush &brush);
6569 void setSize(
double size);
6572 void setGraphKey(
double key);
6573 void setInterpolating(
bool enabled);
6579 void updatePosition();
6597 QPen mainPen()
const;
6598 QBrush mainBrush()
const;
6612 Q_PROPERTY(QPen pen READ pen WRITE setPen)
6613 Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
6615 Q_PROPERTY(
BracketStyle style READ style WRITE setStyle)
6641 void setPen(
const QPen &pen);
6642 void setSelectedPen(
const QPen &pen);
6643 void setLength(
double length);
6662 virtual QPointF anchorPixelPosition(
int anchorId)
const Q_DECL_OVERRIDE;
6665 QPen mainPen()
const;
6672 #endif // QCUSTOMPLOT_H
double whiskerWidth() const
BracketStyle mBracketStyle
QCPItemAnchor *const right
int iconTextPadding() const
bool mAntialiasedScatters
void setBrush(const QBrush &brush)
QCPLineEnding tail() const
Qt::TransformationMode transformationMode() const
const_iterator constBegin() const
int columnSpacing() const
virtual QCPItemPosition * toQCPItemPosition() Q_DECL_OVERRIDE
QColor selectedTickLabelColor() const
The base class tick generator used by QCPAxis to create tick positions and tick labels.
QCustomPlot * parentPlot() const
0x001 Axis ranges are draggable (see QCPAxisRect::setRangeDrag, QCPAxisRect::setRangeDragAxes) ...
QCPItemPosition *const position
virtual QRect clipRect() const Q_DECL_OVERRIDE
QCPItemPosition *const start
QCPRange valueRange() const
Manages the position of an item.
QColor mSelectedLabelColor
QList< InsetPlacement > mInsetPlacement
QCP::AntialiasedElements antialiasedElements() const
QCPRange & operator/=(const double &value)
bool mNumberBeautifulPowers
QCPAbstractPlottable * dataPlottable() const
void performAutoSqueeze()
virtual int findBegin(double sortKey, bool expandedRange=true) const Q_DECL_OVERRIDE
QCPItemAnchor *const left
QVector< double > tickVector() const
QCPDataRange dataRange() const
0x0200 Zero-lines, see QCPGrid::setZeroLinePen
QColor mSelectedTextColor
QCPLayoutInset * mInsetLayout
QCPDataContainer< QCPStatisticalBoxData > QCPStatisticalBoxDataContainer
QList< double > rowStretchFactors() const
Qt::AspectRatioMode backgroundScaledMode() const
QList< QSharedPointer< QCPAbstractPaintBuffer > > mPaintBuffers
QCPBarsGroup * mBarsGroup
QCPItemPosition *const topLeft
int dataRangeCount() const
QSize maximumSize() const
Any combination of data points/ranges can be selected.
The abstract base class for layouts.
bool tangentToData() const
Resolution is given in dots per inch (DPI/PPI)
void selectionChanged(bool selected)
QCPGraph * channelFillGraph() const
QCPColorScale * mParentColorScale
QCPColorGradient gradient() const
Specialized axis ticker to display ticks in units of an arbitrary constant, for example pi...
ErrorType errorType() const
QPointer< QCPGraph > mChannelFillGraph
QCPLayerable * parentLayerable() const
Cosmetic pens are converted to pens with pixel width 1 when exporting.
PainterModes modes() const
SizeConstraintRect sizeConstraintRect() const
Qt::Alignment positionAlignment() const
QBrush selectedBrush() const
A curved line from one point to another.
QList< QCPDataRange > dataRanges() const
QPen selectedTickPen() const
bool antialiasedFill() const
bool clipToAxisRect() const
QCPLineEnding upperEnding
ScaleType scaleType() const
QCPLayoutGrid * mPlotLayout
QCP::MarginSides autoMargins() const
TickStepStrategy tickStepStrategy() const
QCP::SelectionRectMode selectionRectMode() const
Controls how a plottable's data selection is drawn.
void remove(double sortKeyFrom, double sortKeyTo)
const QCPVector2D operator-(const QCPVector2D &vec1, const QCPVector2D &vec2)
Represents the range an axis is encompassing.
virtual QCPItemPosition * toQCPItemPosition()
QRect axisSelectionBox() const
bool subGridVisible() const
bool backgroundScaled() const
bool antialiasing() const
QFont selectedTickLabelFont() const
std::vector< double > values
QCPAxis::ScaleType mDataScaleType
A straight line that spans infinitely in both directions.
QCPAxis * valueAxis() const
virtual void mousePressEvent(QMouseEvent *event, const QVariant &details)
bool antialiasedSubGrid() const
const_iterator at(int index) const
QPointer< QCPAxisRect > mClipAxisRect
static bool sortKeyIsMainKey()
virtual QCPPlottableInterface1D * interface1D() Q_DECL_OVERRIDE
QList< QRectF > mInsetRect
QWeakPointer< QCPAbstractPaintBuffer > mPaintBuffer
QCustomPlot * mParentPlot
Holds the data of one single data point for QCPCurve.
Qt::Alignment textAlignment() const
QColor selectedTextColor() const
QCPItemPosition *const end
QCPItemPosition *const bottomRight
0x004 axis (tick) labels will be cached as pixmaps, increasing replot performance.
QCPScatterStyle outlierStyle() const
double tickOrigin() const
Qt::Alignment mTextAlignment
bool contains(QCPBars *bars) const
ScatterShape shape() const
QSet< QCPItemPosition * > mChildrenY
QPointer< QCPAxis > mValueAxis
QCustomPlot * mParentPlot
QVector< DataType >::const_iterator const_iterator
QColor selectedTextColor() const
QCPRange & operator+=(const double &value)
QCPBarsGroup * barsGroup() const
Holds the data of one single data point (one bar) for QCPBars.
Qt::TimeSpec dateTimeSpec() const
QCPRange valueRange(bool &foundRange, QCP::SignDomain signDomain=QCP::sdBoth, const QCPRange &inKeyRange=QCPRange())
Provides rect/rubber-band data selection and range zoom interaction.
QCPScatterStyle scatterStyle() const
QColor selectedColor() const
QSharedPointer< QCPErrorBarsDataContainer > data() const
SpacingType spacingType() const
QColor labelColor() const
bool tightBoundary() const
ScaleStrategy mScaleStrategy
QPointer< QCPColorScale > mColorScale
QPen whiskerBarPen() const
QCPAbstractPlottable * mPlottable
QCPScatterStyle::ScatterProperties mUsedScatterProperties
QList< QCPDataRange > mDataRanges
Represents the visual appearance of scatter points.
QPainterPath customPath() const
QList< QCPRange > mDragStartVertRange
static QCPStatisticalBoxData fromSortKey(double sortKey)
IMETHOD Vector diff(const Vector &p_w_a, const Vector &p_w_b, double dt=1)
QSharedPointer< QCPAxisTicker > ticker() const
void removeBefore(double sortKey)
ColorInterpolation colorInterpolation() const
QVariant mMouseSignalLayerableDetails
QByteArray mLabelParameterHash
QCPItemAnchor *const bottomLeft
void set(const QCPDataContainer< DataType > &data)
QCPMarginGroup * marginGroup(QCP::MarginSide side) const
Specialized axis ticker for calendar dates and times as axis ticks.
QCPSelectionDecorator * mSelectionDecorator
QList< QCPGraph * > mGraphs
Defines an abstract interface for one-dimensional plottables.
void applyDefaultAntialiasingHint(QCPPainter *painter) const Q_DECL_OVERRIDE
QCPAxis::ScaleType dataScaleType() const
QPen selectedBorderPen() const
QVector< QString > tickVectorLabels() const
bool abbreviateDecimalPowers
QCPItemPosition *const topLeft
QBrush bracketBrush() const
QCPLegend * mParentLegend
QBrush selectedBrush() const
Specialized axis ticker suited for logarithmic axes.
A plottable representing a single statistical box in a plot.
0x0020 Main lines of plottables
virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const Q_DECL_OVERRIDE
virtual void update(UpdatePhase phase) Q_DECL_OVERRIDE
bool backgroundScaled() const
QCPLayoutInset * insetLayout() const
QCPRange keyRange() const
friend class QCPPlottableLegendItem
double whiskerWidth() const
static bool sortKeyIsMainKey()
QList< QPointer< QCPAxis > > mRangeZoomVertAxis
QHash< QCP::MarginSide, QCPMarginGroup * > mMarginGroups
QSharedPointer< QCPStatisticalBoxDataContainer > data() const
virtual QCPRange dataValueRange(int index) const Q_DECL_OVERRIDE
QCP::AntialiasedElements mNotAADragBackup
QPointer< QCPAbstractPlottable > mDataPlottable
void drawPolyline(QCPPainter *painter, const QVector< QPointF > &lineData) const
When dragging the mouse, a selection rect becomes active. Upon releasing, the axes that are currently...
QHash< QCP::MarginSide, QCPMarginGroup * > marginGroups() const
QMap< double, QString > & ticks()
Q_DECLARE_METATYPE(ros::Time)
A layout element displaying a text.
QCP::MarginSides mAutoMargins
QList< QCPItemPosition * > mPositions
QCPItemAnchor * parentAnchorX() const
QBrush selectedBrush() const
AxisType axisType() const
const_iterator constEnd() const
virtual void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE
QCPItemAnchor * parentAnchorY() const
QCPAxis::ScaleType mDataScaleType
QPixmap mBackgroundPixmap
A layer that may contain objects, to control the rendering order.
QPointer< QCPColorScaleAxisRectPrivate > mAxisRect
QPoint bottomRight() const
QCPItemPosition *const point2
QVariant mMouseEventLayerableDetails
0x02 Mode for all sorts of exports (e.g. PNG, PDF,...). For example, this prevents using cached pixma...
double lengthSquared() const
bool add(const actionlib::TwoIntsGoal &req, actionlib::TwoIntsResult &res)
QBrush backgroundBrush() const
Handles the different ending decorations for line-like items.
QFont selectedFont() const
QCustomPlot * mParentPlot
virtual ~QCPPlottableInterface1D()
bool mGradientImageInvalidated
The positive sign domain, i.e. numbers greater than zero.
QString timeFormat() const
void drawLine(const QPointF &p1, const QPointF &p2)
Responsible for drawing the grid of a QCPAxis.
const_iterator findEnd(double sortKey, bool expandedRange=true) const
bool operator==(const QCPDataRange &other) const
QCPDataContainer< QCPCurveData > QCPCurveDataContainer
Describes a data set by holding multiple QCPDataRange instances.
QCP::SelectionType mSelectable
QVector< QCPErrorBarsData > QCPErrorBarsDataContainer
geometry_msgs::TransformStamped t
0x004 The user can select multiple objects by holding the modifier set by QCustomPlot::setMultiSelect...
Q_DECLARE_TYPEINFO(QCPVector2D, Q_MOVABLE_TYPE)
virtual void parentPlotInitialized(QCustomPlot *parentPlot)
void expand(const QCPRange &otherRange)
FillOrder fillOrder() const
QCPRange valueRange() const
TracerStyle style() const
QList< QCPLayerable * > mChildren
QBrush brushPositive() const
QCPDataRange adjusted(int changeBegin, int changeEnd) const
QCPColorGradient mGradient
QCPItemAnchor *const right
QSharedPointer< QCPBarsDataContainer > data() const
QPoint bottomLeft() const
virtual int dataCount() const Q_DECL_OVERRIDE
QCustomPlot * mParentPlot
virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE=0
QCPItemAnchor *const bottom
0x020 Legends are selectable (or their child items, see QCPLegend::setSelectableParts) ...
virtual QCPRange getValueRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth, const QCPRange &inKeyRange=QCPRange()) const =0
Qt::TransformationMode mTransformationMode
QCache< QString, CachedLabel > mLabelCache
Defines a color gradient for use with e.g. QCPColorMap.
QSharedPointer< QCPCurveDataContainer > data() const
QCPItemPosition *const right
const QCPVector2D operator*(double factor, const QCPVector2D &vec)
QCPItemAnchor *const bottom
QList< QCPBars * > bars() const
TFSIMD_FORCE_INLINE tfScalar angle(const Quaternion &q1, const Quaternion &q2)
Q_SLOT void setSelectable(QCP::SelectionType selectable)
void setVisible(PanelDockWidget *widget, bool visible)
QCPItemAnchor *const topRight
QCPItemPosition *const bottomRight
bool qcpLessThanSortKey(const DataType &a, const DataType &b)
int numberPrecision() const
QCPRange dataRange() const
Holds the data of one single data point for QCPStatisticalBox.
void update(const std::string &key, const XmlRpc::XmlRpcValue &v)
QLatin1Char mNumberFormatChar
QCP::AntialiasedElements notAntialiasedElements() const
QCPAxisPainterPrivate * mAxisPainter
QCP::AntialiasedElements mNotAntialiasedElements
The central class of the library. This is the QWidget which displays the plot and interacts with the ...
virtual void mouseDoubleClickEvent(QMouseEvent *event, const QVariant &details)
bool mAntialiasedZeroLine
Qt::AspectRatioMode mBackgroundScaledMode
QCPAxis::AxisType type() const
One individual data point can be selected at a time.
virtual double dataSortKey(int index) const Q_DECL_OVERRIDE
QCPScatterStyle scatterStyle() const
double mRangeZoomFactorVert
QPixmap mScaledBackgroundPixmap
void removeAfter(double sortKey)
QCPVector2D perpendicular() const
Qt::AspectRatioMode aspectRatioMode() const
QCPItemPosition *const left
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const Q_DECL_OVERRIDE
QCPItemPosition *const startDir
QCPItemAnchor *const bottomRightRim
QPointer< QCPLayerable > mParentLayerable
QCPItemPosition *const topLeft
QPointer< QCPAxisRect > mAxisRect
QCPItemAnchor *const topRightRim
QCPBars * barAbove() const
void squeeze(bool preAllocation=true, bool postAllocation=true)
Represents two doubles as a mathematical 2D vector.
virtual QCPPlottableInterface1D * interface1D() Q_DECL_OVERRIDE
QCPDataSelection inverse(const QCPDataRange &outerRange) const
QCPRange dataRange() const
void preallocateGrow(int minimumPreallocSize)
QPen selectedSubTickPen() const
virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) Q_DECL_OVERRIDE
Qt::Orientations rangeDrag() const
QMargins minimumMargins() const
QCPItemPosition *const bottomRight
int getMarginValue(const QMargins &margins, QCP::MarginSide side)
The generic data container for one-dimensional plottables.
Manages a legend inside a QCustomPlot.
double mBufferDevicePixelRatio
QCPItemAnchor *const bottomRight
QCPColorScale * colorScale() const
void setMarginValue(QMargins &margins, QCP::MarginSide side, int value)
QPointer< QCPBars > mBarBelow
QSharedPointer< QCPFinancialDataContainer > data() const
Qt::Orientations rangeZoom() const
QPixmap mScaledBackgroundPixmap
SelectableParts selectableParts() const
QCPDataRange bounded(const QCPDataRange &other) const
virtual void mouseReleaseEvent(QMouseEvent *event, const QPointF &startPos) Q_DECL_OVERRIDE
The selection rect is disabled, and all mouse events are forwarded to the underlying objects...
QCPAbstractPlottable * plottable()
const QCPVector2D operator/(const QCPVector2D &vec, double divisor)
QList< double > mRowStretchFactors
FractionStyle fractionStyle() const
virtual void mousePressEvent(QMouseEvent *event, const QVariant &details) Q_DECL_OVERRIDE
A layout that arranges child elements in a grid.
QCPAbstractPlottable * mPlottable
Qt::Orientation orientation() const
static bool lessThanDataRangeBegin(const QCPDataRange &a, const QCPDataRange &b)
static QCPGraphData fromSortKey(double sortKey)
QPainter subclass used internally.
The abstract base class for all objects that form the layout system.
bool autoAddPlottableToLegend() const
Holds the data of one single data point for QCPGraph.
PositionType typeY() const
const_iterator findBegin(double sortKey, bool expandedRange=true) const
EndingStyle style() const
QCPAxis * keyAxis() const
ChartStyle chartStyle() const
QList< QCPAbstractPlottable * > mPlottables
virtual void mouseReleaseEvent(QMouseEvent *event, const QPointF &startPos)
Multiple contiguous data points (a data range) can be selected.
Holds multiple axes and arranges them in a rectangular shape.
void setPen(const QPen &pen)
virtual QCPDataSelection selectTestRect(const QRectF &rect, bool onlySelectable) const Q_DECL_OVERRIDE
bool adaptiveSampling() const
bool mColorBufferInvalidated
virtual double dataMainValue(int index) const Q_DECL_OVERRIDE
When dragging the mouse, a selection rect becomes active. It is the programmer's responsibility to co...
Both sign domains, including zero, i.e. all numbers.
QVector< DataType >::iterator iterator
QPointer< QCPLayerable > mMouseSignalLayerable
A color scale for use with color coding data such as QCPColorMap.
QMap< double, QColor > mColorStops
TFSIMD_FORCE_INLINE Quaternion inverse(const Quaternion &q)
QCPLineEnding head() const
virtual int findEnd(double sortKey, bool expandedRange=true) const Q_DECL_OVERRIDE
bool operator!=(const QCPRange &other) const
void pixelsToCoords(double x, double y, double &key, double &value) const
0x010 Axes are selectable (or parts of them, see QCPAxis::setSelectableParts)
Groups multiple QCPBars together so they appear side by side.
bool operator==(const QCPRange &other) const
QCPLineEnding head() const
QCPBars * barBelow() const
QCPScatterStyle mOutlierStyle
const QCPVector2D operator+(const QCPVector2D &vec1, const QCPVector2D &vec2)
QCPItemAnchor *const bottomLeftRim
Qt::Orientation mOrientation
int pixelOrientation() const
QFont selectedFont() const
QList< double > columnStretchFactors() const
A bracket for referencing/highlighting certain parts in the plot.
Qt::KeyboardModifier multiSelectModifier() const
virtual QCPRange getKeyRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth) const =0
QList< QPointer< QCPAxis > > mRangeDragVertAxis
The abstract base class for all entries in a QCPLegend.
SelectableParts selectableParts() const
QCPItemAnchor *const topRight
QCPItemAnchor *const bottomLeft
PositionType mPositionTypeY
QCP::AntialiasedElements mOpenGlAntialiasedElementsBackup
QBrush selectedBrush() const
SelectableParts mSelectedParts
Describes a data range given by begin and end index.
virtual double dataMainKey(int index) const Q_DECL_OVERRIDE
static QCPCurveData fromSortKey(double sortKey)
QCPScatterStyle::ScatterProperties usedScatterProperties() const
0x008 Plottables are selectable (e.g. graphs, curves, bars,... see QCPAbstractPlottable) ...
The abstract base class for paint buffers, which define the rendering backend.
static QCPFinancialData fromSortKey(double sortKey)
QCP::PlottingHints mPlottingHints
A plottable representing a parametric curve in a plot.
QColor mSelectedTextColor
void addDataRange(const QCPDataRange &dataRange, bool simplify=true)
static bool sortKeyIsMainKey()
A legend item representing a plottable with an icon and the plottable name.
bool operator!=(const QCPDataSelection &other) const
QCPAxis::LabelSide tickLabelSide
QCPDataContainer< QCPBarsData > QCPBarsDataContainer
QCPItemAnchor *const topLeftRim
bool isPenDefined() const
QCustomPlot * parentPlot() const
QList< QCPLayoutElement * > mElements
const QCP::Interactions interactions() const
QCPItemAnchor *const left
QCPRange valueRange() const
WidthType widthType() const
QCP::SelectionRectMode mSelectionRectMode
QMap< double, QString > mTicks
bool contains(double value) const
QHash< TimeUnit, int > mFieldWidth
bool isInvalidData(double value)
QCPRange valueRange() const
0x0040 Main lines of items
Manages a single axis inside a QCustomPlot.
virtual ~QCPAbstractPlottable1D()
QPointer< QCPAxis > mValueAxis
int tangentAverage() const
ScaleStrategy scaleStrategy() const
A template base class for plottables with one-dimensional data.
0x01 The pen property, see setPen
bool whiskerAntialiased() const
QRect tickLabelsSelectionBox() const
QPixmap background() const
QCPItemPosition *const end
Item that sticks to QCPGraph data points.
SelectableParts selectedParts() const
QList< QCPAbstractItem * > mItems
QCPLegend * parentLegend() const
QCP::Interactions mInteractions
PositionType typeX() const
virtual QCP::Interaction selectionCategory() const Q_DECL_OVERRIDE
QCPAxis * keyAxis() const
QVector< QRgb > mColorBuffer
bool interpolating() const
QPointer< QCPAxis > mColorAxis
A margin group allows synchronization of margin sides if working with multiple layout elements...
QCPRange & operator-=(const double &value)
QFont selectedFont() const
QCPDataSelection mSelection
QSharedPointer< QCPAxisTicker > mTicker
virtual void mouseMoveEvent(QMouseEvent *event, const QPointF &startPos) Q_DECL_OVERRIDE
QList< QCPItemPosition * > positions() const
QCPRange keyRange(bool &foundRange, QCP::SignDomain signDomain=QCP::sdBoth)
QCPItemPosition *const start
QRect labelSelectionBox() const
int bracketHeight() const
bool antialiasedZeroLine() const
Qt::KeyboardModifier mMultiSelectModifier
QFont selectedLabelFont() const
virtual void deselectEvent(bool *selectionStateChanged) Q_DECL_OVERRIDE
QList< QCPLayerable * > children() const
An anchor of an item to which positions can be attached to.
0x0100 Borders of fills (e.g. under or between graphs)
The abstract base class for all items in a plot.
QList< QCPItemAnchor * > anchors() const
static const double minRange
QVector< double > mTickVector
Selection behaves like stMultipleDataRanges, but if there are any data points selected, the entire plottable is drawn as selected.
bool mAutoAddPlottableToLegend
bool mMapImageInvalidated
QCPRange valueRange() const
Specialized axis ticker for time spans in units of milliseconds to days.
QCPColorGradient gradient() const
A paint buffer based on QPixmap, using software raster rendering.
QImage mUndersampledMapImage
static bool sortKeyIsMainKey()
bool operator!=(const QCPColorGradient &other) const
LineStyle lineStyle() const
QCPAxisRect * axisRect() const
QPixmap mBackgroundPixmap
QCPAbstractItem * mParentItem
BracketStyle style() const
static QCPBarsData fromSortKey(double sortKey)
0x0080 Scatter symbols of plottables (excluding scatter symbols of type ssPixmap) ...
bool noAntialiasingOnDrag() const
TickStepStrategy mTickStepStrategy
Qt::AspectRatioMode backgroundScaledMode() const
Specialized axis ticker which allows arbitrary labels at specified coordinates.
virtual int elementCount() const Q_DECL_OVERRIDE
QCPSelectionRect * selectionRect() const
A layout that places child elements aligned to the border or arbitrarily positioned.
QCPScatterStyle scatterStyle() const
QPen selectedBasePen() const
0x080 All other objects are selectable (e.g. your own derived layerables, other layout elements...
Whether to use immediate or queued refresh depends on whether the plotting hint QCP::phImmediateRefre...
virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE
0x002 Axis ranges are zoomable with the mouse wheel (see QCPAxisRect::setRangeZoom, QCPAxisRect::setRangeZoomAxes)
QCPLayout * mParentLayout
void coordsToPixels(double key, double value, double &x, double &y) const
QCustomPlot * mParentPlot
QCPItemAnchor *const left
Qt::TimeSpec mDateTimeSpec
QPen iconBorderPen() const
A plottable representing a bar chart in a plot.
Qt::AspectRatioMode mAspectRatioMode
double devicePixelRatio() const
bool operator!=(const QCPDataRange &other) const
QCPLayoutGrid * plotLayout() const
QFont tickLabelFont() const
double stackingGap() const
QCPColorMapData * mMapData
0x8000 Other elements that don't fit into any of the existing categories
QPen selectedIconBorderPen() const
QCPLineEnding tail() const
QCPItemAnchor *const topRight
Qt::Orientations mRangeZoom
QColor selectedTextColor() const
QColor mSelectedTextColor
QSharedPointer< QCPErrorBarsDataContainer > mDataContainer
QPixmap background() const
void add(const QCPDataContainer< DataType > &data)
QCPRange valueRange() const
ROSCPP_DECL std::string append(const std::string &left, const std::string &right)
A selection decorator which draws brackets around each selected data segment.
QHash< QCPAxis::AxisType, QList< QCPAxis * > > mAxes
QVector< double > outliers
QCP::PlottingHints plottingHints() const
0x01 Mode for vectorized painting (e.g. PDF export). For example, this prevents some antialiasing fix...
QCPItemAnchor *const bottom
virtual QPointF dataPixelPosition(int index) const Q_DECL_OVERRIDE
QCPScatterStyle mScatterStyle
Base class for all drawable objects.
Specialized axis ticker with a fixed tick step.
QCPDataSelection selection() const
bool mOpenGlCacheLabelsBackup
QCustomPlot * mParentPlot
static bool sortKeyIsMainKey()
QCPAbstractPlottable1D(QCPAxis *keyAxis, QCPAxis *valueAxis)
QCP::SelectionType selectable() const
QCP::AntialiasedElements mNotAADragBackup
QCPLayout * layout() const
QVector< double > mSubTickVector
double bufferDevicePixelRatio() const
The plottable is not selectable.
Resolution is given in dots per centimeter (dpcm)
bool mScaledPixmapInvalidated
bool antialiasedScatters() const
TFSIMD_FORCE_INLINE tfScalar length(const Quaternion &q)
QVector< DataType > mData
QBrush selectedBrush() const
QVector< double > tickPositions
QList< QCPLayoutElement * > elements(QCP::MarginSide side) const
Qt::Alignment mPositionAlignment
QCPItemAnchor *const right
QCPItemAnchor *const center
A plottable representing a graph in a plot.
int selectionTolerance() const
QHash< TimeUnit, QString > mFormatPattern
QVector< QString > mTickVectorLabels
QCPAxis * valueAxis() const
QCPDataContainer< QCPFinancialData > QCPFinancialDataContainer
The negative sign domain, i.e. numbers smaller than zero.
QCPItemPosition *const position
void selectableChanged(QCP::SelectionType selectable)
QPointer< QCPLayerable > mMouseEventLayerable
0x040 Items are selectable (Rectangles, Arrows, Textitems, etc. see QCPAbstractItem) ...
Holds the two-dimensional data of a QCPColorMap plottable.
QCPColorGradient mGradient
virtual void donePainting()
QColor selectedLabelColor() const
QSize minimumSize() const
The abstract base class for all data representing objects in a plot.
QCPItemAnchor *const bottom
QPen mSelectedIconBorderPen
QCPDataRange dataRange(int index=0) const
QCPItemAnchor *const center
virtual int calculateAutoMargin(QCP::MarginSide side) Q_DECL_OVERRIDE
void drawLine(const QLineF &line)
QSharedPointer< QCPDataContainer< DataType > > mDataContainer
QList< double > mColumnStretchFactors
0x0001 Axis base line and tick marks
const QMetaObject staticMetaObject
static Qt::Orientation orientation(AxisType type)
QString dateTimeFormat() const
QRect mTickLabelsSelectionBox
bool mNoAntialiasingOnDrag
PositionType type() const
Holds the data of one single error bar for QCPErrorBars.
SizeConstraintRect mSizeConstraintRect
LineStyle lineStyle() const
QCPItemAnchor * mParentAnchorY
Cosmetic pens are exported normally (e.g. in PDF exports, cosmetic pens always appear as 1 pixel on s...
FractionStyle mFractionStyle
QCPAxis::ScaleType dataScaleType() const
QList< Qt::Alignment > mInsetAlignment
A plottable representing a financial stock chart.
void getDataSegments(QList< QCPDataRange > &selectedSegments, QList< QCPDataRange > &unselectedSegments) const
void setAutoSqueeze(bool enabled)
QCPScatterStyle mScatterStyle
QCPItemPosition *const endDir
QCPSelectionDecorator * selectionDecorator() const
A plottable representing a two-dimensional color map in a plot.
int fieldWidth(TimeUnit unit) const
QVector< QString > tickLabels
QBrush brushNegative() const
QList< QCPItemAnchor * > mAnchors
bool operator==(const Rotation &a, const Rotation &b)
Qt::AspectRatioMode mBackgroundScaledMode
WidthType widthType() const
QCPItemAnchor * parentAnchor() const
QCPRange & operator*=(const double &value)
QVector< double > subTickPositions
virtual QCPPlottableInterface1D * interface1D()
static const double maxRange
BracketStyle bracketStyle() const
virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const =0
bool rangeReversed() const
QList< QList< QCPLayoutElement * > > mElements
QHash< QCP::MarginSide, QList< QCPLayoutElement * > > mChildren
QCPScatterStyle mScatterStyle
QCPSelectionRect * mSelectionRect
QCPItemPosition *const point1
SelectableParts mSelectedParts
virtual bool sortKeyIsMainKey() const Q_DECL_OVERRIDE
QStack< bool > mAntialiasingStack
QMap< double, QColor > colorStops() const
A line from one point to another.
const QCPRange range() const
QList< QCPLayer * > mLayers
QColor tickLabelColor() const
Holds the data of one single data point for QCPFinancial.
QCPDataContainer< QCPGraphData > QCPGraphDataContainer
When dragging the mouse, a selection rect becomes active. Upon releasing, plottable data points that ...
QCPRange dataBounds() const
Resolution is given in dots per meter (dpm)
QFont selectedFont() const
QSharedPointer< QCPGraphDataContainer > data() const
void limitIteratorsToDataRange(const_iterator &begin, const_iterator &end, const QCPDataRange &dataRange) const
A plottable that adds a set of error bars to other plottables.
virtual void wheelEvent(QWheelEvent *event)
ColorInterpolation mColorInterpolation
virtual void mouseMoveEvent(QMouseEvent *event, const QPointF &startPos)
QCPItemAnchor *const right
QCPItemAnchor *const bottomLeft
double dot(const QCPVector2D &vec) const
QCPItemAnchor *const topLeft
QCPItemAnchor *const left
QCPColorMapData * data() const