LARS
LARS (Light Augmented Reality System) is an open-source framework for light-based interaction and real-time tracking in multi-robot experiments. Inspired by ARK, LARS extends the augmented reality paradigm to robotic collectives by projecting dynamic visual cues and environments onto the arena, enabling new experimental possibilities for collective robotics research, education, and outreach. LARS features integrated tracking, light projection, and modular experiment control with a user-friendly Qt GUI.
Loading...
Searching...
No Matches
qcustomplot.h
1/***************************************************************************
2** **
3** QCustomPlot, an easy to use, modern plotting widget for Qt **
4** Copyright (C) 2011-2021 Emanuel Eichhammer **
5** **
6** This program is free software: you can redistribute it and/or modify **
7** it under the terms of the GNU General Public License as published by **
8** the Free Software Foundation, either version 3 of the License, or **
9** (at your option) any later version. **
10** **
11** This program is distributed in the hope that it will be useful, **
12** but WITHOUT ANY WARRANTY; without even the implied warranty of **
13** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the **
14** GNU General Public License for more details. **
15** **
16** You should have received a copy of the GNU General Public License **
17** along with this program. If not, see http://www.gnu.org/licenses/. **
18** **
19****************************************************************************
20** Author: Emanuel Eichhammer **
21** Website/Contact: http://www.qcustomplot.com/ **
22** Date: 29.03.21 **
23** Version: 2.1.0 **
24****************************************************************************/
25
26#ifndef QCUSTOMPLOT_H
27#define QCUSTOMPLOT_H
28
29#include <QtCore/qglobal.h>
30
31// some Qt version/configuration dependent macros to include or exclude certain code paths:
32#ifdef QCUSTOMPLOT_USE_OPENGL
33# if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
34# define QCP_OPENGL_PBUFFER
35# else
36# define QCP_OPENGL_FBO
37# endif
38# if QT_VERSION >= QT_VERSION_CHECK(5, 3, 0)
39# define QCP_OPENGL_OFFSCREENSURFACE
40# endif
41#endif
42
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
47# endif
48#endif
49
50#include <QtCore/QObject>
51#include <QtCore/QPointer>
52#include <QtCore/QSharedPointer>
53#include <QtCore/QTimer>
54#include <QtGui/QPainter>
55#include <QtGui/QPainterPath>
56#include <QtGui/QPaintEvent>
57#include <QtGui/QMouseEvent>
58#include <QtGui/QWheelEvent>
59#include <QtGui/QPixmap>
60#include <QtCore/QVector>
61#include <QtCore/QString>
62#include <QtCore/QDateTime>
63#include <QtCore/QMultiMap>
64#include <QtCore/QFlags>
65#include <QtCore/QDebug>
66#include <QtCore/QStack>
67#include <QtCore/QCache>
68#include <QtCore/QMargins>
69#include <qmath.h>
70#include <limits>
71#include <algorithm>
72#ifdef QCP_OPENGL_FBO
73# include <QtGui/QOpenGLContext>
74# if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
75# include <QtGui/QOpenGLFramebufferObject>
76# else
77# include <QOpenGLFramebufferObject>
78# include <QOpenGLPaintDevice>
79# endif
80# ifdef QCP_OPENGL_OFFSCREENSURFACE
81# include <QtGui/QOffscreenSurface>
82# else
83# include <QtGui/QWindow>
84# endif
85#endif
86#ifdef QCP_OPENGL_PBUFFER
87# include <QtOpenGL/QGLPixelBuffer>
88#endif
89#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
90# include <qnumeric.h>
91# include <QtGui/QWidget>
92# include <QtGui/QPrinter>
93# include <QtGui/QPrintEngine>
94#else
95# include <QtNumeric>
96# include <QtWidgets/QWidget>
97# include <QtPrintSupport/QtPrintSupport>
98#endif
99#if QT_VERSION >= QT_VERSION_CHECK(4, 8, 0)
100# include <QtCore/QElapsedTimer>
101#endif
102# if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0)
103# include <QtCore/QTimeZone>
104#endif
105
106class QCPPainter;
107class QCustomPlot;
108class QCPLayerable;
109class QCPLayoutElement;
110class QCPLayout;
111class QCPAxis;
112class QCPAxisRect;
115class QCPGraph;
116class QCPAbstractItem;
118class QCPLegend;
119class QCPItemPosition;
120class QCPLayer;
122class QCPSelectionRect;
123class QCPColorMap;
124class QCPColorScale;
125class QCPBars;
128class QCPPolarGrid;
129class QCPPolarGraph;
130
131/* including file 'src/global.h' */
132/* modified 2021-03-29T02:30:44, size 16981 */
133
134#define QCUSTOMPLOT_VERSION_STR "2.1.0"
135#define QCUSTOMPLOT_VERSION 0x020100
136
137// decl definitions for shared library compilation/usage:
138#if defined(QT_STATIC_BUILD)
139# define QCP_LIB_DECL
140#elif defined(QCUSTOMPLOT_COMPILE_LIBRARY)
141# define QCP_LIB_DECL Q_DECL_EXPORT
142#elif defined(QCUSTOMPLOT_USE_LIBRARY)
143# define QCP_LIB_DECL Q_DECL_IMPORT
144#else
145# define QCP_LIB_DECL
146#endif
147
148// define empty macro for Q_DECL_OVERRIDE if it doesn't exist (Qt < 5)
149#ifndef Q_DECL_OVERRIDE
150# define Q_DECL_OVERRIDE
151#endif
152
159#ifndef Q_MOC_RUN
160namespace QCP {
161#else
162class QCP { // when in moc-run, make it look like a class, so we get Q_GADGET, Q_ENUMS/Q_FLAGS features in namespace
163 Q_GADGET
164 Q_ENUMS(ExportPen)
165 Q_ENUMS(ResolutionUnit)
166 Q_ENUMS(SignDomain)
167 Q_ENUMS(MarginSide)
168 Q_FLAGS(MarginSides)
169 Q_ENUMS(AntialiasedElement)
170 Q_FLAGS(AntialiasedElements)
171 Q_ENUMS(PlottingHint)
172 Q_FLAGS(PlottingHints)
173 Q_ENUMS(Interaction)
174 Q_FLAGS(Interactions)
175 Q_ENUMS(SelectionRectMode)
176 Q_ENUMS(SelectionType)
177public:
178#endif
179
190
198 };
199
210 };
211
217enum MarginSide { msLeft = 0x01
218 ,msRight = 0x02
219 ,msTop = 0x04
220 ,msBottom = 0x08
221 ,msAll = 0xFF
222 ,msNone = 0x00
223 };
224Q_DECLARE_FLAGS(MarginSides, MarginSide)
225
226
236 ,aeGrid = 0x0002
237 ,aeSubGrid = 0x0004
238 ,aeLegend = 0x0008
239 ,aeLegendItems = 0x0010
240 ,aePlottables = 0x0020
241 ,aeItems = 0x0040
242 ,aeScatters = 0x0080
243 ,aeFills = 0x0100
244 ,aeZeroLine = 0x0200
245 ,aeOther = 0x8000
246 ,aeAll = 0xFFFF
247 ,aeNone = 0x0000
248 };
249Q_DECLARE_FLAGS(AntialiasedElements, AntialiasedElement)
250
251
256enum PlottingHint { phNone = 0x000
262 };
263Q_DECLARE_FLAGS(PlottingHints, PlottingHint)
264
265
272enum Interaction { iNone = 0x000
273 ,iRangeDrag = 0x001
274 ,iRangeZoom = 0x002
275 ,iMultiSelect = 0x004
277 ,iSelectAxes = 0x010
279 ,iSelectItems = 0x040
280 ,iSelectOther = 0x080
282 };
283Q_DECLARE_FLAGS(Interactions, Interaction)
284
285
295
320
327inline bool isInvalidData(double value)
328{
329 return qIsNaN(value) || qIsInf(value);
330}
331
337inline bool isInvalidData(double value1, double value2)
338{
339 return isInvalidData(value1) || isInvalidData(value2);
340}
341
348inline void setMarginValue(QMargins &margins, QCP::MarginSide side, int value)
349{
350 switch (side)
351 {
352 case QCP::msLeft: margins.setLeft(value); break;
353 case QCP::msRight: margins.setRight(value); break;
354 case QCP::msTop: margins.setTop(value); break;
355 case QCP::msBottom: margins.setBottom(value); break;
356 case QCP::msAll: margins = QMargins(value, value, value, value); break;
357 default: break;
358 }
359}
360
368inline int getMarginValue(const QMargins &margins, QCP::MarginSide side)
369{
370 switch (side)
371 {
372 case QCP::msLeft: return margins.left();
373 case QCP::msRight: return margins.right();
374 case QCP::msTop: return margins.top();
375 case QCP::msBottom: return margins.bottom();
376 default: break;
377 }
378 return 0;
379}
380
381
382extern const QMetaObject staticMetaObject; // in moc-run we create a static meta object for QCP "fake" object. This line is the link to it via QCP::staticMetaObject in normal operation as namespace
383
384} // end of namespace QCP
385Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::AntialiasedElements)
386Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::PlottingHints)
387Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::MarginSides)
388Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::Interactions)
389Q_DECLARE_METATYPE(QCP::ExportPen)
390Q_DECLARE_METATYPE(QCP::ResolutionUnit)
391Q_DECLARE_METATYPE(QCP::SignDomain)
392Q_DECLARE_METATYPE(QCP::MarginSide)
393Q_DECLARE_METATYPE(QCP::AntialiasedElement)
394Q_DECLARE_METATYPE(QCP::PlottingHint)
395Q_DECLARE_METATYPE(QCP::Interaction)
396Q_DECLARE_METATYPE(QCP::SelectionRectMode)
397Q_DECLARE_METATYPE(QCP::SelectionType)
398
399/* end of 'src/global.h' */
400
401
402/* including file 'src/vector2d.h' */
403/* modified 2021-03-29T02:30:44, size 4988 */
404
405class QCP_LIB_DECL QCPVector2D
406{
407public:
408 QCPVector2D();
409 QCPVector2D(double x, double y);
410 QCPVector2D(const QPoint &point);
411 QCPVector2D(const QPointF &point);
412
413 // getters:
414 double x() const { return mX; }
415 double y() const { return mY; }
416 double &rx() { return mX; }
417 double &ry() { return mY; }
418
419 // setters:
420 void setX(double x) { mX = x; }
421 void setY(double y) { mY = y; }
422
423 // non-virtual methods:
424 double length() const { return qSqrt(mX*mX+mY*mY); }
425 double lengthSquared() const { return mX*mX+mY*mY; }
426 double angle() const { return qAtan2(mY, mX); }
427 QPoint toPoint() const { return QPoint(int(mX), int(mY)); }
428 QPointF toPointF() const { return QPointF(mX, mY); }
429
430 bool isNull() const { return qIsNull(mX) && qIsNull(mY); }
431 void normalize();
432 QCPVector2D normalized() const;
433 QCPVector2D perpendicular() const { return QCPVector2D(-mY, mX); }
434 double dot(const QCPVector2D &vec) const { return mX*vec.mX+mY*vec.mY; }
435 double distanceSquaredToLine(const QCPVector2D &start, const QCPVector2D &end) const;
436 double distanceSquaredToLine(const QLineF &line) const;
437 double distanceToStraightLine(const QCPVector2D &base, const QCPVector2D &direction) const;
438
439 QCPVector2D &operator*=(double factor);
440 QCPVector2D &operator/=(double divisor);
441 QCPVector2D &operator+=(const QCPVector2D &vector);
442 QCPVector2D &operator-=(const QCPVector2D &vector);
443
444private:
445 // property members:
446 double mX, mY;
447
448 friend inline const QCPVector2D operator*(double factor, const QCPVector2D &vec);
449 friend inline const QCPVector2D operator*(const QCPVector2D &vec, double factor);
450 friend inline const QCPVector2D operator/(const QCPVector2D &vec, double divisor);
451 friend inline const QCPVector2D operator+(const QCPVector2D &vec1, const QCPVector2D &vec2);
452 friend inline const QCPVector2D operator-(const QCPVector2D &vec1, const QCPVector2D &vec2);
453 friend inline const QCPVector2D operator-(const QCPVector2D &vec);
454};
455Q_DECLARE_TYPEINFO(QCPVector2D, Q_MOVABLE_TYPE);
456
457inline const QCPVector2D operator*(double factor, const QCPVector2D &vec) { return QCPVector2D(vec.mX*factor, vec.mY*factor); }
458inline const QCPVector2D operator*(const QCPVector2D &vec, double factor) { return QCPVector2D(vec.mX*factor, vec.mY*factor); }
459inline const QCPVector2D operator/(const QCPVector2D &vec, double divisor) { return QCPVector2D(vec.mX/divisor, vec.mY/divisor); }
460inline const QCPVector2D operator+(const QCPVector2D &vec1, const QCPVector2D &vec2) { return QCPVector2D(vec1.mX+vec2.mX, vec1.mY+vec2.mY); }
461inline const QCPVector2D operator-(const QCPVector2D &vec1, const QCPVector2D &vec2) { return QCPVector2D(vec1.mX-vec2.mX, vec1.mY-vec2.mY); }
462inline const QCPVector2D operator-(const QCPVector2D &vec) { return QCPVector2D(-vec.mX, -vec.mY); }
463
468inline QDebug operator<< (QDebug d, const QCPVector2D &vec)
469{
470 d.nospace() << "QCPVector2D(" << vec.x() << ", " << vec.y() << ")";
471 return d.space();
472}
473
474/* end of 'src/vector2d.h' */
475
476
477/* including file 'src/painter.h' */
478/* modified 2021-03-29T02:30:44, size 4035 */
479
480class QCP_LIB_DECL QCPPainter : public QPainter
481{
482 Q_GADGET
483public:
488 enum PainterMode { pmDefault = 0x00
490 ,pmNoCaching = 0x02
492 };
493 Q_ENUMS(PainterMode)
494 Q_FLAGS(PainterModes)
495 Q_DECLARE_FLAGS(PainterModes, PainterMode)
496
497 QCPPainter();
498 explicit QCPPainter(QPaintDevice *device);
499
500 // getters:
501 bool antialiasing() const { return testRenderHint(QPainter::Antialiasing); }
502 PainterModes modes() const { return mModes; }
503
504 // setters:
505 void setAntialiasing(bool enabled);
506 void setMode(PainterMode mode, bool enabled=true);
507 void setModes(PainterModes modes);
508
509 // methods hiding non-virtual base class functions (QPainter bug workarounds):
510 bool begin(QPaintDevice *device);
511 void setPen(const QPen &pen);
512 void setPen(const QColor &color);
513 void setPen(Qt::PenStyle penStyle);
514 void drawLine(const QLineF &line);
515 void drawLine(const QPointF &p1, const QPointF &p2) {drawLine(QLineF(p1, p2));}
516 void save();
517 void restore();
518
519 // non-virtual methods:
520 void makeNonCosmetic();
521
522protected:
523 // property members:
524 PainterModes mModes;
525 bool mIsAntialiasing;
526
527 // non-property members:
528 QStack<bool> mAntialiasingStack;
529};
530Q_DECLARE_OPERATORS_FOR_FLAGS(QCPPainter::PainterModes)
531Q_DECLARE_METATYPE(QCPPainter::PainterMode)
532
533/* end of 'src/painter.h' */
534
535
536/* including file 'src/paintbuffer.h' */
537/* modified 2021-03-29T02:30:44, size 5006 */
538
539class QCP_LIB_DECL QCPAbstractPaintBuffer
540{
541public:
542 explicit QCPAbstractPaintBuffer(const QSize &size, double devicePixelRatio);
543 virtual ~QCPAbstractPaintBuffer();
544
545 // getters:
546 QSize size() const { return mSize; }
547 bool invalidated() const { return mInvalidated; }
548 double devicePixelRatio() const { return mDevicePixelRatio; }
549
550 // setters:
551 void setSize(const QSize &size);
552 void setInvalidated(bool invalidated=true);
553 void setDevicePixelRatio(double ratio);
554
555 // introduced virtual methods:
556 virtual QCPPainter *startPainting() = 0;
557 virtual void donePainting() {}
558 virtual void draw(QCPPainter *painter) const = 0;
559 virtual void clear(const QColor &color) = 0;
560
561protected:
562 // property members:
563 QSize mSize;
564 double mDevicePixelRatio;
565
566 // non-property members:
567 bool mInvalidated;
568
569 // introduced virtual methods:
570 virtual void reallocateBuffer() = 0;
571};
572
573
575{
576public:
577 explicit QCPPaintBufferPixmap(const QSize &size, double devicePixelRatio);
578 virtual ~QCPPaintBufferPixmap() Q_DECL_OVERRIDE;
579
580 // reimplemented virtual methods:
581 virtual QCPPainter *startPainting() Q_DECL_OVERRIDE;
582 virtual void draw(QCPPainter *painter) const Q_DECL_OVERRIDE;
583 void clear(const QColor &color) Q_DECL_OVERRIDE;
584
585protected:
586 // non-property members:
587 QPixmap mBuffer;
588
589 // reimplemented virtual methods:
590 virtual void reallocateBuffer() Q_DECL_OVERRIDE;
591};
592
593
594#ifdef QCP_OPENGL_PBUFFER
595class QCP_LIB_DECL QCPPaintBufferGlPbuffer : public QCPAbstractPaintBuffer
596{
597public:
598 explicit QCPPaintBufferGlPbuffer(const QSize &size, double devicePixelRatio, int multisamples);
599 virtual ~QCPPaintBufferGlPbuffer() Q_DECL_OVERRIDE;
600
601 // reimplemented virtual methods:
602 virtual QCPPainter *startPainting() Q_DECL_OVERRIDE;
603 virtual void draw(QCPPainter *painter) const Q_DECL_OVERRIDE;
604 void clear(const QColor &color) Q_DECL_OVERRIDE;
605
606protected:
607 // non-property members:
608 QGLPixelBuffer *mGlPBuffer;
609 int mMultisamples;
610
611 // reimplemented virtual methods:
612 virtual void reallocateBuffer() Q_DECL_OVERRIDE;
613};
614#endif // QCP_OPENGL_PBUFFER
615
616
617#ifdef QCP_OPENGL_FBO
618class QCP_LIB_DECL QCPPaintBufferGlFbo : public QCPAbstractPaintBuffer
619{
620public:
621 explicit QCPPaintBufferGlFbo(const QSize &size, double devicePixelRatio, QWeakPointer<QOpenGLContext> glContext, QWeakPointer<QOpenGLPaintDevice> glPaintDevice);
622 virtual ~QCPPaintBufferGlFbo() Q_DECL_OVERRIDE;
623
624 // reimplemented virtual methods:
625 virtual QCPPainter *startPainting() Q_DECL_OVERRIDE;
626 virtual void donePainting() Q_DECL_OVERRIDE;
627 virtual void draw(QCPPainter *painter) const Q_DECL_OVERRIDE;
628 void clear(const QColor &color) Q_DECL_OVERRIDE;
629
630protected:
631 // non-property members:
632 QWeakPointer<QOpenGLContext> mGlContext;
633 QWeakPointer<QOpenGLPaintDevice> mGlPaintDevice;
634 QOpenGLFramebufferObject *mGlFrameBuffer;
635
636 // reimplemented virtual methods:
637 virtual void reallocateBuffer() Q_DECL_OVERRIDE;
638};
639#endif // QCP_OPENGL_FBO
640
641/* end of 'src/paintbuffer.h' */
642
643
644/* including file 'src/layer.h' */
645/* modified 2021-03-29T02:30:44, size 7038 */
646
647class QCP_LIB_DECL QCPLayer : public QObject
648{
649 Q_OBJECT
651 Q_PROPERTY(QCustomPlot* parentPlot READ parentPlot)
652 Q_PROPERTY(QString name READ name)
653 Q_PROPERTY(int index READ index)
654 Q_PROPERTY(QList<QCPLayerable*> children READ children)
655 Q_PROPERTY(bool visible READ visible WRITE setVisible)
656 Q_PROPERTY(LayerMode mode READ mode WRITE setMode)
658public:
659
670 Q_ENUMS(LayerMode)
671
672 QCPLayer(QCustomPlot* parentPlot, const QString &layerName);
673 virtual ~QCPLayer();
674
675 // getters:
676 QCustomPlot *parentPlot() const { return mParentPlot; }
677 QString name() const { return mName; }
678 int index() const { return mIndex; }
679 QList<QCPLayerable*> children() const { return mChildren; }
680 bool visible() const { return mVisible; }
681 LayerMode mode() const { return mMode; }
682
683 // setters:
684 void setVisible(bool visible);
685 void setMode(LayerMode mode);
686
687 // non-virtual methods:
688 void replot();
689
690protected:
691 // property members:
692 QCustomPlot *mParentPlot;
693 QString mName;
694 int mIndex;
695 QList<QCPLayerable*> mChildren;
696 bool mVisible;
697 LayerMode mMode;
698
699 // non-property members:
700 QWeakPointer<QCPAbstractPaintBuffer> mPaintBuffer;
701
702 // non-virtual methods:
703 void draw(QCPPainter *painter);
704 void drawToPaintBuffer();
705 void addChild(QCPLayerable *layerable, bool prepend);
706 void removeChild(QCPLayerable *layerable);
707
708private:
709 Q_DISABLE_COPY(QCPLayer)
710
711 friend class QCustomPlot;
712 friend class QCPLayerable;
713};
714Q_DECLARE_METATYPE(QCPLayer::LayerMode)
715
716class QCP_LIB_DECL QCPLayerable : public QObject
717{
718 Q_OBJECT
720 Q_PROPERTY(bool visible READ visible WRITE setVisible)
721 Q_PROPERTY(QCustomPlot* parentPlot READ parentPlot)
723 Q_PROPERTY(QCPLayer* layer READ layer WRITE setLayer NOTIFY layerChanged)
724 Q_PROPERTY(bool antialiased READ antialiased WRITE setAntialiased)
726public:
727 QCPLayerable(QCustomPlot *plot, QString targetLayer=QString(), QCPLayerable *parentLayerable=nullptr);
728 virtual ~QCPLayerable();
729
730 // getters:
731 bool visible() const { return mVisible; }
732 QCustomPlot *parentPlot() const { return mParentPlot; }
733 QCPLayerable *parentLayerable() const { return mParentLayerable.data(); }
734 QCPLayer *layer() const { return mLayer; }
735 bool antialiased() const { return mAntialiased; }
736
737 // setters:
738 void setVisible(bool on);
739 Q_SLOT bool setLayer(QCPLayer *layer);
740 bool setLayer(const QString &layerName);
741 void setAntialiased(bool enabled);
742
743 // introduced virtual methods:
744 virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const;
745
746 // non-property methods:
747 bool realVisibility() const;
748
749signals:
750 void layerChanged(QCPLayer *newLayer);
751
752protected:
753 // property members:
754 bool mVisible;
755 QCustomPlot *mParentPlot;
756 QPointer<QCPLayerable> mParentLayerable;
757 QCPLayer *mLayer;
758 bool mAntialiased;
759
760 // introduced virtual methods:
761 virtual void parentPlotInitialized(QCustomPlot *parentPlot);
762 virtual QCP::Interaction selectionCategory() const;
763 virtual QRect clipRect() const;
764 virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const = 0;
765 virtual void draw(QCPPainter *painter) = 0;
766 // selection events:
767 virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged);
768 virtual void deselectEvent(bool *selectionStateChanged);
769 // low-level mouse events:
770 virtual void mousePressEvent(QMouseEvent *event, const QVariant &details);
771 virtual void mouseMoveEvent(QMouseEvent *event, const QPointF &startPos);
772 virtual void mouseReleaseEvent(QMouseEvent *event, const QPointF &startPos);
773 virtual void mouseDoubleClickEvent(QMouseEvent *event, const QVariant &details);
774 virtual void wheelEvent(QWheelEvent *event);
775
776 // non-property methods:
777 void initializeParentPlot(QCustomPlot *parentPlot);
778 void setParentLayerable(QCPLayerable* parentLayerable);
779 bool moveToLayer(QCPLayer *layer, bool prepend);
780 void applyAntialiasingHint(QCPPainter *painter, bool localAntialiased, QCP::AntialiasedElement overrideElement) const;
781
782private:
783 Q_DISABLE_COPY(QCPLayerable)
784
785 friend class QCustomPlot;
786 friend class QCPLayer;
787 friend class QCPAxisRect;
788};
789
790/* end of 'src/layer.h' */
791
792
793/* including file 'src/axis/range.h' */
794/* modified 2021-03-29T02:30:44, size 5280 */
795
796class QCP_LIB_DECL QCPRange
797{
798public:
799 double lower, upper;
800
801 QCPRange();
802 QCPRange(double lower, double upper);
803
804 bool operator==(const QCPRange& other) const { return lower == other.lower && upper == other.upper; }
805 bool operator!=(const QCPRange& other) const { return !(*this == other); }
806
807 QCPRange &operator+=(const double& value) { lower+=value; upper+=value; return *this; }
808 QCPRange &operator-=(const double& value) { lower-=value; upper-=value; return *this; }
809 QCPRange &operator*=(const double& value) { lower*=value; upper*=value; return *this; }
810 QCPRange &operator/=(const double& value) { lower/=value; upper/=value; return *this; }
811 friend inline const QCPRange operator+(const QCPRange&, double);
812 friend inline const QCPRange operator+(double, const QCPRange&);
813 friend inline const QCPRange operator-(const QCPRange& range, double value);
814 friend inline const QCPRange operator*(const QCPRange& range, double value);
815 friend inline const QCPRange operator*(double value, const QCPRange& range);
816 friend inline const QCPRange operator/(const QCPRange& range, double value);
817
818 double size() const { return upper-lower; }
819 double center() const { return (upper+lower)*0.5; }
820 void normalize() { if (lower > upper) qSwap(lower, upper); }
821 void expand(const QCPRange &otherRange);
822 void expand(double includeCoord);
823 QCPRange expanded(const QCPRange &otherRange) const;
824 QCPRange expanded(double includeCoord) const;
825 QCPRange bounded(double lowerBound, double upperBound) const;
826 QCPRange sanitizedForLogScale() const;
827 QCPRange sanitizedForLinScale() const;
828 bool contains(double value) const { return value >= lower && value <= upper; }
829
830 static bool validRange(double lower, double upper);
831 static bool validRange(const QCPRange &range);
832 static const double minRange;
833 static const double maxRange;
834
835};
836Q_DECLARE_TYPEINFO(QCPRange, Q_MOVABLE_TYPE);
837
842inline QDebug operator<< (QDebug d, const QCPRange &range)
843{
844 d.nospace() << "QCPRange(" << range.lower << ", " << range.upper << ")";
845 return d.space();
846}
847
851inline const QCPRange operator+(const QCPRange& range, double value)
852{
853 QCPRange result(range);
854 result += value;
855 return result;
856}
857
861inline const QCPRange operator+(double value, const QCPRange& range)
862{
863 QCPRange result(range);
864 result += value;
865 return result;
866}
867
871inline const QCPRange operator-(const QCPRange& range, double value)
872{
873 QCPRange result(range);
874 result -= value;
875 return result;
876}
877
881inline const QCPRange operator*(const QCPRange& range, double value)
882{
883 QCPRange result(range);
884 result *= value;
885 return result;
886}
887
891inline const QCPRange operator*(double value, const QCPRange& range)
892{
893 QCPRange result(range);
894 result *= value;
895 return result;
896}
897
901inline const QCPRange operator/(const QCPRange& range, double value)
902{
903 QCPRange result(range);
904 result /= value;
905 return result;
906}
907
908/* end of 'src/axis/range.h' */
909
910
911/* including file 'src/selection.h' */
912/* modified 2021-03-29T02:30:44, size 8569 */
913
914class QCP_LIB_DECL QCPDataRange
915{
916public:
917 QCPDataRange();
918 QCPDataRange(int begin, int end);
919
920 bool operator==(const QCPDataRange& other) const { return mBegin == other.mBegin && mEnd == other.mEnd; }
921 bool operator!=(const QCPDataRange& other) const { return !(*this == other); }
922
923 // getters:
924 int begin() const { return mBegin; }
925 int end() const { return mEnd; }
926 int size() const { return mEnd-mBegin; }
927 int length() const { return size(); }
928
929 // setters:
930 void setBegin(int begin) { mBegin = begin; }
931 void setEnd(int end) { mEnd = end; }
932
933 // non-property methods:
934 bool isValid() const { return (mEnd >= mBegin) && (mBegin >= 0); }
935 bool isEmpty() const { return length() == 0; }
936 QCPDataRange bounded(const QCPDataRange &other) const;
937 QCPDataRange expanded(const QCPDataRange &other) const;
938 QCPDataRange intersection(const QCPDataRange &other) const;
939 QCPDataRange adjusted(int changeBegin, int changeEnd) const { return QCPDataRange(mBegin+changeBegin, mEnd+changeEnd); }
940 bool intersects(const QCPDataRange &other) const;
941 bool contains(const QCPDataRange &other) const;
942
943private:
944 // property members:
945 int mBegin, mEnd;
946
947};
948Q_DECLARE_TYPEINFO(QCPDataRange, Q_MOVABLE_TYPE);
949
950
951class QCP_LIB_DECL QCPDataSelection
952{
953public:
954 explicit QCPDataSelection();
955 explicit QCPDataSelection(const QCPDataRange &range);
956
957 bool operator==(const QCPDataSelection& other) const;
958 bool operator!=(const QCPDataSelection& other) const { return !(*this == other); }
963 friend inline const QCPDataSelection operator+(const QCPDataSelection& a, const QCPDataSelection& b);
964 friend inline const QCPDataSelection operator+(const QCPDataRange& a, const QCPDataSelection& b);
965 friend inline const QCPDataSelection operator+(const QCPDataSelection& a, const QCPDataRange& b);
966 friend inline const QCPDataSelection operator+(const QCPDataRange& a, const QCPDataRange& b);
967 friend inline const QCPDataSelection operator-(const QCPDataSelection& a, const QCPDataSelection& b);
968 friend inline const QCPDataSelection operator-(const QCPDataRange& a, const QCPDataSelection& b);
969 friend inline const QCPDataSelection operator-(const QCPDataSelection& a, const QCPDataRange& b);
970 friend inline const QCPDataSelection operator-(const QCPDataRange& a, const QCPDataRange& b);
971
972 // getters:
973 int dataRangeCount() const { return mDataRanges.size(); }
974 int dataPointCount() const;
975 QCPDataRange dataRange(int index=0) const;
976 QList<QCPDataRange> dataRanges() const { return mDataRanges; }
977 QCPDataRange span() const;
978
979 // non-property methods:
980 void addDataRange(const QCPDataRange &dataRange, bool simplify=true);
981 void clear();
982 bool isEmpty() const { return mDataRanges.isEmpty(); }
983 void simplify();
984 void enforceType(QCP::SelectionType type);
985 bool contains(const QCPDataSelection &other) const;
986 QCPDataSelection intersection(const QCPDataRange &other) const;
987 QCPDataSelection intersection(const QCPDataSelection &other) const;
988 QCPDataSelection inverse(const QCPDataRange &outerRange) const;
989
990private:
991 // property members:
992 QList<QCPDataRange> mDataRanges;
993
994 inline static bool lessThanDataRangeBegin(const QCPDataRange &a, const QCPDataRange &b) { return a.begin() < b.begin(); }
995};
996Q_DECLARE_METATYPE(QCPDataSelection)
997
998
999
1003inline const QCPDataSelection operator+(const QCPDataSelection& a, const QCPDataSelection& b)
1004{
1005 QCPDataSelection result(a);
1006 result += b;
1007 return result;
1008}
1009
1015{
1016 QCPDataSelection result(a);
1017 result += b;
1018 return result;
1019}
1020
1026{
1027 QCPDataSelection result(a);
1028 result += b;
1029 return result;
1030}
1031
1036inline const QCPDataSelection operator+(const QCPDataRange& a, const QCPDataRange& b)
1037{
1038 QCPDataSelection result(a);
1039 result += b;
1040 return result;
1041}
1042
1047{
1048 QCPDataSelection result(a);
1049 result -= b;
1050 return result;
1051}
1052
1057{
1058 QCPDataSelection result(a);
1059 result -= b;
1060 return result;
1061}
1062
1067{
1068 QCPDataSelection result(a);
1069 result -= b;
1070 return result;
1071}
1072
1076inline const QCPDataSelection operator-(const QCPDataRange& a, const QCPDataRange& b)
1077{
1078 QCPDataSelection result(a);
1079 result -= b;
1080 return result;
1081}
1082
1087inline QDebug operator<< (QDebug d, const QCPDataRange &dataRange)
1088{
1089 d.nospace() << "QCPDataRange(" << dataRange.begin() << ", " << dataRange.end() << ")";
1090 return d;
1091}
1092
1097inline QDebug operator<< (QDebug d, const QCPDataSelection &selection)
1098{
1099 d.nospace() << "QCPDataSelection(";
1100 for (int i=0; i<selection.dataRangeCount(); ++i)
1101 {
1102 if (i != 0)
1103 d << ", ";
1104 d << selection.dataRange(i);
1105 }
1106 d << ")";
1107 return d;
1108}
1109
1110
1111
1112/* end of 'src/selection.h' */
1113
1114
1115/* including file 'src/selectionrect.h' */
1116/* modified 2021-03-29T02:30:44, size 3354 */
1117
1118class QCP_LIB_DECL QCPSelectionRect : public QCPLayerable
1119{
1120 Q_OBJECT
1121public:
1122 explicit QCPSelectionRect(QCustomPlot *parentPlot);
1123 virtual ~QCPSelectionRect() Q_DECL_OVERRIDE;
1124
1125 // getters:
1126 QRect rect() const { return mRect; }
1127 QCPRange range(const QCPAxis *axis) const;
1128 QPen pen() const { return mPen; }
1129 QBrush brush() const { return mBrush; }
1130 bool isActive() const { return mActive; }
1131
1132 // setters:
1133 void setPen(const QPen &pen);
1134 void setBrush(const QBrush &brush);
1135
1136 // non-property methods:
1137 Q_SLOT void cancel();
1138
1139signals:
1140 void started(QMouseEvent *event);
1141 void changed(const QRect &rect, QMouseEvent *event);
1142 void canceled(const QRect &rect, QInputEvent *event);
1143 void accepted(const QRect &rect, QMouseEvent *event);
1144
1145protected:
1146 // property members:
1147 QRect mRect;
1148 QPen mPen;
1149 QBrush mBrush;
1150 // non-property members:
1151 bool mActive;
1152
1153 // introduced virtual methods:
1154 virtual void startSelection(QMouseEvent *event);
1155 virtual void moveSelection(QMouseEvent *event);
1156 virtual void endSelection(QMouseEvent *event);
1157 virtual void keyPressEvent(QKeyEvent *event);
1158
1159 // reimplemented virtual methods
1160 virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const Q_DECL_OVERRIDE;
1161 virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
1162
1163 friend class QCustomPlot;
1164};
1165
1166/* end of 'src/selectionrect.h' */
1167
1168
1169/* including file 'src/layout.h' */
1170/* modified 2021-03-29T02:30:44, size 14279 */
1171
1172class QCP_LIB_DECL QCPMarginGroup : public QObject
1173{
1174 Q_OBJECT
1175public:
1176 explicit QCPMarginGroup(QCustomPlot *parentPlot);
1177 virtual ~QCPMarginGroup();
1178
1179 // non-virtual methods:
1180 QList<QCPLayoutElement*> elements(QCP::MarginSide side) const { return mChildren.value(side); }
1181 bool isEmpty() const;
1182 void clear();
1183
1184protected:
1185 // non-property members:
1186 QCustomPlot *mParentPlot;
1187 QHash<QCP::MarginSide, QList<QCPLayoutElement*> > mChildren;
1188
1189 // introduced virtual methods:
1190 virtual int commonMargin(QCP::MarginSide side) const;
1191
1192 // non-virtual methods:
1193 void addChild(QCP::MarginSide side, QCPLayoutElement *element);
1194 void removeChild(QCP::MarginSide side, QCPLayoutElement *element);
1195
1196private:
1197 Q_DISABLE_COPY(QCPMarginGroup)
1198
1199 friend class QCPLayoutElement;
1200};
1201
1202
1203class QCP_LIB_DECL QCPLayoutElement : public QCPLayerable
1204{
1205 Q_OBJECT
1207 Q_PROPERTY(QCPLayout* layout READ layout)
1208 Q_PROPERTY(QRect rect READ rect)
1209 Q_PROPERTY(QRect outerRect READ outerRect WRITE setOuterRect)
1210 Q_PROPERTY(QMargins margins READ margins WRITE setMargins)
1211 Q_PROPERTY(QMargins minimumMargins READ minimumMargins WRITE setMinimumMargins)
1212 Q_PROPERTY(QSize minimumSize READ minimumSize WRITE setMinimumSize)
1213 Q_PROPERTY(QSize maximumSize READ maximumSize WRITE setMaximumSize)
1214 Q_PROPERTY(SizeConstraintRect sizeConstraintRect READ sizeConstraintRect WRITE setSizeConstraintRect)
1216public:
1225 Q_ENUMS(UpdatePhase)
1226
1227
1237 };
1238 Q_ENUMS(SizeConstraintRect)
1239
1240 explicit QCPLayoutElement(QCustomPlot *parentPlot=nullptr);
1241 virtual ~QCPLayoutElement() Q_DECL_OVERRIDE;
1242
1243 // getters:
1244 QCPLayout *layout() const { return mParentLayout; }
1245 QRect rect() const { return mRect; }
1246 QRect outerRect() const { return mOuterRect; }
1247 QMargins margins() const { return mMargins; }
1248 QMargins minimumMargins() const { return mMinimumMargins; }
1249 QCP::MarginSides autoMargins() const { return mAutoMargins; }
1250 QSize minimumSize() const { return mMinimumSize; }
1251 QSize maximumSize() const { return mMaximumSize; }
1252 SizeConstraintRect sizeConstraintRect() const { return mSizeConstraintRect; }
1253 QCPMarginGroup *marginGroup(QCP::MarginSide side) const { return mMarginGroups.value(side, nullptr); }
1254 QHash<QCP::MarginSide, QCPMarginGroup*> marginGroups() const { return mMarginGroups; }
1255
1256 // setters:
1257 void setOuterRect(const QRect &rect);
1258 void setMargins(const QMargins &margins);
1259 void setMinimumMargins(const QMargins &margins);
1260 void setAutoMargins(QCP::MarginSides sides);
1261 void setMinimumSize(const QSize &size);
1262 void setMinimumSize(int width, int height);
1263 void setMaximumSize(const QSize &size);
1264 void setMaximumSize(int width, int height);
1265 void setSizeConstraintRect(SizeConstraintRect constraintRect);
1266 void setMarginGroup(QCP::MarginSides sides, QCPMarginGroup *group);
1267
1268 // introduced virtual methods:
1269 virtual void update(UpdatePhase phase);
1270 virtual QSize minimumOuterSizeHint() const;
1271 virtual QSize maximumOuterSizeHint() const;
1272 virtual QList<QCPLayoutElement*> elements(bool recursive) const;
1273
1274 // reimplemented virtual methods:
1275 virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE;
1276
1277protected:
1278 // property members:
1279 QCPLayout *mParentLayout;
1280 QSize mMinimumSize, mMaximumSize;
1281 SizeConstraintRect mSizeConstraintRect;
1282 QRect mRect, mOuterRect;
1283 QMargins mMargins, mMinimumMargins;
1284 QCP::MarginSides mAutoMargins;
1285 QHash<QCP::MarginSide, QCPMarginGroup*> mMarginGroups;
1286
1287 // introduced virtual methods:
1288 virtual int calculateAutoMargin(QCP::MarginSide side);
1289 virtual void layoutChanged();
1290
1291 // reimplemented virtual methods:
1292 virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const Q_DECL_OVERRIDE { Q_UNUSED(painter) }
1293 virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE { Q_UNUSED(painter) }
1294 virtual void parentPlotInitialized(QCustomPlot *parentPlot) Q_DECL_OVERRIDE;
1295
1296private:
1297 Q_DISABLE_COPY(QCPLayoutElement)
1298
1299 friend class QCustomPlot;
1300 friend class QCPLayout;
1301 friend class QCPMarginGroup;
1302};
1303Q_DECLARE_METATYPE(QCPLayoutElement::UpdatePhase)
1304
1305
1306class QCP_LIB_DECL QCPLayout : public QCPLayoutElement
1307{
1308 Q_OBJECT
1309public:
1310 explicit QCPLayout();
1311
1312 // reimplemented virtual methods:
1313 virtual void update(UpdatePhase phase) Q_DECL_OVERRIDE;
1314 virtual QList<QCPLayoutElement*> elements(bool recursive) const Q_DECL_OVERRIDE;
1315
1316 // introduced virtual methods:
1317 virtual int elementCount() const = 0;
1318 virtual QCPLayoutElement* elementAt(int index) const = 0;
1319 virtual QCPLayoutElement* takeAt(int index) = 0;
1320 virtual bool take(QCPLayoutElement* element) = 0;
1321 virtual void simplify();
1322
1323 // non-virtual methods:
1324 bool removeAt(int index);
1325 bool remove(QCPLayoutElement* element);
1326 void clear();
1327
1328protected:
1329 // introduced virtual methods:
1330 virtual void updateLayout();
1331
1332 // non-virtual methods:
1333 void sizeConstraintsChanged() const;
1334 void adoptElement(QCPLayoutElement *el);
1335 void releaseElement(QCPLayoutElement *el);
1336 QVector<int> getSectionSizes(QVector<int> maxSizes, QVector<int> minSizes, QVector<double> stretchFactors, int totalSize) const;
1337 static QSize getFinalMinimumOuterSize(const QCPLayoutElement *el);
1338 static QSize getFinalMaximumOuterSize(const QCPLayoutElement *el);
1339
1340private:
1341 Q_DISABLE_COPY(QCPLayout)
1342 friend class QCPLayoutElement;
1343};
1344
1345
1346class QCP_LIB_DECL QCPLayoutGrid : public QCPLayout
1347{
1348 Q_OBJECT
1350 Q_PROPERTY(int rowCount READ rowCount)
1351 Q_PROPERTY(int columnCount READ columnCount)
1352 Q_PROPERTY(QList<double> columnStretchFactors READ columnStretchFactors WRITE setColumnStretchFactors)
1353 Q_PROPERTY(QList<double> rowStretchFactors READ rowStretchFactors WRITE setRowStretchFactors)
1354 Q_PROPERTY(int columnSpacing READ columnSpacing WRITE setColumnSpacing)
1355 Q_PROPERTY(int rowSpacing READ rowSpacing WRITE setRowSpacing)
1356 Q_PROPERTY(FillOrder fillOrder READ fillOrder WRITE setFillOrder)
1357 Q_PROPERTY(int wrap READ wrap WRITE setWrap)
1359public:
1360
1371 Q_ENUMS(FillOrder)
1372
1373 explicit QCPLayoutGrid();
1374 virtual ~QCPLayoutGrid() Q_DECL_OVERRIDE;
1375
1376 // getters:
1377 int rowCount() const { return mElements.size(); }
1378 int columnCount() const { return mElements.size() > 0 ? mElements.first().size() : 0; }
1379 QList<double> columnStretchFactors() const { return mColumnStretchFactors; }
1380 QList<double> rowStretchFactors() const { return mRowStretchFactors; }
1381 int columnSpacing() const { return mColumnSpacing; }
1382 int rowSpacing() const { return mRowSpacing; }
1383 int wrap() const { return mWrap; }
1384 FillOrder fillOrder() const { return mFillOrder; }
1385
1386 // setters:
1387 void setColumnStretchFactor(int column, double factor);
1388 void setColumnStretchFactors(const QList<double> &factors);
1389 void setRowStretchFactor(int row, double factor);
1390 void setRowStretchFactors(const QList<double> &factors);
1391 void setColumnSpacing(int pixels);
1392 void setRowSpacing(int pixels);
1393 void setWrap(int count);
1394 void setFillOrder(FillOrder order, bool rearrange=true);
1395
1396 // reimplemented virtual methods:
1397 virtual void updateLayout() Q_DECL_OVERRIDE;
1398 virtual int elementCount() const Q_DECL_OVERRIDE { return rowCount()*columnCount(); }
1399 virtual QCPLayoutElement* elementAt(int index) const Q_DECL_OVERRIDE;
1400 virtual QCPLayoutElement* takeAt(int index) Q_DECL_OVERRIDE;
1401 virtual bool take(QCPLayoutElement* element) Q_DECL_OVERRIDE;
1402 virtual QList<QCPLayoutElement*> elements(bool recursive) const Q_DECL_OVERRIDE;
1403 virtual void simplify() Q_DECL_OVERRIDE;
1404 virtual QSize minimumOuterSizeHint() const Q_DECL_OVERRIDE;
1405 virtual QSize maximumOuterSizeHint() const Q_DECL_OVERRIDE;
1406
1407 // non-virtual methods:
1408 QCPLayoutElement *element(int row, int column) const;
1409 bool addElement(int row, int column, QCPLayoutElement *element);
1410 bool addElement(QCPLayoutElement *element);
1411 bool hasElement(int row, int column);
1412 void expandTo(int newRowCount, int newColumnCount);
1413 void insertRow(int newIndex);
1414 void insertColumn(int newIndex);
1415 int rowColToIndex(int row, int column) const;
1416 void indexToRowCol(int index, int &row, int &column) const;
1417
1418protected:
1419 // property members:
1420 QList<QList<QCPLayoutElement*> > mElements;
1421 QList<double> mColumnStretchFactors;
1422 QList<double> mRowStretchFactors;
1423 int mColumnSpacing, mRowSpacing;
1424 int mWrap;
1425 FillOrder mFillOrder;
1426
1427 // non-virtual methods:
1428 void getMinimumRowColSizes(QVector<int> *minColWidths, QVector<int> *minRowHeights) const;
1429 void getMaximumRowColSizes(QVector<int> *maxColWidths, QVector<int> *maxRowHeights) const;
1430
1431private:
1432 Q_DISABLE_COPY(QCPLayoutGrid)
1433};
1434Q_DECLARE_METATYPE(QCPLayoutGrid::FillOrder)
1435
1436
1437class QCP_LIB_DECL QCPLayoutInset : public QCPLayout
1438{
1439 Q_OBJECT
1440public:
1447 Q_ENUMS(InsetPlacement)
1448
1449 explicit QCPLayoutInset();
1450 virtual ~QCPLayoutInset() Q_DECL_OVERRIDE;
1451
1452 // getters:
1453 InsetPlacement insetPlacement(int index) const;
1454 Qt::Alignment insetAlignment(int index) const;
1455 QRectF insetRect(int index) const;
1456
1457 // setters:
1458 void setInsetPlacement(int index, InsetPlacement placement);
1459 void setInsetAlignment(int index, Qt::Alignment alignment);
1460 void setInsetRect(int index, const QRectF &rect);
1461
1462 // reimplemented virtual methods:
1463 virtual void updateLayout() Q_DECL_OVERRIDE;
1464 virtual int elementCount() const Q_DECL_OVERRIDE;
1465 virtual QCPLayoutElement* elementAt(int index) const Q_DECL_OVERRIDE;
1466 virtual QCPLayoutElement* takeAt(int index) Q_DECL_OVERRIDE;
1467 virtual bool take(QCPLayoutElement* element) Q_DECL_OVERRIDE;
1468 virtual void simplify() Q_DECL_OVERRIDE {}
1469 virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE;
1470
1471 // non-virtual methods:
1472 void addElement(QCPLayoutElement *element, Qt::Alignment alignment);
1473 void addElement(QCPLayoutElement *element, const QRectF &rect);
1474
1475protected:
1476 // property members:
1477 QList<QCPLayoutElement*> mElements;
1478 QList<InsetPlacement> mInsetPlacement;
1479 QList<Qt::Alignment> mInsetAlignment;
1480 QList<QRectF> mInsetRect;
1481
1482private:
1483 Q_DISABLE_COPY(QCPLayoutInset)
1484};
1485Q_DECLARE_METATYPE(QCPLayoutInset::InsetPlacement)
1486
1487/* end of 'src/layout.h' */
1488
1489
1490/* including file 'src/lineending.h' */
1491/* modified 2021-03-29T02:30:44, size 4426 */
1492
1493class QCP_LIB_DECL QCPLineEnding
1494{
1495 Q_GADGET
1496public:
1519 Q_ENUMS(EndingStyle)
1520
1521 QCPLineEnding();
1522 QCPLineEnding(EndingStyle style, double width=8, double length=10, bool inverted=false);
1523
1524 // getters:
1525 EndingStyle style() const { return mStyle; }
1526 double width() const { return mWidth; }
1527 double length() const { return mLength; }
1528 bool inverted() const { return mInverted; }
1529
1530 // setters:
1531 void setStyle(EndingStyle style);
1532 void setWidth(double width);
1533 void setLength(double length);
1534 void setInverted(bool inverted);
1535
1536 // non-property methods:
1537 double boundingDistance() const;
1538 double realLength() const;
1539 void draw(QCPPainter *painter, const QCPVector2D &pos, const QCPVector2D &dir) const;
1540 void draw(QCPPainter *painter, const QCPVector2D &pos, double angle) const;
1541
1542protected:
1543 // property members:
1544 EndingStyle mStyle;
1545 double mWidth, mLength;
1546 bool mInverted;
1547};
1548Q_DECLARE_TYPEINFO(QCPLineEnding, Q_MOVABLE_TYPE);
1549Q_DECLARE_METATYPE(QCPLineEnding::EndingStyle)
1550
1551/* end of 'src/lineending.h' */
1552
1553
1554/* including file 'src/axis/labelpainter.h' */
1555/* modified 2021-03-29T02:30:44, size 7086 */
1556
1558{
1559 Q_GADGET
1560public:
1564 enum AnchorMode { amRectangular
1565 ,amSkewedUpright
1566 ,amSkewedRotated
1567 };
1568 Q_ENUMS(AnchorMode)
1569
1570
1573 enum AnchorReferenceType { artNormal
1574 ,artTangent
1575 };
1576 Q_ENUMS(AnchorReferenceType)
1577
1578
1581 enum AnchorSide { asLeft
1582 ,asRight
1583 ,asTop
1584 ,asBottom
1585 ,asTopLeft
1586 ,asTopRight
1587 ,asBottomRight
1588 ,asBottomLeft
1589 };
1590 Q_ENUMS(AnchorSide)
1591
1592 explicit QCPLabelPainterPrivate(QCustomPlot *parentPlot);
1593 virtual ~QCPLabelPainterPrivate();
1594
1595 // setters:
1596 void setAnchorSide(AnchorSide side);
1597 void setAnchorMode(AnchorMode mode);
1598 void setAnchorReference(const QPointF &pixelPoint);
1599 void setAnchorReferenceType(AnchorReferenceType type);
1600 void setFont(const QFont &font);
1601 void setColor(const QColor &color);
1602 void setPadding(int padding);
1603 void setRotation(double rotation);
1604 void setSubstituteExponent(bool enabled);
1605 void setMultiplicationSymbol(QChar symbol);
1606 void setAbbreviateDecimalPowers(bool enabled);
1607 void setCacheSize(int labelCount);
1608
1609 // getters:
1610 AnchorMode anchorMode() const { return mAnchorMode; }
1611 AnchorSide anchorSide() const { return mAnchorSide; }
1612 QPointF anchorReference() const { return mAnchorReference; }
1613 AnchorReferenceType anchorReferenceType() const { return mAnchorReferenceType; }
1614 QFont font() const { return mFont; }
1615 QColor color() const { return mColor; }
1616 int padding() const { return mPadding; }
1617 double rotation() const { return mRotation; }
1618 bool substituteExponent() const { return mSubstituteExponent; }
1619 QChar multiplicationSymbol() const { return mMultiplicationSymbol; }
1620 bool abbreviateDecimalPowers() const { return mAbbreviateDecimalPowers; }
1621 int cacheSize() const;
1622
1623 //virtual int size() const;
1624
1625 // non-property methods:
1626 void drawTickLabel(QCPPainter *painter, const QPointF &tickPos, const QString &text);
1627 void clearCache();
1628
1629 // constants that may be used with setMultiplicationSymbol:
1630 static const QChar SymbolDot;
1631 static const QChar SymbolCross;
1632
1633protected:
1635 {
1636 QPoint offset;
1637 QPixmap pixmap;
1638 };
1640 {
1641 AnchorSide side;
1642 double rotation; // angle in degrees
1643 QTransform transform; // the transform about the label anchor which is at (0, 0). Does not contain final absolute x/y positioning on the plot/axis
1644 QString basePart, expPart, suffixPart;
1645 QRect baseBounds, expBounds, suffixBounds;
1646 QRect totalBounds; // is in a coordinate system where label top left is at (0, 0)
1647 QRect rotatedTotalBounds; // is in a coordinate system where the label anchor is at (0, 0)
1648 QFont baseFont, expFont;
1649 QColor color;
1650 };
1651
1652 // property members:
1653 AnchorMode mAnchorMode;
1654 AnchorSide mAnchorSide;
1655 QPointF mAnchorReference;
1656 AnchorReferenceType mAnchorReferenceType;
1657 QFont mFont;
1658 QColor mColor;
1659 int mPadding;
1660 double mRotation; // this is the rotation applied uniformly to all labels, not the heterogeneous rotation in amCircularRotated mode
1661 bool mSubstituteExponent;
1662 QChar mMultiplicationSymbol;
1663 bool mAbbreviateDecimalPowers;
1664 // non-property members:
1665 QCustomPlot *mParentPlot;
1666 QByteArray mLabelParameterHash; // to determine whether mLabelCache needs to be cleared due to changed parameters
1667 QCache<QString, CachedLabel> mLabelCache;
1668 QRect mAxisSelectionBox, mTickLabelsSelectionBox, mLabelSelectionBox;
1669 int mLetterCapHeight, mLetterDescent;
1670
1671 // introduced virtual methods:
1672 virtual void drawLabelMaybeCached(QCPPainter *painter, const QFont &font, const QColor &color, const QPointF &pos, AnchorSide side, double rotation, const QString &text);
1673 virtual QByteArray generateLabelParameterHash() const; // TODO: get rid of this in favor of invalidation flag upon setters?
1674
1675 // non-virtual methods:
1676 QPointF getAnchorPos(const QPointF &tickPos);
1677 void drawText(QCPPainter *painter, const QPointF &pos, const LabelData &labelData) const;
1678 LabelData getTickLabelData(const QFont &font, const QColor &color, double rotation, AnchorSide side, const QString &text) const;
1679 void applyAnchorTransform(LabelData &labelData) const;
1680 //void getMaxTickLabelSize(const QFont &font, const QString &text, QSize *tickLabelsSize) const;
1681 CachedLabel *createCachedLabel(const LabelData &labelData) const;
1682 QByteArray cacheKey(const QString &text, const QColor &color, double rotation, AnchorSide side) const;
1683 AnchorSide skewedAnchorSide(const QPointF &tickPos, double sideExpandHorz, double sideExpandVert) const;
1684 AnchorSide rotationCorrectedSide(AnchorSide side, double rotation) const;
1685 void analyzeFontMetrics();
1686};
1687Q_DECLARE_METATYPE(QCPLabelPainterPrivate::AnchorMode)
1688Q_DECLARE_METATYPE(QCPLabelPainterPrivate::AnchorSide)
1689
1690
1691/* end of 'src/axis/labelpainter.h' */
1692
1693
1694/* including file 'src/axis/axisticker.h' */
1695/* modified 2021-03-29T02:30:44, size 4230 */
1696
1697class QCP_LIB_DECL QCPAxisTicker
1698{
1699 Q_GADGET
1700public:
1711 Q_ENUMS(TickStepStrategy)
1712
1713 QCPAxisTicker();
1714 virtual ~QCPAxisTicker();
1715
1716 // getters:
1717 TickStepStrategy tickStepStrategy() const { return mTickStepStrategy; }
1718 int tickCount() const { return mTickCount; }
1719 double tickOrigin() const { return mTickOrigin; }
1720
1721 // setters:
1722 void setTickStepStrategy(TickStepStrategy strategy);
1723 void setTickCount(int count);
1724 void setTickOrigin(double origin);
1725
1726 // introduced virtual methods:
1727 virtual void generate(const QCPRange &range, const QLocale &locale, QChar formatChar, int precision, QVector<double> &ticks, QVector<double> *subTicks, QVector<QString> *tickLabels);
1728
1729protected:
1730 // property members:
1731 TickStepStrategy mTickStepStrategy;
1732 int mTickCount;
1733 double mTickOrigin;
1734
1735 // introduced virtual methods:
1736 virtual double getTickStep(const QCPRange &range);
1737 virtual int getSubTickCount(double tickStep);
1738 virtual QString getTickLabel(double tick, const QLocale &locale, QChar formatChar, int precision);
1739 virtual QVector<double> createTickVector(double tickStep, const QCPRange &range);
1740 virtual QVector<double> createSubTickVector(int subTickCount, const QVector<double> &ticks);
1741 virtual QVector<QString> createLabelVector(const QVector<double> &ticks, const QLocale &locale, QChar formatChar, int precision);
1742
1743 // non-virtual methods:
1744 void trimTicks(const QCPRange &range, QVector<double> &ticks, bool keepOneOutlier) const;
1745 double pickClosest(double target, const QVector<double> &candidates) const;
1746 double getMantissa(double input, double *magnitude=nullptr) const;
1747 double cleanMantissa(double input) const;
1748
1749private:
1750 Q_DISABLE_COPY(QCPAxisTicker)
1751
1752};
1753Q_DECLARE_METATYPE(QCPAxisTicker::TickStepStrategy)
1754Q_DECLARE_METATYPE(QSharedPointer<QCPAxisTicker>)
1755
1756/* end of 'src/axis/axisticker.h' */
1757
1758
1759/* including file 'src/axis/axistickerdatetime.h' */
1760/* modified 2021-03-29T02:30:44, size 3600 */
1761
1762class QCP_LIB_DECL QCPAxisTickerDateTime : public QCPAxisTicker
1763{
1764public:
1766
1767 // getters:
1768 QString dateTimeFormat() const { return mDateTimeFormat; }
1769 Qt::TimeSpec dateTimeSpec() const { return mDateTimeSpec; }
1770# if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0)
1771 QTimeZone timeZone() const { return mTimeZone; }
1772#endif
1773
1774 // setters:
1775 void setDateTimeFormat(const QString &format);
1776 void setDateTimeSpec(Qt::TimeSpec spec);
1777# if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0)
1778 void setTimeZone(const QTimeZone &zone);
1779# endif
1780 void setTickOrigin(double origin); // hides base class method but calls baseclass implementation ("using" throws off IDEs and doxygen)
1781 void setTickOrigin(const QDateTime &origin);
1782
1783 // static methods:
1784 static QDateTime keyToDateTime(double key);
1785 static double dateTimeToKey(const QDateTime &dateTime);
1786 static double dateTimeToKey(const QDate &date, Qt::TimeSpec timeSpec=Qt::LocalTime);
1787
1788protected:
1789 // property members:
1790 QString mDateTimeFormat;
1791 Qt::TimeSpec mDateTimeSpec;
1792# if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0)
1793 QTimeZone mTimeZone;
1794# endif
1795 // non-property members:
1796 enum DateStrategy {dsNone, dsUniformTimeInDay, dsUniformDayInMonth} mDateStrategy;
1797
1798 // reimplemented virtual methods:
1799 virtual double getTickStep(const QCPRange &range) Q_DECL_OVERRIDE;
1800 virtual int getSubTickCount(double tickStep) Q_DECL_OVERRIDE;
1801 virtual QString getTickLabel(double tick, const QLocale &locale, QChar formatChar, int precision) Q_DECL_OVERRIDE;
1802 virtual QVector<double> createTickVector(double tickStep, const QCPRange &range) Q_DECL_OVERRIDE;
1803};
1804
1805/* end of 'src/axis/axistickerdatetime.h' */
1806
1807
1808/* including file 'src/axis/axistickertime.h' */
1809/* modified 2021-03-29T02:30:44, size 3542 */
1810
1811class QCP_LIB_DECL QCPAxisTickerTime : public QCPAxisTicker
1812{
1813 Q_GADGET
1814public:
1826 Q_ENUMS(TimeUnit)
1827
1829
1830 // getters:
1831 QString timeFormat() const { return mTimeFormat; }
1832 int fieldWidth(TimeUnit unit) const { return mFieldWidth.value(unit); }
1833
1834 // setters:
1835 void setTimeFormat(const QString &format);
1836 void setFieldWidth(TimeUnit unit, int width);
1837
1838protected:
1839 // property members:
1840 QString mTimeFormat;
1841 QHash<TimeUnit, int> mFieldWidth;
1842
1843 // non-property members:
1844 TimeUnit mSmallestUnit, mBiggestUnit;
1845 QHash<TimeUnit, QString> mFormatPattern;
1846
1847 // reimplemented virtual methods:
1848 virtual double getTickStep(const QCPRange &range) Q_DECL_OVERRIDE;
1849 virtual int getSubTickCount(double tickStep) Q_DECL_OVERRIDE;
1850 virtual QString getTickLabel(double tick, const QLocale &locale, QChar formatChar, int precision) Q_DECL_OVERRIDE;
1851
1852 // non-virtual methods:
1853 void replaceUnit(QString &text, TimeUnit unit, int value) const;
1854};
1855Q_DECLARE_METATYPE(QCPAxisTickerTime::TimeUnit)
1856
1857/* end of 'src/axis/axistickertime.h' */
1858
1859
1860/* including file 'src/axis/axistickerfixed.h' */
1861/* modified 2021-03-29T02:30:44, size 3308 */
1862
1863class QCP_LIB_DECL QCPAxisTickerFixed : public QCPAxisTicker
1864{
1865 Q_GADGET
1866public:
1877 Q_ENUMS(ScaleStrategy)
1878
1880
1881 // getters:
1882 double tickStep() const { return mTickStep; }
1883 ScaleStrategy scaleStrategy() const { return mScaleStrategy; }
1884
1885 // setters:
1886 void setTickStep(double step);
1887 void setScaleStrategy(ScaleStrategy strategy);
1888
1889protected:
1890 // property members:
1891 double mTickStep;
1892 ScaleStrategy mScaleStrategy;
1893
1894 // reimplemented virtual methods:
1895 virtual double getTickStep(const QCPRange &range) Q_DECL_OVERRIDE;
1896};
1897Q_DECLARE_METATYPE(QCPAxisTickerFixed::ScaleStrategy)
1898
1899/* end of 'src/axis/axistickerfixed.h' */
1900
1901
1902/* including file 'src/axis/axistickertext.h' */
1903/* modified 2021-03-29T02:30:44, size 3090 */
1904
1905class QCP_LIB_DECL QCPAxisTickerText : public QCPAxisTicker
1906{
1907public:
1909
1910 // getters:
1911 QMap<double, QString> &ticks() { return mTicks; }
1912 int subTickCount() const { return mSubTickCount; }
1913
1914 // setters:
1915 void setTicks(const QMap<double, QString> &ticks);
1916 void setTicks(const QVector<double> &positions, const QVector<QString> &labels);
1917 void setSubTickCount(int subTicks);
1918
1919 // non-virtual methods:
1920 void clear();
1921 void addTick(double position, const QString &label);
1922 void addTicks(const QMap<double, QString> &ticks);
1923 void addTicks(const QVector<double> &positions, const QVector<QString> &labels);
1924
1925protected:
1926 // property members:
1927 QMap<double, QString> mTicks;
1928 int mSubTickCount;
1929
1930 // reimplemented virtual methods:
1931 virtual double getTickStep(const QCPRange &range) Q_DECL_OVERRIDE;
1932 virtual int getSubTickCount(double tickStep) Q_DECL_OVERRIDE;
1933 virtual QString getTickLabel(double tick, const QLocale &locale, QChar formatChar, int precision) Q_DECL_OVERRIDE;
1934 virtual QVector<double> createTickVector(double tickStep, const QCPRange &range) Q_DECL_OVERRIDE;
1935};
1936
1937/* end of 'src/axis/axistickertext.h' */
1938
1939
1940/* including file 'src/axis/axistickerpi.h' */
1941/* modified 2021-03-29T02:30:44, size 3911 */
1942
1943class QCP_LIB_DECL QCPAxisTickerPi : public QCPAxisTicker
1944{
1945 Q_GADGET
1946public:
1956 Q_ENUMS(FractionStyle)
1957
1959
1960 // getters:
1961 QString piSymbol() const { return mPiSymbol; }
1962 double piValue() const { return mPiValue; }
1963 bool periodicity() const { return mPeriodicity; }
1964 FractionStyle fractionStyle() const { return mFractionStyle; }
1965
1966 // setters:
1967 void setPiSymbol(QString symbol);
1968 void setPiValue(double pi);
1969 void setPeriodicity(int multiplesOfPi);
1970 void setFractionStyle(FractionStyle style);
1971
1972protected:
1973 // property members:
1974 QString mPiSymbol;
1975 double mPiValue;
1976 int mPeriodicity;
1977 FractionStyle mFractionStyle;
1978
1979 // non-property members:
1980 double mPiTickStep; // size of one tick step in units of mPiValue
1981
1982 // reimplemented virtual methods:
1983 virtual double getTickStep(const QCPRange &range) Q_DECL_OVERRIDE;
1984 virtual int getSubTickCount(double tickStep) Q_DECL_OVERRIDE;
1985 virtual QString getTickLabel(double tick, const QLocale &locale, QChar formatChar, int precision) Q_DECL_OVERRIDE;
1986
1987 // non-virtual methods:
1988 void simplifyFraction(int &numerator, int &denominator) const;
1989 QString fractionToString(int numerator, int denominator) const;
1990 QString unicodeFraction(int numerator, int denominator) const;
1991 QString unicodeSuperscript(int number) const;
1992 QString unicodeSubscript(int number) const;
1993};
1994Q_DECLARE_METATYPE(QCPAxisTickerPi::FractionStyle)
1995
1996/* end of 'src/axis/axistickerpi.h' */
1997
1998
1999/* including file 'src/axis/axistickerlog.h' */
2000/* modified 2021-03-29T02:30:44, size 2594 */
2001
2002class QCP_LIB_DECL QCPAxisTickerLog : public QCPAxisTicker
2003{
2004public:
2006
2007 // getters:
2008 double logBase() const { return mLogBase; }
2009 int subTickCount() const { return mSubTickCount; }
2010
2011 // setters:
2012 void setLogBase(double base);
2013 void setSubTickCount(int subTicks);
2014
2015protected:
2016 // property members:
2017 double mLogBase;
2018 int mSubTickCount;
2019
2020 // non-property members:
2021 double mLogBaseLnInv;
2022
2023 // reimplemented virtual methods:
2024 virtual int getSubTickCount(double tickStep) Q_DECL_OVERRIDE;
2025 virtual QVector<double> createTickVector(double tickStep, const QCPRange &range) Q_DECL_OVERRIDE;
2026};
2027
2028/* end of 'src/axis/axistickerlog.h' */
2029
2030
2031/* including file 'src/axis/axis.h' */
2032/* modified 2021-03-29T02:30:44, size 20913 */
2033
2034class QCP_LIB_DECL QCPGrid :public QCPLayerable
2035{
2036 Q_OBJECT
2038 Q_PROPERTY(bool subGridVisible READ subGridVisible WRITE setSubGridVisible)
2039 Q_PROPERTY(bool antialiasedSubGrid READ antialiasedSubGrid WRITE setAntialiasedSubGrid)
2040 Q_PROPERTY(bool antialiasedZeroLine READ antialiasedZeroLine WRITE setAntialiasedZeroLine)
2041 Q_PROPERTY(QPen pen READ pen WRITE setPen)
2042 Q_PROPERTY(QPen subGridPen READ subGridPen WRITE setSubGridPen)
2043 Q_PROPERTY(QPen zeroLinePen READ zeroLinePen WRITE setZeroLinePen)
2045public:
2046 explicit QCPGrid(QCPAxis *parentAxis);
2047
2048 // getters:
2049 bool subGridVisible() const { return mSubGridVisible; }
2050 bool antialiasedSubGrid() const { return mAntialiasedSubGrid; }
2051 bool antialiasedZeroLine() const { return mAntialiasedZeroLine; }
2052 QPen pen() const { return mPen; }
2053 QPen subGridPen() const { return mSubGridPen; }
2054 QPen zeroLinePen() const { return mZeroLinePen; }
2055
2056 // setters:
2057 void setSubGridVisible(bool visible);
2058 void setAntialiasedSubGrid(bool enabled);
2059 void setAntialiasedZeroLine(bool enabled);
2060 void setPen(const QPen &pen);
2061 void setSubGridPen(const QPen &pen);
2062 void setZeroLinePen(const QPen &pen);
2063
2064protected:
2065 // property members:
2066 bool mSubGridVisible;
2067 bool mAntialiasedSubGrid, mAntialiasedZeroLine;
2068 QPen mPen, mSubGridPen, mZeroLinePen;
2069
2070 // non-property members:
2071 QCPAxis *mParentAxis;
2072
2073 // reimplemented virtual methods:
2074 virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const Q_DECL_OVERRIDE;
2075 virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
2076
2077 // non-virtual methods:
2078 void drawGridLines(QCPPainter *painter) const;
2079 void drawSubGridLines(QCPPainter *painter) const;
2080
2081 friend class QCPAxis;
2082};
2083
2084
2085class QCP_LIB_DECL QCPAxis : public QCPLayerable
2086{
2087 Q_OBJECT
2089 Q_PROPERTY(AxisType axisType READ axisType)
2090 Q_PROPERTY(QCPAxisRect* axisRect READ axisRect)
2091 Q_PROPERTY(ScaleType scaleType READ scaleType WRITE setScaleType NOTIFY scaleTypeChanged)
2092 Q_PROPERTY(QCPRange range READ range WRITE setRange NOTIFY rangeChanged)
2093 Q_PROPERTY(bool rangeReversed READ rangeReversed WRITE setRangeReversed)
2094 Q_PROPERTY(QSharedPointer<QCPAxisTicker> ticker READ ticker WRITE setTicker)
2095 Q_PROPERTY(bool ticks READ ticks WRITE setTicks)
2096 Q_PROPERTY(bool tickLabels READ tickLabels WRITE setTickLabels)
2097 Q_PROPERTY(int tickLabelPadding READ tickLabelPadding WRITE setTickLabelPadding)
2098 Q_PROPERTY(QFont tickLabelFont READ tickLabelFont WRITE setTickLabelFont)
2099 Q_PROPERTY(QColor tickLabelColor READ tickLabelColor WRITE setTickLabelColor)
2100 Q_PROPERTY(double tickLabelRotation READ tickLabelRotation WRITE setTickLabelRotation)
2101 Q_PROPERTY(LabelSide tickLabelSide READ tickLabelSide WRITE setTickLabelSide)
2102 Q_PROPERTY(QString numberFormat READ numberFormat WRITE setNumberFormat)
2103 Q_PROPERTY(int numberPrecision READ numberPrecision WRITE setNumberPrecision)
2104 Q_PROPERTY(QVector<double> tickVector READ tickVector)
2105 Q_PROPERTY(QVector<QString> tickVectorLabels READ tickVectorLabels)
2106 Q_PROPERTY(int tickLengthIn READ tickLengthIn WRITE setTickLengthIn)
2107 Q_PROPERTY(int tickLengthOut READ tickLengthOut WRITE setTickLengthOut)
2108 Q_PROPERTY(bool subTicks READ subTicks WRITE setSubTicks)
2109 Q_PROPERTY(int subTickLengthIn READ subTickLengthIn WRITE setSubTickLengthIn)
2110 Q_PROPERTY(int subTickLengthOut READ subTickLengthOut WRITE setSubTickLengthOut)
2111 Q_PROPERTY(QPen basePen READ basePen WRITE setBasePen)
2112 Q_PROPERTY(QPen tickPen READ tickPen WRITE setTickPen)
2113 Q_PROPERTY(QPen subTickPen READ subTickPen WRITE setSubTickPen)
2114 Q_PROPERTY(QFont labelFont READ labelFont WRITE setLabelFont)
2115 Q_PROPERTY(QColor labelColor READ labelColor WRITE setLabelColor)
2116 Q_PROPERTY(QString label READ label WRITE setLabel)
2117 Q_PROPERTY(int labelPadding READ labelPadding WRITE setLabelPadding)
2118 Q_PROPERTY(int padding READ padding WRITE setPadding)
2119 Q_PROPERTY(int offset READ offset WRITE setOffset)
2120 Q_PROPERTY(SelectableParts selectedParts READ selectedParts WRITE setSelectedParts NOTIFY selectionChanged)
2121 Q_PROPERTY(SelectableParts selectableParts READ selectableParts WRITE setSelectableParts NOTIFY selectableChanged)
2122 Q_PROPERTY(QFont selectedTickLabelFont READ selectedTickLabelFont WRITE setSelectedTickLabelFont)
2123 Q_PROPERTY(QFont selectedLabelFont READ selectedLabelFont WRITE setSelectedLabelFont)
2124 Q_PROPERTY(QColor selectedTickLabelColor READ selectedTickLabelColor WRITE setSelectedTickLabelColor)
2125 Q_PROPERTY(QColor selectedLabelColor READ selectedLabelColor WRITE setSelectedLabelColor)
2126 Q_PROPERTY(QPen selectedBasePen READ selectedBasePen WRITE setSelectedBasePen)
2127 Q_PROPERTY(QPen selectedTickPen READ selectedTickPen WRITE setSelectedTickPen)
2128 Q_PROPERTY(QPen selectedSubTickPen READ selectedSubTickPen WRITE setSelectedSubTickPen)
2129 Q_PROPERTY(QCPLineEnding lowerEnding READ lowerEnding WRITE setLowerEnding)
2130 Q_PROPERTY(QCPLineEnding upperEnding READ upperEnding WRITE setUpperEnding)
2131 Q_PROPERTY(QCPGrid* grid READ grid)
2133public:
2138 enum AxisType { atLeft = 0x01
2139 ,atRight = 0x02
2140 ,atTop = 0x04
2141 ,atBottom = 0x08
2142 };
2143 Q_ENUMS(AxisType)
2144 Q_FLAGS(AxisTypes)
2145 Q_DECLARE_FLAGS(AxisTypes, AxisType)
2154 Q_ENUMS(LabelSide)
2162 Q_ENUMS(ScaleType)
2168 ,spAxis = 0x001
2170 ,spAxisLabel = 0x004
2171 };
2172 Q_ENUMS(SelectablePart)
2173 Q_FLAGS(SelectableParts)
2174 Q_DECLARE_FLAGS(SelectableParts, SelectablePart)
2175
2176 explicit QCPAxis(QCPAxisRect *parent, AxisType type);
2177 virtual ~QCPAxis() Q_DECL_OVERRIDE;
2178
2179 // getters:
2180 AxisType axisType() const { return mAxisType; }
2181 QCPAxisRect *axisRect() const { return mAxisRect; }
2182 ScaleType scaleType() const { return mScaleType; }
2183 const QCPRange range() const { return mRange; }
2184 bool rangeReversed() const { return mRangeReversed; }
2185 QSharedPointer<QCPAxisTicker> ticker() const { return mTicker; }
2186 bool ticks() const { return mTicks; }
2187 bool tickLabels() const { return mTickLabels; }
2188 int tickLabelPadding() const;
2189 QFont tickLabelFont() const { return mTickLabelFont; }
2190 QColor tickLabelColor() const { return mTickLabelColor; }
2191 double tickLabelRotation() const;
2192 LabelSide tickLabelSide() const;
2193 QString numberFormat() const;
2194 int numberPrecision() const { return mNumberPrecision; }
2195 QVector<double> tickVector() const { return mTickVector; }
2196 QVector<QString> tickVectorLabels() const { return mTickVectorLabels; }
2197 int tickLengthIn() const;
2198 int tickLengthOut() const;
2199 bool subTicks() const { return mSubTicks; }
2200 int subTickLengthIn() const;
2201 int subTickLengthOut() const;
2202 QPen basePen() const { return mBasePen; }
2203 QPen tickPen() const { return mTickPen; }
2204 QPen subTickPen() const { return mSubTickPen; }
2205 QFont labelFont() const { return mLabelFont; }
2206 QColor labelColor() const { return mLabelColor; }
2207 QString label() const { return mLabel; }
2208 int labelPadding() const;
2209 int padding() const { return mPadding; }
2210 int offset() const;
2211 SelectableParts selectedParts() const { return mSelectedParts; }
2212 SelectableParts selectableParts() const { return mSelectableParts; }
2213 QFont selectedTickLabelFont() const { return mSelectedTickLabelFont; }
2214 QFont selectedLabelFont() const { return mSelectedLabelFont; }
2215 QColor selectedTickLabelColor() const { return mSelectedTickLabelColor; }
2216 QColor selectedLabelColor() const { return mSelectedLabelColor; }
2217 QPen selectedBasePen() const { return mSelectedBasePen; }
2218 QPen selectedTickPen() const { return mSelectedTickPen; }
2219 QPen selectedSubTickPen() const { return mSelectedSubTickPen; }
2220 QCPLineEnding lowerEnding() const;
2221 QCPLineEnding upperEnding() const;
2222 QCPGrid *grid() const { return mGrid; }
2223
2224 // setters:
2225 Q_SLOT void setScaleType(QCPAxis::ScaleType type);
2226 Q_SLOT void setRange(const QCPRange &range);
2227 void setRange(double lower, double upper);
2228 void setRange(double position, double size, Qt::AlignmentFlag alignment);
2229 void setRangeLower(double lower);
2230 void setRangeUpper(double upper);
2231 void setRangeReversed(bool reversed);
2232 void setTicker(QSharedPointer<QCPAxisTicker> ticker);
2233 void setTicks(bool show);
2234 void setTickLabels(bool show);
2235 void setTickLabelPadding(int padding);
2236 void setTickLabelFont(const QFont &font);
2237 void setTickLabelColor(const QColor &color);
2238 void setTickLabelRotation(double degrees);
2239 void setTickLabelSide(LabelSide side);
2240 void setNumberFormat(const QString &formatCode);
2241 void setNumberPrecision(int precision);
2242 void setTickLength(int inside, int outside=0);
2243 void setTickLengthIn(int inside);
2244 void setTickLengthOut(int outside);
2245 void setSubTicks(bool show);
2246 void setSubTickLength(int inside, int outside=0);
2247 void setSubTickLengthIn(int inside);
2248 void setSubTickLengthOut(int outside);
2249 void setBasePen(const QPen &pen);
2250 void setTickPen(const QPen &pen);
2251 void setSubTickPen(const QPen &pen);
2252 void setLabelFont(const QFont &font);
2253 void setLabelColor(const QColor &color);
2254 void setLabel(const QString &str);
2255 void setLabelPadding(int padding);
2256 void setPadding(int padding);
2257 void setOffset(int offset);
2258 void setSelectedTickLabelFont(const QFont &font);
2259 void setSelectedLabelFont(const QFont &font);
2260 void setSelectedTickLabelColor(const QColor &color);
2261 void setSelectedLabelColor(const QColor &color);
2262 void setSelectedBasePen(const QPen &pen);
2263 void setSelectedTickPen(const QPen &pen);
2264 void setSelectedSubTickPen(const QPen &pen);
2265 Q_SLOT void setSelectableParts(const QCPAxis::SelectableParts &selectableParts);
2266 Q_SLOT void setSelectedParts(const QCPAxis::SelectableParts &selectedParts);
2267 void setLowerEnding(const QCPLineEnding &ending);
2268 void setUpperEnding(const QCPLineEnding &ending);
2269
2270 // reimplemented virtual methods:
2271 virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE;
2272
2273 // non-property methods:
2274 Qt::Orientation orientation() const { return mOrientation; }
2275 int pixelOrientation() const { return rangeReversed() != (orientation()==Qt::Vertical) ? -1 : 1; }
2276 void moveRange(double diff);
2277 void scaleRange(double factor);
2278 void scaleRange(double factor, double center);
2279 void setScaleRatio(const QCPAxis *otherAxis, double ratio=1.0);
2280 void rescale(bool onlyVisiblePlottables=false);
2281 double pixelToCoord(double value) const;
2282 double coordToPixel(double value) const;
2283 SelectablePart getPartAt(const QPointF &pos) const;
2284 QList<QCPAbstractPlottable*> plottables() const;
2285 QList<QCPGraph*> graphs() const;
2286 QList<QCPAbstractItem*> items() const;
2287
2288 static AxisType marginSideToAxisType(QCP::MarginSide side);
2289 static Qt::Orientation orientation(AxisType type) { return type==atBottom || type==atTop ? Qt::Horizontal : Qt::Vertical; }
2290 static AxisType opposite(AxisType type);
2291
2292signals:
2293 void rangeChanged(const QCPRange &newRange);
2294 void rangeChanged(const QCPRange &newRange, const QCPRange &oldRange);
2296 void selectionChanged(const QCPAxis::SelectableParts &parts);
2297 void selectableChanged(const QCPAxis::SelectableParts &parts);
2298
2299protected:
2300 // property members:
2301 // axis base:
2302 AxisType mAxisType;
2303 QCPAxisRect *mAxisRect;
2304 //int mOffset; // in QCPAxisPainter
2305 int mPadding;
2306 Qt::Orientation mOrientation;
2307 SelectableParts mSelectableParts, mSelectedParts;
2308 QPen mBasePen, mSelectedBasePen;
2309 //QCPLineEnding mLowerEnding, mUpperEnding; // in QCPAxisPainter
2310 // axis label:
2311 //int mLabelPadding; // in QCPAxisPainter
2312 QString mLabel;
2313 QFont mLabelFont, mSelectedLabelFont;
2314 QColor mLabelColor, mSelectedLabelColor;
2315 // tick labels:
2316 //int mTickLabelPadding; // in QCPAxisPainter
2317 bool mTickLabels;
2318 //double mTickLabelRotation; // in QCPAxisPainter
2319 QFont mTickLabelFont, mSelectedTickLabelFont;
2320 QColor mTickLabelColor, mSelectedTickLabelColor;
2321 int mNumberPrecision;
2322 QLatin1Char mNumberFormatChar;
2323 bool mNumberBeautifulPowers;
2324 //bool mNumberMultiplyCross; // QCPAxisPainter
2325 // ticks and subticks:
2326 bool mTicks;
2327 bool mSubTicks;
2328 //int mTickLengthIn, mTickLengthOut, mSubTickLengthIn, mSubTickLengthOut; // QCPAxisPainter
2329 QPen mTickPen, mSelectedTickPen;
2330 QPen mSubTickPen, mSelectedSubTickPen;
2331 // scale and range:
2332 QCPRange mRange;
2333 bool mRangeReversed;
2334 ScaleType mScaleType;
2335
2336 // non-property members:
2337 QCPGrid *mGrid;
2338 QCPAxisPainterPrivate *mAxisPainter;
2339 QSharedPointer<QCPAxisTicker> mTicker;
2340 QVector<double> mTickVector;
2341 QVector<QString> mTickVectorLabels;
2342 QVector<double> mSubTickVector;
2343 bool mCachedMarginValid;
2344 int mCachedMargin;
2345 bool mDragging;
2346 QCPRange mDragStartRange;
2347 QCP::AntialiasedElements mAADragBackup, mNotAADragBackup;
2348
2349 // introduced virtual methods:
2350 virtual int calculateMargin();
2351
2352 // reimplemented virtual methods:
2353 virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const Q_DECL_OVERRIDE;
2354 virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
2355 virtual QCP::Interaction selectionCategory() const Q_DECL_OVERRIDE;
2356 // events:
2357 virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) Q_DECL_OVERRIDE;
2358 virtual void deselectEvent(bool *selectionStateChanged) Q_DECL_OVERRIDE;
2359 // mouse events:
2360 virtual void mousePressEvent(QMouseEvent *event, const QVariant &details) Q_DECL_OVERRIDE;
2361 virtual void mouseMoveEvent(QMouseEvent *event, const QPointF &startPos) Q_DECL_OVERRIDE;
2362 virtual void mouseReleaseEvent(QMouseEvent *event, const QPointF &startPos) Q_DECL_OVERRIDE;
2363 virtual void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE;
2364
2365 // non-virtual methods:
2366 void setupTickVectors();
2367 QPen getBasePen() const;
2368 QPen getTickPen() const;
2369 QPen getSubTickPen() const;
2370 QFont getTickLabelFont() const;
2371 QFont getLabelFont() const;
2372 QColor getTickLabelColor() const;
2373 QColor getLabelColor() const;
2374
2375private:
2376 Q_DISABLE_COPY(QCPAxis)
2377
2378 friend class QCustomPlot;
2379 friend class QCPGrid;
2380 friend class QCPAxisRect;
2381};
2382Q_DECLARE_OPERATORS_FOR_FLAGS(QCPAxis::SelectableParts)
2383Q_DECLARE_OPERATORS_FOR_FLAGS(QCPAxis::AxisTypes)
2384Q_DECLARE_METATYPE(QCPAxis::AxisType)
2385Q_DECLARE_METATYPE(QCPAxis::LabelSide)
2386Q_DECLARE_METATYPE(QCPAxis::ScaleType)
2387Q_DECLARE_METATYPE(QCPAxis::SelectablePart)
2388
2389
2391{
2392public:
2393 explicit QCPAxisPainterPrivate(QCustomPlot *parentPlot);
2394 virtual ~QCPAxisPainterPrivate();
2395
2396 virtual void draw(QCPPainter *painter);
2397 virtual int size();
2398 void clearCache();
2399
2400 QRect axisSelectionBox() const { return mAxisSelectionBox; }
2401 QRect tickLabelsSelectionBox() const { return mTickLabelsSelectionBox; }
2402 QRect labelSelectionBox() const { return mLabelSelectionBox; }
2403
2404 // public property members:
2405 QCPAxis::AxisType type;
2406 QPen basePen;
2407 QCPLineEnding lowerEnding, upperEnding; // directly accessed by QCPAxis setters/getters
2408 int labelPadding; // directly accessed by QCPAxis setters/getters
2409 QFont labelFont;
2410 QColor labelColor;
2411 QString label;
2412 int tickLabelPadding; // directly accessed by QCPAxis setters/getters
2413 double tickLabelRotation; // directly accessed by QCPAxis setters/getters
2414 QCPAxis::LabelSide tickLabelSide; // directly accessed by QCPAxis setters/getters
2415 bool substituteExponent;
2416 bool numberMultiplyCross; // directly accessed by QCPAxis setters/getters
2417 int tickLengthIn, tickLengthOut, subTickLengthIn, subTickLengthOut; // directly accessed by QCPAxis setters/getters
2418 QPen tickPen, subTickPen;
2419 QFont tickLabelFont;
2420 QColor tickLabelColor;
2421 QRect axisRect, viewportRect;
2422 int offset; // directly accessed by QCPAxis setters/getters
2423 bool abbreviateDecimalPowers;
2424 bool reversedEndings;
2425
2426 QVector<double> subTickPositions;
2427 QVector<double> tickPositions;
2428 QVector<QString> tickLabels;
2429
2430protected:
2432 {
2433 QPointF offset;
2434 QPixmap pixmap;
2435 };
2437 {
2438 QString basePart, expPart, suffixPart;
2439 QRect baseBounds, expBounds, suffixBounds, totalBounds, rotatedTotalBounds;
2440 QFont baseFont, expFont;
2441 };
2442 QCustomPlot *mParentPlot;
2443 QByteArray mLabelParameterHash; // to determine whether mLabelCache needs to be cleared due to changed parameters
2444 QCache<QString, CachedLabel> mLabelCache;
2445 QRect mAxisSelectionBox, mTickLabelsSelectionBox, mLabelSelectionBox;
2446
2447 virtual QByteArray generateLabelParameterHash() const;
2448
2449 virtual void placeTickLabel(QCPPainter *painter, double position, int distanceToAxis, const QString &text, QSize *tickLabelsSize);
2450 virtual void drawTickLabel(QCPPainter *painter, double x, double y, const TickLabelData &labelData) const;
2451 virtual TickLabelData getTickLabelData(const QFont &font, const QString &text) const;
2452 virtual QPointF getTickLabelDrawOffset(const TickLabelData &labelData) const;
2453 virtual void getMaxTickLabelSize(const QFont &font, const QString &text, QSize *tickLabelsSize) const;
2454};
2455
2456/* end of 'src/axis/axis.h' */
2457
2458
2459/* including file 'src/scatterstyle.h' */
2460/* modified 2021-03-29T02:30:44, size 7275 */
2461
2462class QCP_LIB_DECL QCPScatterStyle
2463{
2464 Q_GADGET
2465public:
2475 ,spPen = 0x01
2476 ,spBrush = 0x02
2477 ,spSize = 0x04
2478 ,spShape = 0x08
2479 ,spAll = 0xFF
2480 };
2481 Q_ENUMS(ScatterProperty)
2482 Q_FLAGS(ScatterProperties)
2483 Q_DECLARE_FLAGS(ScatterProperties, ScatterProperty)
2484
2485
2511 Q_ENUMS(ScatterShape)
2512
2514 QCPScatterStyle(ScatterShape shape, double size=6);
2515 QCPScatterStyle(ScatterShape shape, const QColor &color, double size);
2516 QCPScatterStyle(ScatterShape shape, const QColor &color, const QColor &fill, double size);
2517 QCPScatterStyle(ScatterShape shape, const QPen &pen, const QBrush &brush, double size);
2518 QCPScatterStyle(const QPixmap &pixmap);
2519 QCPScatterStyle(const QPainterPath &customPath, const QPen &pen, const QBrush &brush=Qt::NoBrush, double size=6);
2520
2521 // getters:
2522 double size() const { return mSize; }
2523 ScatterShape shape() const { return mShape; }
2524 QPen pen() const { return mPen; }
2525 QBrush brush() const { return mBrush; }
2526 QPixmap pixmap() const { return mPixmap; }
2527 QPainterPath customPath() const { return mCustomPath; }
2528
2529 // setters:
2530 void setFromOther(const QCPScatterStyle &other, ScatterProperties properties);
2531 void setSize(double size);
2532 void setShape(ScatterShape shape);
2533 void setPen(const QPen &pen);
2534 void setBrush(const QBrush &brush);
2535 void setPixmap(const QPixmap &pixmap);
2536 void setCustomPath(const QPainterPath &customPath);
2537
2538 // non-property methods:
2539 bool isNone() const { return mShape == ssNone; }
2540 bool isPenDefined() const { return mPenDefined; }
2541 void undefinePen();
2542 void applyTo(QCPPainter *painter, const QPen &defaultPen) const;
2543 void drawShape(QCPPainter *painter, const QPointF &pos) const;
2544 void drawShape(QCPPainter *painter, double x, double y) const;
2545
2546protected:
2547 // property members:
2548 double mSize;
2549 ScatterShape mShape;
2550 QPen mPen;
2551 QBrush mBrush;
2552 QPixmap mPixmap;
2553 QPainterPath mCustomPath;
2554
2555 // non-property members:
2556 bool mPenDefined;
2557};
2558Q_DECLARE_TYPEINFO(QCPScatterStyle, Q_MOVABLE_TYPE);
2559Q_DECLARE_OPERATORS_FOR_FLAGS(QCPScatterStyle::ScatterProperties)
2560Q_DECLARE_METATYPE(QCPScatterStyle::ScatterProperty)
2561Q_DECLARE_METATYPE(QCPScatterStyle::ScatterShape)
2562
2563/* end of 'src/scatterstyle.h' */
2564
2565
2566/* including file 'src/datacontainer.h' */
2567/* modified 2021-03-29T02:30:44, size 34070 */
2568
2569
2574template <class DataType>
2575inline bool qcpLessThanSortKey(const DataType &a, const DataType &b) { return a.sortKey() < b.sortKey(); }
2576
2577template <class DataType>
2578class QCPDataContainer // no QCP_LIB_DECL, template class ends up in header (cpp included below)
2579{
2580public:
2581 typedef typename QVector<DataType>::const_iterator const_iterator;
2582 typedef typename QVector<DataType>::iterator iterator;
2583
2585
2586 // getters:
2587 int size() const { return mData.size()-mPreallocSize; }
2588 bool isEmpty() const { return size() == 0; }
2589 bool autoSqueeze() const { return mAutoSqueeze; }
2590
2591 // setters:
2592 void setAutoSqueeze(bool enabled);
2593
2594 // non-virtual methods:
2596 void set(const QVector<DataType> &data, bool alreadySorted=false);
2598 void add(const QVector<DataType> &data, bool alreadySorted=false);
2599 void add(const DataType &data);
2600 void removeBefore(double sortKey);
2601 void removeAfter(double sortKey);
2602 void remove(double sortKeyFrom, double sortKeyTo);
2603 void remove(double sortKey);
2604 void clear();
2605 void sort();
2606 void squeeze(bool preAllocation=true, bool postAllocation=true);
2607
2608 const_iterator constBegin() const { return mData.constBegin()+mPreallocSize; }
2609 const_iterator constEnd() const { return mData.constEnd(); }
2610 iterator begin() { return mData.begin()+mPreallocSize; }
2611 iterator end() { return mData.end(); }
2612 const_iterator findBegin(double sortKey, bool expandedRange=true) const;
2613 const_iterator findEnd(double sortKey, bool expandedRange=true) const;
2614 const_iterator at(int index) const { return constBegin()+qBound(0, index, size()); }
2615 QCPRange keyRange(bool &foundRange, QCP::SignDomain signDomain=QCP::sdBoth);
2616 QCPRange valueRange(bool &foundRange, QCP::SignDomain signDomain=QCP::sdBoth, const QCPRange &inKeyRange=QCPRange());
2617 QCPDataRange dataRange() const { return QCPDataRange(0, size()); }
2618 void limitIteratorsToDataRange(const_iterator &begin, const_iterator &end, const QCPDataRange &dataRange) const;
2619
2620protected:
2621 // property members:
2622 bool mAutoSqueeze;
2623
2624 // non-property memebers:
2625 QVector<DataType> mData;
2626 int mPreallocSize;
2627 int mPreallocIteration;
2628
2629 // non-virtual methods:
2630 void preallocateGrow(int minimumPreallocSize);
2631 void performAutoSqueeze();
2632};
2633
2634
2635
2636// include implementation in header since it is a class template:
2640
2707
2708/* start documentation of inline functions */
2709
2714
2719
2724
2729
2738
2747
2757
2763
2764/* end documentation of inline functions */
2765
2770template <class DataType>
2772 mAutoSqueeze(true),
2773 mPreallocSize(0),
2774 mPreallocIteration(0)
2775{
2776}
2777
2786template <class DataType>
2788{
2789 if (mAutoSqueeze != enabled)
2790 {
2791 mAutoSqueeze = enabled;
2792 if (mAutoSqueeze)
2793 performAutoSqueeze();
2794 }
2795}
2796
2803template <class DataType>
2805{
2806 clear();
2807 add(data);
2808}
2809
2819template <class DataType>
2820void QCPDataContainer<DataType>::set(const QVector<DataType> &data, bool alreadySorted)
2821{
2822 mData = data;
2823 mPreallocSize = 0;
2824 mPreallocIteration = 0;
2825 if (!alreadySorted)
2826 sort();
2827}
2828
2835template <class DataType>
2837{
2838 if (data.isEmpty())
2839 return;
2840
2841 const int n = data.size();
2842 const int oldSize = size();
2843
2844 if (oldSize > 0 && !qcpLessThanSortKey<DataType>(*constBegin(), *(data.constEnd()-1))) // prepend if new data keys are all smaller than or equal to existing ones
2845 {
2846 if (mPreallocSize < n)
2847 preallocateGrow(n);
2848 mPreallocSize -= n;
2849 std::copy(data.constBegin(), data.constEnd(), begin());
2850 } else // don't need to prepend, so append and merge if necessary
2851 {
2852 mData.resize(mData.size()+n);
2853 std::copy(data.constBegin(), data.constEnd(), end()-n);
2854 if (oldSize > 0 && !qcpLessThanSortKey<DataType>(*(constEnd()-n-1), *(constEnd()-n))) // if appended range keys aren't all greater than existing ones, merge the two partitions
2855 std::inplace_merge(begin(), end()-n, end(), qcpLessThanSortKey<DataType>);
2856 }
2857}
2858
2867template <class DataType>
2868void QCPDataContainer<DataType>::add(const QVector<DataType> &data, bool alreadySorted)
2869{
2870 if (data.isEmpty())
2871 return;
2872 if (isEmpty())
2873 {
2874 set(data, alreadySorted);
2875 return;
2876 }
2877
2878 const int n = data.size();
2879 const int oldSize = size();
2880
2881 if (alreadySorted && oldSize > 0 && !qcpLessThanSortKey<DataType>(*constBegin(), *(data.constEnd()-1))) // prepend if new data is sorted and keys are all smaller than or equal to existing ones
2882 {
2883 if (mPreallocSize < n)
2884 preallocateGrow(n);
2885 mPreallocSize -= n;
2886 std::copy(data.constBegin(), data.constEnd(), begin());
2887 } else // don't need to prepend, so append and then sort and merge if necessary
2888 {
2889 mData.resize(mData.size()+n);
2890 std::copy(data.constBegin(), data.constEnd(), end()-n);
2891 if (!alreadySorted) // sort appended subrange if it wasn't already sorted
2892 std::sort(end()-n, end(), qcpLessThanSortKey<DataType>);
2893 if (oldSize > 0 && !qcpLessThanSortKey<DataType>(*(constEnd()-n-1), *(constEnd()-n))) // if appended range keys aren't all greater than existing ones, merge the two partitions
2894 std::inplace_merge(begin(), end()-n, end(), qcpLessThanSortKey<DataType>);
2895 }
2896}
2897
2904template <class DataType>
2905void QCPDataContainer<DataType>::add(const DataType &data)
2906{
2907 if (isEmpty() || !qcpLessThanSortKey<DataType>(data, *(constEnd()-1))) // quickly handle appends if new data key is greater or equal to existing ones
2908 {
2909 mData.append(data);
2910 } else if (qcpLessThanSortKey<DataType>(data, *constBegin())) // quickly handle prepends using preallocated space
2911 {
2912 if (mPreallocSize < 1)
2913 preallocateGrow(1);
2914 --mPreallocSize;
2915 *begin() = data;
2916 } else // handle inserts, maintaining sorted keys
2917 {
2918 QCPDataContainer<DataType>::iterator insertionPoint = std::lower_bound(begin(), end(), data, qcpLessThanSortKey<DataType>);
2919 mData.insert(insertionPoint, data);
2920 }
2921}
2922
2928template <class DataType>
2930{
2931 QCPDataContainer<DataType>::iterator it = begin();
2932 QCPDataContainer<DataType>::iterator itEnd = std::lower_bound(begin(), end(), DataType::fromSortKey(sortKey), qcpLessThanSortKey<DataType>);
2933 mPreallocSize += int(itEnd-it); // don't actually delete, just add it to the preallocated block (if it gets too large, squeeze will take care of it)
2934 if (mAutoSqueeze)
2935 performAutoSqueeze();
2936}
2937
2943template <class DataType>
2945{
2946 QCPDataContainer<DataType>::iterator it = std::upper_bound(begin(), end(), DataType::fromSortKey(sortKey), qcpLessThanSortKey<DataType>);
2947 QCPDataContainer<DataType>::iterator itEnd = end();
2948 mData.erase(it, itEnd); // typically adds it to the postallocated block
2949 if (mAutoSqueeze)
2950 performAutoSqueeze();
2951}
2952
2960template <class DataType>
2961void QCPDataContainer<DataType>::remove(double sortKeyFrom, double sortKeyTo)
2962{
2963 if (sortKeyFrom >= sortKeyTo || isEmpty())
2964 return;
2965
2966 QCPDataContainer<DataType>::iterator it = std::lower_bound(begin(), end(), DataType::fromSortKey(sortKeyFrom), qcpLessThanSortKey<DataType>);
2967 QCPDataContainer<DataType>::iterator itEnd = std::upper_bound(it, end(), DataType::fromSortKey(sortKeyTo), qcpLessThanSortKey<DataType>);
2968 mData.erase(it, itEnd);
2969 if (mAutoSqueeze)
2970 performAutoSqueeze();
2971}
2972
2982template <class DataType>
2984{
2985 QCPDataContainer::iterator it = std::lower_bound(begin(), end(), DataType::fromSortKey(sortKey), qcpLessThanSortKey<DataType>);
2986 if (it != end() && it->sortKey() == sortKey)
2987 {
2988 if (it == begin())
2989 ++mPreallocSize; // don't actually delete, just add it to the preallocated block (if it gets too large, squeeze will take care of it)
2990 else
2991 mData.erase(it);
2992 }
2993 if (mAutoSqueeze)
2994 performAutoSqueeze();
2995}
2996
3002template <class DataType>
3004{
3005 mData.clear();
3006 mPreallocIteration = 0;
3007 mPreallocSize = 0;
3008}
3009
3021template <class DataType>
3026
3037template <class DataType>
3038void QCPDataContainer<DataType>::squeeze(bool preAllocation, bool postAllocation)
3039{
3040 if (preAllocation)
3041 {
3042 if (mPreallocSize > 0)
3043 {
3044 std::copy(begin(), end(), mData.begin());
3045 mData.resize(size());
3046 mPreallocSize = 0;
3047 }
3048 mPreallocIteration = 0;
3049 }
3050 if (postAllocation)
3051 mData.squeeze();
3052}
3053
3069template <class DataType>
3070typename QCPDataContainer<DataType>::const_iterator QCPDataContainer<DataType>::findBegin(double sortKey, bool expandedRange) const
3071{
3072 if (isEmpty())
3073 return constEnd();
3074
3075 QCPDataContainer<DataType>::const_iterator it = std::lower_bound(constBegin(), constEnd(), DataType::fromSortKey(sortKey), qcpLessThanSortKey<DataType>);
3076 if (expandedRange && it != constBegin()) // also covers it == constEnd case, and we know --constEnd is valid because mData isn't empty
3077 --it;
3078 return it;
3079}
3080
3096template <class DataType>
3097typename QCPDataContainer<DataType>::const_iterator QCPDataContainer<DataType>::findEnd(double sortKey, bool expandedRange) const
3098{
3099 if (isEmpty())
3100 return constEnd();
3101
3102 QCPDataContainer<DataType>::const_iterator it = std::upper_bound(constBegin(), constEnd(), DataType::fromSortKey(sortKey), qcpLessThanSortKey<DataType>);
3103 if (expandedRange && it != constEnd())
3104 ++it;
3105 return it;
3106}
3107
3123template <class DataType>
3125{
3126 if (isEmpty())
3127 {
3128 foundRange = false;
3129 return QCPRange();
3130 }
3131 QCPRange range;
3132 bool haveLower = false;
3133 bool haveUpper = false;
3134 double current;
3135
3136 QCPDataContainer<DataType>::const_iterator it = constBegin();
3137 QCPDataContainer<DataType>::const_iterator itEnd = constEnd();
3138 if (signDomain == QCP::sdBoth) // range may be anywhere
3139 {
3140 if (DataType::sortKeyIsMainKey()) // if DataType is sorted by main key (e.g. QCPGraph, but not QCPCurve), use faster algorithm by finding just first and last key with non-NaN value
3141 {
3142 while (it != itEnd) // find first non-nan going up from left
3143 {
3144 if (!qIsNaN(it->mainValue()))
3145 {
3146 range.lower = it->mainKey();
3147 haveLower = true;
3148 break;
3149 }
3150 ++it;
3151 }
3152 it = itEnd;
3153 while (it != constBegin()) // find first non-nan going down from right
3154 {
3155 --it;
3156 if (!qIsNaN(it->mainValue()))
3157 {
3158 range.upper = it->mainKey();
3159 haveUpper = true;
3160 break;
3161 }
3162 }
3163 } else // DataType is not sorted by main key, go through all data points and accordingly expand range
3164 {
3165 while (it != itEnd)
3166 {
3167 if (!qIsNaN(it->mainValue()))
3168 {
3169 current = it->mainKey();
3170 if (current < range.lower || !haveLower)
3171 {
3172 range.lower = current;
3173 haveLower = true;
3174 }
3175 if (current > range.upper || !haveUpper)
3176 {
3177 range.upper = current;
3178 haveUpper = true;
3179 }
3180 }
3181 ++it;
3182 }
3183 }
3184 } else if (signDomain == QCP::sdNegative) // range may only be in the negative sign domain
3185 {
3186 while (it != itEnd)
3187 {
3188 if (!qIsNaN(it->mainValue()))
3189 {
3190 current = it->mainKey();
3191 if ((current < range.lower || !haveLower) && current < 0)
3192 {
3193 range.lower = current;
3194 haveLower = true;
3195 }
3196 if ((current > range.upper || !haveUpper) && current < 0)
3197 {
3198 range.upper = current;
3199 haveUpper = true;
3200 }
3201 }
3202 ++it;
3203 }
3204 } else if (signDomain == QCP::sdPositive) // range may only be in the positive sign domain
3205 {
3206 while (it != itEnd)
3207 {
3208 if (!qIsNaN(it->mainValue()))
3209 {
3210 current = it->mainKey();
3211 if ((current < range.lower || !haveLower) && current > 0)
3212 {
3213 range.lower = current;
3214 haveLower = true;
3215 }
3216 if ((current > range.upper || !haveUpper) && current > 0)
3217 {
3218 range.upper = current;
3219 haveUpper = true;
3220 }
3221 }
3222 ++it;
3223 }
3224 }
3225
3226 foundRange = haveLower && haveUpper;
3227 return range;
3228}
3229
3246template <class DataType>
3247QCPRange QCPDataContainer<DataType>::valueRange(bool &foundRange, QCP::SignDomain signDomain, const QCPRange &inKeyRange)
3248{
3249 if (isEmpty())
3250 {
3251 foundRange = false;
3252 return QCPRange();
3253 }
3254 QCPRange range;
3255 const bool restrictKeyRange = inKeyRange != QCPRange();
3256 bool haveLower = false;
3257 bool haveUpper = false;
3258 QCPRange current;
3259 QCPDataContainer<DataType>::const_iterator itBegin = constBegin();
3260 QCPDataContainer<DataType>::const_iterator itEnd = constEnd();
3261 if (DataType::sortKeyIsMainKey() && restrictKeyRange)
3262 {
3263 itBegin = findBegin(inKeyRange.lower, false);
3264 itEnd = findEnd(inKeyRange.upper, false);
3265 }
3266 if (signDomain == QCP::sdBoth) // range may be anywhere
3267 {
3268 for (QCPDataContainer<DataType>::const_iterator it = itBegin; it != itEnd; ++it)
3269 {
3270 if (restrictKeyRange && (it->mainKey() < inKeyRange.lower || it->mainKey() > inKeyRange.upper))
3271 continue;
3272 current = it->valueRange();
3273 if ((current.lower < range.lower || !haveLower) && !qIsNaN(current.lower))
3274 {
3275 range.lower = current.lower;
3276 haveLower = true;
3277 }
3278 if ((current.upper > range.upper || !haveUpper) && !qIsNaN(current.upper))
3279 {
3280 range.upper = current.upper;
3281 haveUpper = true;
3282 }
3283 }
3284 } else if (signDomain == QCP::sdNegative) // range may only be in the negative sign domain
3285 {
3286 for (QCPDataContainer<DataType>::const_iterator it = itBegin; it != itEnd; ++it)
3287 {
3288 if (restrictKeyRange && (it->mainKey() < inKeyRange.lower || it->mainKey() > inKeyRange.upper))
3289 continue;
3290 current = it->valueRange();
3291 if ((current.lower < range.lower || !haveLower) && current.lower < 0 && !qIsNaN(current.lower))
3292 {
3293 range.lower = current.lower;
3294 haveLower = true;
3295 }
3296 if ((current.upper > range.upper || !haveUpper) && current.upper < 0 && !qIsNaN(current.upper))
3297 {
3298 range.upper = current.upper;
3299 haveUpper = true;
3300 }
3301 }
3302 } else if (signDomain == QCP::sdPositive) // range may only be in the positive sign domain
3303 {
3304 for (QCPDataContainer<DataType>::const_iterator it = itBegin; it != itEnd; ++it)
3305 {
3306 if (restrictKeyRange && (it->mainKey() < inKeyRange.lower || it->mainKey() > inKeyRange.upper))
3307 continue;
3308 current = it->valueRange();
3309 if ((current.lower < range.lower || !haveLower) && current.lower > 0 && !qIsNaN(current.lower))
3310 {
3311 range.lower = current.lower;
3312 haveLower = true;
3313 }
3314 if ((current.upper > range.upper || !haveUpper) && current.upper > 0 && !qIsNaN(current.upper))
3315 {
3316 range.upper = current.upper;
3317 haveUpper = true;
3318 }
3319 }
3320 }
3321
3322 foundRange = haveLower && haveUpper;
3323 return range;
3324}
3325
3334template <class DataType>
3336{
3337 QCPDataRange iteratorRange(int(begin-constBegin()), int(end-constBegin()));
3338 iteratorRange = iteratorRange.bounded(dataRange.bounded(this->dataRange()));
3339 begin = constBegin()+iteratorRange.begin();
3340 end = constBegin()+iteratorRange.end();
3341}
3342
3352template <class DataType>
3353void QCPDataContainer<DataType>::preallocateGrow(int minimumPreallocSize)
3354{
3355 if (minimumPreallocSize <= mPreallocSize)
3356 return;
3357
3358 int newPreallocSize = minimumPreallocSize;
3359 newPreallocSize += (1u<<qBound(4, mPreallocIteration+4, 15)) - 12; // do 4 up to 32768-12 preallocation, doubling in each intermediate iteration
3360 ++mPreallocIteration;
3361
3362 int sizeDifference = newPreallocSize-mPreallocSize;
3363 mData.resize(mData.size()+sizeDifference);
3364 std::copy_backward(mData.begin()+mPreallocSize, mData.end()-sizeDifference, mData.end());
3365 mPreallocSize = newPreallocSize;
3366}
3367
3382template <class DataType>
3383void QCPDataContainer<DataType>::performAutoSqueeze()
3384{
3385 const int totalAlloc = mData.capacity();
3386 const int postAllocSize = totalAlloc-mData.size();
3387 const int usedSize = size();
3388 bool shrinkPostAllocation = false;
3389 bool shrinkPreAllocation = false;
3390 if (totalAlloc > 650000) // if allocation is larger, shrink earlier with respect to total used size
3391 {
3392 shrinkPostAllocation = postAllocSize > usedSize*1.5; // QVector grow strategy is 2^n for static data. Watch out not to oscillate!
3393 shrinkPreAllocation = mPreallocSize*10 > usedSize;
3394 } else if (totalAlloc > 1000) // below 10 MiB raw data be generous with preallocated memory, below 1k points don't even bother
3395 {
3396 shrinkPostAllocation = postAllocSize > usedSize*5;
3397 shrinkPreAllocation = mPreallocSize > usedSize*1.5; // preallocation can grow into postallocation, so can be smaller
3398 }
3399
3400 if (shrinkPreAllocation || shrinkPostAllocation)
3401 squeeze(shrinkPreAllocation, shrinkPostAllocation);
3402}
3403
3404
3405/* end of 'src/datacontainer.h' */
3406
3407
3408/* including file 'src/plottable.h' */
3409/* modified 2021-03-29T02:30:44, size 8461 */
3410
3411class QCP_LIB_DECL QCPSelectionDecorator
3412{
3413 Q_GADGET
3414public:
3416 virtual ~QCPSelectionDecorator();
3417
3418 // getters:
3419 QPen pen() const { return mPen; }
3420 QBrush brush() const { return mBrush; }
3421 QCPScatterStyle scatterStyle() const { return mScatterStyle; }
3422 QCPScatterStyle::ScatterProperties usedScatterProperties() const { return mUsedScatterProperties; }
3423
3424 // setters:
3425 void setPen(const QPen &pen);
3426 void setBrush(const QBrush &brush);
3427 void setScatterStyle(const QCPScatterStyle &scatterStyle, QCPScatterStyle::ScatterProperties usedProperties=QCPScatterStyle::spPen);
3428 void setUsedScatterProperties(const QCPScatterStyle::ScatterProperties &properties);
3429
3430 // non-virtual methods:
3431 void applyPen(QCPPainter *painter) const;
3432 void applyBrush(QCPPainter *painter) const;
3433 QCPScatterStyle getFinalScatterStyle(const QCPScatterStyle &unselectedStyle) const;
3434
3435 // introduced virtual methods:
3436 virtual void copyFrom(const QCPSelectionDecorator *other);
3437 virtual void drawDecoration(QCPPainter *painter, QCPDataSelection selection);
3438
3439protected:
3440 // property members:
3441 QPen mPen;
3442 QBrush mBrush;
3443 QCPScatterStyle mScatterStyle;
3444 QCPScatterStyle::ScatterProperties mUsedScatterProperties;
3445 // non-property members:
3446 QCPAbstractPlottable *mPlottable;
3447
3448 // introduced virtual methods:
3449 virtual bool registerWithPlottable(QCPAbstractPlottable *plottable);
3450
3451private:
3452 Q_DISABLE_COPY(QCPSelectionDecorator)
3453 friend class QCPAbstractPlottable;
3454};
3455Q_DECLARE_METATYPE(QCPSelectionDecorator*)
3456
3457
3458class QCP_LIB_DECL QCPAbstractPlottable : public QCPLayerable
3459{
3460 Q_OBJECT
3462 Q_PROPERTY(QString name READ name WRITE setName)
3463 Q_PROPERTY(bool antialiasedFill READ antialiasedFill WRITE setAntialiasedFill)
3464 Q_PROPERTY(bool antialiasedScatters READ antialiasedScatters WRITE setAntialiasedScatters)
3465 Q_PROPERTY(QPen pen READ pen WRITE setPen)
3466 Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
3467 Q_PROPERTY(QCPAxis* keyAxis READ keyAxis WRITE setKeyAxis)
3468 Q_PROPERTY(QCPAxis* valueAxis READ valueAxis WRITE setValueAxis)
3469 Q_PROPERTY(QCP::SelectionType selectable READ selectable WRITE setSelectable NOTIFY selectableChanged)
3473public:
3474 QCPAbstractPlottable(QCPAxis *keyAxis, QCPAxis *valueAxis);
3475 virtual ~QCPAbstractPlottable() Q_DECL_OVERRIDE;
3476
3477 // getters:
3478 QString name() const { return mName; }
3479 bool antialiasedFill() const { return mAntialiasedFill; }
3480 bool antialiasedScatters() const { return mAntialiasedScatters; }
3481 QPen pen() const { return mPen; }
3482 QBrush brush() const { return mBrush; }
3483 QCPAxis *keyAxis() const { return mKeyAxis.data(); }
3484 QCPAxis *valueAxis() const { return mValueAxis.data(); }
3485 QCP::SelectionType selectable() const { return mSelectable; }
3486 bool selected() const { return !mSelection.isEmpty(); }
3487 QCPDataSelection selection() const { return mSelection; }
3488 QCPSelectionDecorator *selectionDecorator() const { return mSelectionDecorator; }
3489
3490 // setters:
3491 void setName(const QString &name);
3492 void setAntialiasedFill(bool enabled);
3493 void setAntialiasedScatters(bool enabled);
3494 void setPen(const QPen &pen);
3495 void setBrush(const QBrush &brush);
3496 void setKeyAxis(QCPAxis *axis);
3497 void setValueAxis(QCPAxis *axis);
3498 Q_SLOT void setSelectable(QCP::SelectionType selectable);
3501
3502 // introduced virtual methods:
3503 virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE = 0; // actually introduced in QCPLayerable as non-pure, but we want to force reimplementation for plottables
3504 virtual QCPPlottableInterface1D *interface1D() { return nullptr; }
3505 virtual QCPRange getKeyRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth) const = 0;
3506 virtual QCPRange getValueRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth, const QCPRange &inKeyRange=QCPRange()) const = 0;
3507
3508 // non-property methods:
3509 void coordsToPixels(double key, double value, double &x, double &y) const;
3510 const QPointF coordsToPixels(double key, double value) const;
3511 void pixelsToCoords(double x, double y, double &key, double &value) const;
3512 void pixelsToCoords(const QPointF &pixelPos, double &key, double &value) const;
3513 void rescaleAxes(bool onlyEnlarge=false) const;
3514 void rescaleKeyAxis(bool onlyEnlarge=false) const;
3515 void rescaleValueAxis(bool onlyEnlarge=false, bool inKeyRange=false) const;
3516 bool addToLegend(QCPLegend *legend);
3517 bool addToLegend();
3518 bool removeFromLegend(QCPLegend *legend) const;
3519 bool removeFromLegend() const;
3520
3521signals:
3525
3526protected:
3527 // property members:
3528 QString mName;
3529 bool mAntialiasedFill, mAntialiasedScatters;
3530 QPen mPen;
3531 QBrush mBrush;
3532 QPointer<QCPAxis> mKeyAxis, mValueAxis;
3533 QCP::SelectionType mSelectable;
3534 QCPDataSelection mSelection;
3535 QCPSelectionDecorator *mSelectionDecorator;
3536
3537 // reimplemented virtual methods:
3538 virtual QRect clipRect() const Q_DECL_OVERRIDE;
3539 virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE = 0;
3540 virtual QCP::Interaction selectionCategory() const Q_DECL_OVERRIDE;
3541 void applyDefaultAntialiasingHint(QCPPainter *painter) const Q_DECL_OVERRIDE;
3542 // events:
3543 virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) Q_DECL_OVERRIDE;
3544 virtual void deselectEvent(bool *selectionStateChanged) Q_DECL_OVERRIDE;
3545
3546 // introduced virtual methods:
3547 virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const = 0;
3548
3549 // non-virtual methods:
3550 void applyFillAntialiasingHint(QCPPainter *painter) const;
3551 void applyScattersAntialiasingHint(QCPPainter *painter) const;
3552
3553private:
3554 Q_DISABLE_COPY(QCPAbstractPlottable)
3555
3556 friend class QCustomPlot;
3557 friend class QCPAxis;
3558 friend class QCPPlottableLegendItem;
3559};
3560
3561
3562/* end of 'src/plottable.h' */
3563
3564
3565/* including file 'src/item.h' */
3566/* modified 2021-03-29T02:30:44, size 9425 */
3567
3568class QCP_LIB_DECL QCPItemAnchor
3569{
3570 Q_GADGET
3571public:
3572 QCPItemAnchor(QCustomPlot *parentPlot, QCPAbstractItem *parentItem, const QString &name, int anchorId=-1);
3573 virtual ~QCPItemAnchor();
3574
3575 // getters:
3576 QString name() const { return mName; }
3577 virtual QPointF pixelPosition() const;
3578
3579protected:
3580 // property members:
3581 QString mName;
3582
3583 // non-property members:
3584 QCustomPlot *mParentPlot;
3585 QCPAbstractItem *mParentItem;
3586 int mAnchorId;
3587 QSet<QCPItemPosition*> mChildrenX, mChildrenY;
3588
3589 // introduced virtual methods:
3590 virtual QCPItemPosition *toQCPItemPosition() { return nullptr; }
3591
3592 // non-virtual methods:
3593 void addChildX(QCPItemPosition* pos); // called from pos when this anchor is set as parent
3594 void removeChildX(QCPItemPosition *pos); // called from pos when its parent anchor is reset or pos deleted
3595 void addChildY(QCPItemPosition* pos); // called from pos when this anchor is set as parent
3596 void removeChildY(QCPItemPosition *pos); // called from pos when its parent anchor is reset or pos deleted
3597
3598private:
3599 Q_DISABLE_COPY(QCPItemAnchor)
3600
3601 friend class QCPItemPosition;
3602};
3603
3604
3605
3606class QCP_LIB_DECL QCPItemPosition : public QCPItemAnchor
3607{
3608 Q_GADGET
3609public:
3625 Q_ENUMS(PositionType)
3626
3627 QCPItemPosition(QCustomPlot *parentPlot, QCPAbstractItem *parentItem, const QString &name);
3628 virtual ~QCPItemPosition() Q_DECL_OVERRIDE;
3629
3630 // getters:
3631 PositionType type() const { return typeX(); }
3632 PositionType typeX() const { return mPositionTypeX; }
3633 PositionType typeY() const { return mPositionTypeY; }
3634 QCPItemAnchor *parentAnchor() const { return parentAnchorX(); }
3635 QCPItemAnchor *parentAnchorX() const { return mParentAnchorX; }
3636 QCPItemAnchor *parentAnchorY() const { return mParentAnchorY; }
3637 double key() const { return mKey; }
3638 double value() const { return mValue; }
3639 QPointF coords() const { return QPointF(mKey, mValue); }
3640 QCPAxis *keyAxis() const { return mKeyAxis.data(); }
3641 QCPAxis *valueAxis() const { return mValueAxis.data(); }
3642 QCPAxisRect *axisRect() const;
3643 virtual QPointF pixelPosition() const Q_DECL_OVERRIDE;
3644
3645 // setters:
3646 void setType(PositionType type);
3647 void setTypeX(PositionType type);
3648 void setTypeY(PositionType type);
3649 bool setParentAnchor(QCPItemAnchor *parentAnchor, bool keepPixelPosition=false);
3650 bool setParentAnchorX(QCPItemAnchor *parentAnchor, bool keepPixelPosition=false);
3651 bool setParentAnchorY(QCPItemAnchor *parentAnchor, bool keepPixelPosition=false);
3652 void setCoords(double key, double value);
3653 void setCoords(const QPointF &pos);
3654 void setAxes(QCPAxis* keyAxis, QCPAxis* valueAxis);
3655 void setAxisRect(QCPAxisRect *axisRect);
3656 void setPixelPosition(const QPointF &pixelPosition);
3657
3658protected:
3659 // property members:
3660 PositionType mPositionTypeX, mPositionTypeY;
3661 QPointer<QCPAxis> mKeyAxis, mValueAxis;
3662 QPointer<QCPAxisRect> mAxisRect;
3663 double mKey, mValue;
3664 QCPItemAnchor *mParentAnchorX, *mParentAnchorY;
3665
3666 // reimplemented virtual methods:
3667 virtual QCPItemPosition *toQCPItemPosition() Q_DECL_OVERRIDE { return this; }
3668
3669private:
3670 Q_DISABLE_COPY(QCPItemPosition)
3671
3672};
3673Q_DECLARE_METATYPE(QCPItemPosition::PositionType)
3674
3675
3676class QCP_LIB_DECL QCPAbstractItem : public QCPLayerable
3677{
3678 Q_OBJECT
3680 Q_PROPERTY(bool clipToAxisRect READ clipToAxisRect WRITE setClipToAxisRect)
3681 Q_PROPERTY(QCPAxisRect* clipAxisRect READ clipAxisRect WRITE setClipAxisRect)
3682 Q_PROPERTY(bool selectable READ selectable WRITE setSelectable NOTIFY selectableChanged)
3683 Q_PROPERTY(bool selected READ selected WRITE setSelected NOTIFY selectionChanged)
3685public:
3686 explicit QCPAbstractItem(QCustomPlot *parentPlot);
3687 virtual ~QCPAbstractItem() Q_DECL_OVERRIDE;
3688
3689 // getters:
3690 bool clipToAxisRect() const { return mClipToAxisRect; }
3691 QCPAxisRect *clipAxisRect() const;
3692 bool selectable() const { return mSelectable; }
3693 bool selected() const { return mSelected; }
3694
3695 // setters:
3696 void setClipToAxisRect(bool clip);
3697 void setClipAxisRect(QCPAxisRect *rect);
3698 Q_SLOT void setSelectable(bool selectable);
3699 Q_SLOT void setSelected(bool selected);
3700
3701 // reimplemented virtual methods:
3702 virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE = 0;
3703
3704 // non-virtual methods:
3705 QList<QCPItemPosition*> positions() const { return mPositions; }
3706 QList<QCPItemAnchor*> anchors() const { return mAnchors; }
3707 QCPItemPosition *position(const QString &name) const;
3708 QCPItemAnchor *anchor(const QString &name) const;
3709 bool hasAnchor(const QString &name) const;
3710
3711signals:
3712 void selectionChanged(bool selected);
3713 void selectableChanged(bool selectable);
3714
3715protected:
3716 // property members:
3717 bool mClipToAxisRect;
3718 QPointer<QCPAxisRect> mClipAxisRect;
3719 QList<QCPItemPosition*> mPositions;
3720 QList<QCPItemAnchor*> mAnchors;
3721 bool mSelectable, mSelected;
3722
3723 // reimplemented virtual methods:
3724 virtual QCP::Interaction selectionCategory() const Q_DECL_OVERRIDE;
3725 virtual QRect clipRect() const Q_DECL_OVERRIDE;
3726 virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const Q_DECL_OVERRIDE;
3727 virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE = 0;
3728 // events:
3729 virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) Q_DECL_OVERRIDE;
3730 virtual void deselectEvent(bool *selectionStateChanged) Q_DECL_OVERRIDE;
3731
3732 // introduced virtual methods:
3733 virtual QPointF anchorPixelPosition(int anchorId) const;
3734
3735 // non-virtual methods:
3736 double rectDistance(const QRectF &rect, const QPointF &pos, bool filledRect) const;
3737 QCPItemPosition *createPosition(const QString &name);
3738 QCPItemAnchor *createAnchor(const QString &name, int anchorId);
3739
3740private:
3741 Q_DISABLE_COPY(QCPAbstractItem)
3742
3743 friend class QCustomPlot;
3744 friend class QCPItemAnchor;
3745};
3746
3747/* end of 'src/item.h' */
3748
3749
3750/* including file 'src/core.h' */
3751/* modified 2021-03-29T02:30:44, size 19304 */
3752
3753class QCP_LIB_DECL QCustomPlot : public QWidget
3754{
3755 Q_OBJECT
3757 Q_PROPERTY(QRect viewport READ viewport WRITE setViewport)
3758 Q_PROPERTY(QPixmap background READ background WRITE setBackground)
3759 Q_PROPERTY(bool backgroundScaled READ backgroundScaled WRITE setBackgroundScaled)
3760 Q_PROPERTY(Qt::AspectRatioMode backgroundScaledMode READ backgroundScaledMode WRITE setBackgroundScaledMode)
3761 Q_PROPERTY(QCPLayoutGrid* plotLayout READ plotLayout)
3762 Q_PROPERTY(bool autoAddPlottableToLegend READ autoAddPlottableToLegend WRITE setAutoAddPlottableToLegend)
3763 Q_PROPERTY(int selectionTolerance READ selectionTolerance WRITE setSelectionTolerance)
3764 Q_PROPERTY(bool noAntialiasingOnDrag READ noAntialiasingOnDrag WRITE setNoAntialiasingOnDrag)
3765 Q_PROPERTY(Qt::KeyboardModifier multiSelectModifier READ multiSelectModifier WRITE setMultiSelectModifier)
3766 Q_PROPERTY(bool openGl READ openGl WRITE setOpenGl)
3768public:
3777 Q_ENUMS(LayerInsertMode)
3778
3779
3789 Q_ENUMS(RefreshPriority)
3790
3791 explicit QCustomPlot(QWidget *parent = nullptr);
3792 virtual ~QCustomPlot() Q_DECL_OVERRIDE;
3793
3794 // getters:
3795 QRect viewport() const { return mViewport; }
3796 double bufferDevicePixelRatio() const { return mBufferDevicePixelRatio; }
3797 QPixmap background() const { return mBackgroundPixmap; }
3798 bool backgroundScaled() const { return mBackgroundScaled; }
3799 Qt::AspectRatioMode backgroundScaledMode() const { return mBackgroundScaledMode; }
3800 QCPLayoutGrid *plotLayout() const { return mPlotLayout; }
3801 QCP::AntialiasedElements antialiasedElements() const { return mAntialiasedElements; }
3802 QCP::AntialiasedElements notAntialiasedElements() const { return mNotAntialiasedElements; }
3803 bool autoAddPlottableToLegend() const { return mAutoAddPlottableToLegend; }
3804 const QCP::Interactions interactions() const { return mInteractions; }
3805 int selectionTolerance() const { return mSelectionTolerance; }
3806 bool noAntialiasingOnDrag() const { return mNoAntialiasingOnDrag; }
3807 QCP::PlottingHints plottingHints() const { return mPlottingHints; }
3808 Qt::KeyboardModifier multiSelectModifier() const { return mMultiSelectModifier; }
3809 QCP::SelectionRectMode selectionRectMode() const { return mSelectionRectMode; }
3810 QCPSelectionRect *selectionRect() const { return mSelectionRect; }
3811 bool openGl() const { return mOpenGl; }
3812
3813 // setters:
3814 void setViewport(const QRect &rect);
3815 void setBufferDevicePixelRatio(double ratio);
3816 void setBackground(const QPixmap &pm);
3817 void setBackground(const QPixmap &pm, bool scaled, Qt::AspectRatioMode mode=Qt::KeepAspectRatioByExpanding);
3818 void setBackground(const QBrush &brush);
3819 void setBackgroundScaled(bool scaled);
3820 void setBackgroundScaledMode(Qt::AspectRatioMode mode);
3821 void setAntialiasedElements(const QCP::AntialiasedElements &antialiasedElements);
3822 void setAntialiasedElement(QCP::AntialiasedElement antialiasedElement, bool enabled=true);
3823 void setNotAntialiasedElements(const QCP::AntialiasedElements &notAntialiasedElements);
3824 void setNotAntialiasedElement(QCP::AntialiasedElement notAntialiasedElement, bool enabled=true);
3825 void setAutoAddPlottableToLegend(bool on);
3826 void setInteractions(const QCP::Interactions &interactions);
3827 void setInteraction(const QCP::Interaction &interaction, bool enabled=true);
3828 void setSelectionTolerance(int pixels);
3829 void setNoAntialiasingOnDrag(bool enabled);
3830 void setPlottingHints(const QCP::PlottingHints &hints);
3831 void setPlottingHint(QCP::PlottingHint hint, bool enabled=true);
3832 void setMultiSelectModifier(Qt::KeyboardModifier modifier);
3833 void setSelectionRectMode(QCP::SelectionRectMode mode);
3834 void setSelectionRect(QCPSelectionRect *selectionRect);
3835 void setOpenGl(bool enabled, int multisampling=16);
3836
3837 // non-property methods:
3838 // plottable interface:
3839 QCPAbstractPlottable *plottable(int index);
3840 QCPAbstractPlottable *plottable();
3841 bool removePlottable(QCPAbstractPlottable *plottable);
3842 bool removePlottable(int index);
3843 int clearPlottables();
3844 int plottableCount() const;
3845 QList<QCPAbstractPlottable*> selectedPlottables() const;
3846 template<class PlottableType>
3847 PlottableType *plottableAt(const QPointF &pos, bool onlySelectable=false, int *dataIndex=nullptr) const;
3848 QCPAbstractPlottable *plottableAt(const QPointF &pos, bool onlySelectable=false, int *dataIndex=nullptr) const;
3849 bool hasPlottable(QCPAbstractPlottable *plottable) const;
3850
3851 // specialized interface for QCPGraph:
3852 QCPGraph *graph(int index) const;
3853 QCPGraph *graph() const;
3854 QCPGraph *addGraph(QCPAxis *keyAxis=nullptr, QCPAxis *valueAxis=nullptr);
3855 bool removeGraph(QCPGraph *graph);
3856 bool removeGraph(int index);
3857 int clearGraphs();
3858 int graphCount() const;
3859 QList<QCPGraph*> selectedGraphs() const;
3860
3861 // item interface:
3862 QCPAbstractItem *item(int index) const;
3863 QCPAbstractItem *item() const;
3864 bool removeItem(QCPAbstractItem *item);
3865 bool removeItem(int index);
3866 int clearItems();
3867 int itemCount() const;
3868 QList<QCPAbstractItem*> selectedItems() const;
3869 template<class ItemType>
3870 ItemType *itemAt(const QPointF &pos, bool onlySelectable=false) const;
3871 QCPAbstractItem *itemAt(const QPointF &pos, bool onlySelectable=false) const;
3872 bool hasItem(QCPAbstractItem *item) const;
3873
3874 // layer interface:
3875 QCPLayer *layer(const QString &name) const;
3876 QCPLayer *layer(int index) const;
3877 QCPLayer *currentLayer() const;
3878 bool setCurrentLayer(const QString &name);
3879 bool setCurrentLayer(QCPLayer *layer);
3880 int layerCount() const;
3881 bool addLayer(const QString &name, QCPLayer *otherLayer=nullptr, LayerInsertMode insertMode=limAbove);
3882 bool removeLayer(QCPLayer *layer);
3883 bool moveLayer(QCPLayer *layer, QCPLayer *otherLayer, LayerInsertMode insertMode=limAbove);
3884
3885 // axis rect/layout interface:
3886 int axisRectCount() const;
3887 QCPAxisRect* axisRect(int index=0) const;
3888 QList<QCPAxisRect*> axisRects() const;
3889 QCPLayoutElement* layoutElementAt(const QPointF &pos) const;
3890 QCPAxisRect* axisRectAt(const QPointF &pos) const;
3891 Q_SLOT void rescaleAxes(bool onlyVisiblePlottables=false);
3892
3893 QList<QCPAxis*> selectedAxes() const;
3894 QList<QCPLegend*> selectedLegends() const;
3895 Q_SLOT void deselectAll();
3896
3897 bool savePdf(const QString &fileName, int width=0, int height=0, QCP::ExportPen exportPen=QCP::epAllowCosmetic, const QString &pdfCreator=QString(), const QString &pdfTitle=QString());
3898 bool savePng(const QString &fileName, int width=0, int height=0, double scale=1.0, int quality=-1, int resolution=96, QCP::ResolutionUnit resolutionUnit=QCP::ruDotsPerInch);
3899 bool saveJpg(const QString &fileName, int width=0, int height=0, double scale=1.0, int quality=-1, int resolution=96, QCP::ResolutionUnit resolutionUnit=QCP::ruDotsPerInch);
3900 bool saveBmp(const QString &fileName, int width=0, int height=0, double scale=1.0, int resolution=96, QCP::ResolutionUnit resolutionUnit=QCP::ruDotsPerInch);
3901 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);
3902 QPixmap toPixmap(int width=0, int height=0, double scale=1.0);
3903 void toPainter(QCPPainter *painter, int width=0, int height=0);
3904 Q_SLOT void replot(QCustomPlot::RefreshPriority refreshPriority=QCustomPlot::rpRefreshHint);
3905 double replotTime(bool average=false) const;
3906
3907 QCPAxis *xAxis, *yAxis, *xAxis2, *yAxis2;
3908 QCPLegend *legend;
3909
3910signals:
3911 void mouseDoubleClick(QMouseEvent *event);
3912 void mousePress(QMouseEvent *event);
3913 void mouseMove(QMouseEvent *event);
3914 void mouseRelease(QMouseEvent *event);
3915 void mouseWheel(QWheelEvent *event);
3916
3917 void plottableClick(QCPAbstractPlottable *plottable, int dataIndex, QMouseEvent *event);
3918 void plottableDoubleClick(QCPAbstractPlottable *plottable, int dataIndex, QMouseEvent *event);
3919 void itemClick(QCPAbstractItem *item, QMouseEvent *event);
3920 void itemDoubleClick(QCPAbstractItem *item, QMouseEvent *event);
3921 void axisClick(QCPAxis *axis, QCPAxis::SelectablePart part, QMouseEvent *event);
3922 void axisDoubleClick(QCPAxis *axis, QCPAxis::SelectablePart part, QMouseEvent *event);
3923 void legendClick(QCPLegend *legend, QCPAbstractLegendItem *item, QMouseEvent *event);
3924 void legendDoubleClick(QCPLegend *legend, QCPAbstractLegendItem *item, QMouseEvent *event);
3925
3930
3931protected:
3932 // property members:
3933 QRect mViewport;
3934 double mBufferDevicePixelRatio;
3935 QCPLayoutGrid *mPlotLayout;
3936 bool mAutoAddPlottableToLegend;
3937 QList<QCPAbstractPlottable*> mPlottables;
3938 QList<QCPGraph*> mGraphs; // extra list of plottables also in mPlottables that are of type QCPGraph
3939 QList<QCPAbstractItem*> mItems;
3940 QList<QCPLayer*> mLayers;
3941 QCP::AntialiasedElements mAntialiasedElements, mNotAntialiasedElements;
3942 QCP::Interactions mInteractions;
3943 int mSelectionTolerance;
3944 bool mNoAntialiasingOnDrag;
3945 QBrush mBackgroundBrush;
3946 QPixmap mBackgroundPixmap;
3947 QPixmap mScaledBackgroundPixmap;
3948 bool mBackgroundScaled;
3949 Qt::AspectRatioMode mBackgroundScaledMode;
3950 QCPLayer *mCurrentLayer;
3951 QCP::PlottingHints mPlottingHints;
3952 Qt::KeyboardModifier mMultiSelectModifier;
3953 QCP::SelectionRectMode mSelectionRectMode;
3954 QCPSelectionRect *mSelectionRect;
3955 bool mOpenGl;
3956
3957 // non-property members:
3958 QList<QSharedPointer<QCPAbstractPaintBuffer> > mPaintBuffers;
3959 QPoint mMousePressPos;
3960 bool mMouseHasMoved;
3961 QPointer<QCPLayerable> mMouseEventLayerable;
3962 QPointer<QCPLayerable> mMouseSignalLayerable;
3963 QVariant mMouseEventLayerableDetails;
3964 QVariant mMouseSignalLayerableDetails;
3965 bool mReplotting;
3966 bool mReplotQueued;
3967 double mReplotTime, mReplotTimeAverage;
3968 int mOpenGlMultisamples;
3969 QCP::AntialiasedElements mOpenGlAntialiasedElementsBackup;
3970 bool mOpenGlCacheLabelsBackup;
3971#ifdef QCP_OPENGL_FBO
3972 QSharedPointer<QOpenGLContext> mGlContext;
3973 QSharedPointer<QSurface> mGlSurface;
3974 QSharedPointer<QOpenGLPaintDevice> mGlPaintDevice;
3975#endif
3976
3977 // reimplemented virtual methods:
3978 virtual QSize minimumSizeHint() const Q_DECL_OVERRIDE;
3979 virtual QSize sizeHint() const Q_DECL_OVERRIDE;
3980 virtual void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
3981 virtual void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
3982 virtual void mouseDoubleClickEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
3983 virtual void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
3984 virtual void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
3985 virtual void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
3986 virtual void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE;
3987
3988 // introduced virtual methods:
3989 virtual void draw(QCPPainter *painter);
3990 virtual void updateLayout();
3991 virtual void axisRemoved(QCPAxis *axis);
3992 virtual void legendRemoved(QCPLegend *legend);
3993 Q_SLOT virtual void processRectSelection(QRect rect, QMouseEvent *event);
3994 Q_SLOT virtual void processRectZoom(QRect rect, QMouseEvent *event);
3995 Q_SLOT virtual void processPointSelection(QMouseEvent *event);
3996
3997 // non-virtual methods:
3998 bool registerPlottable(QCPAbstractPlottable *plottable);
3999 bool registerGraph(QCPGraph *graph);
4000 bool registerItem(QCPAbstractItem* item);
4001 void updateLayerIndices() const;
4002 QCPLayerable *layerableAt(const QPointF &pos, bool onlySelectable, QVariant *selectionDetails=nullptr) const;
4003 QList<QCPLayerable*> layerableListAt(const QPointF &pos, bool onlySelectable, QList<QVariant> *selectionDetails=nullptr) const;
4004 void drawBackground(QCPPainter *painter);
4005 void setupPaintBuffers();
4006 QCPAbstractPaintBuffer *createPaintBuffer();
4008 bool setupOpenGl();
4009 void freeOpenGl();
4010
4011 friend class QCPLegend;
4012 friend class QCPAxis;
4013 friend class QCPLayer;
4014 friend class QCPAxisRect;
4015 friend class QCPAbstractPlottable;
4016 friend class QCPGraph;
4017 friend class QCPAbstractItem;
4018};
4019Q_DECLARE_METATYPE(QCustomPlot::LayerInsertMode)
4020Q_DECLARE_METATYPE(QCustomPlot::RefreshPriority)
4021
4022
4023// implementation of template functions:
4024
4043template<class PlottableType>
4044PlottableType *QCustomPlot::plottableAt(const QPointF &pos, bool onlySelectable, int *dataIndex) const
4045{
4046 PlottableType *resultPlottable = 0;
4047 QVariant resultDetails;
4048 double resultDistance = mSelectionTolerance; // only regard clicks with distances smaller than mSelectionTolerance as selections, so initialize with that value
4049
4050 foreach (QCPAbstractPlottable *plottable, mPlottables)
4051 {
4052 PlottableType *currentPlottable = qobject_cast<PlottableType*>(plottable);
4053 if (!currentPlottable || (onlySelectable && !currentPlottable->selectable())) // we could have also passed onlySelectable to the selectTest function, but checking here is faster, because we have access to QCPAbstractPlottable::selectable
4054 continue;
4055 if (currentPlottable->clipRect().contains(pos.toPoint())) // only consider clicks where the plottable is actually visible
4056 {
4057 QVariant details;
4058 double currentDistance = currentPlottable->selectTest(pos, false, dataIndex ? &details : nullptr);
4059 if (currentDistance >= 0 && currentDistance < resultDistance)
4060 {
4061 resultPlottable = currentPlottable;
4062 resultDetails = details;
4063 resultDistance = currentDistance;
4064 }
4065 }
4066 }
4067
4068 if (resultPlottable && dataIndex)
4069 {
4070 QCPDataSelection sel = resultDetails.value<QCPDataSelection>();
4071 if (!sel.isEmpty())
4072 *dataIndex = sel.dataRange(0).begin();
4073 }
4074 return resultPlottable;
4075}
4076
4090template<class ItemType>
4091ItemType *QCustomPlot::itemAt(const QPointF &pos, bool onlySelectable) const
4092{
4093 ItemType *resultItem = 0;
4094 double resultDistance = mSelectionTolerance; // only regard clicks with distances smaller than mSelectionTolerance as selections, so initialize with that value
4095
4096 foreach (QCPAbstractItem *item, mItems)
4097 {
4098 ItemType *currentItem = qobject_cast<ItemType*>(item);
4099 if (!currentItem || (onlySelectable && !currentItem->selectable())) // we could have also passed onlySelectable to the selectTest function, but checking here is faster, because we have access to QCPAbstractItem::selectable
4100 continue;
4101 if (!currentItem->clipToAxisRect() || currentItem->clipRect().contains(pos.toPoint())) // only consider clicks inside axis cliprect of the item if actually clipped to it
4102 {
4103 double currentDistance = currentItem->selectTest(pos, false);
4104 if (currentDistance >= 0 && currentDistance < resultDistance)
4105 {
4106 resultItem = currentItem;
4107 resultDistance = currentDistance;
4108 }
4109 }
4110 }
4111
4112 return resultItem;
4113}
4114
4115
4116
4117/* end of 'src/core.h' */
4118
4119
4120/* including file 'src/plottable1d.h' */
4121/* modified 2021-03-29T02:30:44, size 25638 */
4122
4124{
4125public:
4126 virtual ~QCPPlottableInterface1D() = default;
4127 // introduced pure virtual methods:
4128 virtual int dataCount() const = 0;
4129 virtual double dataMainKey(int index) const = 0;
4130 virtual double dataSortKey(int index) const = 0;
4131 virtual double dataMainValue(int index) const = 0;
4132 virtual QCPRange dataValueRange(int index) const = 0;
4133 virtual QPointF dataPixelPosition(int index) const = 0;
4134 virtual bool sortKeyIsMainKey() const = 0;
4135 virtual QCPDataSelection selectTestRect(const QRectF &rect, bool onlySelectable) const = 0;
4136 virtual int findBegin(double sortKey, bool expandedRange=true) const = 0;
4137 virtual int findEnd(double sortKey, bool expandedRange=true) const = 0;
4138};
4139
4140template <class DataType>
4141class QCPAbstractPlottable1D : public QCPAbstractPlottable, public QCPPlottableInterface1D // no QCP_LIB_DECL, template class ends up in header (cpp included below)
4142{
4143 // No Q_OBJECT macro due to template class
4144
4145public:
4146 QCPAbstractPlottable1D(QCPAxis *keyAxis, QCPAxis *valueAxis);
4147 virtual ~QCPAbstractPlottable1D() Q_DECL_OVERRIDE;
4148
4149 // virtual methods of 1d plottable interface:
4150 virtual int dataCount() const Q_DECL_OVERRIDE;
4151 virtual double dataMainKey(int index) const Q_DECL_OVERRIDE;
4152 virtual double dataSortKey(int index) const Q_DECL_OVERRIDE;
4153 virtual double dataMainValue(int index) const Q_DECL_OVERRIDE;
4154 virtual QCPRange dataValueRange(int index) const Q_DECL_OVERRIDE;
4155 virtual QPointF dataPixelPosition(int index) const Q_DECL_OVERRIDE;
4156 virtual bool sortKeyIsMainKey() const Q_DECL_OVERRIDE;
4157 virtual QCPDataSelection selectTestRect(const QRectF &rect, bool onlySelectable) const Q_DECL_OVERRIDE;
4158 virtual int findBegin(double sortKey, bool expandedRange=true) const Q_DECL_OVERRIDE;
4159 virtual int findEnd(double sortKey, bool expandedRange=true) const Q_DECL_OVERRIDE;
4160
4161 // reimplemented virtual methods:
4162 virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE;
4163 virtual QCPPlottableInterface1D *interface1D() Q_DECL_OVERRIDE { return this; }
4164
4165protected:
4166 // property members:
4167 QSharedPointer<QCPDataContainer<DataType> > mDataContainer;
4168
4169 // helpers for subclasses:
4170 void getDataSegments(QList<QCPDataRange> &selectedSegments, QList<QCPDataRange> &unselectedSegments) const;
4171 void drawPolyline(QCPPainter *painter, const QVector<QPointF> &lineData) const;
4172
4173private:
4174 Q_DISABLE_COPY(QCPAbstractPlottable1D)
4175
4176};
4177
4178
4179
4180// include implementation in header since it is a class template:
4184
4207
4208/* start documentation of pure virtual functions */
4209
4214
4228
4237
4246
4255
4264
4275
4284
4301
4318
4319/* end documentation of pure virtual functions */
4320
4321
4325
4349
4350/* start documentation of inline functions */
4351
4359
4360/* end documentation of inline functions */
4361
4366template <class DataType>
4368 QCPAbstractPlottable(keyAxis, valueAxis),
4369 mDataContainer(new QCPDataContainer<DataType>)
4370{
4371}
4372
4373template <class DataType>
4374QCPAbstractPlottable1D<DataType>::~QCPAbstractPlottable1D()
4375{
4376}
4377
4381template <class DataType>
4383{
4384 return mDataContainer->size();
4385}
4386
4390template <class DataType>
4392{
4393 if (index >= 0 && index < mDataContainer->size())
4394 {
4395 return (mDataContainer->constBegin()+index)->mainKey();
4396 } else
4397 {
4398 qDebug() << Q_FUNC_INFO << "Index out of bounds" << index;
4399 return 0;
4400 }
4401}
4402
4406template <class DataType>
4408{
4409 if (index >= 0 && index < mDataContainer->size())
4410 {
4411 return (mDataContainer->constBegin()+index)->sortKey();
4412 } else
4413 {
4414 qDebug() << Q_FUNC_INFO << "Index out of bounds" << index;
4415 return 0;
4416 }
4417}
4418
4422template <class DataType>
4424{
4425 if (index >= 0 && index < mDataContainer->size())
4426 {
4427 return (mDataContainer->constBegin()+index)->mainValue();
4428 } else
4429 {
4430 qDebug() << Q_FUNC_INFO << "Index out of bounds" << index;
4431 return 0;
4432 }
4433}
4434
4438template <class DataType>
4440{
4441 if (index >= 0 && index < mDataContainer->size())
4442 {
4443 return (mDataContainer->constBegin()+index)->valueRange();
4444 } else
4445 {
4446 qDebug() << Q_FUNC_INFO << "Index out of bounds" << index;
4447 return QCPRange(0, 0);
4448 }
4449}
4450
4454template <class DataType>
4456{
4457 if (index >= 0 && index < mDataContainer->size())
4458 {
4459 const typename QCPDataContainer<DataType>::const_iterator it = mDataContainer->constBegin()+index;
4460 return coordsToPixels(it->mainKey(), it->mainValue());
4461 } else
4462 {
4463 qDebug() << Q_FUNC_INFO << "Index out of bounds" << index;
4464 return QPointF();
4465 }
4466}
4467
4471template <class DataType>
4473{
4474 return DataType::sortKeyIsMainKey();
4475}
4476
4484template <class DataType>
4485QCPDataSelection QCPAbstractPlottable1D<DataType>::selectTestRect(const QRectF &rect, bool onlySelectable) const
4486{
4487 QCPDataSelection result;
4488 if ((onlySelectable && mSelectable == QCP::stNone) || mDataContainer->isEmpty())
4489 return result;
4490 if (!mKeyAxis || !mValueAxis)
4491 return result;
4492
4493 // convert rect given in pixels to ranges given in plot coordinates:
4494 double key1, value1, key2, value2;
4495 pixelsToCoords(rect.topLeft(), key1, value1);
4496 pixelsToCoords(rect.bottomRight(), key2, value2);
4497 QCPRange keyRange(key1, key2); // QCPRange normalizes internally so we don't have to care about whether key1 < key2
4498 QCPRange valueRange(value1, value2);
4499 typename QCPDataContainer<DataType>::const_iterator begin = mDataContainer->constBegin();
4500 typename QCPDataContainer<DataType>::const_iterator end = mDataContainer->constEnd();
4501 if (DataType::sortKeyIsMainKey()) // we can assume that data is sorted by main key, so can reduce the searched key interval:
4502 {
4503 begin = mDataContainer->findBegin(keyRange.lower, false);
4504 end = mDataContainer->findEnd(keyRange.upper, false);
4505 }
4506 if (begin == end)
4507 return result;
4508
4509 int currentSegmentBegin = -1; // -1 means we're currently not in a segment that's contained in rect
4510 for (typename QCPDataContainer<DataType>::const_iterator it=begin; it!=end; ++it)
4511 {
4512 if (currentSegmentBegin == -1)
4513 {
4514 if (valueRange.contains(it->mainValue()) && keyRange.contains(it->mainKey())) // start segment
4515 currentSegmentBegin = int(it-mDataContainer->constBegin());
4516 } else if (!valueRange.contains(it->mainValue()) || !keyRange.contains(it->mainKey())) // segment just ended
4517 {
4518 result.addDataRange(QCPDataRange(currentSegmentBegin, int(it-mDataContainer->constBegin())), false);
4519 currentSegmentBegin = -1;
4520 }
4521 }
4522 // process potential last segment:
4523 if (currentSegmentBegin != -1)
4524 result.addDataRange(QCPDataRange(currentSegmentBegin, int(end-mDataContainer->constBegin())), false);
4525
4526 result.simplify();
4527 return result;
4528}
4529
4533template <class DataType>
4534int QCPAbstractPlottable1D<DataType>::findBegin(double sortKey, bool expandedRange) const
4535{
4536 return int(mDataContainer->findBegin(sortKey, expandedRange)-mDataContainer->constBegin());
4537}
4538
4542template <class DataType>
4543int QCPAbstractPlottable1D<DataType>::findEnd(double sortKey, bool expandedRange) const
4544{
4545 return int(mDataContainer->findEnd(sortKey, expandedRange)-mDataContainer->constBegin());
4546}
4547
4558template <class DataType>
4559double QCPAbstractPlottable1D<DataType>::selectTest(const QPointF &pos, bool onlySelectable, QVariant *details) const
4560{
4561 if ((onlySelectable && mSelectable == QCP::stNone) || mDataContainer->isEmpty())
4562 return -1;
4563 if (!mKeyAxis || !mValueAxis)
4564 return -1;
4565
4566 QCPDataSelection selectionResult;
4567 double minDistSqr = (std::numeric_limits<double>::max)();
4568 int minDistIndex = mDataContainer->size();
4569
4570 typename QCPDataContainer<DataType>::const_iterator begin = mDataContainer->constBegin();
4571 typename QCPDataContainer<DataType>::const_iterator end = mDataContainer->constEnd();
4572 if (DataType::sortKeyIsMainKey()) // we can assume that data is sorted by main key, so can reduce the searched key interval:
4573 {
4574 // determine which key range comes into question, taking selection tolerance around pos into account:
4575 double posKeyMin, posKeyMax, dummy;
4576 pixelsToCoords(pos-QPointF(mParentPlot->selectionTolerance(), mParentPlot->selectionTolerance()), posKeyMin, dummy);
4577 pixelsToCoords(pos+QPointF(mParentPlot->selectionTolerance(), mParentPlot->selectionTolerance()), posKeyMax, dummy);
4578 if (posKeyMin > posKeyMax)
4579 qSwap(posKeyMin, posKeyMax);
4580 begin = mDataContainer->findBegin(posKeyMin, true);
4581 end = mDataContainer->findEnd(posKeyMax, true);
4582 }
4583 if (begin == end)
4584 return -1;
4585 QCPRange keyRange(mKeyAxis->range());
4586 QCPRange valueRange(mValueAxis->range());
4587 for (typename QCPDataContainer<DataType>::const_iterator it=begin; it!=end; ++it)
4588 {
4589 const double mainKey = it->mainKey();
4590 const double mainValue = it->mainValue();
4591 if (keyRange.contains(mainKey) && valueRange.contains(mainValue)) // make sure data point is inside visible range, for speedup in cases where sort key isn't main key and we iterate over all points
4592 {
4593 const double currentDistSqr = QCPVector2D(coordsToPixels(mainKey, mainValue)-pos).lengthSquared();
4594 if (currentDistSqr < minDistSqr)
4595 {
4596 minDistSqr = currentDistSqr;
4597 minDistIndex = int(it-mDataContainer->constBegin());
4598 }
4599 }
4600 }
4601 if (minDistIndex != mDataContainer->size())
4602 selectionResult.addDataRange(QCPDataRange(minDistIndex, minDistIndex+1), false);
4603
4604 selectionResult.simplify();
4605 if (details)
4606 details->setValue(selectionResult);
4607 return qSqrt(minDistSqr);
4608}
4609
4620template <class DataType>
4621void QCPAbstractPlottable1D<DataType>::getDataSegments(QList<QCPDataRange> &selectedSegments, QList<QCPDataRange> &unselectedSegments) const
4622{
4623 selectedSegments.clear();
4624 unselectedSegments.clear();
4625 if (mSelectable == QCP::stWhole) // stWhole selection type draws the entire plottable with selected style if mSelection isn't empty
4626 {
4627 if (selected())
4628 selectedSegments << QCPDataRange(0, dataCount());
4629 else
4630 unselectedSegments << QCPDataRange(0, dataCount());
4631 } else
4632 {
4634 sel.simplify();
4635 selectedSegments = sel.dataRanges();
4636 unselectedSegments = sel.inverse(QCPDataRange(0, dataCount())).dataRanges();
4637 }
4638}
4639
4650template <class DataType>
4651void QCPAbstractPlottable1D<DataType>::drawPolyline(QCPPainter *painter, const QVector<QPointF> &lineData) const
4652{
4653 // if drawing lines in plot (instead of PDF), reduce 1px lines to cosmetic, because at least in
4654 // Qt6 drawing of "1px" width lines is much slower even though it has same appearance apart from
4655 // High-DPI. In High-DPI cases people must set a pen width slightly larger than 1.0 to get
4656 // correct DPI scaling of width, but of course with performance penalty.
4657 if (!painter->modes().testFlag(QCPPainter::pmVectorized) &&
4658 qFuzzyCompare(painter->pen().widthF(), 1.0))
4659 {
4660 QPen newPen = painter->pen();
4661 newPen.setWidth(0);
4662 painter->setPen(newPen);
4663 }
4664
4665 // if drawing solid line and not in PDF, use much faster line drawing instead of polyline:
4666 if (mParentPlot->plottingHints().testFlag(QCP::phFastPolylines) &&
4667 painter->pen().style() == Qt::SolidLine &&
4668 !painter->modes().testFlag(QCPPainter::pmVectorized) &&
4669 !painter->modes().testFlag(QCPPainter::pmNoCaching))
4670 {
4671 int i = 0;
4672 bool lastIsNan = false;
4673 const int lineDataSize = lineData.size();
4674 while (i < lineDataSize && (qIsNaN(lineData.at(i).y()) || qIsNaN(lineData.at(i).x()))) // make sure first point is not NaN
4675 ++i;
4676 ++i; // because drawing works in 1 point retrospect
4677 while (i < lineDataSize)
4678 {
4679 if (!qIsNaN(lineData.at(i).y()) && !qIsNaN(lineData.at(i).x())) // NaNs create a gap in the line
4680 {
4681 if (!lastIsNan)
4682 painter->drawLine(lineData.at(i-1), lineData.at(i));
4683 else
4684 lastIsNan = false;
4685 } else
4686 lastIsNan = true;
4687 ++i;
4688 }
4689 } else
4690 {
4691 int segmentStart = 0;
4692 int i = 0;
4693 const int lineDataSize = lineData.size();
4694 while (i < lineDataSize)
4695 {
4696 if (qIsNaN(lineData.at(i).y()) || qIsNaN(lineData.at(i).x()) || qIsInf(lineData.at(i).y())) // NaNs create a gap in the line. Also filter Infs which make drawPolyline block
4697 {
4698 painter->drawPolyline(lineData.constData()+segmentStart, i-segmentStart); // i, because we don't want to include the current NaN point
4699 segmentStart = i+1;
4700 }
4701 ++i;
4702 }
4703 // draw last segment:
4704 painter->drawPolyline(lineData.constData()+segmentStart, lineDataSize-segmentStart);
4705 }
4706}
4707
4708
4709/* end of 'src/plottable1d.h' */
4710
4711
4712/* including file 'src/colorgradient.h' */
4713/* modified 2021-03-29T02:30:44, size 7262 */
4714
4715class QCP_LIB_DECL QCPColorGradient
4716{
4717 Q_GADGET
4718public:
4726 };
4727 Q_ENUMS(ColorInterpolation)
4728
4729
4740 Q_ENUMS(NanHandling)
4741
4742
4758 };
4759 Q_ENUMS(GradientPreset)
4760
4762 QCPColorGradient(GradientPreset preset);
4763 bool operator==(const QCPColorGradient &other) const;
4764 bool operator!=(const QCPColorGradient &other) const { return !(*this == other); }
4765
4766 // getters:
4767 int levelCount() const { return mLevelCount; }
4768 QMap<double, QColor> colorStops() const { return mColorStops; }
4769 ColorInterpolation colorInterpolation() const { return mColorInterpolation; }
4770 NanHandling nanHandling() const { return mNanHandling; }
4771 QColor nanColor() const { return mNanColor; }
4772 bool periodic() const { return mPeriodic; }
4773
4774 // setters:
4775 void setLevelCount(int n);
4776 void setColorStops(const QMap<double, QColor> &colorStops);
4777 void setColorStopAt(double position, const QColor &color);
4778 void setColorInterpolation(ColorInterpolation interpolation);
4779 void setNanHandling(NanHandling handling);
4780 void setNanColor(const QColor &color);
4781 void setPeriodic(bool enabled);
4782
4783 // non-property methods:
4784 void colorize(const double *data, const QCPRange &range, QRgb *scanLine, int n, int dataIndexFactor=1, bool logarithmic=false);
4785 void colorize(const double *data, const unsigned char *alpha, const QCPRange &range, QRgb *scanLine, int n, int dataIndexFactor=1, bool logarithmic=false);
4786 QRgb color(double position, const QCPRange &range, bool logarithmic=false);
4787 void loadPreset(GradientPreset preset);
4788 void clearColorStops();
4789 QCPColorGradient inverted() const;
4790
4791protected:
4792 // property members:
4793 int mLevelCount;
4794 QMap<double, QColor> mColorStops;
4795 ColorInterpolation mColorInterpolation;
4796 NanHandling mNanHandling;
4797 QColor mNanColor;
4798 bool mPeriodic;
4799
4800 // non-property members:
4801 QVector<QRgb> mColorBuffer; // have colors premultiplied with alpha (for usage with QImage::Format_ARGB32_Premultiplied)
4802 bool mColorBufferInvalidated;
4803
4804 // non-virtual methods:
4805 bool stopsUseAlpha() const;
4806 void updateColorBuffer();
4807};
4808Q_DECLARE_METATYPE(QCPColorGradient::ColorInterpolation)
4809Q_DECLARE_METATYPE(QCPColorGradient::NanHandling)
4810Q_DECLARE_METATYPE(QCPColorGradient::GradientPreset)
4811
4812/* end of 'src/colorgradient.h' */
4813
4814
4815/* including file 'src/selectiondecorator-bracket.h' */
4816/* modified 2021-03-29T02:30:44, size 4458 */
4817
4819{
4820 Q_GADGET
4821public:
4822
4835 Q_ENUMS(BracketStyle)
4836
4838 virtual ~QCPSelectionDecoratorBracket() Q_DECL_OVERRIDE;
4839
4840 // getters:
4841 QPen bracketPen() const { return mBracketPen; }
4842 QBrush bracketBrush() const { return mBracketBrush; }
4843 int bracketWidth() const { return mBracketWidth; }
4844 int bracketHeight() const { return mBracketHeight; }
4845 BracketStyle bracketStyle() const { return mBracketStyle; }
4846 bool tangentToData() const { return mTangentToData; }
4847 int tangentAverage() const { return mTangentAverage; }
4848
4849 // setters:
4850 void setBracketPen(const QPen &pen);
4851 void setBracketBrush(const QBrush &brush);
4852 void setBracketWidth(int width);
4853 void setBracketHeight(int height);
4854 void setBracketStyle(BracketStyle style);
4855 void setTangentToData(bool enabled);
4856 void setTangentAverage(int pointCount);
4857
4858 // introduced virtual methods:
4859 virtual void drawBracket(QCPPainter *painter, int direction) const;
4860
4861 // virtual methods:
4862 virtual void drawDecoration(QCPPainter *painter, QCPDataSelection selection) Q_DECL_OVERRIDE;
4863
4864protected:
4865 // property members:
4866 QPen mBracketPen;
4867 QBrush mBracketBrush;
4868 int mBracketWidth;
4869 int mBracketHeight;
4870 BracketStyle mBracketStyle;
4871 bool mTangentToData;
4872 int mTangentAverage;
4873
4874 // non-virtual methods:
4875 double getTangentAngle(const QCPPlottableInterface1D *interface1d, int dataIndex, int direction) const;
4876 QPointF getPixelCoordinates(const QCPPlottableInterface1D *interface1d, int dataIndex) const;
4877
4878};
4880
4881/* end of 'src/selectiondecorator-bracket.h' */
4882
4883
4884/* including file 'src/layoutelements/layoutelement-axisrect.h' */
4885/* modified 2021-03-29T02:30:44, size 7529 */
4886
4887class QCP_LIB_DECL QCPAxisRect : public QCPLayoutElement
4888{
4889 Q_OBJECT
4891 Q_PROPERTY(QPixmap background READ background WRITE setBackground)
4892 Q_PROPERTY(bool backgroundScaled READ backgroundScaled WRITE setBackgroundScaled)
4893 Q_PROPERTY(Qt::AspectRatioMode backgroundScaledMode READ backgroundScaledMode WRITE setBackgroundScaledMode)
4894 Q_PROPERTY(Qt::Orientations rangeDrag READ rangeDrag WRITE setRangeDrag)
4895 Q_PROPERTY(Qt::Orientations rangeZoom READ rangeZoom WRITE setRangeZoom)
4897public:
4898 explicit QCPAxisRect(QCustomPlot *parentPlot, bool setupDefaultAxes=true);
4899 virtual ~QCPAxisRect() Q_DECL_OVERRIDE;
4900
4901 // getters:
4902 QPixmap background() const { return mBackgroundPixmap; }
4903 QBrush backgroundBrush() const { return mBackgroundBrush; }
4904 bool backgroundScaled() const { return mBackgroundScaled; }
4905 Qt::AspectRatioMode backgroundScaledMode() const { return mBackgroundScaledMode; }
4906 Qt::Orientations rangeDrag() const { return mRangeDrag; }
4907 Qt::Orientations rangeZoom() const { return mRangeZoom; }
4908 QCPAxis *rangeDragAxis(Qt::Orientation orientation);
4909 QCPAxis *rangeZoomAxis(Qt::Orientation orientation);
4910 QList<QCPAxis*> rangeDragAxes(Qt::Orientation orientation);
4911 QList<QCPAxis*> rangeZoomAxes(Qt::Orientation orientation);
4912 double rangeZoomFactor(Qt::Orientation orientation);
4913
4914 // setters:
4915 void setBackground(const QPixmap &pm);
4916 void setBackground(const QPixmap &pm, bool scaled, Qt::AspectRatioMode mode=Qt::KeepAspectRatioByExpanding);
4917 void setBackground(const QBrush &brush);
4918 void setBackgroundScaled(bool scaled);
4919 void setBackgroundScaledMode(Qt::AspectRatioMode mode);
4920 void setRangeDrag(Qt::Orientations orientations);
4921 void setRangeZoom(Qt::Orientations orientations);
4922 void setRangeDragAxes(QCPAxis *horizontal, QCPAxis *vertical);
4923 void setRangeDragAxes(QList<QCPAxis*> axes);
4924 void setRangeDragAxes(QList<QCPAxis*> horizontal, QList<QCPAxis*> vertical);
4925 void setRangeZoomAxes(QCPAxis *horizontal, QCPAxis *vertical);
4926 void setRangeZoomAxes(QList<QCPAxis*> axes);
4927 void setRangeZoomAxes(QList<QCPAxis*> horizontal, QList<QCPAxis*> vertical);
4928 void setRangeZoomFactor(double horizontalFactor, double verticalFactor);
4929 void setRangeZoomFactor(double factor);
4930
4931 // non-property methods:
4932 int axisCount(QCPAxis::AxisType type) const;
4933 QCPAxis *axis(QCPAxis::AxisType type, int index=0) const;
4934 QList<QCPAxis*> axes(QCPAxis::AxisTypes types) const;
4935 QList<QCPAxis*> axes() const;
4936 QCPAxis *addAxis(QCPAxis::AxisType type, QCPAxis *axis=nullptr);
4937 QList<QCPAxis*> addAxes(QCPAxis::AxisTypes types);
4938 bool removeAxis(QCPAxis *axis);
4939 QCPLayoutInset *insetLayout() const { return mInsetLayout; }
4940
4941 void zoom(const QRectF &pixelRect);
4942 void zoom(const QRectF &pixelRect, const QList<QCPAxis*> &affectedAxes);
4943 void setupFullAxesBox(bool connectRanges=false);
4944 QList<QCPAbstractPlottable*> plottables() const;
4945 QList<QCPGraph*> graphs() const;
4946 QList<QCPAbstractItem*> items() const;
4947
4948 // read-only interface imitating a QRect:
4949 int left() const { return mRect.left(); }
4950 int right() const { return mRect.right(); }
4951 int top() const { return mRect.top(); }
4952 int bottom() const { return mRect.bottom(); }
4953 int width() const { return mRect.width(); }
4954 int height() const { return mRect.height(); }
4955 QSize size() const { return mRect.size(); }
4956 QPoint topLeft() const { return mRect.topLeft(); }
4957 QPoint topRight() const { return mRect.topRight(); }
4958 QPoint bottomLeft() const { return mRect.bottomLeft(); }
4959 QPoint bottomRight() const { return mRect.bottomRight(); }
4960 QPoint center() const { return mRect.center(); }
4961
4962 // reimplemented virtual methods:
4963 virtual void update(UpdatePhase phase) Q_DECL_OVERRIDE;
4964 virtual QList<QCPLayoutElement*> elements(bool recursive) const Q_DECL_OVERRIDE;
4965
4966protected:
4967 // property members:
4968 QBrush mBackgroundBrush;
4969 QPixmap mBackgroundPixmap;
4970 QPixmap mScaledBackgroundPixmap;
4971 bool mBackgroundScaled;
4972 Qt::AspectRatioMode mBackgroundScaledMode;
4973 QCPLayoutInset *mInsetLayout;
4974 Qt::Orientations mRangeDrag, mRangeZoom;
4975 QList<QPointer<QCPAxis> > mRangeDragHorzAxis, mRangeDragVertAxis;
4976 QList<QPointer<QCPAxis> > mRangeZoomHorzAxis, mRangeZoomVertAxis;
4977 double mRangeZoomFactorHorz, mRangeZoomFactorVert;
4978
4979 // non-property members:
4980 QList<QCPRange> mDragStartHorzRange, mDragStartVertRange;
4981 QCP::AntialiasedElements mAADragBackup, mNotAADragBackup;
4982 bool mDragging;
4983 QHash<QCPAxis::AxisType, QList<QCPAxis*> > mAxes;
4984
4985 // reimplemented virtual methods:
4986 virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const Q_DECL_OVERRIDE;
4987 virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
4988 virtual int calculateAutoMargin(QCP::MarginSide side) Q_DECL_OVERRIDE;
4989 virtual void layoutChanged() Q_DECL_OVERRIDE;
4990 // events:
4991 virtual void mousePressEvent(QMouseEvent *event, const QVariant &details) Q_DECL_OVERRIDE;
4992 virtual void mouseMoveEvent(QMouseEvent *event, const QPointF &startPos) Q_DECL_OVERRIDE;
4993 virtual void mouseReleaseEvent(QMouseEvent *event, const QPointF &startPos) Q_DECL_OVERRIDE;
4994 virtual void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE;
4995
4996 // non-property methods:
4997 void drawBackground(QCPPainter *painter);
4998 void updateAxesOffset(QCPAxis::AxisType type);
4999
5000private:
5001 Q_DISABLE_COPY(QCPAxisRect)
5002
5003 friend class QCustomPlot;
5004};
5005
5006
5007/* end of 'src/layoutelements/layoutelement-axisrect.h' */
5008
5009
5010/* including file 'src/layoutelements/layoutelement-legend.h' */
5011/* modified 2021-03-29T02:30:44, size 10425 */
5012
5013class QCP_LIB_DECL QCPAbstractLegendItem : public QCPLayoutElement
5014{
5015 Q_OBJECT
5017 Q_PROPERTY(QCPLegend* parentLegend READ parentLegend)
5018 Q_PROPERTY(QFont font READ font WRITE setFont)
5019 Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor)
5020 Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont)
5021 Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE setSelectedTextColor)
5022 Q_PROPERTY(bool selectable READ selectable WRITE setSelectable NOTIFY selectionChanged)
5023 Q_PROPERTY(bool selected READ selected WRITE setSelected NOTIFY selectableChanged)
5025public:
5026 explicit QCPAbstractLegendItem(QCPLegend *parent);
5027
5028 // getters:
5029 QCPLegend *parentLegend() const { return mParentLegend; }
5030 QFont font() const { return mFont; }
5031 QColor textColor() const { return mTextColor; }
5032 QFont selectedFont() const { return mSelectedFont; }
5033 QColor selectedTextColor() const { return mSelectedTextColor; }
5034 bool selectable() const { return mSelectable; }
5035 bool selected() const { return mSelected; }
5036
5037 // setters:
5038 void setFont(const QFont &font);
5039 void setTextColor(const QColor &color);
5040 void setSelectedFont(const QFont &font);
5041 void setSelectedTextColor(const QColor &color);
5042 Q_SLOT void setSelectable(bool selectable);
5043 Q_SLOT void setSelected(bool selected);
5044
5045 // reimplemented virtual methods:
5046 virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE;
5047
5048signals:
5049 void selectionChanged(bool selected);
5050 void selectableChanged(bool selectable);
5051
5052protected:
5053 // property members:
5054 QCPLegend *mParentLegend;
5055 QFont mFont;
5056 QColor mTextColor;
5057 QFont mSelectedFont;
5058 QColor mSelectedTextColor;
5059 bool mSelectable, mSelected;
5060
5061 // reimplemented virtual methods:
5062 virtual QCP::Interaction selectionCategory() const Q_DECL_OVERRIDE;
5063 virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const Q_DECL_OVERRIDE;
5064 virtual QRect clipRect() const Q_DECL_OVERRIDE;
5065 virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE = 0;
5066 // events:
5067 virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) Q_DECL_OVERRIDE;
5068 virtual void deselectEvent(bool *selectionStateChanged) Q_DECL_OVERRIDE;
5069
5070private:
5071 Q_DISABLE_COPY(QCPAbstractLegendItem)
5072
5073 friend class QCPLegend;
5074};
5075
5076
5078{
5079 Q_OBJECT
5080public:
5081 QCPPlottableLegendItem(QCPLegend *parent, QCPAbstractPlottable *plottable);
5082
5083 // getters:
5084 QCPAbstractPlottable *plottable() { return mPlottable; }
5085
5086protected:
5087 // property members:
5088 QCPAbstractPlottable *mPlottable;
5089
5090 // reimplemented virtual methods:
5091 virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
5092 virtual QSize minimumOuterSizeHint() const Q_DECL_OVERRIDE;
5093
5094 // non-virtual methods:
5095 QPen getIconBorderPen() const;
5096 QColor getTextColor() const;
5097 QFont getFont() const;
5098};
5099
5100
5101class QCP_LIB_DECL QCPLegend : public QCPLayoutGrid
5102{
5103 Q_OBJECT
5105 Q_PROPERTY(QPen borderPen READ borderPen WRITE setBorderPen)
5106 Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
5107 Q_PROPERTY(QFont font READ font WRITE setFont)
5108 Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor)
5109 Q_PROPERTY(QSize iconSize READ iconSize WRITE setIconSize)
5110 Q_PROPERTY(int iconTextPadding READ iconTextPadding WRITE setIconTextPadding)
5111 Q_PROPERTY(QPen iconBorderPen READ iconBorderPen WRITE setIconBorderPen)
5112 Q_PROPERTY(SelectableParts selectableParts READ selectableParts WRITE setSelectableParts NOTIFY selectionChanged)
5113 Q_PROPERTY(SelectableParts selectedParts READ selectedParts WRITE setSelectedParts NOTIFY selectableChanged)
5114 Q_PROPERTY(QPen selectedBorderPen READ selectedBorderPen WRITE setSelectedBorderPen)
5115 Q_PROPERTY(QPen selectedIconBorderPen READ selectedIconBorderPen WRITE setSelectedIconBorderPen)
5116 Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
5117 Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont)
5118 Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE setSelectedTextColor)
5120public:
5126 enum SelectablePart { spNone = 0x000
5127 ,spLegendBox = 0x001
5128 ,spItems = 0x002
5129 };
5130 Q_ENUMS(SelectablePart)
5131 Q_FLAGS(SelectableParts)
5132 Q_DECLARE_FLAGS(SelectableParts, SelectablePart)
5133
5134 explicit QCPLegend();
5135 virtual ~QCPLegend() Q_DECL_OVERRIDE;
5136
5137 // getters:
5138 QPen borderPen() const { return mBorderPen; }
5139 QBrush brush() const { return mBrush; }
5140 QFont font() const { return mFont; }
5141 QColor textColor() const { return mTextColor; }
5142 QSize iconSize() const { return mIconSize; }
5143 int iconTextPadding() const { return mIconTextPadding; }
5144 QPen iconBorderPen() const { return mIconBorderPen; }
5145 SelectableParts selectableParts() const { return mSelectableParts; }
5146 SelectableParts selectedParts() const;
5147 QPen selectedBorderPen() const { return mSelectedBorderPen; }
5148 QPen selectedIconBorderPen() const { return mSelectedIconBorderPen; }
5149 QBrush selectedBrush() const { return mSelectedBrush; }
5150 QFont selectedFont() const { return mSelectedFont; }
5151 QColor selectedTextColor() const { return mSelectedTextColor; }
5152
5153 // setters:
5154 void setBorderPen(const QPen &pen);
5155 void setBrush(const QBrush &brush);
5156 void setFont(const QFont &font);
5157 void setTextColor(const QColor &color);
5158 void setIconSize(const QSize &size);
5159 void setIconSize(int width, int height);
5160 void setIconTextPadding(int padding);
5161 void setIconBorderPen(const QPen &pen);
5162 Q_SLOT void setSelectableParts(const SelectableParts &selectableParts);
5163 Q_SLOT void setSelectedParts(const SelectableParts &selectedParts);
5164 void setSelectedBorderPen(const QPen &pen);
5165 void setSelectedIconBorderPen(const QPen &pen);
5166 void setSelectedBrush(const QBrush &brush);
5167 void setSelectedFont(const QFont &font);
5168 void setSelectedTextColor(const QColor &color);
5169
5170 // reimplemented virtual methods:
5171 virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE;
5172
5173 // non-virtual methods:
5174 QCPAbstractLegendItem *item(int index) const;
5175 QCPPlottableLegendItem *itemWithPlottable(const QCPAbstractPlottable *plottable) const;
5176 int itemCount() const;
5177 bool hasItem(QCPAbstractLegendItem *item) const;
5178 bool hasItemWithPlottable(const QCPAbstractPlottable *plottable) const;
5179 bool addItem(QCPAbstractLegendItem *item);
5180 bool removeItem(int index);
5181 bool removeItem(QCPAbstractLegendItem *item);
5182 void clearItems();
5183 QList<QCPAbstractLegendItem*> selectedItems() const;
5184
5185signals:
5186 void selectionChanged(QCPLegend::SelectableParts parts);
5187 void selectableChanged(QCPLegend::SelectableParts parts);
5188
5189protected:
5190 // property members:
5191 QPen mBorderPen, mIconBorderPen;
5192 QBrush mBrush;
5193 QFont mFont;
5194 QColor mTextColor;
5195 QSize mIconSize;
5196 int mIconTextPadding;
5197 SelectableParts mSelectedParts, mSelectableParts;
5198 QPen mSelectedBorderPen, mSelectedIconBorderPen;
5199 QBrush mSelectedBrush;
5200 QFont mSelectedFont;
5201 QColor mSelectedTextColor;
5202
5203 // reimplemented virtual methods:
5204 virtual void parentPlotInitialized(QCustomPlot *parentPlot) Q_DECL_OVERRIDE;
5205 virtual QCP::Interaction selectionCategory() const Q_DECL_OVERRIDE;
5206 virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const Q_DECL_OVERRIDE;
5207 virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
5208 // events:
5209 virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) Q_DECL_OVERRIDE;
5210 virtual void deselectEvent(bool *selectionStateChanged) Q_DECL_OVERRIDE;
5211
5212 // non-virtual methods:
5213 QPen getBorderPen() const;
5214 QBrush getBrush() const;
5215
5216private:
5217 Q_DISABLE_COPY(QCPLegend)
5218
5219 friend class QCustomPlot;
5220 friend class QCPAbstractLegendItem;
5221};
5222Q_DECLARE_OPERATORS_FOR_FLAGS(QCPLegend::SelectableParts)
5223Q_DECLARE_METATYPE(QCPLegend::SelectablePart)
5224
5225/* end of 'src/layoutelements/layoutelement-legend.h' */
5226
5227
5228/* including file 'src/layoutelements/layoutelement-textelement.h' */
5229/* modified 2021-03-29T02:30:44, size 5359 */
5230
5231class QCP_LIB_DECL QCPTextElement : public QCPLayoutElement
5232{
5233 Q_OBJECT
5235 Q_PROPERTY(QString text READ text WRITE setText)
5236 Q_PROPERTY(QFont font READ font WRITE setFont)
5237 Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor)
5238 Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont)
5239 Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE setSelectedTextColor)
5240 Q_PROPERTY(bool selectable READ selectable WRITE setSelectable NOTIFY selectableChanged)
5241 Q_PROPERTY(bool selected READ selected WRITE setSelected NOTIFY selectionChanged)
5243public:
5244 explicit QCPTextElement(QCustomPlot *parentPlot);
5245 QCPTextElement(QCustomPlot *parentPlot, const QString &text);
5246 QCPTextElement(QCustomPlot *parentPlot, const QString &text, double pointSize);
5247 QCPTextElement(QCustomPlot *parentPlot, const QString &text, const QString &fontFamily, double pointSize);
5248 QCPTextElement(QCustomPlot *parentPlot, const QString &text, const QFont &font);
5249
5250 // getters:
5251 QString text() const { return mText; }
5252 int textFlags() const { return mTextFlags; }
5253 QFont font() const { return mFont; }
5254 QColor textColor() const { return mTextColor; }
5255 QFont selectedFont() const { return mSelectedFont; }
5256 QColor selectedTextColor() const { return mSelectedTextColor; }
5257 bool selectable() const { return mSelectable; }
5258 bool selected() const { return mSelected; }
5259
5260 // setters:
5261 void setText(const QString &text);
5262 void setTextFlags(int flags);
5263 void setFont(const QFont &font);
5264 void setTextColor(const QColor &color);
5265 void setSelectedFont(const QFont &font);
5266 void setSelectedTextColor(const QColor &color);
5267 Q_SLOT void setSelectable(bool selectable);
5268 Q_SLOT void setSelected(bool selected);
5269
5270 // reimplemented virtual methods:
5271 virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE;
5272 virtual void mousePressEvent(QMouseEvent *event, const QVariant &details) Q_DECL_OVERRIDE;
5273 virtual void mouseReleaseEvent(QMouseEvent *event, const QPointF &startPos) Q_DECL_OVERRIDE;
5274 virtual void mouseDoubleClickEvent(QMouseEvent *event, const QVariant &details) Q_DECL_OVERRIDE;
5275
5276signals:
5277 void selectionChanged(bool selected);
5278 void selectableChanged(bool selectable);
5279 void clicked(QMouseEvent *event);
5280 void doubleClicked(QMouseEvent *event);
5281
5282protected:
5283 // property members:
5284 QString mText;
5285 int mTextFlags;
5286 QFont mFont;
5287 QColor mTextColor;
5288 QFont mSelectedFont;
5289 QColor mSelectedTextColor;
5290 QRect mTextBoundingRect;
5291 bool mSelectable, mSelected;
5292
5293 // reimplemented virtual methods:
5294 virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const Q_DECL_OVERRIDE;
5295 virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
5296 virtual QSize minimumOuterSizeHint() const Q_DECL_OVERRIDE;
5297 virtual QSize maximumOuterSizeHint() const Q_DECL_OVERRIDE;
5298 // events:
5299 virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) Q_DECL_OVERRIDE;
5300 virtual void deselectEvent(bool *selectionStateChanged) Q_DECL_OVERRIDE;
5301
5302 // non-virtual methods:
5303 QFont mainFont() const;
5304 QColor mainTextColor() const;
5305
5306private:
5307 Q_DISABLE_COPY(QCPTextElement)
5308};
5309
5310
5311
5312/* end of 'src/layoutelements/layoutelement-textelement.h' */
5313
5314
5315/* including file 'src/layoutelements/layoutelement-colorscale.h' */
5316/* modified 2021-03-29T02:30:44, size 5939 */
5317
5318
5320{
5321 Q_OBJECT
5322public:
5323 explicit QCPColorScaleAxisRectPrivate(QCPColorScale *parentColorScale);
5324protected:
5325 QCPColorScale *mParentColorScale;
5326 QImage mGradientImage;
5327 bool mGradientImageInvalidated;
5328 // re-using some methods of QCPAxisRect to make them available to friend class QCPColorScale
5329 using QCPAxisRect::calculateAutoMargin;
5334 using QCPAxisRect::update;
5335 virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
5336 void updateGradientImage();
5337 Q_SLOT void axisSelectionChanged(QCPAxis::SelectableParts selectedParts);
5338 Q_SLOT void axisSelectableChanged(QCPAxis::SelectableParts selectableParts);
5339 friend class QCPColorScale;
5340};
5341
5342
5343class QCP_LIB_DECL QCPColorScale : public QCPLayoutElement
5344{
5345 Q_OBJECT
5347 Q_PROPERTY(QCPAxis::AxisType type READ type WRITE setType)
5348 Q_PROPERTY(QCPRange dataRange READ dataRange WRITE setDataRange NOTIFY dataRangeChanged)
5349 Q_PROPERTY(QCPAxis::ScaleType dataScaleType READ dataScaleType WRITE setDataScaleType NOTIFY dataScaleTypeChanged)
5350 Q_PROPERTY(QCPColorGradient gradient READ gradient WRITE setGradient NOTIFY gradientChanged)
5351 Q_PROPERTY(QString label READ label WRITE setLabel)
5352 Q_PROPERTY(int barWidth READ barWidth WRITE setBarWidth)
5353 Q_PROPERTY(bool rangeDrag READ rangeDrag WRITE setRangeDrag)
5354 Q_PROPERTY(bool rangeZoom READ rangeZoom WRITE setRangeZoom)
5356public:
5357 explicit QCPColorScale(QCustomPlot *parentPlot);
5358 virtual ~QCPColorScale() Q_DECL_OVERRIDE;
5359
5360 // getters:
5361 QCPAxis *axis() const { return mColorAxis.data(); }
5362 QCPAxis::AxisType type() const { return mType; }
5363 QCPRange dataRange() const { return mDataRange; }
5364 QCPAxis::ScaleType dataScaleType() const { return mDataScaleType; }
5365 QCPColorGradient gradient() const { return mGradient; }
5366 QString label() const;
5367 int barWidth () const { return mBarWidth; }
5368 bool rangeDrag() const;
5369 bool rangeZoom() const;
5370
5371 // setters:
5372 void setType(QCPAxis::AxisType type);
5373 Q_SLOT void setDataRange(const QCPRange &dataRange);
5374 Q_SLOT void setDataScaleType(QCPAxis::ScaleType scaleType);
5375 Q_SLOT void setGradient(const QCPColorGradient &gradient);
5376 void setLabel(const QString &str);
5377 void setBarWidth(int width);
5378 void setRangeDrag(bool enabled);
5379 void setRangeZoom(bool enabled);
5380
5381 // non-property methods:
5382 QList<QCPColorMap*> colorMaps() const;
5383 void rescaleDataRange(bool onlyVisibleMaps);
5384
5385 // reimplemented virtual methods:
5386 virtual void update(UpdatePhase phase) Q_DECL_OVERRIDE;
5387
5388signals:
5389 void dataRangeChanged(const QCPRange &newRange);
5391 void gradientChanged(const QCPColorGradient &newGradient);
5392
5393protected:
5394 // property members:
5395 QCPAxis::AxisType mType;
5396 QCPRange mDataRange;
5397 QCPAxis::ScaleType mDataScaleType;
5398 QCPColorGradient mGradient;
5399 int mBarWidth;
5400
5401 // non-property members:
5402 QPointer<QCPColorScaleAxisRectPrivate> mAxisRect;
5403 QPointer<QCPAxis> mColorAxis;
5404
5405 // reimplemented virtual methods:
5406 virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const Q_DECL_OVERRIDE;
5407 // events:
5408 virtual void mousePressEvent(QMouseEvent *event, const QVariant &details) Q_DECL_OVERRIDE;
5409 virtual void mouseMoveEvent(QMouseEvent *event, const QPointF &startPos) Q_DECL_OVERRIDE;
5410 virtual void mouseReleaseEvent(QMouseEvent *event, const QPointF &startPos) Q_DECL_OVERRIDE;
5411 virtual void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE;
5412
5413private:
5414 Q_DISABLE_COPY(QCPColorScale)
5415
5416 friend class QCPColorScaleAxisRectPrivate;
5417};
5418
5419
5420/* end of 'src/layoutelements/layoutelement-colorscale.h' */
5421
5422
5423/* including file 'src/plottables/plottable-graph.h' */
5424/* modified 2021-03-29T02:30:44, size 9316 */
5425
5426class QCP_LIB_DECL QCPGraphData
5427{
5428public:
5429 QCPGraphData();
5430 QCPGraphData(double key, double value);
5431
5432 inline double sortKey() const { return key; }
5433 inline static QCPGraphData fromSortKey(double sortKey) { return QCPGraphData(sortKey, 0); }
5434 inline static bool sortKeyIsMainKey() { return true; }
5435
5436 inline double mainKey() const { return key; }
5437 inline double mainValue() const { return value; }
5438
5439 inline QCPRange valueRange() const { return QCPRange(value, value); }
5440
5441 double key, value;
5442};
5443Q_DECLARE_TYPEINFO(QCPGraphData, Q_PRIMITIVE_TYPE);
5444
5445
5455typedef QCPDataContainer<QCPGraphData> QCPGraphDataContainer;
5456
5457class QCP_LIB_DECL QCPGraph : public QCPAbstractPlottable1D<QCPGraphData>
5458{
5459 Q_OBJECT
5461 Q_PROPERTY(LineStyle lineStyle READ lineStyle WRITE setLineStyle)
5462 Q_PROPERTY(QCPScatterStyle scatterStyle READ scatterStyle WRITE setScatterStyle)
5463 Q_PROPERTY(int scatterSkip READ scatterSkip WRITE setScatterSkip)
5464 Q_PROPERTY(QCPGraph* channelFillGraph READ channelFillGraph WRITE setChannelFillGraph)
5465 Q_PROPERTY(bool adaptiveSampling READ adaptiveSampling WRITE setAdaptiveSampling)
5467public:
5481 Q_ENUMS(LineStyle)
5482
5483 explicit QCPGraph(QCPAxis *keyAxis, QCPAxis *valueAxis);
5484 virtual ~QCPGraph() Q_DECL_OVERRIDE;
5485
5486 // getters:
5487 QSharedPointer<QCPGraphDataContainer> data() const { return mDataContainer; }
5488 LineStyle lineStyle() const { return mLineStyle; }
5489 QCPScatterStyle scatterStyle() const { return mScatterStyle; }
5490 int scatterSkip() const { return mScatterSkip; }
5491 QCPGraph *channelFillGraph() const { return mChannelFillGraph.data(); }
5492 bool adaptiveSampling() const { return mAdaptiveSampling; }
5493
5494 // setters:
5495 void setData(QSharedPointer<QCPGraphDataContainer> data);
5496 void setData(const QVector<double> &keys, const QVector<double> &values, bool alreadySorted=false);
5497 void setLineStyle(LineStyle ls);
5498 void setScatterStyle(const QCPScatterStyle &style);
5499 void setScatterSkip(int skip);
5500 void setChannelFillGraph(QCPGraph *targetGraph);
5501 void setAdaptiveSampling(bool enabled);
5502
5503 // non-property methods:
5504 void addData(const QVector<double> &keys, const QVector<double> &values, bool alreadySorted=false);
5505 void addData(double key, double value);
5506
5507 // reimplemented virtual methods:
5508 virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE;
5509 virtual QCPRange getKeyRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth) const Q_DECL_OVERRIDE;
5510 virtual QCPRange getValueRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth, const QCPRange &inKeyRange=QCPRange()) const Q_DECL_OVERRIDE;
5511
5512protected:
5513 // property members:
5514 LineStyle mLineStyle;
5515 QCPScatterStyle mScatterStyle;
5516 int mScatterSkip;
5517 QPointer<QCPGraph> mChannelFillGraph;
5518 bool mAdaptiveSampling;
5519
5520 // reimplemented virtual methods:
5521 virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
5522 virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const Q_DECL_OVERRIDE;
5523
5524 // introduced virtual methods:
5525 virtual void drawFill(QCPPainter *painter, QVector<QPointF> *lines) const;
5526 virtual void drawScatterPlot(QCPPainter *painter, const QVector<QPointF> &scatters, const QCPScatterStyle &style) const;
5527 virtual void drawLinePlot(QCPPainter *painter, const QVector<QPointF> &lines) const;
5528 virtual void drawImpulsePlot(QCPPainter *painter, const QVector<QPointF> &lines) const;
5529
5530 virtual void getOptimizedLineData(QVector<QCPGraphData> *lineData, const QCPGraphDataContainer::const_iterator &begin, const QCPGraphDataContainer::const_iterator &end) const;
5531 virtual void getOptimizedScatterData(QVector<QCPGraphData> *scatterData, QCPGraphDataContainer::const_iterator begin, QCPGraphDataContainer::const_iterator end) const;
5532
5533 // non-virtual methods:
5534 void getVisibleDataBounds(QCPGraphDataContainer::const_iterator &begin, QCPGraphDataContainer::const_iterator &end, const QCPDataRange &rangeRestriction) const;
5535 void getLines(QVector<QPointF> *lines, const QCPDataRange &dataRange) const;
5536 void getScatters(QVector<QPointF> *scatters, const QCPDataRange &dataRange) const;
5537 QVector<QPointF> dataToLines(const QVector<QCPGraphData> &data) const;
5538 QVector<QPointF> dataToStepLeftLines(const QVector<QCPGraphData> &data) const;
5539 QVector<QPointF> dataToStepRightLines(const QVector<QCPGraphData> &data) const;
5540 QVector<QPointF> dataToStepCenterLines(const QVector<QCPGraphData> &data) const;
5541 QVector<QPointF> dataToImpulseLines(const QVector<QCPGraphData> &data) const;
5542 QVector<QCPDataRange> getNonNanSegments(const QVector<QPointF> *lineData, Qt::Orientation keyOrientation) const;
5543 QVector<QPair<QCPDataRange, QCPDataRange> > getOverlappingSegments(QVector<QCPDataRange> thisSegments, const QVector<QPointF> *thisData, QVector<QCPDataRange> otherSegments, const QVector<QPointF> *otherData) const;
5544 bool segmentsIntersect(double aLower, double aUpper, double bLower, double bUpper, int &bPrecedence) const;
5545 QPointF getFillBasePoint(QPointF matchingDataPoint) const;
5546 const QPolygonF getFillPolygon(const QVector<QPointF> *lineData, QCPDataRange segment) const;
5547 const QPolygonF getChannelFillPolygon(const QVector<QPointF> *thisData, QCPDataRange thisSegment, const QVector<QPointF> *otherData, QCPDataRange otherSegment) const;
5548 int findIndexBelowX(const QVector<QPointF> *data, double x) const;
5549 int findIndexAboveX(const QVector<QPointF> *data, double x) const;
5550 int findIndexBelowY(const QVector<QPointF> *data, double y) const;
5551 int findIndexAboveY(const QVector<QPointF> *data, double y) const;
5552 double pointDistance(const QPointF &pixelPoint, QCPGraphDataContainer::const_iterator &closestData) const;
5553
5554 friend class QCustomPlot;
5555 friend class QCPLegend;
5556};
5557Q_DECLARE_METATYPE(QCPGraph::LineStyle)
5558
5559/* end of 'src/plottables/plottable-graph.h' */
5560
5561
5562/* including file 'src/plottables/plottable-curve.h' */
5563/* modified 2021-03-29T02:30:44, size 7434 */
5564
5565class QCP_LIB_DECL QCPCurveData
5566{
5567public:
5568 QCPCurveData();
5569 QCPCurveData(double t, double key, double value);
5570
5571 inline double sortKey() const { return t; }
5572 inline static QCPCurveData fromSortKey(double sortKey) { return QCPCurveData(sortKey, 0, 0); }
5573 inline static bool sortKeyIsMainKey() { return false; }
5574
5575 inline double mainKey() const { return key; }
5576 inline double mainValue() const { return value; }
5577
5578 inline QCPRange valueRange() const { return QCPRange(value, value); }
5579
5580 double t, key, value;
5581};
5582Q_DECLARE_TYPEINFO(QCPCurveData, Q_PRIMITIVE_TYPE);
5583
5584
5595typedef QCPDataContainer<QCPCurveData> QCPCurveDataContainer;
5596
5597class QCP_LIB_DECL QCPCurve : public QCPAbstractPlottable1D<QCPCurveData>
5598{
5599 Q_OBJECT
5601 Q_PROPERTY(QCPScatterStyle scatterStyle READ scatterStyle WRITE setScatterStyle)
5602 Q_PROPERTY(int scatterSkip READ scatterSkip WRITE setScatterSkip)
5603 Q_PROPERTY(LineStyle lineStyle READ lineStyle WRITE setLineStyle)
5605public:
5614 Q_ENUMS(LineStyle)
5615
5616 explicit QCPCurve(QCPAxis *keyAxis, QCPAxis *valueAxis);
5617 virtual ~QCPCurve() Q_DECL_OVERRIDE;
5618
5619 // getters:
5620 QSharedPointer<QCPCurveDataContainer> data() const { return mDataContainer; }
5621 QCPScatterStyle scatterStyle() const { return mScatterStyle; }
5622 int scatterSkip() const { return mScatterSkip; }
5623 LineStyle lineStyle() const { return mLineStyle; }
5624
5625 // setters:
5626 void setData(QSharedPointer<QCPCurveDataContainer> data);
5627 void setData(const QVector<double> &t, const QVector<double> &keys, const QVector<double> &values, bool alreadySorted=false);
5628 void setData(const QVector<double> &keys, const QVector<double> &values);
5629 void setScatterStyle(const QCPScatterStyle &style);
5630 void setScatterSkip(int skip);
5631 void setLineStyle(LineStyle style);
5632
5633 // non-property methods:
5634 void addData(const QVector<double> &t, const QVector<double> &keys, const QVector<double> &values, bool alreadySorted=false);
5635 void addData(const QVector<double> &keys, const QVector<double> &values);
5636 void addData(double t, double key, double value);
5637 void addData(double key, double value);
5638
5639 // reimplemented virtual methods:
5640 virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE;
5641 virtual QCPRange getKeyRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth) const Q_DECL_OVERRIDE;
5642 virtual QCPRange getValueRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth, const QCPRange &inKeyRange=QCPRange()) const Q_DECL_OVERRIDE;
5643
5644protected:
5645 // property members:
5646 QCPScatterStyle mScatterStyle;
5647 int mScatterSkip;
5648 LineStyle mLineStyle;
5649
5650 // reimplemented virtual methods:
5651 virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
5652 virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const Q_DECL_OVERRIDE;
5653
5654 // introduced virtual methods:
5655 virtual void drawCurveLine(QCPPainter *painter, const QVector<QPointF> &lines) const;
5656 virtual void drawScatterPlot(QCPPainter *painter, const QVector<QPointF> &points, const QCPScatterStyle &style) const;
5657
5658 // non-virtual methods:
5659 void getCurveLines(QVector<QPointF> *lines, const QCPDataRange &dataRange, double penWidth) const;
5660 void getScatters(QVector<QPointF> *scatters, const QCPDataRange &dataRange, double scatterWidth) const;
5661 int getRegion(double key, double value, double keyMin, double valueMax, double keyMax, double valueMin) const;
5662 QPointF getOptimizedPoint(int otherRegion, double otherKey, double otherValue, double key, double value, double keyMin, double valueMax, double keyMax, double valueMin) const;
5663 QVector<QPointF> getOptimizedCornerPoints(int prevRegion, int currentRegion, double prevKey, double prevValue, double key, double value, double keyMin, double valueMax, double keyMax, double valueMin) const;
5664 bool mayTraverse(int prevRegion, int currentRegion) const;
5665 bool getTraverse(double prevKey, double prevValue, double key, double value, double keyMin, double valueMax, double keyMax, double valueMin, QPointF &crossA, QPointF &crossB) const;
5666 void getTraverseCornerPoints(int prevRegion, int currentRegion, double keyMin, double valueMax, double keyMax, double valueMin, QVector<QPointF> &beforeTraverse, QVector<QPointF> &afterTraverse) const;
5667 double pointDistance(const QPointF &pixelPoint, QCPCurveDataContainer::const_iterator &closestData) const;
5668
5669 friend class QCustomPlot;
5670 friend class QCPLegend;
5671};
5672Q_DECLARE_METATYPE(QCPCurve::LineStyle)
5673
5674/* end of 'src/plottables/plottable-curve.h' */
5675
5676
5677/* including file 'src/plottables/plottable-bars.h' */
5678/* modified 2021-03-29T02:30:44, size 8955 */
5679
5680class QCP_LIB_DECL QCPBarsGroup : public QObject
5681{
5682 Q_OBJECT
5684 Q_PROPERTY(SpacingType spacingType READ spacingType WRITE setSpacingType)
5685 Q_PROPERTY(double spacing READ spacing WRITE setSpacing)
5687public:
5698 Q_ENUMS(SpacingType)
5699
5700 explicit QCPBarsGroup(QCustomPlot *parentPlot);
5701 virtual ~QCPBarsGroup();
5702
5703 // getters:
5704 SpacingType spacingType() const { return mSpacingType; }
5705 double spacing() const { return mSpacing; }
5706
5707 // setters:
5708 void setSpacingType(SpacingType spacingType);
5709 void setSpacing(double spacing);
5710
5711 // non-virtual methods:
5712 QList<QCPBars*> bars() const { return mBars; }
5713 QCPBars* bars(int index) const;
5714 int size() const { return mBars.size(); }
5715 bool isEmpty() const { return mBars.isEmpty(); }
5716 void clear();
5717 bool contains(QCPBars *bars) const { return mBars.contains(bars); }
5718 void append(QCPBars *bars);
5719 void insert(int i, QCPBars *bars);
5720 void remove(QCPBars *bars);
5721
5722protected:
5723 // non-property members:
5724 QCustomPlot *mParentPlot;
5725 SpacingType mSpacingType;
5726 double mSpacing;
5727 QList<QCPBars*> mBars;
5728
5729 // non-virtual methods:
5730 void registerBars(QCPBars *bars);
5731 void unregisterBars(QCPBars *bars);
5732
5733 // virtual methods:
5734 double keyPixelOffset(const QCPBars *bars, double keyCoord);
5735 double getPixelSpacing(const QCPBars *bars, double keyCoord);
5736
5737private:
5738 Q_DISABLE_COPY(QCPBarsGroup)
5739
5740 friend class QCPBars;
5741};
5742Q_DECLARE_METATYPE(QCPBarsGroup::SpacingType)
5743
5744
5745class QCP_LIB_DECL QCPBarsData
5746{
5747public:
5748 QCPBarsData();
5749 QCPBarsData(double key, double value);
5750
5751 inline double sortKey() const { return key; }
5752 inline static QCPBarsData fromSortKey(double sortKey) { return QCPBarsData(sortKey, 0); }
5753 inline static bool sortKeyIsMainKey() { return true; }
5754
5755 inline double mainKey() const { return key; }
5756 inline double mainValue() const { return value; }
5757
5758 inline QCPRange valueRange() const { return QCPRange(value, value); } // note that bar base value isn't held in each QCPBarsData and thus can't/shouldn't be returned here
5759
5760 double key, value;
5761};
5762Q_DECLARE_TYPEINFO(QCPBarsData, Q_PRIMITIVE_TYPE);
5763
5764
5774typedef QCPDataContainer<QCPBarsData> QCPBarsDataContainer;
5775
5776class QCP_LIB_DECL QCPBars : public QCPAbstractPlottable1D<QCPBarsData>
5777{
5778 Q_OBJECT
5780 Q_PROPERTY(double width READ width WRITE setWidth)
5781 Q_PROPERTY(WidthType widthType READ widthType WRITE setWidthType)
5782 Q_PROPERTY(QCPBarsGroup* barsGroup READ barsGroup WRITE setBarsGroup)
5783 Q_PROPERTY(double baseValue READ baseValue WRITE setBaseValue)
5784 Q_PROPERTY(double stackingGap READ stackingGap WRITE setStackingGap)
5785 Q_PROPERTY(QCPBars* barBelow READ barBelow)
5786 Q_PROPERTY(QCPBars* barAbove READ barAbove)
5788public:
5799 Q_ENUMS(WidthType)
5800
5801 explicit QCPBars(QCPAxis *keyAxis, QCPAxis *valueAxis);
5802 virtual ~QCPBars() Q_DECL_OVERRIDE;
5803
5804 // getters:
5805 double width() const { return mWidth; }
5806 WidthType widthType() const { return mWidthType; }
5807 QCPBarsGroup *barsGroup() const { return mBarsGroup; }
5808 double baseValue() const { return mBaseValue; }
5809 double stackingGap() const { return mStackingGap; }
5810 QCPBars *barBelow() const { return mBarBelow.data(); }
5811 QCPBars *barAbove() const { return mBarAbove.data(); }
5812 QSharedPointer<QCPBarsDataContainer> data() const { return mDataContainer; }
5813
5814 // setters:
5815 void setData(QSharedPointer<QCPBarsDataContainer> data);
5816 void setData(const QVector<double> &keys, const QVector<double> &values, bool alreadySorted=false);
5817 void setWidth(double width);
5818 void setWidthType(WidthType widthType);
5819 void setBarsGroup(QCPBarsGroup *barsGroup);
5820 void setBaseValue(double baseValue);
5821 void setStackingGap(double pixels);
5822
5823 // non-property methods:
5824 void addData(const QVector<double> &keys, const QVector<double> &values, bool alreadySorted=false);
5825 void addData(double key, double value);
5826 void moveBelow(QCPBars *bars);
5827 void moveAbove(QCPBars *bars);
5828
5829 // reimplemented virtual methods:
5830 virtual QCPDataSelection selectTestRect(const QRectF &rect, bool onlySelectable) const Q_DECL_OVERRIDE;
5831 virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE;
5832 virtual QCPRange getKeyRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth) const Q_DECL_OVERRIDE;
5833 virtual QCPRange getValueRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth, const QCPRange &inKeyRange=QCPRange()) const Q_DECL_OVERRIDE;
5834 virtual QPointF dataPixelPosition(int index) const Q_DECL_OVERRIDE;
5835
5836protected:
5837 // property members:
5838 double mWidth;
5839 WidthType mWidthType;
5840 QCPBarsGroup *mBarsGroup;
5841 double mBaseValue;
5842 double mStackingGap;
5843 QPointer<QCPBars> mBarBelow, mBarAbove;
5844
5845 // reimplemented virtual methods:
5846 virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
5847 virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const Q_DECL_OVERRIDE;
5848
5849 // non-virtual methods:
5850 void getVisibleDataBounds(QCPBarsDataContainer::const_iterator &begin, QCPBarsDataContainer::const_iterator &end) const;
5851 QRectF getBarRect(double key, double value) const;
5852 void getPixelWidth(double key, double &lower, double &upper) const;
5853 double getStackedBaseValue(double key, bool positive) const;
5854 static void connectBars(QCPBars* lower, QCPBars* upper);
5855
5856 friend class QCustomPlot;
5857 friend class QCPLegend;
5858 friend class QCPBarsGroup;
5859};
5860Q_DECLARE_METATYPE(QCPBars::WidthType)
5861
5862/* end of 'src/plottables/plottable-bars.h' */
5863
5864
5865/* including file 'src/plottables/plottable-statisticalbox.h' */
5866/* modified 2021-03-29T02:30:44, size 7522 */
5867
5868class QCP_LIB_DECL QCPStatisticalBoxData
5869{
5870public:
5872 QCPStatisticalBoxData(double key, double minimum, double lowerQuartile, double median, double upperQuartile, double maximum, const QVector<double>& outliers=QVector<double>());
5873
5874 inline double sortKey() const { return key; }
5875 inline static QCPStatisticalBoxData fromSortKey(double sortKey) { return QCPStatisticalBoxData(sortKey, 0, 0, 0, 0, 0); }
5876 inline static bool sortKeyIsMainKey() { return true; }
5877
5878 inline double mainKey() const { return key; }
5879 inline double mainValue() const { return median; }
5880
5881 inline QCPRange valueRange() const
5882 {
5883 QCPRange result(minimum, maximum);
5884 for (QVector<double>::const_iterator it = outliers.constBegin(); it != outliers.constEnd(); ++it)
5885 result.expand(*it);
5886 return result;
5887 }
5888
5889 double key, minimum, lowerQuartile, median, upperQuartile, maximum;
5890 QVector<double> outliers;
5891};
5892Q_DECLARE_TYPEINFO(QCPStatisticalBoxData, Q_MOVABLE_TYPE);
5893
5894
5905typedef QCPDataContainer<QCPStatisticalBoxData> QCPStatisticalBoxDataContainer;
5906
5907class QCP_LIB_DECL QCPStatisticalBox : public QCPAbstractPlottable1D<QCPStatisticalBoxData>
5908{
5909 Q_OBJECT
5911 Q_PROPERTY(double width READ width WRITE setWidth)
5912 Q_PROPERTY(double whiskerWidth READ whiskerWidth WRITE setWhiskerWidth)
5913 Q_PROPERTY(QPen whiskerPen READ whiskerPen WRITE setWhiskerPen)
5914 Q_PROPERTY(QPen whiskerBarPen READ whiskerBarPen WRITE setWhiskerBarPen)
5915 Q_PROPERTY(bool whiskerAntialiased READ whiskerAntialiased WRITE setWhiskerAntialiased)
5916 Q_PROPERTY(QPen medianPen READ medianPen WRITE setMedianPen)
5917 Q_PROPERTY(QCPScatterStyle outlierStyle READ outlierStyle WRITE setOutlierStyle)
5919public:
5920 explicit QCPStatisticalBox(QCPAxis *keyAxis, QCPAxis *valueAxis);
5921
5922 // getters:
5923 QSharedPointer<QCPStatisticalBoxDataContainer> data() const { return mDataContainer; }
5924 double width() const { return mWidth; }
5925 double whiskerWidth() const { return mWhiskerWidth; }
5926 QPen whiskerPen() const { return mWhiskerPen; }
5927 QPen whiskerBarPen() const { return mWhiskerBarPen; }
5928 bool whiskerAntialiased() const { return mWhiskerAntialiased; }
5929 QPen medianPen() const { return mMedianPen; }
5930 QCPScatterStyle outlierStyle() const { return mOutlierStyle; }
5931
5932 // setters:
5933 void setData(QSharedPointer<QCPStatisticalBoxDataContainer> data);
5934 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);
5935 void setWidth(double width);
5936 void setWhiskerWidth(double width);
5937 void setWhiskerPen(const QPen &pen);
5938 void setWhiskerBarPen(const QPen &pen);
5939 void setWhiskerAntialiased(bool enabled);
5940 void setMedianPen(const QPen &pen);
5941 void setOutlierStyle(const QCPScatterStyle &style);
5942
5943 // non-property methods:
5944 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);
5945 void addData(double key, double minimum, double lowerQuartile, double median, double upperQuartile, double maximum, const QVector<double> &outliers=QVector<double>());
5946
5947 // reimplemented virtual methods:
5948 virtual QCPDataSelection selectTestRect(const QRectF &rect, bool onlySelectable) const Q_DECL_OVERRIDE;
5949 virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE;
5950 virtual QCPRange getKeyRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth) const Q_DECL_OVERRIDE;
5951 virtual QCPRange getValueRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth, const QCPRange &inKeyRange=QCPRange()) const Q_DECL_OVERRIDE;
5952
5953protected:
5954 // property members:
5955 double mWidth;
5956 double mWhiskerWidth;
5957 QPen mWhiskerPen, mWhiskerBarPen;
5958 bool mWhiskerAntialiased;
5959 QPen mMedianPen;
5960 QCPScatterStyle mOutlierStyle;
5961
5962 // reimplemented virtual methods:
5963 virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
5964 virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const Q_DECL_OVERRIDE;
5965
5966 // introduced virtual methods:
5967 virtual void drawStatisticalBox(QCPPainter *painter, QCPStatisticalBoxDataContainer::const_iterator it, const QCPScatterStyle &outlierStyle) const;
5968
5969 // non-virtual methods:
5970 void getVisibleDataBounds(QCPStatisticalBoxDataContainer::const_iterator &begin, QCPStatisticalBoxDataContainer::const_iterator &end) const;
5971 QRectF getQuartileBox(QCPStatisticalBoxDataContainer::const_iterator it) const;
5972 QVector<QLineF> getWhiskerBackboneLines(QCPStatisticalBoxDataContainer::const_iterator it) const;
5973 QVector<QLineF> getWhiskerBarLines(QCPStatisticalBoxDataContainer::const_iterator it) const;
5974
5975 friend class QCustomPlot;
5976 friend class QCPLegend;
5977};
5978
5979/* end of 'src/plottables/plottable-statisticalbox.h' */
5980
5981
5982/* including file 'src/plottables/plottable-colormap.h' */
5983/* modified 2021-03-29T02:30:44, size 7092 */
5984
5985class QCP_LIB_DECL QCPColorMapData
5986{
5987public:
5988 QCPColorMapData(int keySize, int valueSize, const QCPRange &keyRange, const QCPRange &valueRange);
5990 QCPColorMapData(const QCPColorMapData &other);
5992
5993 // getters:
5994 int keySize() const { return mKeySize; }
5995 int valueSize() const { return mValueSize; }
5996 QCPRange keyRange() const { return mKeyRange; }
5997 QCPRange valueRange() const { return mValueRange; }
5998 QCPRange dataBounds() const { return mDataBounds; }
5999 double data(double key, double value);
6000 double cell(int keyIndex, int valueIndex);
6001 unsigned char alpha(int keyIndex, int valueIndex);
6002
6003 // setters:
6004 void setSize(int keySize, int valueSize);
6005 void setKeySize(int keySize);
6006 void setValueSize(int valueSize);
6007 void setRange(const QCPRange &keyRange, const QCPRange &valueRange);
6008 void setKeyRange(const QCPRange &keyRange);
6009 void setValueRange(const QCPRange &valueRange);
6010 void setData(double key, double value, double z);
6011 void setCell(int keyIndex, int valueIndex, double z);
6012 void setAlpha(int keyIndex, int valueIndex, unsigned char alpha);
6013
6014 // non-property methods:
6015 void recalculateDataBounds();
6016 void clear();
6017 void clearAlpha();
6018 void fill(double z);
6019 void fillAlpha(unsigned char alpha);
6020 bool isEmpty() const { return mIsEmpty; }
6021 void coordToCell(double key, double value, int *keyIndex, int *valueIndex) const;
6022 void cellToCoord(int keyIndex, int valueIndex, double *key, double *value) const;
6023
6024protected:
6025 // property members:
6026 int mKeySize, mValueSize;
6027 QCPRange mKeyRange, mValueRange;
6028 bool mIsEmpty;
6029
6030 // non-property members:
6031 double *mData;
6032 unsigned char *mAlpha;
6033 QCPRange mDataBounds;
6034 bool mDataModified;
6035
6036 bool createAlpha(bool initializeOpaque=true);
6037
6038 friend class QCPColorMap;
6039};
6040
6041
6042class QCP_LIB_DECL QCPColorMap : public QCPAbstractPlottable
6043{
6044 Q_OBJECT
6046 Q_PROPERTY(QCPRange dataRange READ dataRange WRITE setDataRange NOTIFY dataRangeChanged)
6047 Q_PROPERTY(QCPAxis::ScaleType dataScaleType READ dataScaleType WRITE setDataScaleType NOTIFY dataScaleTypeChanged)
6048 Q_PROPERTY(QCPColorGradient gradient READ gradient WRITE setGradient NOTIFY gradientChanged)
6049 Q_PROPERTY(bool interpolate READ interpolate WRITE setInterpolate)
6050 Q_PROPERTY(bool tightBoundary READ tightBoundary WRITE setTightBoundary)
6051 Q_PROPERTY(QCPColorScale* colorScale READ colorScale WRITE setColorScale)
6053public:
6054 explicit QCPColorMap(QCPAxis *keyAxis, QCPAxis *valueAxis);
6055 virtual ~QCPColorMap() Q_DECL_OVERRIDE;
6056
6057 // getters:
6058 QCPColorMapData *data() const { return mMapData; }
6059 QCPRange dataRange() const { return mDataRange; }
6060 QCPAxis::ScaleType dataScaleType() const { return mDataScaleType; }
6061 bool interpolate() const { return mInterpolate; }
6062 bool tightBoundary() const { return mTightBoundary; }
6063 QCPColorGradient gradient() const { return mGradient; }
6064 QCPColorScale *colorScale() const { return mColorScale.data(); }
6065
6066 // setters:
6067 void setData(QCPColorMapData *data, bool copy=false);
6068 Q_SLOT void setDataRange(const QCPRange &dataRange);
6069 Q_SLOT void setDataScaleType(QCPAxis::ScaleType scaleType);
6070 Q_SLOT void setGradient(const QCPColorGradient &gradient);
6071 void setInterpolate(bool enabled);
6072 void setTightBoundary(bool enabled);
6073 void setColorScale(QCPColorScale *colorScale);
6074
6075 // non-property methods:
6076 void rescaleDataRange(bool recalculateDataBounds=false);
6077 Q_SLOT void updateLegendIcon(Qt::TransformationMode transformMode=Qt::SmoothTransformation, const QSize &thumbSize=QSize(32, 18));
6078
6079 // reimplemented virtual methods:
6080 virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE;
6081 virtual QCPRange getKeyRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth) const Q_DECL_OVERRIDE;
6082 virtual QCPRange getValueRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth, const QCPRange &inKeyRange=QCPRange()) const Q_DECL_OVERRIDE;
6083
6084signals:
6085 void dataRangeChanged(const QCPRange &newRange);
6086 void dataScaleTypeChanged(QCPAxis::ScaleType scaleType);
6087 void gradientChanged(const QCPColorGradient &newGradient);
6088
6089protected:
6090 // property members:
6091 QCPRange mDataRange;
6092 QCPAxis::ScaleType mDataScaleType;
6093 QCPColorMapData *mMapData;
6094 QCPColorGradient mGradient;
6095 bool mInterpolate;
6096 bool mTightBoundary;
6097 QPointer<QCPColorScale> mColorScale;
6098
6099 // non-property members:
6100 QImage mMapImage, mUndersampledMapImage;
6101 QPixmap mLegendIcon;
6102 bool mMapImageInvalidated;
6103
6104 // introduced virtual methods:
6105 virtual void updateMapImage();
6106
6107 // reimplemented virtual methods:
6108 virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
6109 virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const Q_DECL_OVERRIDE;
6110
6111 friend class QCustomPlot;
6112 friend class QCPLegend;
6113};
6114
6115/* end of 'src/plottables/plottable-colormap.h' */
6116
6117
6118/* including file 'src/plottables/plottable-financial.h' */
6119/* modified 2021-03-29T02:30:44, size 8644 */
6120
6121class QCP_LIB_DECL QCPFinancialData
6122{
6123public:
6125 QCPFinancialData(double key, double open, double high, double low, double close);
6126
6127 inline double sortKey() const { return key; }
6128 inline static QCPFinancialData fromSortKey(double sortKey) { return QCPFinancialData(sortKey, 0, 0, 0, 0); }
6129 inline static bool sortKeyIsMainKey() { return true; }
6130
6131 inline double mainKey() const { return key; }
6132 inline double mainValue() const { return open; }
6133
6134 inline QCPRange valueRange() const { return QCPRange(low, high); } // open and close must lie between low and high, so we don't need to check them
6135
6136 double key, open, high, low, close;
6137};
6138Q_DECLARE_TYPEINFO(QCPFinancialData, Q_PRIMITIVE_TYPE);
6139
6140
6150typedef QCPDataContainer<QCPFinancialData> QCPFinancialDataContainer;
6151
6152class QCP_LIB_DECL QCPFinancial : public QCPAbstractPlottable1D<QCPFinancialData>
6153{
6154 Q_OBJECT
6156 Q_PROPERTY(ChartStyle chartStyle READ chartStyle WRITE setChartStyle)
6157 Q_PROPERTY(double width READ width WRITE setWidth)
6158 Q_PROPERTY(WidthType widthType READ widthType WRITE setWidthType)
6159 Q_PROPERTY(bool twoColored READ twoColored WRITE setTwoColored)
6160 Q_PROPERTY(QBrush brushPositive READ brushPositive WRITE setBrushPositive)
6161 Q_PROPERTY(QBrush brushNegative READ brushNegative WRITE setBrushNegative)
6162 Q_PROPERTY(QPen penPositive READ penPositive WRITE setPenPositive)
6163 Q_PROPERTY(QPen penNegative READ penNegative WRITE setPenNegative)
6165public:
6176 Q_ENUMS(WidthType)
6177
6178
6186 Q_ENUMS(ChartStyle)
6187
6188 explicit QCPFinancial(QCPAxis *keyAxis, QCPAxis *valueAxis);
6189 virtual ~QCPFinancial() Q_DECL_OVERRIDE;
6190
6191 // getters:
6192 QSharedPointer<QCPFinancialDataContainer> data() const { return mDataContainer; }
6193 ChartStyle chartStyle() const { return mChartStyle; }
6194 double width() const { return mWidth; }
6195 WidthType widthType() const { return mWidthType; }
6196 bool twoColored() const { return mTwoColored; }
6197 QBrush brushPositive() const { return mBrushPositive; }
6198 QBrush brushNegative() const { return mBrushNegative; }
6199 QPen penPositive() const { return mPenPositive; }
6200 QPen penNegative() const { return mPenNegative; }
6201
6202 // setters:
6203 void setData(QSharedPointer<QCPFinancialDataContainer> data);
6204 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);
6205 void setChartStyle(ChartStyle style);
6206 void setWidth(double width);
6207 void setWidthType(WidthType widthType);
6208 void setTwoColored(bool twoColored);
6209 void setBrushPositive(const QBrush &brush);
6210 void setBrushNegative(const QBrush &brush);
6211 void setPenPositive(const QPen &pen);
6212 void setPenNegative(const QPen &pen);
6213
6214 // non-property methods:
6215 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);
6216 void addData(double key, double open, double high, double low, double close);
6217
6218 // reimplemented virtual methods:
6219 virtual QCPDataSelection selectTestRect(const QRectF &rect, bool onlySelectable) const Q_DECL_OVERRIDE;
6220 virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE;
6221 virtual QCPRange getKeyRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth) const Q_DECL_OVERRIDE;
6222 virtual QCPRange getValueRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth, const QCPRange &inKeyRange=QCPRange()) const Q_DECL_OVERRIDE;
6223
6224 // static methods:
6225 static QCPFinancialDataContainer timeSeriesToOhlc(const QVector<double> &time, const QVector<double> &value, double timeBinSize, double timeBinOffset = 0);
6226
6227protected:
6228 // property members:
6229 ChartStyle mChartStyle;
6230 double mWidth;
6231 WidthType mWidthType;
6232 bool mTwoColored;
6233 QBrush mBrushPositive, mBrushNegative;
6234 QPen mPenPositive, mPenNegative;
6235
6236 // reimplemented virtual methods:
6237 virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
6238 virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const Q_DECL_OVERRIDE;
6239
6240 // non-virtual methods:
6241 void drawOhlcPlot(QCPPainter *painter, const QCPFinancialDataContainer::const_iterator &begin, const QCPFinancialDataContainer::const_iterator &end, bool isSelected);
6242 void drawCandlestickPlot(QCPPainter *painter, const QCPFinancialDataContainer::const_iterator &begin, const QCPFinancialDataContainer::const_iterator &end, bool isSelected);
6243 double getPixelWidth(double key, double keyPixel) const;
6244 double ohlcSelectTest(const QPointF &pos, const QCPFinancialDataContainer::const_iterator &begin, const QCPFinancialDataContainer::const_iterator &end, QCPFinancialDataContainer::const_iterator &closestDataPoint) const;
6245 double candlestickSelectTest(const QPointF &pos, const QCPFinancialDataContainer::const_iterator &begin, const QCPFinancialDataContainer::const_iterator &end, QCPFinancialDataContainer::const_iterator &closestDataPoint) const;
6246 void getVisibleDataBounds(QCPFinancialDataContainer::const_iterator &begin, QCPFinancialDataContainer::const_iterator &end) const;
6247 QRectF selectionHitBox(QCPFinancialDataContainer::const_iterator it) const;
6248
6249 friend class QCustomPlot;
6250 friend class QCPLegend;
6251};
6252Q_DECLARE_METATYPE(QCPFinancial::ChartStyle)
6253
6254/* end of 'src/plottables/plottable-financial.h' */
6255
6256
6257/* including file 'src/plottables/plottable-errorbar.h' */
6258/* modified 2021-03-29T02:30:44, size 7749 */
6259
6260class QCP_LIB_DECL QCPErrorBarsData
6261{
6262public:
6264 explicit QCPErrorBarsData(double error);
6265 QCPErrorBarsData(double errorMinus, double errorPlus);
6266
6267 double errorMinus, errorPlus;
6268};
6269Q_DECLARE_TYPEINFO(QCPErrorBarsData, Q_PRIMITIVE_TYPE);
6270
6271
6287typedef QVector<QCPErrorBarsData> QCPErrorBarsDataContainer;
6288
6290{
6291 Q_OBJECT
6293 Q_PROPERTY(QSharedPointer<QCPErrorBarsDataContainer> data READ data WRITE setData)
6294 Q_PROPERTY(QCPAbstractPlottable* dataPlottable READ dataPlottable WRITE setDataPlottable)
6295 Q_PROPERTY(ErrorType errorType READ errorType WRITE setErrorType)
6296 Q_PROPERTY(double whiskerWidth READ whiskerWidth WRITE setWhiskerWidth)
6297 Q_PROPERTY(double symbolGap READ symbolGap WRITE setSymbolGap)
6299public:
6300
6310 Q_ENUMS(ErrorType)
6311
6312 explicit QCPErrorBars(QCPAxis *keyAxis, QCPAxis *valueAxis);
6313 virtual ~QCPErrorBars() Q_DECL_OVERRIDE;
6314 // getters:
6315 QSharedPointer<QCPErrorBarsDataContainer> data() const { return mDataContainer; }
6316 QCPAbstractPlottable *dataPlottable() const { return mDataPlottable.data(); }
6317 ErrorType errorType() const { return mErrorType; }
6318 double whiskerWidth() const { return mWhiskerWidth; }
6319 double symbolGap() const { return mSymbolGap; }
6320
6321 // setters:
6322 void setData(QSharedPointer<QCPErrorBarsDataContainer> data);
6323 void setData(const QVector<double> &error);
6324 void setData(const QVector<double> &errorMinus, const QVector<double> &errorPlus);
6325 void setDataPlottable(QCPAbstractPlottable* plottable);
6326 void setErrorType(ErrorType type);
6327 void setWhiskerWidth(double pixels);
6328 void setSymbolGap(double pixels);
6329
6330 // non-property methods:
6331 void addData(const QVector<double> &error);
6332 void addData(const QVector<double> &errorMinus, const QVector<double> &errorPlus);
6333 void addData(double error);
6334 void addData(double errorMinus, double errorPlus);
6335
6336 // virtual methods of 1d plottable interface:
6337 virtual int dataCount() const Q_DECL_OVERRIDE;
6338 virtual double dataMainKey(int index) const Q_DECL_OVERRIDE;
6339 virtual double dataSortKey(int index) const Q_DECL_OVERRIDE;
6340 virtual double dataMainValue(int index) const Q_DECL_OVERRIDE;
6341 virtual QCPRange dataValueRange(int index) const Q_DECL_OVERRIDE;
6342 virtual QPointF dataPixelPosition(int index) const Q_DECL_OVERRIDE;
6343 virtual bool sortKeyIsMainKey() const Q_DECL_OVERRIDE;
6344 virtual QCPDataSelection selectTestRect(const QRectF &rect, bool onlySelectable) const Q_DECL_OVERRIDE;
6345 virtual int findBegin(double sortKey, bool expandedRange=true) const Q_DECL_OVERRIDE;
6346 virtual int findEnd(double sortKey, bool expandedRange=true) const Q_DECL_OVERRIDE;
6347
6348 // reimplemented virtual methods:
6349 virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE;
6350 virtual QCPPlottableInterface1D *interface1D() Q_DECL_OVERRIDE { return this; }
6351
6352protected:
6353 // property members:
6354 QSharedPointer<QCPErrorBarsDataContainer> mDataContainer;
6355 QPointer<QCPAbstractPlottable> mDataPlottable;
6356 ErrorType mErrorType;
6357 double mWhiskerWidth;
6358 double mSymbolGap;
6359
6360 // reimplemented virtual methods:
6361 virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
6362 virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const Q_DECL_OVERRIDE;
6363 virtual QCPRange getKeyRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth) const Q_DECL_OVERRIDE;
6364 virtual QCPRange getValueRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth, const QCPRange &inKeyRange=QCPRange()) const Q_DECL_OVERRIDE;
6365
6366 // non-virtual methods:
6367 void getErrorBarLines(QCPErrorBarsDataContainer::const_iterator it, QVector<QLineF> &backbones, QVector<QLineF> &whiskers) const;
6368 void getVisibleDataBounds(QCPErrorBarsDataContainer::const_iterator &begin, QCPErrorBarsDataContainer::const_iterator &end, const QCPDataRange &rangeRestriction) const;
6369 double pointDistance(const QPointF &pixelPoint, QCPErrorBarsDataContainer::const_iterator &closestData) const;
6370 // helpers:
6371 void getDataSegments(QList<QCPDataRange> &selectedSegments, QList<QCPDataRange> &unselectedSegments) const;
6372 bool errorBarVisible(int index) const;
6373 bool rectIntersectsLine(const QRectF &pixelRect, const QLineF &line) const;
6374
6375 friend class QCustomPlot;
6376 friend class QCPLegend;
6377};
6378
6379/* end of 'src/plottables/plottable-errorbar.h' */
6380
6381
6382/* including file 'src/items/item-straightline.h' */
6383/* modified 2021-03-29T02:30:44, size 3137 */
6384
6385class QCP_LIB_DECL QCPItemStraightLine : public QCPAbstractItem
6386{
6387 Q_OBJECT
6389 Q_PROPERTY(QPen pen READ pen WRITE setPen)
6390 Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
6392public:
6393 explicit QCPItemStraightLine(QCustomPlot *parentPlot);
6394 virtual ~QCPItemStraightLine() Q_DECL_OVERRIDE;
6395
6396 // getters:
6397 QPen pen() const { return mPen; }
6398 QPen selectedPen() const { return mSelectedPen; }
6399
6400 // setters;
6401 void setPen(const QPen &pen);
6402 void setSelectedPen(const QPen &pen);
6403
6404 // reimplemented virtual methods:
6405 virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE;
6406
6407 QCPItemPosition * const point1;
6408 QCPItemPosition * const point2;
6409
6410protected:
6411 // property members:
6412 QPen mPen, mSelectedPen;
6413
6414 // reimplemented virtual methods:
6415 virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
6416
6417 // non-virtual methods:
6418 QLineF getRectClippedStraightLine(const QCPVector2D &base, const QCPVector2D &vec, const QRect &rect) const;
6419 QPen mainPen() const;
6420};
6421
6422/* end of 'src/items/item-straightline.h' */
6423
6424
6425/* including file 'src/items/item-line.h' */
6426/* modified 2021-03-29T02:30:44, size 3429 */
6427
6428class QCP_LIB_DECL QCPItemLine : public QCPAbstractItem
6429{
6430 Q_OBJECT
6432 Q_PROPERTY(QPen pen READ pen WRITE setPen)
6433 Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
6434 Q_PROPERTY(QCPLineEnding head READ head WRITE setHead)
6435 Q_PROPERTY(QCPLineEnding tail READ tail WRITE setTail)
6437public:
6438 explicit QCPItemLine(QCustomPlot *parentPlot);
6439 virtual ~QCPItemLine() Q_DECL_OVERRIDE;
6440
6441 // getters:
6442 QPen pen() const { return mPen; }
6443 QPen selectedPen() const { return mSelectedPen; }
6444 QCPLineEnding head() const { return mHead; }
6445 QCPLineEnding tail() const { return mTail; }
6446
6447 // setters;
6448 void setPen(const QPen &pen);
6449 void setSelectedPen(const QPen &pen);
6450 void setHead(const QCPLineEnding &head);
6451 void setTail(const QCPLineEnding &tail);
6452
6453 // reimplemented virtual methods:
6454 virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE;
6455
6456 QCPItemPosition * const start;
6457 QCPItemPosition * const end;
6458
6459protected:
6460 // property members:
6461 QPen mPen, mSelectedPen;
6462 QCPLineEnding mHead, mTail;
6463
6464 // reimplemented virtual methods:
6465 virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
6466
6467 // non-virtual methods:
6468 QLineF getRectClippedLine(const QCPVector2D &start, const QCPVector2D &end, const QRect &rect) const;
6469 QPen mainPen() const;
6470};
6471
6472/* end of 'src/items/item-line.h' */
6473
6474
6475/* including file 'src/items/item-curve.h' */
6476/* modified 2021-03-29T02:30:44, size 3401 */
6477
6478class QCP_LIB_DECL QCPItemCurve : public QCPAbstractItem
6479{
6480 Q_OBJECT
6482 Q_PROPERTY(QPen pen READ pen WRITE setPen)
6483 Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
6484 Q_PROPERTY(QCPLineEnding head READ head WRITE setHead)
6485 Q_PROPERTY(QCPLineEnding tail READ tail WRITE setTail)
6487public:
6488 explicit QCPItemCurve(QCustomPlot *parentPlot);
6489 virtual ~QCPItemCurve() Q_DECL_OVERRIDE;
6490
6491 // getters:
6492 QPen pen() const { return mPen; }
6493 QPen selectedPen() const { return mSelectedPen; }
6494 QCPLineEnding head() const { return mHead; }
6495 QCPLineEnding tail() const { return mTail; }
6496
6497 // setters;
6498 void setPen(const QPen &pen);
6499 void setSelectedPen(const QPen &pen);
6500 void setHead(const QCPLineEnding &head);
6501 void setTail(const QCPLineEnding &tail);
6502
6503 // reimplemented virtual methods:
6504 virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE;
6505
6506 QCPItemPosition * const start;
6507 QCPItemPosition * const startDir;
6508 QCPItemPosition * const endDir;
6509 QCPItemPosition * const end;
6510
6511protected:
6512 // property members:
6513 QPen mPen, mSelectedPen;
6514 QCPLineEnding mHead, mTail;
6515
6516 // reimplemented virtual methods:
6517 virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
6518
6519 // non-virtual methods:
6520 QPen mainPen() const;
6521};
6522
6523/* end of 'src/items/item-curve.h' */
6524
6525
6526/* including file 'src/items/item-rect.h' */
6527/* modified 2021-03-29T02:30:44, size 3710 */
6528
6529class QCP_LIB_DECL QCPItemRect : public QCPAbstractItem
6530{
6531 Q_OBJECT
6533 Q_PROPERTY(QPen pen READ pen WRITE setPen)
6534 Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
6535 Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
6536 Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
6538public:
6539 explicit QCPItemRect(QCustomPlot *parentPlot);
6540 virtual ~QCPItemRect() Q_DECL_OVERRIDE;
6541
6542 // getters:
6543 QPen pen() const { return mPen; }
6544 QPen selectedPen() const { return mSelectedPen; }
6545 QBrush brush() const { return mBrush; }
6546 QBrush selectedBrush() const { return mSelectedBrush; }
6547
6548 // setters;
6549 void setPen(const QPen &pen);
6550 void setSelectedPen(const QPen &pen);
6551 void setBrush(const QBrush &brush);
6552 void setSelectedBrush(const QBrush &brush);
6553
6554 // reimplemented virtual methods:
6555 virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE;
6556
6557 QCPItemPosition * const topLeft;
6558 QCPItemPosition * const bottomRight;
6559 QCPItemAnchor * const top;
6560 QCPItemAnchor * const topRight;
6561 QCPItemAnchor * const right;
6562 QCPItemAnchor * const bottom;
6563 QCPItemAnchor * const bottomLeft;
6564 QCPItemAnchor * const left;
6565
6566protected:
6567 enum AnchorIndex {aiTop, aiTopRight, aiRight, aiBottom, aiBottomLeft, aiLeft};
6568
6569 // property members:
6570 QPen mPen, mSelectedPen;
6571 QBrush mBrush, mSelectedBrush;
6572
6573 // reimplemented virtual methods:
6574 virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
6575 virtual QPointF anchorPixelPosition(int anchorId) const Q_DECL_OVERRIDE;
6576
6577 // non-virtual methods:
6578 QPen mainPen() const;
6579 QBrush mainBrush() const;
6580};
6581
6582/* end of 'src/items/item-rect.h' */
6583
6584
6585/* including file 'src/items/item-text.h' */
6586/* modified 2021-03-29T02:30:44, size 5576 */
6587
6588class QCP_LIB_DECL QCPItemText : public QCPAbstractItem
6589{
6590 Q_OBJECT
6592 Q_PROPERTY(QColor color READ color WRITE setColor)
6593 Q_PROPERTY(QColor selectedColor READ selectedColor WRITE setSelectedColor)
6594 Q_PROPERTY(QPen pen READ pen WRITE setPen)
6595 Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
6596 Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
6597 Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
6598 Q_PROPERTY(QFont font READ font WRITE setFont)
6599 Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont)
6600 Q_PROPERTY(QString text READ text WRITE setText)
6601 Q_PROPERTY(Qt::Alignment positionAlignment READ positionAlignment WRITE setPositionAlignment)
6602 Q_PROPERTY(Qt::Alignment textAlignment READ textAlignment WRITE setTextAlignment)
6603 Q_PROPERTY(double rotation READ rotation WRITE setRotation)
6604 Q_PROPERTY(QMargins padding READ padding WRITE setPadding)
6606public:
6607 explicit QCPItemText(QCustomPlot *parentPlot);
6608 virtual ~QCPItemText() Q_DECL_OVERRIDE;
6609
6610 // getters:
6611 QColor color() const { return mColor; }
6612 QColor selectedColor() const { return mSelectedColor; }
6613 QPen pen() const { return mPen; }
6614 QPen selectedPen() const { return mSelectedPen; }
6615 QBrush brush() const { return mBrush; }
6616 QBrush selectedBrush() const { return mSelectedBrush; }
6617 QFont font() const { return mFont; }
6618 QFont selectedFont() const { return mSelectedFont; }
6619 QString text() const { return mText; }
6620 Qt::Alignment positionAlignment() const { return mPositionAlignment; }
6621 Qt::Alignment textAlignment() const { return mTextAlignment; }
6622 double rotation() const { return mRotation; }
6623 QMargins padding() const { return mPadding; }
6624
6625 // setters;
6626 void setColor(const QColor &color);
6627 void setSelectedColor(const QColor &color);
6628 void setPen(const QPen &pen);
6629 void setSelectedPen(const QPen &pen);
6630 void setBrush(const QBrush &brush);
6631 void setSelectedBrush(const QBrush &brush);
6632 void setFont(const QFont &font);
6633 void setSelectedFont(const QFont &font);
6634 void setText(const QString &text);
6635 void setPositionAlignment(Qt::Alignment alignment);
6636 void setTextAlignment(Qt::Alignment alignment);
6637 void setRotation(double degrees);
6638 void setPadding(const QMargins &padding);
6639
6640 // reimplemented virtual methods:
6641 virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE;
6642
6643 QCPItemPosition * const position;
6644 QCPItemAnchor * const topLeft;
6645 QCPItemAnchor * const top;
6646 QCPItemAnchor * const topRight;
6647 QCPItemAnchor * const right;
6648 QCPItemAnchor * const bottomRight;
6649 QCPItemAnchor * const bottom;
6650 QCPItemAnchor * const bottomLeft;
6651 QCPItemAnchor * const left;
6652
6653protected:
6654 enum AnchorIndex {aiTopLeft, aiTop, aiTopRight, aiRight, aiBottomRight, aiBottom, aiBottomLeft, aiLeft};
6655
6656 // property members:
6657 QColor mColor, mSelectedColor;
6658 QPen mPen, mSelectedPen;
6659 QBrush mBrush, mSelectedBrush;
6660 QFont mFont, mSelectedFont;
6661 QString mText;
6662 Qt::Alignment mPositionAlignment;
6663 Qt::Alignment mTextAlignment;
6664 double mRotation;
6665 QMargins mPadding;
6666
6667 // reimplemented virtual methods:
6668 virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
6669 virtual QPointF anchorPixelPosition(int anchorId) const Q_DECL_OVERRIDE;
6670
6671 // non-virtual methods:
6672 QPointF getTextDrawPoint(const QPointF &pos, const QRectF &rect, Qt::Alignment positionAlignment) const;
6673 QFont mainFont() const;
6674 QColor mainColor() const;
6675 QPen mainPen() const;
6676 QBrush mainBrush() const;
6677};
6678
6679/* end of 'src/items/item-text.h' */
6680
6681
6682/* including file 'src/items/item-ellipse.h' */
6683/* modified 2021-03-29T02:30:44, size 3890 */
6684
6685class QCP_LIB_DECL QCPItemEllipse : public QCPAbstractItem
6686{
6687 Q_OBJECT
6689 Q_PROPERTY(QPen pen READ pen WRITE setPen)
6690 Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
6691 Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
6692 Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
6694public:
6695 explicit QCPItemEllipse(QCustomPlot *parentPlot);
6696 virtual ~QCPItemEllipse() Q_DECL_OVERRIDE;
6697
6698 // getters:
6699 QPen pen() const { return mPen; }
6700 QPen selectedPen() const { return mSelectedPen; }
6701 QBrush brush() const { return mBrush; }
6702 QBrush selectedBrush() const { return mSelectedBrush; }
6703
6704 // setters;
6705 void setPen(const QPen &pen);
6706 void setSelectedPen(const QPen &pen);
6707 void setBrush(const QBrush &brush);
6708 void setSelectedBrush(const QBrush &brush);
6709
6710 // reimplemented virtual methods:
6711 virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE;
6712
6713 QCPItemPosition * const topLeft;
6714 QCPItemPosition * const bottomRight;
6715 QCPItemAnchor * const topLeftRim;
6716 QCPItemAnchor * const top;
6717 QCPItemAnchor * const topRightRim;
6718 QCPItemAnchor * const right;
6719 QCPItemAnchor * const bottomRightRim;
6720 QCPItemAnchor * const bottom;
6721 QCPItemAnchor * const bottomLeftRim;
6722 QCPItemAnchor * const left;
6723 QCPItemAnchor * const center;
6724
6725protected:
6726 enum AnchorIndex {aiTopLeftRim, aiTop, aiTopRightRim, aiRight, aiBottomRightRim, aiBottom, aiBottomLeftRim, aiLeft, aiCenter};
6727
6728 // property members:
6729 QPen mPen, mSelectedPen;
6730 QBrush mBrush, mSelectedBrush;
6731
6732 // reimplemented virtual methods:
6733 virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
6734 virtual QPointF anchorPixelPosition(int anchorId) const Q_DECL_OVERRIDE;
6735
6736 // non-virtual methods:
6737 QPen mainPen() const;
6738 QBrush mainBrush() const;
6739};
6740
6741/* end of 'src/items/item-ellipse.h' */
6742
6743
6744/* including file 'src/items/item-pixmap.h' */
6745/* modified 2021-03-29T02:30:44, size 4407 */
6746
6747class QCP_LIB_DECL QCPItemPixmap : public QCPAbstractItem
6748{
6749 Q_OBJECT
6751 Q_PROPERTY(QPixmap pixmap READ pixmap WRITE setPixmap)
6752 Q_PROPERTY(bool scaled READ scaled WRITE setScaled)
6753 Q_PROPERTY(Qt::AspectRatioMode aspectRatioMode READ aspectRatioMode)
6754 Q_PROPERTY(Qt::TransformationMode transformationMode READ transformationMode)
6755 Q_PROPERTY(QPen pen READ pen WRITE setPen)
6756 Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
6758public:
6759 explicit QCPItemPixmap(QCustomPlot *parentPlot);
6760 virtual ~QCPItemPixmap() Q_DECL_OVERRIDE;
6761
6762 // getters:
6763 QPixmap pixmap() const { return mPixmap; }
6764 bool scaled() const { return mScaled; }
6765 Qt::AspectRatioMode aspectRatioMode() const { return mAspectRatioMode; }
6766 Qt::TransformationMode transformationMode() const { return mTransformationMode; }
6767 QPen pen() const { return mPen; }
6768 QPen selectedPen() const { return mSelectedPen; }
6769
6770 // setters;
6771 void setPixmap(const QPixmap &pixmap);
6772 void setScaled(bool scaled, Qt::AspectRatioMode aspectRatioMode=Qt::KeepAspectRatio, Qt::TransformationMode transformationMode=Qt::SmoothTransformation);
6773 void setPen(const QPen &pen);
6774 void setSelectedPen(const QPen &pen);
6775
6776 // reimplemented virtual methods:
6777 virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE;
6778
6779 QCPItemPosition * const topLeft;
6780 QCPItemPosition * const bottomRight;
6781 QCPItemAnchor * const top;
6782 QCPItemAnchor * const topRight;
6783 QCPItemAnchor * const right;
6784 QCPItemAnchor * const bottom;
6785 QCPItemAnchor * const bottomLeft;
6786 QCPItemAnchor * const left;
6787
6788protected:
6789 enum AnchorIndex {aiTop, aiTopRight, aiRight, aiBottom, aiBottomLeft, aiLeft};
6790
6791 // property members:
6792 QPixmap mPixmap;
6793 QPixmap mScaledPixmap;
6794 bool mScaled;
6795 bool mScaledPixmapInvalidated;
6796 Qt::AspectRatioMode mAspectRatioMode;
6797 Qt::TransformationMode mTransformationMode;
6798 QPen mPen, mSelectedPen;
6799
6800 // reimplemented virtual methods:
6801 virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
6802 virtual QPointF anchorPixelPosition(int anchorId) const Q_DECL_OVERRIDE;
6803
6804 // non-virtual methods:
6805 void updateScaledPixmap(QRect finalRect=QRect(), bool flipHorz=false, bool flipVert=false);
6806 QRect getFinalRect(bool *flippedHorz=nullptr, bool *flippedVert=nullptr) const;
6807 QPen mainPen() const;
6808};
6809
6810/* end of 'src/items/item-pixmap.h' */
6811
6812
6813/* including file 'src/items/item-tracer.h' */
6814/* modified 2021-03-29T02:30:44, size 4811 */
6815
6816class QCP_LIB_DECL QCPItemTracer : public QCPAbstractItem
6817{
6818 Q_OBJECT
6820 Q_PROPERTY(QPen pen READ pen WRITE setPen)
6821 Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
6822 Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
6823 Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
6824 Q_PROPERTY(double size READ size WRITE setSize)
6825 Q_PROPERTY(TracerStyle style READ style WRITE setStyle)
6826 Q_PROPERTY(QCPGraph* graph READ graph WRITE setGraph)
6827 Q_PROPERTY(double graphKey READ graphKey WRITE setGraphKey)
6828 Q_PROPERTY(bool interpolating READ interpolating WRITE setInterpolating)
6830public:
6842 Q_ENUMS(TracerStyle)
6843
6844 explicit QCPItemTracer(QCustomPlot *parentPlot);
6845 virtual ~QCPItemTracer() Q_DECL_OVERRIDE;
6846
6847 // getters:
6848 QPen pen() const { return mPen; }
6849 QPen selectedPen() const { return mSelectedPen; }
6850 QBrush brush() const { return mBrush; }
6851 QBrush selectedBrush() const { return mSelectedBrush; }
6852 double size() const { return mSize; }
6853 TracerStyle style() const { return mStyle; }
6854 QCPGraph *graph() const { return mGraph; }
6855 double graphKey() const { return mGraphKey; }
6856 bool interpolating() const { return mInterpolating; }
6857
6858 // setters;
6859 void setPen(const QPen &pen);
6860 void setSelectedPen(const QPen &pen);
6861 void setBrush(const QBrush &brush);
6862 void setSelectedBrush(const QBrush &brush);
6863 void setSize(double size);
6864 void setStyle(TracerStyle style);
6865 void setGraph(QCPGraph *graph);
6866 void setGraphKey(double key);
6867 void setInterpolating(bool enabled);
6868
6869 // reimplemented virtual methods:
6870 virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE;
6871
6872 // non-virtual methods:
6873 void updatePosition();
6874
6875 QCPItemPosition * const position;
6876
6877protected:
6878 // property members:
6879 QPen mPen, mSelectedPen;
6880 QBrush mBrush, mSelectedBrush;
6881 double mSize;
6882 TracerStyle mStyle;
6883 QCPGraph *mGraph;
6884 double mGraphKey;
6885 bool mInterpolating;
6886
6887 // reimplemented virtual methods:
6888 virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
6889
6890 // non-virtual methods:
6891 QPen mainPen() const;
6892 QBrush mainBrush() const;
6893};
6894Q_DECLARE_METATYPE(QCPItemTracer::TracerStyle)
6895
6896/* end of 'src/items/item-tracer.h' */
6897
6898
6899/* including file 'src/items/item-bracket.h' */
6900/* modified 2021-03-29T02:30:44, size 3991 */
6901
6902class QCP_LIB_DECL QCPItemBracket : public QCPAbstractItem
6903{
6904 Q_OBJECT
6906 Q_PROPERTY(QPen pen READ pen WRITE setPen)
6907 Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
6908 Q_PROPERTY(double length READ length WRITE setLength)
6909 Q_PROPERTY(BracketStyle style READ style WRITE setStyle)
6911public:
6923 Q_ENUMS(BracketStyle)
6924
6925 explicit QCPItemBracket(QCustomPlot *parentPlot);
6926 virtual ~QCPItemBracket() Q_DECL_OVERRIDE;
6927
6928 // getters:
6929 QPen pen() const { return mPen; }
6930 QPen selectedPen() const { return mSelectedPen; }
6931 double length() const { return mLength; }
6932 BracketStyle style() const { return mStyle; }
6933
6934 // setters;
6935 void setPen(const QPen &pen);
6936 void setSelectedPen(const QPen &pen);
6937 void setLength(double length);
6938 void setStyle(BracketStyle style);
6939
6940 // reimplemented virtual methods:
6941 virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE;
6942
6943 QCPItemPosition * const left;
6944 QCPItemPosition * const right;
6945 QCPItemAnchor * const center;
6946
6947protected:
6948 // property members:
6949 enum AnchorIndex {aiCenter};
6950 QPen mPen, mSelectedPen;
6951 double mLength;
6952 BracketStyle mStyle;
6953
6954 // reimplemented virtual methods:
6955 virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
6956 virtual QPointF anchorPixelPosition(int anchorId) const Q_DECL_OVERRIDE;
6957
6958 // non-virtual methods:
6959 QPen mainPen() const;
6960};
6961Q_DECLARE_METATYPE(QCPItemBracket::BracketStyle)
6962
6963/* end of 'src/items/item-bracket.h' */
6964
6965
6966/* including file 'src/polar/radialaxis.h' */
6967/* modified 2021-03-29T02:30:44, size 12227 */
6968
6969
6970class QCP_LIB_DECL QCPPolarAxisRadial : public QCPLayerable
6971{
6972 Q_OBJECT
6974
6976public:
6983 Q_ENUMS(AngleReference)
6991 Q_ENUMS(ScaleType)
6997 ,spAxis = 0x001
6999 ,spAxisLabel = 0x004
7000 };
7001 Q_ENUMS(SelectablePart)
7002 Q_FLAGS(SelectableParts)
7003 Q_DECLARE_FLAGS(SelectableParts, SelectablePart)
7004
7005 enum LabelMode { lmUpright
7006 ,lmRotated
7007 };
7008 Q_ENUMS(LabelMode)
7009
7010 explicit QCPPolarAxisRadial(QCPPolarAxisAngular *parent);
7011 virtual ~QCPPolarAxisRadial();
7012
7013 // getters:
7014 bool rangeDrag() const { return mRangeDrag; }
7015 bool rangeZoom() const { return mRangeZoom; }
7016 double rangeZoomFactor() const { return mRangeZoomFactor; }
7017
7018 QCPPolarAxisAngular *angularAxis() const { return mAngularAxis; }
7019 ScaleType scaleType() const { return mScaleType; }
7020 const QCPRange range() const { return mRange; }
7021 bool rangeReversed() const { return mRangeReversed; }
7022 double angle() const { return mAngle; }
7023 AngleReference angleReference() const { return mAngleReference; }
7024 QSharedPointer<QCPAxisTicker> ticker() const { return mTicker; }
7025 bool ticks() const { return mTicks; }
7026 bool tickLabels() const { return mTickLabels; }
7027 int tickLabelPadding() const { return mLabelPainter.padding(); }
7028 QFont tickLabelFont() const { return mTickLabelFont; }
7029 QColor tickLabelColor() const { return mTickLabelColor; }
7030 double tickLabelRotation() const { return mLabelPainter.rotation(); }
7031 LabelMode tickLabelMode() const;
7032 QString numberFormat() const;
7033 int numberPrecision() const { return mNumberPrecision; }
7034 QVector<double> tickVector() const { return mTickVector; }
7035 QVector<double> subTickVector() const { return mSubTickVector; }
7036 QVector<QString> tickVectorLabels() const { return mTickVectorLabels; }
7037 int tickLengthIn() const;
7038 int tickLengthOut() const;
7039 bool subTicks() const { return mSubTicks; }
7040 int subTickLengthIn() const;
7041 int subTickLengthOut() const;
7042 QPen basePen() const { return mBasePen; }
7043 QPen tickPen() const { return mTickPen; }
7044 QPen subTickPen() const { return mSubTickPen; }
7045 QFont labelFont() const { return mLabelFont; }
7046 QColor labelColor() const { return mLabelColor; }
7047 QString label() const { return mLabel; }
7048 int labelPadding() const;
7049 SelectableParts selectedParts() const { return mSelectedParts; }
7050 SelectableParts selectableParts() const { return mSelectableParts; }
7051 QFont selectedTickLabelFont() const { return mSelectedTickLabelFont; }
7052 QFont selectedLabelFont() const { return mSelectedLabelFont; }
7053 QColor selectedTickLabelColor() const { return mSelectedTickLabelColor; }
7054 QColor selectedLabelColor() const { return mSelectedLabelColor; }
7055 QPen selectedBasePen() const { return mSelectedBasePen; }
7056 QPen selectedTickPen() const { return mSelectedTickPen; }
7057 QPen selectedSubTickPen() const { return mSelectedSubTickPen; }
7058
7059 // setters:
7060 void setRangeDrag(bool enabled);
7061 void setRangeZoom(bool enabled);
7062 void setRangeZoomFactor(double factor);
7063
7064 Q_SLOT void setScaleType(QCPPolarAxisRadial::ScaleType type);
7065 Q_SLOT void setRange(const QCPRange &range);
7066 void setRange(double lower, double upper);
7067 void setRange(double position, double size, Qt::AlignmentFlag alignment);
7068 void setRangeLower(double lower);
7069 void setRangeUpper(double upper);
7070 void setRangeReversed(bool reversed);
7071 void setAngle(double degrees);
7072 void setAngleReference(AngleReference reference);
7073 void setTicker(QSharedPointer<QCPAxisTicker> ticker);
7074 void setTicks(bool show);
7075 void setTickLabels(bool show);
7076 void setTickLabelPadding(int padding);
7077 void setTickLabelFont(const QFont &font);
7078 void setTickLabelColor(const QColor &color);
7079 void setTickLabelRotation(double degrees);
7080 void setTickLabelMode(LabelMode mode);
7081 void setNumberFormat(const QString &formatCode);
7082 void setNumberPrecision(int precision);
7083 void setTickLength(int inside, int outside=0);
7084 void setTickLengthIn(int inside);
7085 void setTickLengthOut(int outside);
7086 void setSubTicks(bool show);
7087 void setSubTickLength(int inside, int outside=0);
7088 void setSubTickLengthIn(int inside);
7089 void setSubTickLengthOut(int outside);
7090 void setBasePen(const QPen &pen);
7091 void setTickPen(const QPen &pen);
7092 void setSubTickPen(const QPen &pen);
7093 void setLabelFont(const QFont &font);
7094 void setLabelColor(const QColor &color);
7095 void setLabel(const QString &str);
7096 void setLabelPadding(int padding);
7097 void setSelectedTickLabelFont(const QFont &font);
7098 void setSelectedLabelFont(const QFont &font);
7099 void setSelectedTickLabelColor(const QColor &color);
7100 void setSelectedLabelColor(const QColor &color);
7101 void setSelectedBasePen(const QPen &pen);
7102 void setSelectedTickPen(const QPen &pen);
7103 void setSelectedSubTickPen(const QPen &pen);
7104 Q_SLOT void setSelectableParts(const QCPPolarAxisRadial::SelectableParts &selectableParts);
7105 Q_SLOT void setSelectedParts(const QCPPolarAxisRadial::SelectableParts &selectedParts);
7106
7107 // reimplemented virtual methods:
7108 virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const Q_DECL_OVERRIDE;
7109
7110 // non-property methods:
7111 void moveRange(double diff);
7112 void scaleRange(double factor);
7113 void scaleRange(double factor, double center);
7114 void rescale(bool onlyVisiblePlottables=false);
7115 void pixelToCoord(QPointF pixelPos, double &angleCoord, double &radiusCoord) const;
7116 QPointF coordToPixel(double angleCoord, double radiusCoord) const;
7117 double coordToRadius(double coord) const;
7118 double radiusToCoord(double radius) const;
7119 SelectablePart getPartAt(const QPointF &pos) const;
7120
7121signals:
7122 void rangeChanged(const QCPRange &newRange);
7123 void rangeChanged(const QCPRange &newRange, const QCPRange &oldRange);
7125 void selectionChanged(const QCPPolarAxisRadial::SelectableParts &parts);
7126 void selectableChanged(const QCPPolarAxisRadial::SelectableParts &parts);
7127
7128protected:
7129 // property members:
7130 bool mRangeDrag;
7131 bool mRangeZoom;
7132 double mRangeZoomFactor;
7133
7134 // axis base:
7135 QCPPolarAxisAngular *mAngularAxis;
7136 double mAngle;
7137 AngleReference mAngleReference;
7138 SelectableParts mSelectableParts, mSelectedParts;
7139 QPen mBasePen, mSelectedBasePen;
7140 // axis label:
7141 int mLabelPadding;
7142 QString mLabel;
7143 QFont mLabelFont, mSelectedLabelFont;
7144 QColor mLabelColor, mSelectedLabelColor;
7145 // tick labels:
7146 //int mTickLabelPadding; in label painter
7147 bool mTickLabels;
7148 //double mTickLabelRotation; in label painter
7149 QFont mTickLabelFont, mSelectedTickLabelFont;
7150 QColor mTickLabelColor, mSelectedTickLabelColor;
7151 int mNumberPrecision;
7152 QLatin1Char mNumberFormatChar;
7153 bool mNumberBeautifulPowers;
7154 bool mNumberMultiplyCross;
7155 // ticks and subticks:
7156 bool mTicks;
7157 bool mSubTicks;
7158 int mTickLengthIn, mTickLengthOut, mSubTickLengthIn, mSubTickLengthOut;
7159 QPen mTickPen, mSelectedTickPen;
7160 QPen mSubTickPen, mSelectedSubTickPen;
7161 // scale and range:
7162 QCPRange mRange;
7163 bool mRangeReversed;
7164 ScaleType mScaleType;
7165
7166 // non-property members:
7167 QPointF mCenter;
7168 double mRadius;
7169 QSharedPointer<QCPAxisTicker> mTicker;
7170 QVector<double> mTickVector;
7171 QVector<QString> mTickVectorLabels;
7172 QVector<double> mSubTickVector;
7173 bool mDragging;
7174 QCPRange mDragStartRange;
7175 QCP::AntialiasedElements mAADragBackup, mNotAADragBackup;
7176 QCPLabelPainterPrivate mLabelPainter;
7177
7178 // reimplemented virtual methods:
7179 virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const Q_DECL_OVERRIDE;
7180 virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
7181 virtual QCP::Interaction selectionCategory() const Q_DECL_OVERRIDE;
7182 // events:
7183 virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) Q_DECL_OVERRIDE;
7184 virtual void deselectEvent(bool *selectionStateChanged) Q_DECL_OVERRIDE;
7185 // mouse events:
7186 virtual void mousePressEvent(QMouseEvent *event, const QVariant &details) Q_DECL_OVERRIDE;
7187 virtual void mouseMoveEvent(QMouseEvent *event, const QPointF &startPos) Q_DECL_OVERRIDE;
7188 virtual void mouseReleaseEvent(QMouseEvent *event, const QPointF &startPos) Q_DECL_OVERRIDE;
7189 virtual void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE;
7190
7191 // non-virtual methods:
7192 void updateGeometry(const QPointF &center, double radius);
7193 void setupTickVectors();
7194 QPen getBasePen() const;
7195 QPen getTickPen() const;
7196 QPen getSubTickPen() const;
7197 QFont getTickLabelFont() const;
7198 QFont getLabelFont() const;
7199 QColor getTickLabelColor() const;
7200 QColor getLabelColor() const;
7201
7202private:
7203 Q_DISABLE_COPY(QCPPolarAxisRadial)
7204
7205 friend class QCustomPlot;
7206 friend class QCPPolarAxisAngular;
7207};
7208Q_DECLARE_OPERATORS_FOR_FLAGS(QCPPolarAxisRadial::SelectableParts)
7209Q_DECLARE_METATYPE(QCPPolarAxisRadial::AngleReference)
7210Q_DECLARE_METATYPE(QCPPolarAxisRadial::ScaleType)
7211Q_DECLARE_METATYPE(QCPPolarAxisRadial::SelectablePart)
7212
7213
7214
7215/* end of 'src/polar/radialaxis.h' */
7216
7217
7218/* including file 'src/polar/layoutelement-angularaxis.h' */
7219/* modified 2021-03-29T02:30:44, size 13461 */
7220
7221class QCP_LIB_DECL QCPPolarAxisAngular : public QCPLayoutElement
7222{
7223 Q_OBJECT
7225
7227public:
7233 ,spAxis = 0x001
7235 ,spAxisLabel = 0x004
7236 };
7237 Q_ENUMS(SelectablePart)
7238 Q_FLAGS(SelectableParts)
7239 Q_DECLARE_FLAGS(SelectableParts, SelectablePart)
7240
7241
7244 enum LabelMode { lmUpright
7245 ,lmRotated
7246 };
7247 Q_ENUMS(LabelMode)
7248
7249 explicit QCPPolarAxisAngular(QCustomPlot *parentPlot);
7250 virtual ~QCPPolarAxisAngular();
7251
7252 // getters:
7253 QPixmap background() const { return mBackgroundPixmap; }
7254 QBrush backgroundBrush() const { return mBackgroundBrush; }
7255 bool backgroundScaled() const { return mBackgroundScaled; }
7256 Qt::AspectRatioMode backgroundScaledMode() const { return mBackgroundScaledMode; }
7257 bool rangeDrag() const { return mRangeDrag; }
7258 bool rangeZoom() const { return mRangeZoom; }
7259 double rangeZoomFactor() const { return mRangeZoomFactor; }
7260
7261 const QCPRange range() const { return mRange; }
7262 bool rangeReversed() const { return mRangeReversed; }
7263 double angle() const { return mAngle; }
7264 QSharedPointer<QCPAxisTicker> ticker() const { return mTicker; }
7265 bool ticks() const { return mTicks; }
7266 bool tickLabels() const { return mTickLabels; }
7267 int tickLabelPadding() const { return mLabelPainter.padding(); }
7268 QFont tickLabelFont() const { return mTickLabelFont; }
7269 QColor tickLabelColor() const { return mTickLabelColor; }
7270 double tickLabelRotation() const { return mLabelPainter.rotation(); }
7271 LabelMode tickLabelMode() const;
7272 QString numberFormat() const;
7273 int numberPrecision() const { return mNumberPrecision; }
7274 QVector<double> tickVector() const { return mTickVector; }
7275 QVector<QString> tickVectorLabels() const { return mTickVectorLabels; }
7276 int tickLengthIn() const { return mTickLengthIn; }
7277 int tickLengthOut() const { return mTickLengthOut; }
7278 bool subTicks() const { return mSubTicks; }
7279 int subTickLengthIn() const { return mSubTickLengthIn; }
7280 int subTickLengthOut() const { return mSubTickLengthOut; }
7281 QPen basePen() const { return mBasePen; }
7282 QPen tickPen() const { return mTickPen; }
7283 QPen subTickPen() const { return mSubTickPen; }
7284 QFont labelFont() const { return mLabelFont; }
7285 QColor labelColor() const { return mLabelColor; }
7286 QString label() const { return mLabel; }
7287 int labelPadding() const { return mLabelPadding; }
7288 SelectableParts selectedParts() const { return mSelectedParts; }
7289 SelectableParts selectableParts() const { return mSelectableParts; }
7290 QFont selectedTickLabelFont() const { return mSelectedTickLabelFont; }
7291 QFont selectedLabelFont() const { return mSelectedLabelFont; }
7292 QColor selectedTickLabelColor() const { return mSelectedTickLabelColor; }
7293 QColor selectedLabelColor() const { return mSelectedLabelColor; }
7294 QPen selectedBasePen() const { return mSelectedBasePen; }
7295 QPen selectedTickPen() const { return mSelectedTickPen; }
7296 QPen selectedSubTickPen() const { return mSelectedSubTickPen; }
7297 QCPPolarGrid *grid() const { return mGrid; }
7298
7299 // setters:
7300 void setBackground(const QPixmap &pm);
7301 void setBackground(const QPixmap &pm, bool scaled, Qt::AspectRatioMode mode=Qt::KeepAspectRatioByExpanding);
7302 void setBackground(const QBrush &brush);
7303 void setBackgroundScaled(bool scaled);
7304 void setBackgroundScaledMode(Qt::AspectRatioMode mode);
7305 void setRangeDrag(bool enabled);
7306 void setRangeZoom(bool enabled);
7307 void setRangeZoomFactor(double factor);
7308
7309 Q_SLOT void setRange(const QCPRange &range);
7310 void setRange(double lower, double upper);
7311 void setRange(double position, double size, Qt::AlignmentFlag alignment);
7312 void setRangeLower(double lower);
7313 void setRangeUpper(double upper);
7314 void setRangeReversed(bool reversed);
7315 void setAngle(double degrees);
7316 void setTicker(QSharedPointer<QCPAxisTicker> ticker);
7317 void setTicks(bool show);
7318 void setTickLabels(bool show);
7319 void setTickLabelPadding(int padding);
7320 void setTickLabelFont(const QFont &font);
7321 void setTickLabelColor(const QColor &color);
7322 void setTickLabelRotation(double degrees);
7323 void setTickLabelMode(LabelMode mode);
7324 void setNumberFormat(const QString &formatCode);
7325 void setNumberPrecision(int precision);
7326 void setTickLength(int inside, int outside=0);
7327 void setTickLengthIn(int inside);
7328 void setTickLengthOut(int outside);
7329 void setSubTicks(bool show);
7330 void setSubTickLength(int inside, int outside=0);
7331 void setSubTickLengthIn(int inside);
7332 void setSubTickLengthOut(int outside);
7333 void setBasePen(const QPen &pen);
7334 void setTickPen(const QPen &pen);
7335 void setSubTickPen(const QPen &pen);
7336 void setLabelFont(const QFont &font);
7337 void setLabelColor(const QColor &color);
7338 void setLabel(const QString &str);
7339 void setLabelPadding(int padding);
7340 void setLabelPosition(Qt::AlignmentFlag position);
7341 void setSelectedTickLabelFont(const QFont &font);
7342 void setSelectedLabelFont(const QFont &font);
7343 void setSelectedTickLabelColor(const QColor &color);
7344 void setSelectedLabelColor(const QColor &color);
7345 void setSelectedBasePen(const QPen &pen);
7346 void setSelectedTickPen(const QPen &pen);
7347 void setSelectedSubTickPen(const QPen &pen);
7348 Q_SLOT void setSelectableParts(const QCPPolarAxisAngular::SelectableParts &selectableParts);
7349 Q_SLOT void setSelectedParts(const QCPPolarAxisAngular::SelectableParts &selectedParts);
7350
7351 // reimplemented virtual methods:
7352 virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const Q_DECL_OVERRIDE;
7353 virtual void update(UpdatePhase phase) Q_DECL_OVERRIDE;
7354 virtual QList<QCPLayoutElement*> elements(bool recursive) const Q_DECL_OVERRIDE;
7355
7356 // non-property methods:
7357 bool removeGraph(QCPPolarGraph *graph);
7358 int radialAxisCount() const;
7359 QCPPolarAxisRadial *radialAxis(int index=0) const;
7360 QList<QCPPolarAxisRadial*> radialAxes() const;
7361 QCPPolarAxisRadial *addRadialAxis(QCPPolarAxisRadial *axis=0);
7362 bool removeRadialAxis(QCPPolarAxisRadial *axis);
7363 QCPLayoutInset *insetLayout() const { return mInsetLayout; }
7364 QRegion exactClipRegion() const;
7365
7366 void moveRange(double diff);
7367 void scaleRange(double factor);
7368 void scaleRange(double factor, double center);
7369 void rescale(bool onlyVisiblePlottables=false);
7370 double coordToAngleRad(double coord) const { return mAngleRad+(coord-mRange.lower)/mRange.size()*(mRangeReversed ? -2.0*M_PI : 2.0*M_PI); } // mention in doc that return doesn't wrap
7371 double angleRadToCoord(double angleRad) const { return mRange.lower+(angleRad-mAngleRad)/(mRangeReversed ? -2.0*M_PI : 2.0*M_PI)*mRange.size(); }
7372 void pixelToCoord(QPointF pixelPos, double &angleCoord, double &radiusCoord) const;
7373 QPointF coordToPixel(double angleCoord, double radiusCoord) const;
7374 SelectablePart getPartAt(const QPointF &pos) const;
7375
7376 // read-only interface imitating a QRect:
7377 int left() const { return mRect.left(); }
7378 int right() const { return mRect.right(); }
7379 int top() const { return mRect.top(); }
7380 int bottom() const { return mRect.bottom(); }
7381 int width() const { return mRect.width(); }
7382 int height() const { return mRect.height(); }
7383 QSize size() const { return mRect.size(); }
7384 QPoint topLeft() const { return mRect.topLeft(); }
7385 QPoint topRight() const { return mRect.topRight(); }
7386 QPoint bottomLeft() const { return mRect.bottomLeft(); }
7387 QPoint bottomRight() const { return mRect.bottomRight(); }
7388 QPointF center() const { return mCenter; }
7389 double radius() const { return mRadius; }
7390
7391signals:
7392 void rangeChanged(const QCPRange &newRange);
7393 void rangeChanged(const QCPRange &newRange, const QCPRange &oldRange);
7394 void selectionChanged(const QCPPolarAxisAngular::SelectableParts &parts);
7395 void selectableChanged(const QCPPolarAxisAngular::SelectableParts &parts);
7396
7397protected:
7398 // property members:
7399 QBrush mBackgroundBrush;
7400 QPixmap mBackgroundPixmap;
7401 QPixmap mScaledBackgroundPixmap;
7402 bool mBackgroundScaled;
7403 Qt::AspectRatioMode mBackgroundScaledMode;
7404 QCPLayoutInset *mInsetLayout;
7405 bool mRangeDrag;
7406 bool mRangeZoom;
7407 double mRangeZoomFactor;
7408
7409 // axis base:
7410 double mAngle, mAngleRad;
7411 SelectableParts mSelectableParts, mSelectedParts;
7412 QPen mBasePen, mSelectedBasePen;
7413 // axis label:
7414 int mLabelPadding;
7415 QString mLabel;
7416 QFont mLabelFont, mSelectedLabelFont;
7417 QColor mLabelColor, mSelectedLabelColor;
7418 // tick labels:
7419 //int mTickLabelPadding; in label painter
7420 bool mTickLabels;
7421 //double mTickLabelRotation; in label painter
7422 QFont mTickLabelFont, mSelectedTickLabelFont;
7423 QColor mTickLabelColor, mSelectedTickLabelColor;
7424 int mNumberPrecision;
7425 QLatin1Char mNumberFormatChar;
7426 bool mNumberBeautifulPowers;
7427 bool mNumberMultiplyCross;
7428 // ticks and subticks:
7429 bool mTicks;
7430 bool mSubTicks;
7431 int mTickLengthIn, mTickLengthOut, mSubTickLengthIn, mSubTickLengthOut;
7432 QPen mTickPen, mSelectedTickPen;
7433 QPen mSubTickPen, mSelectedSubTickPen;
7434 // scale and range:
7435 QCPRange mRange;
7436 bool mRangeReversed;
7437
7438 // non-property members:
7439 QPointF mCenter;
7440 double mRadius;
7441 QList<QCPPolarAxisRadial*> mRadialAxes;
7442 QCPPolarGrid *mGrid;
7443 QList<QCPPolarGraph*> mGraphs;
7444 QSharedPointer<QCPAxisTicker> mTicker;
7445 QVector<double> mTickVector;
7446 QVector<QString> mTickVectorLabels;
7447 QVector<QPointF> mTickVectorCosSin;
7448 QVector<double> mSubTickVector;
7449 QVector<QPointF> mSubTickVectorCosSin;
7450 bool mDragging;
7451 QCPRange mDragAngularStart;
7452 QList<QCPRange> mDragRadialStart;
7453 QCP::AntialiasedElements mAADragBackup, mNotAADragBackup;
7454 QCPLabelPainterPrivate mLabelPainter;
7455
7456 // reimplemented virtual methods:
7457 virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const Q_DECL_OVERRIDE;
7458 virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
7459 virtual QCP::Interaction selectionCategory() const Q_DECL_OVERRIDE;
7460 // events:
7461 virtual void mousePressEvent(QMouseEvent *event, const QVariant &details) Q_DECL_OVERRIDE;
7462 virtual void mouseMoveEvent(QMouseEvent *event, const QPointF &startPos) Q_DECL_OVERRIDE;
7463 virtual void mouseReleaseEvent(QMouseEvent *event, const QPointF &startPos) Q_DECL_OVERRIDE;
7464 virtual void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE;
7465
7466 // non-virtual methods:
7467 bool registerPolarGraph(QCPPolarGraph *graph);
7468 void drawBackground(QCPPainter *painter, const QPointF &center, double radius);
7469 void setupTickVectors();
7470 QPen getBasePen() const;
7471 QPen getTickPen() const;
7472 QPen getSubTickPen() const;
7473 QFont getTickLabelFont() const;
7474 QFont getLabelFont() const;
7475 QColor getTickLabelColor() const;
7476 QColor getLabelColor() const;
7477
7478private:
7479 Q_DISABLE_COPY(QCPPolarAxisAngular)
7480
7481 friend class QCustomPlot;
7482 friend class QCPPolarGrid;
7483 friend class QCPPolarGraph;
7484};
7485Q_DECLARE_OPERATORS_FOR_FLAGS(QCPPolarAxisAngular::SelectableParts)
7486Q_DECLARE_METATYPE(QCPPolarAxisAngular::SelectablePart)
7487
7488/* end of 'src/polar/layoutelement-angularaxis.h' */
7489
7490
7491/* including file 'src/polar/polargrid.h' */
7492/* modified 2021-03-29T02:30:44, size 4506 */
7493
7494class QCP_LIB_DECL QCPPolarGrid :public QCPLayerable
7495{
7496 Q_OBJECT
7498
7500public:
7504 enum GridType { gtAngular = 0x01
7505 ,gtRadial = 0x02
7506 ,gtAll = 0xFF
7507 ,gtNone = 0x00
7508 };
7509 Q_ENUMS(GridType)
7510 Q_FLAGS(GridTypes)
7511 Q_DECLARE_FLAGS(GridTypes, GridType)
7512
7513 explicit QCPPolarGrid(QCPPolarAxisAngular *parentAxis);
7514
7515 // getters:
7516 QCPPolarAxisRadial *radialAxis() const { return mRadialAxis.data(); }
7517 GridTypes type() const { return mType; }
7518 GridTypes subGridType() const { return mSubGridType; }
7519 bool antialiasedSubGrid() const { return mAntialiasedSubGrid; }
7520 bool antialiasedZeroLine() const { return mAntialiasedZeroLine; }
7521 QPen angularPen() const { return mAngularPen; }
7522 QPen angularSubGridPen() const { return mAngularSubGridPen; }
7523 QPen radialPen() const { return mRadialPen; }
7524 QPen radialSubGridPen() const { return mRadialSubGridPen; }
7525 QPen radialZeroLinePen() const { return mRadialZeroLinePen; }
7526
7527 // setters:
7528 void setRadialAxis(QCPPolarAxisRadial *axis);
7529 void setType(GridTypes type);
7530 void setSubGridType(GridTypes type);
7531 void setAntialiasedSubGrid(bool enabled);
7532 void setAntialiasedZeroLine(bool enabled);
7533 void setAngularPen(const QPen &pen);
7534 void setAngularSubGridPen(const QPen &pen);
7535 void setRadialPen(const QPen &pen);
7536 void setRadialSubGridPen(const QPen &pen);
7537 void setRadialZeroLinePen(const QPen &pen);
7538
7539protected:
7540 // property members:
7541 GridTypes mType;
7542 GridTypes mSubGridType;
7543 bool mAntialiasedSubGrid, mAntialiasedZeroLine;
7544 QPen mAngularPen, mAngularSubGridPen;
7545 QPen mRadialPen, mRadialSubGridPen, mRadialZeroLinePen;
7546
7547 // non-property members:
7548 QCPPolarAxisAngular *mParentAxis;
7549 QPointer<QCPPolarAxisRadial> mRadialAxis;
7550
7551 // reimplemented virtual methods:
7552 virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const Q_DECL_OVERRIDE;
7553 virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
7554
7555 // non-virtual methods:
7556 void drawRadialGrid(QCPPainter *painter, const QPointF &center, const QVector<double> &coords, const QPen &pen, const QPen &zeroPen=Qt::NoPen);
7557 void drawAngularGrid(QCPPainter *painter, const QPointF &center, double radius, const QVector<QPointF> &ticksCosSin, const QPen &pen);
7558
7559private:
7560 Q_DISABLE_COPY(QCPPolarGrid)
7561
7562};
7563
7564Q_DECLARE_OPERATORS_FOR_FLAGS(QCPPolarGrid::GridTypes)
7565Q_DECLARE_METATYPE(QCPPolarGrid::GridType)
7566
7567
7568/* end of 'src/polar/polargrid.h' */
7569
7570
7571/* including file 'src/polar/polargraph.h' */
7572/* modified 2021-03-29T02:30:44, size 9606 */
7573
7574
7575class QCP_LIB_DECL QCPPolarLegendItem : public QCPAbstractLegendItem
7576{
7577 Q_OBJECT
7578public:
7579 QCPPolarLegendItem(QCPLegend *parent, QCPPolarGraph *graph);
7580
7581 // getters:
7582 QCPPolarGraph *polarGraph() { return mPolarGraph; }
7583
7584protected:
7585 // property members:
7586 QCPPolarGraph *mPolarGraph;
7587
7588 // reimplemented virtual methods:
7589 virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
7590 virtual QSize minimumOuterSizeHint() const Q_DECL_OVERRIDE;
7591
7592 // non-virtual methods:
7593 QPen getIconBorderPen() const;
7594 QColor getTextColor() const;
7595 QFont getFont() const;
7596};
7597
7598
7599class QCP_LIB_DECL QCPPolarGraph : public QCPLayerable
7600{
7601 Q_OBJECT
7603
7605public:
7615 Q_ENUMS(LineStyle)
7616
7618 virtual ~QCPPolarGraph();
7619
7620 // getters:
7621 QString name() const { return mName; }
7622 bool antialiasedFill() const { return mAntialiasedFill; }
7623 bool antialiasedScatters() const { return mAntialiasedScatters; }
7624 QPen pen() const { return mPen; }
7625 QBrush brush() const { return mBrush; }
7626 bool periodic() const { return mPeriodic; }
7627 QCPPolarAxisAngular *keyAxis() const { return mKeyAxis.data(); }
7628 QCPPolarAxisRadial *valueAxis() const { return mValueAxis.data(); }
7629 QCP::SelectionType selectable() const { return mSelectable; }
7630 bool selected() const { return !mSelection.isEmpty(); }
7631 QCPDataSelection selection() const { return mSelection; }
7632 //QCPSelectionDecorator *selectionDecorator() const { return mSelectionDecorator; }
7633 QSharedPointer<QCPGraphDataContainer> data() const { return mDataContainer; }
7634 LineStyle lineStyle() const { return mLineStyle; }
7635 QCPScatterStyle scatterStyle() const { return mScatterStyle; }
7636
7637 // setters:
7638 void setName(const QString &name);
7639 void setAntialiasedFill(bool enabled);
7640 void setAntialiasedScatters(bool enabled);
7641 void setPen(const QPen &pen);
7642 void setBrush(const QBrush &brush);
7643 void setPeriodic(bool enabled);
7644 void setKeyAxis(QCPPolarAxisAngular *axis);
7645 void setValueAxis(QCPPolarAxisRadial *axis);
7646 Q_SLOT void setSelectable(QCP::SelectionType selectable);
7647 Q_SLOT void setSelection(QCPDataSelection selection);
7648 //void setSelectionDecorator(QCPSelectionDecorator *decorator);
7649 void setData(QSharedPointer<QCPGraphDataContainer> data);
7650 void setData(const QVector<double> &keys, const QVector<double> &values, bool alreadySorted=false);
7651 void setLineStyle(LineStyle ls);
7652 void setScatterStyle(const QCPScatterStyle &style);
7653
7654 // non-property methods:
7655 void addData(const QVector<double> &keys, const QVector<double> &values, bool alreadySorted=false);
7656 void addData(double key, double value);
7657 void coordsToPixels(double key, double value, double &x, double &y) const;
7658 const QPointF coordsToPixels(double key, double value) const;
7659 void pixelsToCoords(double x, double y, double &key, double &value) const;
7660 void pixelsToCoords(const QPointF &pixelPos, double &key, double &value) const;
7661 void rescaleAxes(bool onlyEnlarge=false) const;
7662 void rescaleKeyAxis(bool onlyEnlarge=false) const;
7663 void rescaleValueAxis(bool onlyEnlarge=false, bool inKeyRange=false) const;
7664 bool addToLegend(QCPLegend *legend);
7665 bool addToLegend();
7666 bool removeFromLegend(QCPLegend *legend) const;
7667 bool removeFromLegend() const;
7668
7669 // introduced virtual methods:
7670 virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const; // actually introduced in QCPLayerable as non-pure, but we want to force reimplementation for plottables
7671 virtual QCPPlottableInterface1D *interface1D() { return 0; } // TODO: return this later, when QCPAbstractPolarPlottable is created
7672 virtual QCPRange getKeyRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth) const;
7673 virtual QCPRange getValueRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth, const QCPRange &inKeyRange=QCPRange()) const;
7674
7675signals:
7676 void selectionChanged(bool selected);
7677 void selectionChanged(const QCPDataSelection &selection);
7678 void selectableChanged(QCP::SelectionType selectable);
7679
7680protected:
7681 // property members:
7682 QSharedPointer<QCPGraphDataContainer> mDataContainer;
7683 LineStyle mLineStyle;
7684 QCPScatterStyle mScatterStyle;
7685 QString mName;
7686 bool mAntialiasedFill, mAntialiasedScatters;
7687 QPen mPen;
7688 QBrush mBrush;
7689 bool mPeriodic;
7690 QPointer<QCPPolarAxisAngular> mKeyAxis;
7691 QPointer<QCPPolarAxisRadial> mValueAxis;
7692 QCP::SelectionType mSelectable;
7693 QCPDataSelection mSelection;
7694 //QCPSelectionDecorator *mSelectionDecorator;
7695
7696 // introduced virtual methods (later reimplemented TODO from QCPAbstractPolarPlottable):
7697 virtual QRect clipRect() const;
7698 virtual void draw(QCPPainter *painter);
7699 virtual QCP::Interaction selectionCategory() const;
7700 void applyDefaultAntialiasingHint(QCPPainter *painter) const;
7701 // events:
7702 virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged);
7703 virtual void deselectEvent(bool *selectionStateChanged);
7704 // virtual drawing helpers:
7705 virtual void drawLinePlot(QCPPainter *painter, const QVector<QPointF> &lines) const;
7706 virtual void drawFill(QCPPainter *painter, QVector<QPointF> *lines) const;
7707 virtual void drawScatterPlot(QCPPainter *painter, const QVector<QPointF> &scatters, const QCPScatterStyle &style) const;
7708
7709 // introduced virtual methods:
7710 virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const;
7711
7712 // non-virtual methods:
7713 void applyFillAntialiasingHint(QCPPainter *painter) const;
7714 void applyScattersAntialiasingHint(QCPPainter *painter) const;
7715 double pointDistance(const QPointF &pixelPoint, QCPGraphDataContainer::const_iterator &closestData) const;
7716 // drawing helpers:
7717 virtual int dataCount() const;
7718 void getDataSegments(QList<QCPDataRange> &selectedSegments, QList<QCPDataRange> &unselectedSegments) const;
7719 void drawPolyline(QCPPainter *painter, const QVector<QPointF> &lineData) const;
7720 void getVisibleDataBounds(QCPGraphDataContainer::const_iterator &begin, QCPGraphDataContainer::const_iterator &end, const QCPDataRange &rangeRestriction) const;
7721 void getLines(QVector<QPointF> *lines, const QCPDataRange &dataRange) const;
7722 void getScatters(QVector<QPointF> *scatters, const QCPDataRange &dataRange) const;
7723 void getOptimizedLineData(QVector<QCPGraphData> *lineData, const QCPGraphDataContainer::const_iterator &begin, const QCPGraphDataContainer::const_iterator &end) const;
7724 void getOptimizedScatterData(QVector<QCPGraphData> *scatterData, QCPGraphDataContainer::const_iterator begin, QCPGraphDataContainer::const_iterator end) const;
7725 QVector<QPointF> dataToLines(const QVector<QCPGraphData> &data) const;
7726
7727private:
7728 Q_DISABLE_COPY(QCPPolarGraph)
7729
7730 friend class QCPPolarLegendItem;
7731};
7732
7733/* end of 'src/polar/polargraph.h' */
7734
7735
7736#endif // QCUSTOMPLOT_H
7737
#define M_PI
PI value macro.
Definition angle_deg.cpp:43
bool operator==(const rcsc::AngleDeg &lhs, const rcsc::AngleDeg &rhs)
predicate operator ==
Definition angle_deg.h:743
std::ostream & operator<<(std::ostream &os, const rcsc::AngleDeg &a)
output to ostream
Definition angle_deg.h:789
bool operator!=(const rcsc::AngleDeg &lhs, const rcsc::AngleDeg &rhs)
predicate operator !=
Definition angle_deg.h:698
The abstract base class for all items in a plot.
Definition qcustomplot.h:3677
Q_SLOT void setSelected(bool selected)
Definition qcustomplot.cpp:13013
void setClipToAxisRect(bool clip)
Definition qcustomplot.cpp:12961
QList< QCPItemPosition * > positions() const
Definition qcustomplot.h:3705
void setClipAxisRect(QCPAxisRect *rect)
Definition qcustomplot.cpp:12974
QList< QCPItemAnchor * > anchors() const
Definition qcustomplot.h:3706
Q_SLOT void setSelectable(bool selectable)
Definition qcustomplot.cpp:12990
QCPAbstractItem(QCustomPlot *parentPlot)
Definition qcustomplot.cpp:12927
void selectionChanged(bool selected)
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE=0
The abstract base class for all entries in a QCPLegend.
Definition qcustomplot.h:5014
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE
Definition qcustomplot.cpp:18821
void setFont(const QFont &font)
Definition qcustomplot.cpp:18752
void setSelectedTextColor(const QColor &color)
Definition qcustomplot.cpp:18784
void setTextColor(const QColor &color)
Definition qcustomplot.cpp:18762
Q_SLOT void setSelected(bool selected)
Definition qcustomplot.cpp:18811
void selectionChanged(bool selected)
void setSelectedFont(const QFont &font)
Definition qcustomplot.cpp:18773
Q_SLOT void setSelectable(bool selectable)
Definition qcustomplot.cpp:18794
QCPAbstractLegendItem(QCPLegend *parent)
Definition qcustomplot.cpp:18733
The abstract base class for paint buffers, which define the rendering backend.
Definition qcustomplot.h:540
virtual void draw(QCPPainter *painter) const =0
QCPAbstractPaintBuffer(const QSize &size, double devicePixelRatio)
Definition qcustomplot.cpp:581
void setDevicePixelRatio(double ratio)
Definition qcustomplot.cpp:638
virtual void clear(const QColor &color)=0
void setSize(const QSize &size)
Definition qcustomplot.cpp:600
virtual void donePainting()
Definition qcustomplot.h:557
virtual void reallocateBuffer()=0
virtual QCPPainter * startPainting()=0
void setInvalidated(bool invalidated=true)
Definition qcustomplot.cpp:624
virtual QCPDataSelection selectTestRect(const QRectF &rect, bool onlySelectable) const Q_DECL_OVERRIDE
Definition qcustomplot.h:4485
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE
Definition qcustomplot.h:4559
QCPAbstractPlottable1D(QCPAxis *keyAxis, QCPAxis *valueAxis)
Definition qcustomplot.h:4367
virtual QCPRange dataValueRange(int index) const Q_DECL_OVERRIDE
Definition qcustomplot.h:4439
virtual double dataMainValue(int index) const Q_DECL_OVERRIDE
Definition qcustomplot.h:4423
virtual QPointF dataPixelPosition(int index) const Q_DECL_OVERRIDE
Definition qcustomplot.h:4455
virtual int findEnd(double sortKey, bool expandedRange=true) const Q_DECL_OVERRIDE
Definition qcustomplot.h:4543
void drawPolyline(QCPPainter *painter, const QVector< QPointF > &lineData) const
Definition qcustomplot.h:4651
virtual double dataSortKey(int index) const Q_DECL_OVERRIDE
Definition qcustomplot.h:4407
virtual int dataCount() const Q_DECL_OVERRIDE
Definition qcustomplot.h:4382
virtual QCPPlottableInterface1D * interface1D() Q_DECL_OVERRIDE
Definition qcustomplot.h:4163
virtual int findBegin(double sortKey, bool expandedRange=true) const Q_DECL_OVERRIDE
Definition qcustomplot.h:4534
void getDataSegments(QList< QCPDataRange > &selectedSegments, QList< QCPDataRange > &unselectedSegments) const
Definition qcustomplot.h:4621
virtual double dataMainKey(int index) const Q_DECL_OVERRIDE
Definition qcustomplot.h:4391
virtual bool sortKeyIsMainKey() const Q_DECL_OVERRIDE
Definition qcustomplot.h:4472
The abstract base class for all data representing objects in a plot.
Definition qcustomplot.h:3459
QCPDataSelection selection() const
Definition qcustomplot.h:3487
void setAntialiasedFill(bool enabled)
Definition qcustomplot.cpp:11459
bool selected() const
Definition qcustomplot.h:3486
void rescaleAxes(bool onlyEnlarge=false) const
Definition qcustomplot.cpp:11706
void setSelectionDecorator(QCPSelectionDecorator *decorator)
Definition qcustomplot.cpp:11573
Q_SLOT void setSelection(QCPDataSelection selection)
Definition qcustomplot.cpp:11553
void setAntialiasedScatters(bool enabled)
Definition qcustomplot.cpp:11470
void pixelsToCoords(double x, double y, double &key, double &value) const
Definition qcustomplot.cpp:11667
void selectionChanged(bool selected)
virtual QCPPlottableInterface1D * interface1D()
Definition qcustomplot.h:3504
virtual QCPRange getKeyRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth) const =0
void selectableChanged(QCP::SelectionType selectable)
bool addToLegend()
Definition qcustomplot.cpp:11833
void rescaleValueAxis(bool onlyEnlarge=false, bool inKeyRange=false) const
Definition qcustomplot.cpp:11759
void setValueAxis(QCPAxis *axis)
Definition qcustomplot.cpp:11529
QCPSelectionDecorator * selectionDecorator() const
Definition qcustomplot.h:3488
void selectionChanged(const QCPDataSelection &selection)
void setBrush(const QBrush &brush)
Definition qcustomplot.cpp:11497
void coordsToPixels(double key, double value, double &x, double &y) const
Definition qcustomplot.cpp:11625
void setKeyAxis(QCPAxis *axis)
Definition qcustomplot.cpp:11513
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE=0
virtual QCPRange getValueRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth, const QCPRange &inKeyRange=QCPRange()) const =0
void setPen(const QPen &pen)
Definition qcustomplot.cpp:11483
void setName(const QString &name)
Definition qcustomplot.cpp:11448
Q_SLOT void setSelectable(QCP::SelectionType selectable)
Definition qcustomplot.cpp:11599
bool removeFromLegend() const
Definition qcustomplot.cpp:11871
void rescaleKeyAxis(bool onlyEnlarge=false) const
Definition qcustomplot.cpp:11717
QCPAbstractPlottable(QCPAxis *keyAxis, QCPAxis *valueAxis)
Definition qcustomplot.cpp:11414
Manages a single axis inside a QCustomPlot.
Definition qcustomplot.h:2086
void setSelectedLabelFont(const QFont &font)
Definition qcustomplot.cpp:9015
void setOffset(int offset)
Definition qcustomplot.cpp:8991
void setTickLabels(bool show)
Definition qcustomplot.cpp:8596
void rangeChanged(const QCPRange &newRange)
void setLowerEnding(const QCPLineEnding &ending)
Definition qcustomplot.cpp:9084
void setTickLabelSide(LabelSide side)
Definition qcustomplot.cpp:8669
void setTickLabelRotation(double degrees)
Definition qcustomplot.cpp:8653
void setRangeReversed(bool reversed)
Definition qcustomplot.cpp:8549
void setNumberPrecision(int precision)
Definition qcustomplot.cpp:8770
LabelSide
Definition qcustomplot.h:2151
@ lsOutside
Tick labels will be displayed outside the axis rect.
Definition qcustomplot.h:2152
@ lsInside
Tick labels will be displayed inside the axis rect and clipped to the inner axis rect.
Definition qcustomplot.h:2151
void setSelectedSubTickPen(const QPen &pen)
Definition qcustomplot.cpp:9069
void setTickLabelFont(const QFont &font)
Definition qcustomplot.cpp:8625
void setLabel(const QString &str)
Definition qcustomplot.cpp:8941
void scaleTypeChanged(QCPAxis::ScaleType scaleType)
ScaleType
Definition qcustomplot.h:2159
@ stLogarithmic
Logarithmic scaling with correspondingly transformed axis coordinates (possibly also setTicker to a Q...
Definition qcustomplot.h:2160
@ stLinear
Linear scaling.
Definition qcustomplot.h:2159
void setTickLabelColor(const QColor &color)
Definition qcustomplot.cpp:8639
void setTickLengthOut(int outside)
Definition qcustomplot.cpp:8814
void setLabelPadding(int padding)
Definition qcustomplot.cpp:8955
int pixelOrientation() const
Definition qcustomplot.h:2275
void setSubTickLengthOut(int outside)
Definition qcustomplot.cpp:8874
void setTicker(QSharedPointer< QCPAxisTicker > ticker)
Definition qcustomplot.cpp:8567
Q_SLOT void setSelectableParts(const QCPAxis::SelectableParts &selectableParts)
Definition qcustomplot.cpp:8413
void setPadding(int padding)
Definition qcustomplot.cpp:8974
void setSelectedLabelColor(const QColor &color)
Definition qcustomplot.cpp:9039
virtual void mousePressEvent(QMouseEvent *event, const QVariant &details) Q_DECL_OVERRIDE
Definition qcustomplot.cpp:9520
void selectionChanged(const QCPAxis::SelectableParts &parts)
QCPGrid * grid() const
Definition qcustomplot.h:2222
void setUpperEnding(const QCPLineEnding &ending)
Definition qcustomplot.cpp:9099
void setLabelColor(const QColor &color)
Definition qcustomplot.cpp:8932
void setLabelFont(const QFont &font)
Definition qcustomplot.cpp:8918
void setBasePen(const QPen &pen)
Definition qcustomplot.cpp:8888
virtual void mouseReleaseEvent(QMouseEvent *event, const QPointF &startPos) Q_DECL_OVERRIDE
Definition qcustomplot.cpp:9592
QSharedPointer< QCPAxisTicker > ticker() const
Definition qcustomplot.h:2185
void setSelectedTickPen(const QPen &pen)
Definition qcustomplot.cpp:9059
void setSelectedTickLabelFont(const QFont &font)
Definition qcustomplot.cpp:9001
static Qt::Orientation orientation(AxisType type)
Definition qcustomplot.h:2289
void setSelectedTickLabelColor(const QColor &color)
Definition qcustomplot.cpp:9026
void selectableChanged(const QCPAxis::SelectableParts &parts)
virtual void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE
Definition qcustomplot.cpp:9619
void rangeChanged(const QCPRange &newRange, const QCPRange &oldRange)
Qt::Orientation orientation() const
Definition qcustomplot.h:2274
Q_SLOT void setSelectedParts(const QCPAxis::SelectableParts &selectedParts)
Definition qcustomplot.cpp:8437
SelectablePart
Definition qcustomplot.h:2167
@ spTickLabels
Tick labels (numbers) of this axis (as a whole, not individually)
Definition qcustomplot.h:2169
@ spAxisLabel
The axis label.
Definition qcustomplot.h:2170
@ spAxis
The axis backbone and tick marks.
Definition qcustomplot.h:2168
@ spNone
None of the selectable parts.
Definition qcustomplot.h:2167
void setSubTickLengthIn(int inside)
Definition qcustomplot.cpp:8859
virtual void mouseMoveEvent(QMouseEvent *event, const QPointF &startPos) Q_DECL_OVERRIDE
Definition qcustomplot.cpp:9558
QCPAxis(QCPAxisRect *parent, AxisType type)
Definition qcustomplot.cpp:8196
void setTicks(bool show)
Definition qcustomplot.cpp:8584
void setTickPen(const QPen &pen)
Definition qcustomplot.cpp:8898
Q_SLOT void setScaleType(QCPAxis::ScaleType type)
Definition qcustomplot.cpp:8365
AxisType
Definition qcustomplot.h:2138
@ atBottom
0x08 Axis is horizontal and on the bottom side of the axis rect
Definition qcustomplot.h:2141
@ atTop
0x04 Axis is horizontal and on the top side of the axis rect
Definition qcustomplot.h:2140
@ atRight
0x02 Axis is vertical and on the right side of the axis rect
Definition qcustomplot.h:2139
@ atLeft
0x01 Axis is vertical and on the left side of the axis rect
Definition qcustomplot.h:2138
void setNumberFormat(const QString &formatCode)
Definition qcustomplot.cpp:8710
void setSelectedBasePen(const QPen &pen)
Definition qcustomplot.cpp:9049
Q_SLOT void setRange(const QCPRange &range)
Definition qcustomplot.cpp:8385
void setSubTickPen(const QPen &pen)
Definition qcustomplot.cpp:8908
void setTickLabelPadding(int padding)
Definition qcustomplot.cpp:8611
void setSubTicks(bool show)
Definition qcustomplot.cpp:8830
void setTickLengthIn(int inside)
Definition qcustomplot.cpp:8799
Definition qcustomplot.h:2391
QCPAxisPainterPrivate(QCustomPlot *parentPlot)
Definition qcustomplot.cpp:9894
Holds multiple axes and arranges them in a rectangular shape.
Definition qcustomplot.h:4888
bool removeAxis(QCPAxis *axis)
Definition qcustomplot.cpp:17751
int width() const
Definition qcustomplot.h:4953
QCPAxis * addAxis(QCPAxis::AxisType type, QCPAxis *axis=nullptr)
Definition qcustomplot.cpp:17675
QPoint bottomRight() const
Definition qcustomplot.h:4959
int right() const
Definition qcustomplot.h:4950
int top() const
Definition qcustomplot.h:4951
QCPAxis * axis(QCPAxis::AxisType type, int index=0) const
Definition qcustomplot.cpp:17604
QPoint topLeft() const
Definition qcustomplot.h:4956
void setBackgroundScaledMode(Qt::AspectRatioMode mode)
Definition qcustomplot.cpp:18095
QCPAxisRect(QCustomPlot *parentPlot, bool setupDefaultAxes=true)
Definition qcustomplot.cpp:17536
void setRangeDragAxes(QCPAxis *horizontal, QCPAxis *vertical)
Definition qcustomplot.cpp:18242
QCPAxis * rangeZoomAxis(Qt::Orientation orientation)
Definition qcustomplot.cpp:18120
virtual void mouseReleaseEvent(QMouseEvent *event, const QPointF &startPos) Q_DECL_OVERRIDE
Definition qcustomplot.cpp:18616
QCPAxis * rangeDragAxis(Qt::Orientation orientation)
Definition qcustomplot.cpp:18106
QList< QCPAxis * > addAxes(QCPAxis::AxisTypes types)
Definition qcustomplot.cpp:17730
void setRangeZoom(Qt::Orientations orientations)
Definition qcustomplot.cpp:18226
QSize size() const
Definition qcustomplot.h:4955
QPoint topRight() const
Definition qcustomplot.h:4957
int axisCount(QCPAxis::AxisType type) const
Definition qcustomplot.cpp:17594
QList< QCPAxis * > rangeZoomAxes(Qt::Orientation orientation)
Definition qcustomplot.cpp:18159
void setRangeZoomFactor(double horizontalFactor, double verticalFactor)
Definition qcustomplot.cpp:18384
QList< QCPAxis * > axes(QCPAxis::AxisTypes types) const
Definition qcustomplot.cpp:17625
virtual void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE
Definition qcustomplot.cpp:18642
void setRangeZoomAxes(QCPAxis *horizontal, QCPAxis *vertical)
Definition qcustomplot.cpp:18314
QCPLayoutInset * insetLayout() const
Definition qcustomplot.h:4939
virtual void mouseMoveEvent(QMouseEvent *event, const QPointF &startPos) Q_DECL_OVERRIDE
Definition qcustomplot.cpp:18556
virtual void mousePressEvent(QMouseEvent *event, const QVariant &details) Q_DECL_OVERRIDE
Definition qcustomplot.cpp:18524
QList< QCPAxis * > rangeDragAxes(Qt::Orientation orientation)
Definition qcustomplot.cpp:18133
QPoint bottomLeft() const
Definition qcustomplot.h:4958
int height() const
Definition qcustomplot.h:4954
int bottom() const
Definition qcustomplot.h:4952
virtual void update(UpdatePhase phase) Q_DECL_OVERRIDE
Definition qcustomplot.cpp:17972
QPoint center() const
Definition qcustomplot.h:4960
double rangeZoomFactor(Qt::Orientation orientation)
Definition qcustomplot.cpp:18185
void setRangeDrag(Qt::Orientations orientations)
Definition qcustomplot.cpp:18206
void setBackgroundScaled(bool scaled)
Definition qcustomplot.cpp:18085
void setBackground(const QPixmap &pm)
Definition qcustomplot.cpp:18036
int left() const
Definition qcustomplot.h:4949
static double dateTimeToKey(const QDateTime &dateTime)
Definition qcustomplot.cpp:6800
void setTimeZone(const QTimeZone &zone)
Definition qcustomplot.cpp:6598
static QDateTime keyToDateTime(double key)
Definition qcustomplot.cpp:6780
void setTickOrigin(double origin)
Definition qcustomplot.cpp:6614
QCPAxisTickerDateTime()
Definition qcustomplot.cpp:6523
void setDateTimeFormat(const QString &format)
Definition qcustomplot.cpp:6568
void setDateTimeSpec(Qt::TimeSpec spec)
Definition qcustomplot.cpp:6586
Specialized axis ticker with a fixed tick step.
Definition qcustomplot.h:1864
ScaleStrategy
Definition qcustomplot.h:1873
@ ssMultiples
An integer multiple of the specified tick step is allowed. The used factor follows the base class pro...
Definition qcustomplot.h:1874
@ ssNone
Modifications are not allowed, the specified tick step is absolutely fixed. This might cause a high t...
Definition qcustomplot.h:1873
@ ssPowers
An integer power of the specified tick step is allowed.
Definition qcustomplot.h:1875
QCPAxisTickerFixed()
Definition qcustomplot.cpp:7112
The base class tick generator used by QCPAxis to create tick positions and tick labels.
Definition qcustomplot.h:1698
QCPAxisTicker()
Definition qcustomplot.cpp:6119
TickStepStrategy
Definition qcustomplot.h:1707
@ tssMeetTickCount
Less readable tick steps are allowed which in turn facilitates getting closer to the requested tick c...
Definition qcustomplot.h:1709
@ tssReadability
A nicely readable tick step is prioritized over matching the requested number of ticks (see setTickCo...
Definition qcustomplot.h:1708
void setLogBase(double base)
Definition qcustomplot.cpp:7735
void setSubTickCount(int subTicks)
Definition qcustomplot.cpp:7755
QCPAxisTickerLog()
Definition qcustomplot.cpp:7724
Specialized axis ticker to display ticks in units of an arbitrary constant, for example pi.
Definition qcustomplot.h:1944
FractionStyle
Definition qcustomplot.h:1952
@ fsFloatingPoint
Fractions are displayed as regular decimal floating point numbers, e.g. "0.25" or "0....
Definition qcustomplot.h:1952
@ fsAsciiFractions
Fractions are written as rationals using ASCII characters only, e.g. "1/4" or "1/8".
Definition qcustomplot.h:1953
@ fsUnicodeFractions
Fractions are written using sub- and superscript UTF-8 digits and the fraction symbol.
Definition qcustomplot.h:1954
QCPAxisTickerPi()
Definition qcustomplot.cpp:7427
QCPAxisTickerText()
Definition qcustomplot.cpp:7227
QMap< double, QString > & ticks()
Definition qcustomplot.h:1911
Specialized axis ticker for time spans in units of milliseconds to days.
Definition qcustomplot.h:1812
QCPAxisTickerTime()
Definition qcustomplot.cpp:6879
TimeUnit
Definition qcustomplot.h:1820
@ tuSeconds
Seconds (%s in setTimeFormat)
Definition qcustomplot.h:1821
@ tuMinutes
Minutes (%m in setTimeFormat)
Definition qcustomplot.h:1822
@ tuMilliseconds
Milliseconds, one thousandth of a second (%z in setTimeFormat)
Definition qcustomplot.h:1820
@ tuHours
Hours (%h in setTimeFormat)
Definition qcustomplot.h:1823
@ tuDays
Days (%d in setTimeFormat)
Definition qcustomplot.h:1824
double sortKey() const
Definition qcustomplot.h:5751
static bool sortKeyIsMainKey()
Definition qcustomplot.h:5753
double mainValue() const
Definition qcustomplot.h:5756
QCPBarsData()
Definition qcustomplot.cpp:24318
double mainKey() const
Definition qcustomplot.h:5755
QCPRange valueRange() const
Definition qcustomplot.h:5758
static QCPBarsData fromSortKey(double sortKey)
Definition qcustomplot.h:5752
Groups multiple QCPBars together so they appear side by side.
Definition qcustomplot.h:5681
void setSpacingType(SpacingType spacingType)
Definition qcustomplot.cpp:24013
int size() const
Definition qcustomplot.h:5714
SpacingType
Definition qcustomplot.h:5694
@ stAbsolute
Bar spacing is in absolute pixels.
Definition qcustomplot.h:5694
@ stPlotCoords
Bar spacing is in key coordinates and thus scales with the key axis range.
Definition qcustomplot.h:5696
@ stAxisRectRatio
Bar spacing is given by a fraction of the axis rect size.
Definition qcustomplot.h:5695
QList< QCPBars * > bars() const
Definition qcustomplot.h:5712
QCPBarsGroup(QCustomPlot *parentPlot)
Definition qcustomplot.cpp:23993
void setSpacing(double spacing)
Definition qcustomplot.cpp:24024
bool isEmpty() const
Definition qcustomplot.h:5715
bool contains(QCPBars *bars) const
Definition qcustomplot.h:5717
A plottable representing a bar chart in a plot.
Definition qcustomplot.h:5777
QCPBars * barBelow() const
Definition qcustomplot.h:5810
void setBaseValue(double baseValue)
Definition qcustomplot.cpp:24521
QCPBars(QCPAxis *keyAxis, QCPAxis *valueAxis)
Definition qcustomplot.cpp:24408
WidthType
Definition qcustomplot.h:5795
@ wtAxisRectRatio
Bar width is given by a fraction of the axis rect size.
Definition qcustomplot.h:5796
@ wtPlotCoords
Bar width is in key coordinates and thus scales with the key axis range.
Definition qcustomplot.h:5797
@ wtAbsolute
Bar width is in absolute pixels.
Definition qcustomplot.h:5795
QSharedPointer< QCPBarsDataContainer > data() const
Definition qcustomplot.h:5812
QCPBars * barAbove() const
Definition qcustomplot.h:5811
void setWidthType(WidthType widthType)
Definition qcustomplot.cpp:24487
void setStackingGap(double pixels)
Definition qcustomplot.cpp:24531
void setBarsGroup(QCPBarsGroup *barsGroup)
Definition qcustomplot.cpp:24498
void setWidth(double width)
Definition qcustomplot.cpp:24474
Defines a color gradient for use with e.g. QCPColorMap.
Definition qcustomplot.h:4716
QCPColorGradient()
Definition qcustomplot.cpp:16526
ColorInterpolation
Definition qcustomplot.h:4724
@ ciRGB
Color channels red, green and blue are linearly interpolated.
Definition qcustomplot.h:4724
@ ciHSV
Color channels hue, saturation and value are linearly interpolated (The hue is interpolated over the ...
Definition qcustomplot.h:4725
GradientPreset
Definition qcustomplot.h:4746
@ gpNight
Continuous lightness from black over weak blueish colors to white (suited for non-biased data represe...
Definition qcustomplot.h:4749
@ gpHues
Full hue cycle, with highest and lowest color red (suitable for periodic data, such as angles and pha...
Definition qcustomplot.h:4757
@ gpGeography
Colors suitable to represent different elevations on geographical maps.
Definition qcustomplot.h:4751
@ gpIon
Half hue spectrum from black over purple to blue and finally green (creates banding illusion but allo...
Definition qcustomplot.h:4752
@ gpHot
Continuous lightness from black over firey colors to white (suited for non-biased data representation...
Definition qcustomplot.h:4747
@ gpJet
Hue variation similar to a spectrum, often used in numerical visualization (creates banding illusion ...
Definition qcustomplot.h:4756
@ gpCandy
Blue over pink to white.
Definition qcustomplot.h:4750
@ gpPolar
Colors suitable to emphasize polarity around the center, with blue for negative, black in the middle ...
Definition qcustomplot.h:4754
@ gpSpectrum
An approximation of the visible light spectrum (creates banding illusion but allows more precise magn...
Definition qcustomplot.h:4755
@ gpGrayscale
Continuous lightness from black to white (suited for non-biased data representation)
Definition qcustomplot.h:4746
@ gpCold
Continuous lightness from black over icey colors to white (suited for non-biased data representation)
Definition qcustomplot.h:4748
@ gpThermal
Colors suitable for thermal imaging, ranging from dark blue over purple to orange,...
Definition qcustomplot.h:4753
NanHandling
Definition qcustomplot.h:4734
@ nhHighestColor
NaN data points appear as the highest color defined in this QCPColorGradient.
Definition qcustomplot.h:4736
@ nhTransparent
NaN data points appear transparent.
Definition qcustomplot.h:4737
@ nhLowestColor
NaN data points appear as the lowest color defined in this QCPColorGradient.
Definition qcustomplot.h:4735
@ nhNone
NaN data points are not explicitly handled and shouldn't occur in the data (this gives slight perform...
Definition qcustomplot.h:4734
@ nhNanColor
NaN data points appear as the color defined with setNanColor.
Definition qcustomplot.h:4738
Holds the two-dimensional data of a QCPColorMap plottable.
Definition qcustomplot.h:5986
void setKeyRange(const QCPRange &keyRange)
Definition qcustomplot.cpp:26010
void setValueSize(int valueSize)
Definition qcustomplot.cpp:25979
void setSize(int keySize, int valueSize)
Definition qcustomplot.cpp:25923
void clearAlpha()
Definition qcustomplot.cpp:26155
void fill(double z)
Definition qcustomplot.cpp:26168
unsigned char alpha(int keyIndex, int valueIndex)
Definition qcustomplot.cpp:25903
void setCell(int keyIndex, int valueIndex, double z)
Definition qcustomplot.cpp:26068
void fillAlpha(unsigned char alpha)
Definition qcustomplot.cpp:26186
void clear()
Definition qcustomplot.cpp:26147
QCPColorMapData(int keySize, int valueSize, const QCPRange &keyRange, const QCPRange &valueRange)
Definition qcustomplot.cpp:25813
void setRange(const QCPRange &keyRange, const QCPRange &valueRange)
Definition qcustomplot.cpp:25994
void setAlpha(int keyIndex, int valueIndex, unsigned char alpha)
Definition qcustomplot.cpp:26097
void recalculateDataBounds()
Definition qcustomplot.cpp:26123
void setKeySize(int keySize)
Definition qcustomplot.cpp:25964
void setValueRange(const QCPRange &valueRange)
Definition qcustomplot.cpp:26025
bool isEmpty() const
Definition qcustomplot.h:6020
void setData(double key, double value, double z)
Definition qcustomplot.cpp:26042
QCPColorMapData & operator=(const QCPColorMapData &other)
Definition qcustomplot.cpp:25851
A plottable representing a two-dimensional color map in a plot.
Definition qcustomplot.h:6043
QCPColorMapData * data() const
Definition qcustomplot.h:6058
void gradientChanged(const QCPColorGradient &newGradient)
void setInterpolate(bool enabled)
Definition qcustomplot.cpp:26515
Q_SLOT void setGradient(const QCPColorGradient &gradient)
Definition qcustomplot.cpp:26499
void dataRangeChanged(const QCPRange &newRange)
void dataScaleTypeChanged(QCPAxis::ScaleType scaleType)
Q_SLOT void setDataRange(const QCPRange &dataRange)
Definition qcustomplot.cpp:26457
Q_SLOT void setDataScaleType(QCPAxis::ScaleType scaleType)
Definition qcustomplot.cpp:26476
QCPColorMap(QCPAxis *keyAxis, QCPAxis *valueAxis)
Definition qcustomplot.cpp:26408
void setColorScale(QCPColorScale *colorScale)
Definition qcustomplot.cpp:26551
void setTightBoundary(bool enabled)
Definition qcustomplot.cpp:26532
QCPColorScaleAxisRectPrivate(QCPColorScale *parentColorScale)
Definition qcustomplot.cpp:20550
A color scale for use with color coding data such as QCPColorMap.
Definition qcustomplot.h:5344
void setType(QCPAxis::AxisType type)
Definition qcustomplot.cpp:20173
Q_SLOT void setGradient(const QCPColorGradient &gradient)
Definition qcustomplot.cpp:20277
void setRangeDrag(bool enabled)
Definition qcustomplot.cpp:20318
QCPAxis * axis() const
Definition qcustomplot.h:5361
virtual void mouseMoveEvent(QMouseEvent *event, const QPointF &startPos) Q_DECL_OVERRIDE
Definition qcustomplot.cpp:20500
void gradientChanged(const QCPColorGradient &newGradient)
void dataScaleTypeChanged(QCPAxis::ScaleType scaleType)
virtual void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE
Definition qcustomplot.cpp:20522
void dataRangeChanged(const QCPRange &newRange)
virtual void mouseReleaseEvent(QMouseEvent *event, const QPointF &startPos) Q_DECL_OVERRIDE
Definition qcustomplot.cpp:20511
virtual void mousePressEvent(QMouseEvent *event, const QVariant &details) Q_DECL_OVERRIDE
Definition qcustomplot.cpp:20489
void setRangeZoom(bool enabled)
Definition qcustomplot.cpp:20345
QCPColorScale(QCustomPlot *parentPlot)
Definition qcustomplot.cpp:20108
void setBarWidth(int width)
Definition qcustomplot.cpp:20307
Q_SLOT void setDataRange(const QCPRange &dataRange)
Definition qcustomplot.cpp:20227
Q_SLOT void setDataScaleType(QCPAxis::ScaleType scaleType)
Definition qcustomplot.cpp:20257
void setLabel(const QString &str)
Definition qcustomplot.cpp:20292
static bool sortKeyIsMainKey()
Definition qcustomplot.h:5573
double mainValue() const
Definition qcustomplot.h:5576
static QCPCurveData fromSortKey(double sortKey)
Definition qcustomplot.h:5572
QCPCurveData()
Definition qcustomplot.cpp:22539
double sortKey() const
Definition qcustomplot.h:5571
double mainKey() const
Definition qcustomplot.h:5575
QCPRange valueRange() const
Definition qcustomplot.h:5578
A plottable representing a parametric curve in a plot.
Definition qcustomplot.h:5598
LineStyle
Definition qcustomplot.h:5611
@ lsLine
Data points are connected with a straight line.
Definition qcustomplot.h:5612
@ lsNone
No line is drawn between data points (e.g. only scatters)
Definition qcustomplot.h:5611
QCPCurve(QCPAxis *keyAxis, QCPAxis *valueAxis)
Definition qcustomplot.cpp:22618
void setLineStyle(LineStyle style)
Definition qcustomplot.cpp:22726
void setScatterStyle(const QCPScatterStyle &style)
Definition qcustomplot.cpp:22698
QSharedPointer< QCPCurveDataContainer > data() const
Definition qcustomplot.h:5620
void setScatterSkip(int skip)
Definition qcustomplot.cpp:22714
The generic data container for one-dimensional plottables.
Definition qcustomplot.h:2579
void setAutoSqueeze(bool enabled)
Definition qcustomplot.h:2787
const_iterator findBegin(double sortKey, bool expandedRange=true) const
Definition qcustomplot.h:3070
void remove(double sortKey)
Definition qcustomplot.h:2983
QCPRange valueRange(bool &foundRange, QCP::SignDomain signDomain=QCP::sdBoth, const QCPRange &inKeyRange=QCPRange())
Definition qcustomplot.h:3247
iterator end()
Definition qcustomplot.h:2611
void add(const QCPDataContainer< DataType > &data)
Definition qcustomplot.h:2836
void add(const QVector< DataType > &data, bool alreadySorted=false)
Definition qcustomplot.h:2868
iterator begin()
Definition qcustomplot.h:2610
void add(const DataType &data)
Definition qcustomplot.h:2905
bool qcpLessThanSortKey(const DataType &a, const DataType &b)
Definition qcustomplot.h:2575
void sort()
Definition qcustomplot.h:3022
bool isEmpty() const
Definition qcustomplot.h:2588
void clear()
Definition qcustomplot.h:3003
void squeeze(bool preAllocation=true, bool postAllocation=true)
Definition qcustomplot.h:3038
int size() const
Definition qcustomplot.h:2587
void limitIteratorsToDataRange(const_iterator &begin, const_iterator &end, const QCPDataRange &dataRange) const
Definition qcustomplot.h:3335
const_iterator constEnd() const
Definition qcustomplot.h:2609
void removeBefore(double sortKey)
Definition qcustomplot.h:2929
QCPRange keyRange(bool &foundRange, QCP::SignDomain signDomain=QCP::sdBoth)
Definition qcustomplot.h:3124
void removeAfter(double sortKey)
Definition qcustomplot.h:2944
const_iterator at(int index) const
Definition qcustomplot.h:2614
void remove(double sortKeyFrom, double sortKeyTo)
Definition qcustomplot.h:2961
void set(const QCPDataContainer< DataType > &data)
Definition qcustomplot.h:2804
QCPDataRange dataRange() const
Definition qcustomplot.h:2617
QCPDataContainer()
Definition qcustomplot.h:2771
const_iterator findEnd(double sortKey, bool expandedRange=true) const
Definition qcustomplot.h:3097
const_iterator constBegin() const
Definition qcustomplot.h:2608
void set(const QVector< DataType > &data, bool alreadySorted=false)
Definition qcustomplot.h:2820
Describes a data range given by begin and end index.
Definition qcustomplot.h:915
int length() const
Definition qcustomplot.h:927
void setEnd(int end)
Definition qcustomplot.h:931
QCPDataRange adjusted(int changeBegin, int changeEnd) const
Definition qcustomplot.h:939
QCPDataRange()
Definition qcustomplot.cpp:2257
void setBegin(int begin)
Definition qcustomplot.h:930
QCPDataRange bounded(const QCPDataRange &other) const
Definition qcustomplot.cpp:2283
bool isValid() const
Definition qcustomplot.h:934
bool isEmpty() const
Definition qcustomplot.h:935
int size() const
Definition qcustomplot.h:926
Describes a data set by holding multiple QCPDataRange instances.
Definition qcustomplot.h:952
QCPDataSelection()
Definition qcustomplot.cpp:2415
friend const QCPDataSelection operator-(const QCPDataSelection &a, const QCPDataSelection &b)
Definition qcustomplot.h:1046
QCPDataSelection & operator+=(const QCPDataSelection &other)
Definition qcustomplot.cpp:2450
void addDataRange(const QCPDataRange &dataRange, bool simplify=true)
Definition qcustomplot.cpp:2574
friend const QCPDataSelection operator+(const QCPDataSelection &a, const QCPDataSelection &b)
Definition qcustomplot.h:1003
void simplify()
Definition qcustomplot.cpp:2600
QCPDataSelection & operator-=(const QCPDataSelection &other)
Definition qcustomplot.cpp:2470
QCPDataRange dataRange(int index=0) const
Definition qcustomplot.cpp:2544
bool isEmpty() const
Definition qcustomplot.h:982
int dataRangeCount() const
Definition qcustomplot.h:973
QList< QCPDataRange > dataRanges() const
Definition qcustomplot.h:976
QCPDataSelection inverse(const QCPDataRange &outerRange) const
Definition qcustomplot.cpp:2739
Holds the data of one single error bar for QCPErrorBars.
Definition qcustomplot.h:6261
QCPErrorBarsData()
Definition qcustomplot.cpp:27876
A plottable that adds a set of error bars to other plottables.
Definition qcustomplot.h:6290
void setSymbolGap(double pixels)
Definition qcustomplot.cpp:28083
QCPErrorBars(QCPAxis *keyAxis, QCPAxis *valueAxis)
Definition qcustomplot.cpp:27959
void setData(QSharedPointer< QCPErrorBarsDataContainer > data)
Definition qcustomplot.cpp:27992
ErrorType
Definition qcustomplot.h:6307
@ etValueError
The errors are for the value dimension (bars appear parallel to the value axis)
Definition qcustomplot.h:6308
@ etKeyError
The errors are for the key dimension (bars appear parallel to the key axis)
Definition qcustomplot.h:6307
void setDataPlottable(QCPAbstractPlottable *plottable)
Definition qcustomplot.cpp:28042
void setWhiskerWidth(double pixels)
Definition qcustomplot.cpp:28073
virtual QCPPlottableInterface1D * interface1D() Q_DECL_OVERRIDE
Definition qcustomplot.h:6350
QSharedPointer< QCPErrorBarsDataContainer > data() const
Definition qcustomplot.h:6315
void setErrorType(ErrorType type)
Definition qcustomplot.cpp:28064
QCPRange valueRange() const
Definition qcustomplot.h:6134
QCPFinancialData()
Definition qcustomplot.cpp:26969
static bool sortKeyIsMainKey()
Definition qcustomplot.h:6129
static QCPFinancialData fromSortKey(double sortKey)
Definition qcustomplot.h:6128
double mainValue() const
Definition qcustomplot.h:6132
double sortKey() const
Definition qcustomplot.h:6127
double mainKey() const
Definition qcustomplot.h:6131
A plottable representing a financial stock chart.
Definition qcustomplot.h:6153
ChartStyle
Definition qcustomplot.h:6183
@ csOhlc
Open-High-Low-Close bar representation.
Definition qcustomplot.h:6183
@ csCandlestick
Candlestick representation.
Definition qcustomplot.h:6184
void setTwoColored(bool twoColored)
Definition qcustomplot.cpp:27160
void setWidthType(WidthType widthType)
Definition qcustomplot.cpp:27146
QCPFinancial(QCPAxis *keyAxis, QCPAxis *valueAxis)
Definition qcustomplot.cpp:27065
void setChartStyle(ChartStyle style)
Definition qcustomplot.cpp:27123
void setBrushPositive(const QBrush &brush)
Definition qcustomplot.cpp:27174
void setBrushNegative(const QBrush &brush)
Definition qcustomplot.cpp:27188
void setWidth(double width)
Definition qcustomplot.cpp:27133
QSharedPointer< QCPFinancialDataContainer > data() const
Definition qcustomplot.h:6192
void setPenPositive(const QPen &pen)
Definition qcustomplot.cpp:27202
WidthType
Definition qcustomplot.h:6172
@ wtAbsolute
width is in absolute pixels
Definition qcustomplot.h:6172
@ wtAxisRectRatio
width is given by a fraction of the axis rect size
Definition qcustomplot.h:6173
@ wtPlotCoords
width is in key coordinates and thus scales with the key axis range
Definition qcustomplot.h:6174
void setPenNegative(const QPen &pen)
Definition qcustomplot.cpp:27216
double mainValue() const
Definition qcustomplot.h:5437
QCPRange valueRange() const
Definition qcustomplot.h:5439
static QCPGraphData fromSortKey(double sortKey)
Definition qcustomplot.h:5433
double sortKey() const
Definition qcustomplot.h:5432
static bool sortKeyIsMainKey()
Definition qcustomplot.h:5434
double mainKey() const
Definition qcustomplot.h:5436
QCPGraphData()
Definition qcustomplot.cpp:20779
A plottable representing a graph in a plot.
Definition qcustomplot.h:5458
QCPGraph(QCPAxis *keyAxis, QCPAxis *valueAxis)
Definition qcustomplot.cpp:20860
void setScatterStyle(const QCPScatterStyle &style)
Definition qcustomplot.cpp:20936
QSharedPointer< QCPGraphDataContainer > data() const
Definition qcustomplot.h:5487
void setScatterSkip(int skip)
Definition qcustomplot.cpp:20952
void setChannelFillGraph(QCPGraph *targetGraph)
Definition qcustomplot.cpp:20966
void setLineStyle(LineStyle ls)
Definition qcustomplot.cpp:20925
void setAdaptiveSampling(bool enabled)
Definition qcustomplot.cpp:21017
LineStyle
Definition qcustomplot.h:5473
@ lsLine
data points are connected by a straight line
Definition qcustomplot.h:5475
@ lsStepCenter
line is drawn as steps where the step is in between two data points
Definition qcustomplot.h:5478
@ lsStepRight
line is drawn as steps where the step height is the value of the right data point
Definition qcustomplot.h:5477
@ lsImpulse
each data point is represented by a line parallel to the value axis, which reaches from the data poin...
Definition qcustomplot.h:5479
@ lsStepLeft
line is drawn as steps where the step height is the value of the left data point
Definition qcustomplot.h:5476
@ lsNone
Definition qcustomplot.h:5473
void setZeroLinePen(const QPen &pen)
Definition qcustomplot.cpp:7921
void setAntialiasedZeroLine(bool enabled)
Definition qcustomplot.cpp:7894
void setAntialiasedSubGrid(bool enabled)
Definition qcustomplot.cpp:7886
void setSubGridPen(const QPen &pen)
Definition qcustomplot.cpp:7910
void setPen(const QPen &pen)
Definition qcustomplot.cpp:7902
QCPGrid(QCPAxis *parentAxis)
Definition qcustomplot.cpp:7855
void setSubGridVisible(bool visible)
Definition qcustomplot.cpp:7878
An anchor of an item to which positions can be attached to.
Definition qcustomplot.h:3569
virtual QPointF pixelPosition() const
Definition qcustomplot.cpp:12067
QCPItemAnchor(QCustomPlot *parentPlot, QCPAbstractItem *parentItem, const QString &name, int anchorId=-1)
Definition qcustomplot.cpp:12038
virtual QCPItemPosition * toQCPItemPosition()
Definition qcustomplot.h:3590
A bracket for referencing/highlighting certain parts in the plot.
Definition qcustomplot.h:6903
void setSelectedPen(const QPen &pen)
Definition qcustomplot.cpp:30805
QCPItemBracket(QCustomPlot *parentPlot)
Definition qcustomplot.cpp:30767
void setStyle(BracketStyle style)
Definition qcustomplot.cpp:30828
BracketStyle
Definition qcustomplot.h:6918
@ bsRound
A brace with round edges.
Definition qcustomplot.h:6919
@ bsCurly
A curly brace.
Definition qcustomplot.h:6920
@ bsSquare
A brace with angled edges.
Definition qcustomplot.h:6918
@ bsCalligraphic
A curly brace with varying stroke width giving a calligraphic impression.
Definition qcustomplot.h:6921
void setPen(const QPen &pen)
Definition qcustomplot.cpp:30795
void setLength(double length)
Definition qcustomplot.cpp:30818
void setPen(const QPen &pen)
Definition qcustomplot.cpp:29286
void setHead(const QCPLineEnding &head)
Definition qcustomplot.cpp:29309
void setSelectedPen(const QPen &pen)
Definition qcustomplot.cpp:29296
void setTail(const QCPLineEnding &tail)
Definition qcustomplot.cpp:29322
QCPItemCurve(QCustomPlot *parentPlot)
Definition qcustomplot.cpp:29261
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE
Definition qcustomplot.cpp:29328
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE
Definition qcustomplot.cpp:29996
void setBrush(const QBrush &brush)
Definition qcustomplot.cpp:29979
void setSelectedPen(const QPen &pen)
Definition qcustomplot.cpp:29968
QCPItemEllipse(QCustomPlot *parentPlot)
Definition qcustomplot.cpp:29926
void setSelectedBrush(const QBrush &brush)
Definition qcustomplot.cpp:29990
void setPen(const QPen &pen)
Definition qcustomplot.cpp:29958
QCPItemLine(QCustomPlot *parentPlot)
Definition qcustomplot.cpp:29023
void setSelectedPen(const QPen &pen)
Definition qcustomplot.cpp:29054
void setPen(const QPen &pen)
Definition qcustomplot.cpp:29044
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE
Definition qcustomplot.cpp:29086
void setTail(const QCPLineEnding &tail)
Definition qcustomplot.cpp:29080
void setHead(const QCPLineEnding &head)
Definition qcustomplot.cpp:29067
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE
Definition qcustomplot.cpp:30191
void setPixmap(const QPixmap &pixmap)
Definition qcustomplot.cpp:30150
QCPItemPixmap(QCustomPlot *parentPlot)
Definition qcustomplot.cpp:30121
void setScaled(bool scaled, Qt::AspectRatioMode aspectRatioMode=Qt::KeepAspectRatio, Qt::TransformationMode transformationMode=Qt::SmoothTransformation)
Definition qcustomplot.cpp:30162
void setPen(const QPen &pen)
Definition qcustomplot.cpp:30175
void setSelectedPen(const QPen &pen)
Definition qcustomplot.cpp:30185
Manages the position of an item.
Definition qcustomplot.h:3607
QCPItemAnchor * parentAnchor() const
Definition qcustomplot.h:3634
virtual QCPItemPosition * toQCPItemPosition() Q_DECL_OVERRIDE
Definition qcustomplot.h:3667
QCPItemPosition(QCustomPlot *parentPlot, QCPAbstractItem *parentItem, const QString &name)
Definition qcustomplot.cpp:12212
PositionType
Definition qcustomplot.h:3616
@ ptAxisRectRatio
Definition qcustomplot.h:3620
@ ptAbsolute
Static positioning in pixels, starting from the top left corner of the viewport/widget.
Definition qcustomplot.h:3616
@ ptViewportRatio
Definition qcustomplot.h:3617
@ ptPlotCoords
Dynamic positioning at a plot coordinate defined by two axes (see setAxes).
Definition qcustomplot.h:3623
PositionType type() const
Definition qcustomplot.h:3631
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE
Definition qcustomplot.cpp:29488
QCPItemRect(QCustomPlot *parentPlot)
Definition qcustomplot.cpp:29421
void setPen(const QPen &pen)
Definition qcustomplot.cpp:29450
void setSelectedPen(const QPen &pen)
Definition qcustomplot.cpp:29460
void setBrush(const QBrush &brush)
Definition qcustomplot.cpp:29471
void setSelectedBrush(const QBrush &brush)
Definition qcustomplot.cpp:29482
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE
Definition qcustomplot.cpp:28877
QCPItemStraightLine(QCustomPlot *parentPlot)
Definition qcustomplot.cpp:28840
void setSelectedPen(const QPen &pen)
Definition qcustomplot.cpp:28871
void setPen(const QPen &pen)
Definition qcustomplot.cpp:28861
void setSelectedFont(const QFont &font)
Definition qcustomplot.cpp:29689
void setBrush(const QBrush &brush)
Definition qcustomplot.cpp:29658
void setSelectedPen(const QPen &pen)
Definition qcustomplot.cpp:29647
void setText(const QString &text)
Definition qcustomplot.cpp:29700
void setRotation(double degrees)
Definition qcustomplot.cpp:29734
void setSelectedBrush(const QBrush &brush)
Definition qcustomplot.cpp:29669
QCPItemText(QCustomPlot *parentPlot)
Definition qcustomplot.cpp:29584
void setPositionAlignment(Qt::Alignment alignment)
Definition qcustomplot.cpp:29717
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE
Definition qcustomplot.cpp:29749
void setFont(const QFont &font)
Definition qcustomplot.cpp:29679
void setPen(const QPen &pen)
Definition qcustomplot.cpp:29636
void setColor(const QColor &color)
Definition qcustomplot.cpp:29617
void setTextAlignment(Qt::Alignment alignment)
Definition qcustomplot.cpp:29725
void setSelectedColor(const QColor &color)
Definition qcustomplot.cpp:29625
void setPadding(const QMargins &padding)
Definition qcustomplot.cpp:29743
Item that sticks to QCPGraph data points.
Definition qcustomplot.h:6817
void setSelectedBrush(const QBrush &brush)
Definition qcustomplot.cpp:30463
void setBrush(const QBrush &brush)
Definition qcustomplot.cpp:30453
TracerStyle
Definition qcustomplot.h:6836
@ tsPlus
A plus shaped crosshair with limited size.
Definition qcustomplot.h:6837
@ tsSquare
A square.
Definition qcustomplot.h:6840
@ tsNone
The tracer is not visible.
Definition qcustomplot.h:6836
@ tsCircle
A circle.
Definition qcustomplot.h:6839
@ tsCrosshair
A plus shaped crosshair which spans the complete axis rect.
Definition qcustomplot.h:6838
void setStyle(TracerStyle style)
Definition qcustomplot.cpp:30483
void setGraphKey(double key)
Definition qcustomplot.cpp:30525
void setInterpolating(bool enabled)
Definition qcustomplot.cpp:30541
QCPItemTracer(QCustomPlot *parentPlot)
Definition qcustomplot.cpp:30407
void setSelectedPen(const QPen &pen)
Definition qcustomplot.cpp:30443
void setSize(double size)
Definition qcustomplot.cpp:30472
void setGraph(QCPGraph *graph)
Definition qcustomplot.cpp:30498
void setPen(const QPen &pen)
Definition qcustomplot.cpp:30433
Definition qcustomplot.h:1558
QCPLabelPainterPrivate(QCustomPlot *parentPlot)
Definition qcustomplot.cpp:5484
AnchorReferenceType
Definition qcustomplot.h:1573
AnchorSide
Definition qcustomplot.h:1581
AnchorMode
Definition qcustomplot.h:1564
A layer that may contain objects, to control the rendering order.
Definition qcustomplot.h:648
QList< QCPLayerable * > children() const
Definition qcustomplot.h:679
QCPLayer(QCustomPlot *parentPlot, const QString &layerName)
Definition qcustomplot.cpp:1067
LayerMode
Definition qcustomplot.h:667
@ lmLogical
Layer is used only for rendering order, and shares paint buffer with all other adjacent logical layer...
Definition qcustomplot.h:667
@ lmBuffered
Layer has its own paint buffer and may be replotted individually (see replot).
Definition qcustomplot.h:668
void setMode(LayerMode mode)
Definition qcustomplot.cpp:1127
void setVisible(bool visible)
Definition qcustomplot.cpp:1101
int index() const
Definition qcustomplot.h:678
Base class for all drawable objects.
Definition qcustomplot.h:717
void setVisible(bool on)
Definition qcustomplot.cpp:1397
virtual void mouseDoubleClickEvent(QMouseEvent *event, const QVariant &details)
Definition qcustomplot.cpp:1808
virtual void wheelEvent(QWheelEvent *event)
Definition qcustomplot.cpp:1831
QCPLayerable(QCustomPlot *plot, QString targetLayer=QString(), QCPLayerable *parentLayerable=nullptr)
Definition qcustomplot.cpp:1366
void setAntialiased(bool enabled)
Definition qcustomplot.cpp:1444
virtual void mouseMoveEvent(QMouseEvent *event, const QPointF &startPos)
Definition qcustomplot.cpp:1758
virtual void mouseReleaseEvent(QMouseEvent *event, const QPointF &startPos)
Definition qcustomplot.cpp:1776
QCPLayerable * parentLayerable() const
Definition qcustomplot.h:733
Q_SLOT bool setLayer(QCPLayer *layer)
Definition qcustomplot.cpp:1411
void layerChanged(QCPLayer *newLayer)
virtual void mousePressEvent(QMouseEvent *event, const QVariant &details)
Definition qcustomplot.cpp:1740
The abstract base class for all objects that form the layout system.
Definition qcustomplot.h:1204
void setMinimumMargins(const QMargins &margins)
Definition qcustomplot.cpp:3278
SizeConstraintRect
Definition qcustomplot.h:1235
@ scrInnerRect
Minimum/Maximum size constraints apply to inner rect.
Definition qcustomplot.h:1235
@ scrOuterRect
Minimum/Maximum size constraints apply to outer rect, thus include layout element margins.
Definition qcustomplot.h:1236
UpdatePhase
Definition qcustomplot.h:1221
@ upMargins
Phase in which the margins are calculated and set.
Definition qcustomplot.h:1222
@ upLayout
Final phase in which the layout system places the rects of the elements.
Definition qcustomplot.h:1223
@ upPreparation
Phase used for any type of preparation that needs to be done before margin calculation and layout.
Definition qcustomplot.h:1221
QRect rect() const
Definition qcustomplot.h:1245
QRect outerRect() const
Definition qcustomplot.h:1246
QCPLayoutElement(QCustomPlot *parentPlot=nullptr)
Definition qcustomplot.cpp:3207
void setSizeConstraintRect(SizeConstraintRect constraintRect)
Definition qcustomplot.cpp:3373
void setOuterRect(const QRect &rect)
Definition qcustomplot.cpp:3240
QCPLayout * layout() const
Definition qcustomplot.h:1244
void setMinimumSize(const QSize &size)
Definition qcustomplot.cpp:3313
void setMaximumSize(const QSize &size)
Definition qcustomplot.cpp:3342
void setMargins(const QMargins &margins)
Definition qcustomplot.cpp:3260
A layout that arranges child elements in a grid.
Definition qcustomplot.h:1347
int rowCount() const
Definition qcustomplot.h:1377
int columnCount() const
Definition qcustomplot.h:1378
void setRowStretchFactors(const QList< double > &factors)
Definition qcustomplot.cpp:4318
void setColumnSpacing(int pixels)
Definition qcustomplot.cpp:4340
void setColumnStretchFactors(const QList< double > &factors)
Definition qcustomplot.cpp:4265
FillOrder
Definition qcustomplot.h:1368
@ foRowsFirst
Rows are filled first, and a new element is wrapped to the next column if the row count would exceed ...
Definition qcustomplot.h:1368
@ foColumnsFirst
Columns are filled first, and a new element is wrapped to the next row if the column count would exce...
Definition qcustomplot.h:1369
virtual int elementCount() const Q_DECL_OVERRIDE
Definition qcustomplot.h:1398
void setRowSpacing(int pixels)
Definition qcustomplot.cpp:4350
QCPLayoutGrid()
Definition qcustomplot.cpp:4104
void setWrap(int count)
Definition qcustomplot.cpp:4372
void setFillOrder(FillOrder order, bool rearrange=true)
Definition qcustomplot.cpp:4402
The abstract base class for layouts.
Definition qcustomplot.h:1307
void clear()
Definition qcustomplot.cpp:3776
QCPLayout()
Definition qcustomplot.cpp:3666
bool removeAt(int index)
Definition qcustomplot.cpp:3739
virtual void simplify()
Definition qcustomplot.cpp:3724
virtual void update(UpdatePhase phase) Q_DECL_OVERRIDE
Definition qcustomplot.cpp:3679
bool remove(QCPLayoutElement *element)
Definition qcustomplot.cpp:3760
virtual QCPLayoutElement * takeAt(int index)=0
virtual QCPLayoutElement * elementAt(int index) const =0
virtual QList< QCPLayoutElement * > elements(bool recursive) const Q_DECL_OVERRIDE
Definition qcustomplot.cpp:3697
virtual int elementCount() const =0
virtual bool take(QCPLayoutElement *element)=0
void sizeConstraintsChanged() const
Definition qcustomplot.cpp:3794
A layout that places child elements aligned to the border or arbitrarily positioned.
Definition qcustomplot.h:1438
QCPLayoutInset()
Definition qcustomplot.cpp:4887
InsetPlacement
Definition qcustomplot.h:1444
@ ipFree
The element may be positioned/sized arbitrarily, see setInsetRect.
Definition qcustomplot.h:1444
@ ipBorderAligned
The element is aligned to one of the layout sides, see setInsetAlignment.
Definition qcustomplot.h:1445
virtual void simplify() Q_DECL_OVERRIDE
Definition qcustomplot.h:1468
Manages a legend inside a QCustomPlot.
Definition qcustomplot.h:5102
QCPLegend()
Definition qcustomplot.cpp:19054
Q_SLOT void setSelectedParts(const SelectableParts &selectedParts)
Definition qcustomplot.cpp:19239
void setSelectedBorderPen(const QPen &pen)
Definition qcustomplot.cpp:19270
void setIconBorderPen(const QPen &pen)
Definition qcustomplot.cpp:19194
void setBrush(const QBrush &brush)
Definition qcustomplot.cpp:19118
SelectablePart
Definition qcustomplot.h:5126
@ spLegendBox
0x001 The legend box (frame)
Definition qcustomplot.h:5127
@ spNone
0x000 None
Definition qcustomplot.h:5126
@ spItems
0x002 Legend items individually (see selectedItems)
Definition qcustomplot.h:5128
void setIconTextPadding(int padding)
Definition qcustomplot.cpp:19183
void setSelectedTextColor(const QColor &color)
Definition qcustomplot.cpp:19320
void selectionChanged(QCPLegend::SelectableParts parts)
void setBorderPen(const QPen &pen)
Definition qcustomplot.cpp:19110
void setSelectedBrush(const QBrush &brush)
Definition qcustomplot.cpp:19291
void setIconSize(const QSize &size)
Definition qcustomplot.cpp:19165
Q_SLOT void setSelectableParts(const SelectableParts &selectableParts)
Definition qcustomplot.cpp:19209
void setFont(const QFont &font)
Definition qcustomplot.cpp:19132
void setSelectedFont(const QFont &font)
Definition qcustomplot.cpp:19303
void setSelectedIconBorderPen(const QPen &pen)
Definition qcustomplot.cpp:19280
void setTextColor(const QColor &color)
Definition qcustomplot.cpp:19151
Handles the different ending decorations for line-like items.
Definition qcustomplot.h:1494
EndingStyle
Definition qcustomplot.h:1508
@ esHalfBar
A bar perpendicular to the line, pointing out to only one side (to which side can be changed with set...
Definition qcustomplot.h:1516
@ esSkewedBar
A bar that is skewed (skew controllable via setLength)
Definition qcustomplot.h:1517
@ esBar
A bar perpendicular to the line.
Definition qcustomplot.h:1515
@ esDiamond
A filled diamond (45 degrees rotated square)
Definition qcustomplot.h:1514
@ esFlatArrow
A filled arrow head with a straight/flat back (a triangle)
Definition qcustomplot.h:1509
@ esLineArrow
A non-filled arrow head with open back.
Definition qcustomplot.h:1511
@ esSpikeArrow
A filled arrow head with an indented back.
Definition qcustomplot.h:1510
@ esNone
No ending decoration.
Definition qcustomplot.h:1508
@ esSquare
A filled square.
Definition qcustomplot.h:1513
@ esDisc
A filled circle.
Definition qcustomplot.h:1512
QCPLineEnding()
Definition qcustomplot.cpp:5193
A margin group allows synchronization of margin sides if working with multiple layout elements.
Definition qcustomplot.h:1173
QCPMarginGroup(QCustomPlot *parentPlot)
Definition qcustomplot.cpp:3041
QList< QCPLayoutElement * > elements(QCP::MarginSide side) const
Definition qcustomplot.h:1180
void clear(const QColor &color) Q_DECL_OVERRIDE
Definition qcustomplot.cpp:697
virtual QCPPainter * startPainting() Q_DECL_OVERRIDE
Definition qcustomplot.cpp:678
virtual void reallocateBuffer() Q_DECL_OVERRIDE
Definition qcustomplot.cpp:703
QCPPaintBufferPixmap(const QSize &size, double devicePixelRatio)
Definition qcustomplot.cpp:667
virtual void draw(QCPPainter *painter) const Q_DECL_OVERRIDE
Definition qcustomplot.cpp:688
QPainter subclass used internally.
Definition qcustomplot.h:481
void drawLine(const QLineF &line)
Definition qcustomplot.cpp:371
PainterMode
Definition qcustomplot.h:488
@ pmDefault
0x00 Default mode for painting on screen devices
Definition qcustomplot.h:488
@ pmNonCosmetic
0x04 Turns pen widths 0 to 1, i.e. disables cosmetic pens. (A cosmetic pen is always drawn with width...
Definition qcustomplot.h:491
@ pmNoCaching
0x02 Mode for all sorts of exports (e.g. PNG, PDF,...). For example, this prevents using cached pixma...
Definition qcustomplot.h:490
@ pmVectorized
0x01 Mode for vectorized painting (e.g. PDF export). For example, this prevents some antialiasing fix...
Definition qcustomplot.h:489
QCPPainter()
Definition qcustomplot.cpp:297
void setPen(const QPen &pen)
Definition qcustomplot.cpp:328
Defines an abstract interface for one-dimensional plottables.
Definition qcustomplot.h:4124
virtual QCPDataSelection selectTestRect(const QRectF &rect, bool onlySelectable) const =0
virtual double dataMainValue(int index) const =0
virtual int findEnd(double sortKey, bool expandedRange=true) const =0
virtual QPointF dataPixelPosition(int index) const =0
virtual double dataMainKey(int index) const =0
virtual double dataSortKey(int index) const =0
virtual int findBegin(double sortKey, bool expandedRange=true) const =0
virtual bool sortKeyIsMainKey() const =0
virtual int dataCount() const =0
virtual QCPRange dataValueRange(int index) const =0
virtual QSize minimumOuterSizeHint() const Q_DECL_OVERRIDE
Definition qcustomplot.cpp:18983
QCPPlottableLegendItem(QCPLegend *parent, QCPAbstractPlottable *plottable)
Definition qcustomplot.cpp:18907
The main container for polar plots, representing the angular axis as a circle.
Definition qcustomplot.h:7222
int height() const
Definition qcustomplot.h:7382
QSize size() const
Definition qcustomplot.h:7383
QPointF center() const
Definition qcustomplot.h:7388
int left() const
Definition qcustomplot.h:7377
SelectablePart
Definition qcustomplot.h:7232
@ spTickLabels
Tick labels (numbers) of this axis (as a whole, not individually)
Definition qcustomplot.h:7234
@ spNone
None of the selectable parts.
Definition qcustomplot.h:7232
@ spAxis
The axis backbone and tick marks.
Definition qcustomplot.h:7233
@ spAxisLabel
The axis label.
Definition qcustomplot.h:7235
QPoint topRight() const
Definition qcustomplot.h:7385
QPoint topLeft() const
Definition qcustomplot.h:7384
QPoint bottomLeft() const
Definition qcustomplot.h:7386
int bottom() const
Definition qcustomplot.h:7380
QCPLayoutInset * insetLayout() const
Definition qcustomplot.h:7363
int right() const
Definition qcustomplot.h:7378
int width() const
Definition qcustomplot.h:7381
int top() const
Definition qcustomplot.h:7379
LabelMode
Definition qcustomplot.h:7244
QPoint bottomRight() const
Definition qcustomplot.h:7387
QCPPolarAxisAngular(QCustomPlot *parentPlot)
Definition qcustomplot.cpp:32539
The radial axis inside a radial plot.
Definition qcustomplot.h:6971
QSharedPointer< QCPAxisTicker > ticker() const
Definition qcustomplot.h:7024
virtual void mousePressEvent(QMouseEvent *event, const QVariant &details) Q_DECL_OVERRIDE
Definition qcustomplot.cpp:32146
ScaleType
Definition qcustomplot.h:6988
@ stLogarithmic
Logarithmic scaling with correspondingly transformed axis coordinates (possibly also setTicker to a Q...
Definition qcustomplot.h:6989
@ stLinear
Linear scaling.
Definition qcustomplot.h:6988
AngleReference
Definition qcustomplot.h:6980
@ arAngularAxis
The axis tilt is measured in the angular coordinate system given by the parent angular axis.
Definition qcustomplot.h:6981
@ arAbsolute
The axis tilt is given in absolute degrees. The zero is to the right and positive angles are measured...
Definition qcustomplot.h:6980
virtual void mouseReleaseEvent(QMouseEvent *event, const QPointF &startPos) Q_DECL_OVERRIDE
Definition qcustomplot.cpp:32220
void selectionChanged(const QCPPolarAxisRadial::SelectableParts &parts)
void scaleTypeChanged(QCPPolarAxisRadial::ScaleType scaleType)
void rangeChanged(const QCPRange &newRange)
virtual void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE
Definition qcustomplot.cpp:32247
virtual void mouseMoveEvent(QMouseEvent *event, const QPointF &startPos) Q_DECL_OVERRIDE
Definition qcustomplot.cpp:32182
QCPPolarAxisRadial(QCPPolarAxisAngular *parent)
Definition qcustomplot.cpp:31064
void selectableChanged(const QCPPolarAxisRadial::SelectableParts &parts)
SelectablePart
Definition qcustomplot.h:6996
@ spTickLabels
Tick labels (numbers) of this axis (as a whole, not individually)
Definition qcustomplot.h:6998
@ spAxis
The axis backbone and tick marks.
Definition qcustomplot.h:6997
@ spNone
None of the selectable parts.
Definition qcustomplot.h:6996
@ spAxisLabel
The axis label.
Definition qcustomplot.h:6999
A radial graph used to display data in polar plots.
Definition qcustomplot.h:7600
LineStyle
Definition qcustomplot.h:7611
@ lsNone
Definition qcustomplot.h:7611
@ lsLine
data points are connected by a straight line
Definition qcustomplot.h:7613
QCPPolarGraph(QCPPolarAxisAngular *keyAxis, QCPPolarAxisRadial *valueAxis)
Definition qcustomplot.cpp:34423
The grid in both angular and radial dimensions for polar plots.
Definition qcustomplot.h:7495
QCPPolarGrid(QCPPolarAxisAngular *parentAxis)
Definition qcustomplot.cpp:34147
GridType
Definition qcustomplot.h:7504
virtual QSize minimumOuterSizeHint() const Q_DECL_OVERRIDE
Definition qcustomplot.cpp:34362
Represents the range an axis is encompassing.
Definition qcustomplot.h:797
void expand(const QCPRange &otherRange)
Definition qcustomplot.cpp:1959
friend const QCPRange operator/(const QCPRange &range, double value)
Definition qcustomplot.h:901
friend const QCPRange operator*(const QCPRange &range, double value)
Definition qcustomplot.h:881
static const double maxRange
Definition qcustomplot.h:833
QCPRange & operator/=(const double &value)
Definition qcustomplot.h:810
double size() const
Definition qcustomplot.h:818
QCPRange & operator*=(const double &value)
Definition qcustomplot.h:809
friend const QCPRange operator-(const QCPRange &range, double value)
Definition qcustomplot.h:871
QCPRange & operator-=(const double &value)
Definition qcustomplot.h:808
static const double minRange
Definition qcustomplot.h:832
QCPRange()
Definition qcustomplot.cpp:1927
bool contains(double value) const
Definition qcustomplot.h:828
friend const QCPRange operator+(const QCPRange &, double)
Definition qcustomplot.h:851
double center() const
Definition qcustomplot.h:819
void normalize()
Definition qcustomplot.h:820
QCPRange & operator+=(const double &value)
Definition qcustomplot.h:807
Represents the visual appearance of scatter points.
Definition qcustomplot.h:2463
bool isPenDefined() const
Definition qcustomplot.h:2540
bool isNone() const
Definition qcustomplot.h:2539
QCPScatterStyle()
Definition qcustomplot.cpp:10635
ScatterProperty
Definition qcustomplot.h:2474
@ spShape
0x08 The shape property, see setShape
Definition qcustomplot.h:2478
@ spSize
0x04 The size property, see setSize
Definition qcustomplot.h:2477
@ spNone
0x00 None
Definition qcustomplot.h:2474
@ spPen
0x01 The pen property, see setPen
Definition qcustomplot.h:2475
@ spBrush
0x02 The brush property, see setBrush
Definition qcustomplot.h:2476
@ spAll
0xFF All properties
Definition qcustomplot.h:2479
ScatterShape
Definition qcustomplot.h:2492
@ ssDot
\enumimage{ssDot.png} a single pixel (use ssDisc or ssCircle if you want a round shape with a certain...
Definition qcustomplot.h:2493
@ ssCustom
custom painter operations are performed per scatter (As QPainterPath, see setCustomPath)
Definition qcustomplot.h:2509
@ ssSquare
\enumimage{ssSquare.png} a square
Definition qcustomplot.h:2498
@ ssDisc
\enumimage{ssDisc.png} a circle which is filled with the pen's color (not the brush as with ssCircle)
Definition qcustomplot.h:2497
@ ssPlus
\enumimage{ssPlus.png} a plus
Definition qcustomplot.h:2495
@ ssDiamond
\enumimage{ssDiamond.png} a diamond
Definition qcustomplot.h:2499
@ ssCrossCircle
\enumimage{ssCrossCircle.png} a circle with a cross inside
Definition qcustomplot.h:2505
@ ssPlusSquare
\enumimage{ssPlusSquare.png} a square with a plus inside
Definition qcustomplot.h:2504
@ ssStar
\enumimage{ssStar.png} a star with eight arms, i.e. a combination of cross and plus
Definition qcustomplot.h:2500
@ ssTriangleInverted
\enumimage{ssTriangleInverted.png} an equilateral triangle, standing on corner
Definition qcustomplot.h:2502
@ ssPlusCircle
\enumimage{ssPlusCircle.png} a circle with a plus inside
Definition qcustomplot.h:2506
@ ssCrossSquare
\enumimage{ssCrossSquare.png} a square with a cross inside
Definition qcustomplot.h:2503
@ ssTriangle
\enumimage{ssTriangle.png} an equilateral triangle, standing on baseline
Definition qcustomplot.h:2501
@ ssCircle
\enumimage{ssCircle.png} a circle
Definition qcustomplot.h:2496
@ ssPixmap
a custom pixmap specified by setPixmap, centered on the data point coordinates
Definition qcustomplot.h:2508
@ ssCross
\enumimage{ssCross.png} a cross
Definition qcustomplot.h:2494
@ ssNone
no scatter symbols are drawn (e.g. in QCPGraph, data only represented with lines)
Definition qcustomplot.h:2492
@ ssPeace
\enumimage{ssPeace.png} a circle, with one vertical and two downward diagonal lines
Definition qcustomplot.h:2507
A selection decorator which draws brackets around each selected data segment.
Definition qcustomplot.h:4819
BracketStyle
Definition qcustomplot.h:4829
@ bsUserStyle
Start custom bracket styles at this index when subclassing and reimplementing drawBracket.
Definition qcustomplot.h:4833
@ bsEllipse
An ellipse is drawn. The size of the ellipse is given by the bracket width/height properties.
Definition qcustomplot.h:4831
@ bsPlus
A plus is drawn.
Definition qcustomplot.h:4832
@ bsSquareBracket
A square bracket is drawn.
Definition qcustomplot.h:4829
@ bsHalfEllipse
A half ellipse is drawn. The size of the ellipse is given by the bracket width/height properties.
Definition qcustomplot.h:4830
QCPSelectionDecoratorBracket()
Definition qcustomplot.cpp:17143
Controls how a plottable's data selection is drawn.
Definition qcustomplot.h:3412
QCPScatterStyle getFinalScatterStyle(const QCPScatterStyle &unselectedStyle) const
Definition qcustomplot.cpp:11137
void applyBrush(QCPPainter *painter) const
Definition qcustomplot.cpp:11124
virtual void copyFrom(const QCPSelectionDecorator *other)
Definition qcustomplot.cpp:11155
virtual void drawDecoration(QCPPainter *painter, QCPDataSelection selection)
Definition qcustomplot.cpp:11170
void applyPen(QCPPainter *painter) const
Definition qcustomplot.cpp:11114
void setUsedScatterProperties(const QCPScatterStyle::ScatterProperties &properties)
Definition qcustomplot.cpp:11104
QCPSelectionDecorator()
Definition qcustomplot.cpp:11056
void setBrush(const QBrush &brush)
Definition qcustomplot.cpp:11079
void setScatterStyle(const QCPScatterStyle &scatterStyle, QCPScatterStyle::ScatterProperties usedProperties=QCPScatterStyle::spPen)
Definition qcustomplot.cpp:11091
void setPen(const QPen &pen)
Definition qcustomplot.cpp:11071
Provides rect/rubber-band data selection and range zoom interaction.
Definition qcustomplot.h:1119
void accepted(const QRect &rect, QMouseEvent *event)
void changed(const QRect &rect, QMouseEvent *event)
QCPRange range(const QCPAxis *axis) const
Definition qcustomplot.cpp:2863
void started(QMouseEvent *event)
bool isActive() const
Definition qcustomplot.h:1130
QCPSelectionRect(QCustomPlot *parentPlot)
Definition qcustomplot.cpp:2846
void canceled(const QRect &rect, QInputEvent *event)
double mainValue() const
Definition qcustomplot.h:5879
double sortKey() const
Definition qcustomplot.h:5874
QCPRange valueRange() const
Definition qcustomplot.h:5881
double mainKey() const
Definition qcustomplot.h:5878
static QCPStatisticalBoxData fromSortKey(double sortKey)
Definition qcustomplot.h:5875
QCPStatisticalBoxData()
Definition qcustomplot.cpp:25193
static bool sortKeyIsMainKey()
Definition qcustomplot.h:5876
void setWidth(double width)
Definition qcustomplot.cpp:25348
void setWhiskerPen(const QPen &pen)
Definition qcustomplot.cpp:25377
void setWhiskerAntialiased(bool enabled)
Definition qcustomplot.cpp:25402
void setMedianPen(const QPen &pen)
Definition qcustomplot.cpp:25410
QSharedPointer< QCPStatisticalBoxDataContainer > data() const
Definition qcustomplot.h:5923
QCPStatisticalBox(QCPAxis *keyAxis, QCPAxis *valueAxis)
Definition qcustomplot.cpp:25292
void setWhiskerBarPen(const QPen &pen)
Definition qcustomplot.cpp:25391
void setOutlierStyle(const QCPScatterStyle &style)
Definition qcustomplot.cpp:25421
void setWhiskerWidth(double width)
Definition qcustomplot.cpp:25361
void setFont(const QFont &font)
Definition qcustomplot.cpp:19813
void setSelectedFont(const QFont &font)
Definition qcustomplot.cpp:19833
virtual void mouseDoubleClickEvent(QMouseEvent *event, const QVariant &details) Q_DECL_OVERRIDE
Definition qcustomplot.cpp:19990
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE
Definition qcustomplot.cpp:19949
Q_SLOT void setSelectable(bool selectable)
Definition qcustomplot.cpp:19854
virtual QSize minimumOuterSizeHint() const Q_DECL_OVERRIDE
Definition qcustomplot.cpp:19894
void selectionChanged(bool selected)
void setTextColor(const QColor &color)
Definition qcustomplot.cpp:19823
void doubleClicked(QMouseEvent *event)
void setTextFlags(int flags)
Definition qcustomplot.cpp:19803
Q_SLOT void setSelected(bool selected)
Definition qcustomplot.cpp:19870
void setSelectedTextColor(const QColor &color)
Definition qcustomplot.cpp:19843
void setText(const QString &text)
Definition qcustomplot.cpp:19778
virtual void mouseReleaseEvent(QMouseEvent *event, const QPointF &startPos) Q_DECL_OVERRIDE
Definition qcustomplot.cpp:19979
void clicked(QMouseEvent *event)
virtual void mousePressEvent(QMouseEvent *event, const QVariant &details) Q_DECL_OVERRIDE
Definition qcustomplot.cpp:19967
QCPTextElement(QCustomPlot *parentPlot)
Definition qcustomplot.cpp:19660
virtual QSize maximumOuterSizeHint() const Q_DECL_OVERRIDE
Definition qcustomplot.cpp:19904
Represents two doubles as a mathematical 2D vector.
Definition qcustomplot.h:406
QCPVector2D()
Definition qcustomplot.cpp:118
QCPVector2D perpendicular() const
Definition qcustomplot.h:433
double length() const
Definition qcustomplot.h:424
double angle() const
Definition qcustomplot.h:426
double dot(const QCPVector2D &vec) const
Definition qcustomplot.h:434
double lengthSquared() const
Definition qcustomplot.h:425
void setX(double x)
Definition qcustomplot.h:420
QPointF toPointF() const
Definition qcustomplot.h:428
bool isNull() const
Definition qcustomplot.h:430
void setY(double y)
Definition qcustomplot.h:421
QPoint toPoint() const
Definition qcustomplot.h:427
The central class of the library. This is the QWidget which displays the plot and interacts with the ...
Definition qcustomplot.h:3754
void legendDoubleClick(QCPLegend *legend, QCPAbstractLegendItem *item, QMouseEvent *event)
void beforeReplot()
void setBackground(const QPixmap &pm)
Definition qcustomplot.cpp:14166
QCPAbstractPlottable * plottable(int index)
Definition qcustomplot.cpp:14239
void setBackgroundScaled(bool scaled)
Definition qcustomplot.cpp:14215
QCustomPlot(QWidget *parent=nullptr)
Definition qcustomplot.cpp:13593
void setViewport(const QRect &rect)
Definition qcustomplot.cpp:14117
RefreshPriority
Definition qcustomplot.h:3784
@ rpQueuedReplot
Queues the entire replot for the next event loop iteration. This way multiple redundant replots can b...
Definition qcustomplot.h:3787
@ rpRefreshHint
Whether to use immediate or queued refresh depends on whether the plotting hint QCP::phImmediateRefre...
Definition qcustomplot.h:3786
@ rpImmediateRefresh
Replots immediately and repaints the widget immediately by calling QWidget::repaint() after the replo...
Definition qcustomplot.h:3784
@ rpQueuedRefresh
Replots immediately, but queues the widget repaint, by calling QWidget::update() after the replot....
Definition qcustomplot.h:3785
void setBackgroundScaledMode(Qt::AspectRatioMode mode)
Definition qcustomplot.cpp:14226
void setSelectionTolerance(int pixels)
Definition qcustomplot.cpp:13897
void selectionChangedByUser()
PlottableType * plottableAt(const QPointF &pos, bool onlySelectable=false, int *dataIndex=nullptr) const
Definition qcustomplot.h:4044
void axisDoubleClick(QCPAxis *axis, QCPAxis::SelectablePart part, QMouseEvent *event)
QCPGraph * graph(int index) const
Definition qcustomplot.cpp:14383
void afterReplot()
QCPLegend * legend
Definition qcustomplot.h:3908
void mouseMove(QMouseEvent *event)
LayerInsertMode
Definition qcustomplot.h:3774
@ limAbove
Layer is inserted above other layer.
Definition qcustomplot.h:3775
@ limBelow
Layer is inserted below other layer.
Definition qcustomplot.h:3774
void setNoAntialiasingOnDrag(bool enabled)
Definition qcustomplot.cpp:13911
void legendClick(QCPLegend *legend, QCPAbstractLegendItem *item, QMouseEvent *event)
void setOpenGl(bool enabled, int multisampling=16)
Definition qcustomplot.cpp:14063
void plottableDoubleClick(QCPAbstractPlottable *plottable, int dataIndex, QMouseEvent *event)
ItemType * itemAt(const QPointF &pos, bool onlySelectable=false) const
Definition qcustomplot.h:4091
void setMultiSelectModifier(Qt::KeyboardModifier modifier)
Definition qcustomplot.cpp:13953
QCPAxis * xAxis
Definition qcustomplot.h:3907
void mouseDoubleClick(QMouseEvent *event)
void afterLayout()
void axisClick(QCPAxis *axis, QCPAxis::SelectablePart part, QMouseEvent *event)
QCPAbstractItem * item(int index) const
Definition qcustomplot.cpp:14523
void mouseWheel(QWheelEvent *event)
void itemDoubleClick(QCPAbstractItem *item, QMouseEvent *event)
void mouseRelease(QMouseEvent *event)
void mousePress(QMouseEvent *event)
bool hasInvalidatedPaintBuffers()
Definition qcustomplot.cpp:15893
QCPSelectionRect * selectionRect() const
Definition qcustomplot.h:3810
void setAutoAddPlottableToLegend(bool on)
Definition qcustomplot.cpp:13805
QCPAxis * xAxis2
Definition qcustomplot.h:3907
void itemClick(QCPAbstractItem *item, QMouseEvent *event)
QCPAxis * yAxis2
Definition qcustomplot.h:3907
QCPLayoutGrid * plotLayout() const
Definition qcustomplot.h:3800
void plottableClick(QCPAbstractPlottable *plottable, int dataIndex, QMouseEvent *event)
QCPAxis * yAxis
Definition qcustomplot.h:3907
Definition qcustomplot.h:160
ExportPen
Definition qcustomplot.h:196
@ epAllowCosmetic
Cosmetic pens are exported normally (e.g. in PDF exports, cosmetic pens always appear as 1 pixel on s...
Definition qcustomplot.h:197
@ epNoCosmetic
Cosmetic pens are converted to pens with pixel width 1 when exporting.
Definition qcustomplot.h:196
Interaction
Definition qcustomplot.h:272
@ iSelectLegend
0x020 Legends are selectable (or their child items, see QCPLegend::setSelectableParts)
Definition qcustomplot.h:278
@ iRangeDrag
0x001 Axis ranges are draggable (see QCPAxisRect::setRangeDrag, QCPAxisRect::setRangeDragAxes)
Definition qcustomplot.h:273
@ iSelectPlottables
0x008 Plottables are selectable (e.g. graphs, curves, bars,... see QCPAbstractPlottable)
Definition qcustomplot.h:276
@ iNone
0x000 None of the interactions are possible
Definition qcustomplot.h:272
@ iRangeZoom
0x002 Axis ranges are zoomable with the mouse wheel (see QCPAxisRect::setRangeZoom,...
Definition qcustomplot.h:274
@ iSelectPlottablesBeyondAxisRect
0x100 When performing plottable selection/hit tests, this flag extends the sensitive area beyond the ...
Definition qcustomplot.h:281
@ iSelectAxes
0x010 Axes are selectable (or parts of them, see QCPAxis::setSelectableParts)
Definition qcustomplot.h:277
@ iSelectItems
0x040 Items are selectable (Rectangles, Arrows, Textitems, etc. see QCPAbstractItem)
Definition qcustomplot.h:279
@ iMultiSelect
0x004 The user can select multiple objects by holding the modifier set by QCustomPlot::setMultiSelect...
Definition qcustomplot.h:275
@ iSelectOther
0x080 All other objects are selectable (e.g. your own derived layerables, other layout elements,...
Definition qcustomplot.h:280
PlottingHint
Definition qcustomplot.h:256
@ phImmediateRefresh
Definition qcustomplot.h:259
@ phCacheLabels
0x004 axis (tick) labels will be cached as pixmaps, increasing replot performance.
Definition qcustomplot.h:261
@ phFastPolylines
Definition qcustomplot.h:257
@ phNone
0x000 No hints are set
Definition qcustomplot.h:256
ResolutionUnit
Definition qcustomplot.h:186
@ ruDotsPerCentimeter
Resolution is given in dots per centimeter (dpcm)
Definition qcustomplot.h:187
@ ruDotsPerMeter
Resolution is given in dots per meter (dpm)
Definition qcustomplot.h:186
@ ruDotsPerInch
Resolution is given in dots per inch (DPI/PPI)
Definition qcustomplot.h:188
MarginSide
Definition qcustomplot.h:217
@ msAll
0xFF all margins
Definition qcustomplot.h:221
@ msBottom
0x08 bottom margin
Definition qcustomplot.h:220
@ msTop
0x04 top margin
Definition qcustomplot.h:219
@ msNone
0x00 no margin
Definition qcustomplot.h:222
@ msRight
0x02 right margin
Definition qcustomplot.h:218
@ msLeft
0x01 left margin
Definition qcustomplot.h:217
SelectionType
Definition qcustomplot.h:314
@ stMultipleDataRanges
Any combination of data points/ranges can be selected.
Definition qcustomplot.h:318
@ stDataRange
Multiple contiguous data points (a data range) can be selected.
Definition qcustomplot.h:317
@ stNone
The plottable is not selectable.
Definition qcustomplot.h:314
@ stSingleData
One individual data point can be selected at a time.
Definition qcustomplot.h:316
@ stWhole
Selection behaves like stMultipleDataRanges, but if there are any data points selected,...
Definition qcustomplot.h:315
SelectionRectMode
Definition qcustomplot.h:290
@ srmCustom
When dragging the mouse, a selection rect becomes active. It is the programmer's responsibility to co...
Definition qcustomplot.h:293
@ srmSelect
When dragging the mouse, a selection rect becomes active. Upon releasing, plottable data points that ...
Definition qcustomplot.h:292
@ srmZoom
When dragging the mouse, a selection rect becomes active. Upon releasing, the axes that are currently...
Definition qcustomplot.h:291
@ srmNone
The selection rect is disabled, and all mouse events are forwarded to the underlying objects,...
Definition qcustomplot.h:290
AntialiasedElement
Definition qcustomplot.h:235
@ aeLegendItems
0x0010 Legend items
Definition qcustomplot.h:239
@ aeZeroLine
0x0200 Zero-lines, see QCPGrid::setZeroLinePen
Definition qcustomplot.h:244
@ aePlottables
0x0020 Main lines of plottables
Definition qcustomplot.h:240
@ aeGrid
0x0002 Grid lines
Definition qcustomplot.h:236
@ aeOther
0x8000 Other elements that don't fit into any of the existing categories
Definition qcustomplot.h:245
@ aeFills
0x0100 Borders of fills (e.g. under or between graphs)
Definition qcustomplot.h:243
@ aeLegend
0x0008 Legend box
Definition qcustomplot.h:238
@ aeAll
0xFFFF All elements
Definition qcustomplot.h:246
@ aeNone
0x0000 No elements
Definition qcustomplot.h:247
@ aeSubGrid
0x0004 Sub grid lines
Definition qcustomplot.h:237
@ aeScatters
0x0080 Scatter symbols of plottables (excluding scatter symbols of type ssPixmap)
Definition qcustomplot.h:242
@ aeAxes
0x0001 Axis base line and tick marks
Definition qcustomplot.h:235
@ aeItems
0x0040 Main lines of items
Definition qcustomplot.h:241
SignDomain
Definition qcustomplot.h:207
@ sdNegative
The negative sign domain, i.e. numbers smaller than zero.
Definition qcustomplot.h:207
@ sdPositive
The positive sign domain, i.e. numbers greater than zero.
Definition qcustomplot.h:209
@ sdBoth
Both sign domains, including zero, i.e. all numbers.
Definition qcustomplot.h:208
Definition qcustomplot.h:2432
Definition qcustomplot.h:2437
Definition qcustomplot.h:1635
Definition qcustomplot.h:1640