Cute Chess  0.1
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 
106 class QCPPainter;
107 class QCustomPlot;
108 class QCPLayerable;
109 class QCPLayoutElement;
110 class QCPLayout;
111 class QCPAxis;
112 class QCPAxisRect;
115 class QCPGraph;
116 class QCPAbstractItem;
118 class QCPLegend;
119 class QCPItemPosition;
120 class QCPLayer;
122 class QCPSelectionRect;
123 class QCPColorMap;
124 class QCPColorScale;
125 class QCPBars;
126 class QCPPolarAxisRadial;
127 class QCPPolarAxisAngular;
128 class QCPPolarGrid;
129 class 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 namespace QCP {
160  Q_NAMESPACE
161 
171  };
172 
180  };
181 
192  };
193 
199 enum MarginSide { msLeft = 0x01
200  ,msRight = 0x02
201  ,msTop = 0x04
202  ,msBottom = 0x08
203  ,msAll = 0xFF
204  ,msNone = 0x00
205  };
206 Q_DECLARE_FLAGS(MarginSides, MarginSide)
207 
208 
217 enum AntialiasedElement { aeAxes = 0x0001
218  ,aeGrid = 0x0002
219  ,aeSubGrid = 0x0004
220  ,aeLegend = 0x0008
221  ,aeLegendItems = 0x0010
222  ,aePlottables = 0x0020
223  ,aeItems = 0x0040
224  ,aeScatters = 0x0080
225  ,aeFills = 0x0100
226  ,aeZeroLine = 0x0200
227  ,aeOther = 0x8000
228  ,aeAll = 0xFFFF
229  ,aeNone = 0x0000
230  };
231 Q_DECLARE_FLAGS(AntialiasedElements, AntialiasedElement)
232 
233 
238 enum PlottingHint { phNone = 0x000
239  ,phFastPolylines = 0x001
240  ,phImmediateRefresh = 0x002
242  ,phCacheLabels = 0x004
244  };
245 Q_DECLARE_FLAGS(PlottingHints, PlottingHint)
246 
247 
254 enum Interaction { iNone = 0x000
255  ,iRangeDrag = 0x001
256  ,iRangeZoom = 0x002
257  ,iMultiSelect = 0x004
259  ,iSelectAxes = 0x010
260  ,iSelectLegend = 0x020
261  ,iSelectItems = 0x040
262  ,iSelectOther = 0x080
264  };
265 Q_DECLARE_FLAGS(Interactions, Interaction)
266 
267 
276  };
277 
301  };
302 
303  Q_ENUM_NS(ExportPen)
304  Q_ENUM_NS(ResolutionUnit)
305  Q_ENUM_NS(SignDomain)
306  Q_ENUM_NS(MarginSide)
307  Q_FLAG_NS(MarginSides)
308  Q_ENUM_NS(AntialiasedElement)
309  Q_FLAG_NS(AntialiasedElements)
310  Q_ENUM_NS(PlottingHint)
311  Q_FLAG_NS(PlottingHints)
312  Q_ENUM_NS(Interaction)
313  Q_FLAG_NS(Interactions)
314  Q_ENUM_NS(SelectionRectMode)
315  Q_ENUM_NS(SelectionType)
316 
317 
323 inline bool isInvalidData(double value)
324 {
325  return qIsNaN(value) || qIsInf(value);
326 }
327 
333 inline bool isInvalidData(double value1, double value2)
334 {
335  return isInvalidData(value1) || isInvalidData(value2);
336 }
337 
344 inline void setMarginValue(QMargins &margins, QCP::MarginSide side, int value)
345 {
346  switch (side)
347  {
348  case QCP::msLeft: margins.setLeft(value); break;
349  case QCP::msRight: margins.setRight(value); break;
350  case QCP::msTop: margins.setTop(value); break;
351  case QCP::msBottom: margins.setBottom(value); break;
352  case QCP::msAll: margins = QMargins(value, value, value, value); break;
353  default: break;
354  }
355 }
356 
364 inline int getMarginValue(const QMargins &margins, QCP::MarginSide side)
365 {
366  switch (side)
367  {
368  case QCP::msLeft: return margins.left();
369  case QCP::msRight: return margins.right();
370  case QCP::msTop: return margins.top();
371  case QCP::msBottom: return margins.bottom();
372  default: break;
373  }
374  return 0;
375 }
376 
377 } // end of namespace QCP
378 Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::AntialiasedElements)
379 Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::PlottingHints)
380 Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::MarginSides)
381 Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::Interactions)
382 //no need to use Q_DECLARE_METATYPE on enum since Q_ENUM_NS adds enum as metatype automatically
383 
384 /* end of 'src/global.h' */
385 
386 
387 /* including file 'src/vector2d.h' */
388 /* modified 2021-03-29T02:30:44, size 4988 */
389 
390 class QCP_LIB_DECL QCPVector2D
391 {
392 public:
393  QCPVector2D();
394  QCPVector2D(double x, double y);
395  QCPVector2D(const QPoint &point);
396  QCPVector2D(const QPointF &point);
397 
398  // getters:
399  double x() const { return mX; }
400  double y() const { return mY; }
401  double &rx() { return mX; }
402  double &ry() { return mY; }
403 
404  // setters:
405  void setX(double x) { mX = x; }
406  void setY(double y) { mY = y; }
407 
408  // non-virtual methods:
409  double length() const { return qSqrt(mX*mX+mY*mY); }
410  double lengthSquared() const { return mX*mX+mY*mY; }
411  double angle() const { return qAtan2(mY, mX); }
412  QPoint toPoint() const { return QPoint(int(mX), int(mY)); }
413  QPointF toPointF() const { return QPointF(mX, mY); }
414 
415  bool isNull() const { return qIsNull(mX) && qIsNull(mY); }
416  void normalize();
417  QCPVector2D normalized() const;
418  QCPVector2D perpendicular() const { return QCPVector2D(-mY, mX); }
419  double dot(const QCPVector2D &vec) const { return mX*vec.mX+mY*vec.mY; }
420  double distanceSquaredToLine(const QCPVector2D &start, const QCPVector2D &end) const;
421  double distanceSquaredToLine(const QLineF &line) const;
422  double distanceToStraightLine(const QCPVector2D &base, const QCPVector2D &direction) const;
423 
424  QCPVector2D &operator*=(double factor);
425  QCPVector2D &operator/=(double divisor);
426  QCPVector2D &operator+=(const QCPVector2D &vector);
427  QCPVector2D &operator-=(const QCPVector2D &vector);
428 
429 private:
430  // property members:
431  double mX, mY;
432 
433  friend inline const QCPVector2D operator*(double factor, const QCPVector2D &vec);
434  friend inline const QCPVector2D operator*(const QCPVector2D &vec, double factor);
435  friend inline const QCPVector2D operator/(const QCPVector2D &vec, double divisor);
436  friend inline const QCPVector2D operator+(const QCPVector2D &vec1, const QCPVector2D &vec2);
437  friend inline const QCPVector2D operator-(const QCPVector2D &vec1, const QCPVector2D &vec2);
438  friend inline const QCPVector2D operator-(const QCPVector2D &vec);
439 };
440 Q_DECLARE_TYPEINFO(QCPVector2D, Q_MOVABLE_TYPE);
441 
442 inline const QCPVector2D operator*(double factor, const QCPVector2D &vec) { return QCPVector2D(vec.mX*factor, vec.mY*factor); }
443 inline const QCPVector2D operator*(const QCPVector2D &vec, double factor) { return QCPVector2D(vec.mX*factor, vec.mY*factor); }
444 inline const QCPVector2D operator/(const QCPVector2D &vec, double divisor) { return QCPVector2D(vec.mX/divisor, vec.mY/divisor); }
445 inline const QCPVector2D operator+(const QCPVector2D &vec1, const QCPVector2D &vec2) { return QCPVector2D(vec1.mX+vec2.mX, vec1.mY+vec2.mY); }
446 inline const QCPVector2D operator-(const QCPVector2D &vec1, const QCPVector2D &vec2) { return QCPVector2D(vec1.mX-vec2.mX, vec1.mY-vec2.mY); }
447 inline const QCPVector2D operator-(const QCPVector2D &vec) { return QCPVector2D(-vec.mX, -vec.mY); }
448 
453 inline QDebug operator<< (QDebug d, const QCPVector2D &vec)
454 {
455  d.nospace() << "QCPVector2D(" << vec.x() << ", " << vec.y() << ")";
456  return d.space();
457 }
458 
459 /* end of 'src/vector2d.h' */
460 
461 
462 /* including file 'src/painter.h' */
463 /* modified 2021-03-29T02:30:44, size 4035 */
464 
465 class QCP_LIB_DECL QCPPainter : public QPainter
466 {
467  Q_GADGET
468 public:
473  enum PainterMode { pmDefault = 0x00
474  ,pmVectorized = 0x01
475  ,pmNoCaching = 0x02
476  ,pmNonCosmetic = 0x04
477  };
478  Q_ENUMS(PainterMode)
479  Q_FLAGS(PainterModes)
480  Q_DECLARE_FLAGS(PainterModes, PainterMode)
481 
482  QCPPainter();
483  explicit QCPPainter(QPaintDevice *device);
484 
485  // getters:
486  bool antialiasing() const { return testRenderHint(QPainter::Antialiasing); }
487  PainterModes modes() const { return mModes; }
488 
489  // setters:
490  void setAntialiasing(bool enabled);
491  void setMode(PainterMode mode, bool enabled=true);
492  void setModes(PainterModes modes);
493 
494  // methods hiding non-virtual base class functions (QPainter bug workarounds):
495  bool begin(QPaintDevice *device);
496  void setPen(const QPen &pen);
497  void setPen(const QColor &color);
498  void setPen(Qt::PenStyle penStyle);
499  void drawLine(const QLineF &line);
500  void drawLine(const QPointF &p1, const QPointF &p2) {drawLine(QLineF(p1, p2));}
501  void save();
502  void restore();
503 
504  // non-virtual methods:
505  void makeNonCosmetic();
506 
507 protected:
508  // property members:
509  PainterModes mModes;
510  bool mIsAntialiasing;
511 
512  // non-property members:
513  QStack<bool> mAntialiasingStack;
514 };
515 Q_DECLARE_OPERATORS_FOR_FLAGS(QCPPainter::PainterModes)
516 Q_DECLARE_METATYPE(QCPPainter::PainterMode)
517 
518 /* end of 'src/painter.h' */
519 
520 
521 /* including file 'src/paintbuffer.h' */
522 /* modified 2021-03-29T02:30:44, size 5006 */
523 
524 class QCP_LIB_DECL QCPAbstractPaintBuffer
525 {
526 public:
527  explicit QCPAbstractPaintBuffer(const QSize &size, double devicePixelRatio);
528  virtual ~QCPAbstractPaintBuffer();
529 
530  // getters:
531  QSize size() const { return mSize; }
532  bool invalidated() const { return mInvalidated; }
533  double devicePixelRatio() const { return mDevicePixelRatio; }
534 
535  // setters:
536  void setSize(const QSize &size);
537  void setInvalidated(bool invalidated=true);
538  void setDevicePixelRatio(double ratio);
539 
540  // introduced virtual methods:
541  virtual QCPPainter *startPainting() = 0;
542  virtual void donePainting() {}
543  virtual void draw(QCPPainter *painter) const = 0;
544  virtual void clear(const QColor &color) = 0;
545 
546 protected:
547  // property members:
548  QSize mSize;
549  double mDevicePixelRatio;
550 
551  // non-property members:
552  bool mInvalidated;
553 
554  // introduced virtual methods:
555  virtual void reallocateBuffer() = 0;
556 };
557 
558 
559 class QCP_LIB_DECL QCPPaintBufferPixmap : public QCPAbstractPaintBuffer
560 {
561 public:
562  explicit QCPPaintBufferPixmap(const QSize &size, double devicePixelRatio);
563  virtual ~QCPPaintBufferPixmap() Q_DECL_OVERRIDE;
564 
565  // reimplemented virtual methods:
566  virtual QCPPainter *startPainting() Q_DECL_OVERRIDE;
567  virtual void draw(QCPPainter *painter) const Q_DECL_OVERRIDE;
568  void clear(const QColor &color) Q_DECL_OVERRIDE;
569 
570 protected:
571  // non-property members:
572  QPixmap mBuffer;
573 
574  // reimplemented virtual methods:
575  virtual void reallocateBuffer() Q_DECL_OVERRIDE;
576 };
577 
578 
579 #ifdef QCP_OPENGL_PBUFFER
580 class QCP_LIB_DECL QCPPaintBufferGlPbuffer : public QCPAbstractPaintBuffer
581 {
582 public:
583  explicit QCPPaintBufferGlPbuffer(const QSize &size, double devicePixelRatio, int multisamples);
584  virtual ~QCPPaintBufferGlPbuffer() Q_DECL_OVERRIDE;
585 
586  // reimplemented virtual methods:
587  virtual QCPPainter *startPainting() Q_DECL_OVERRIDE;
588  virtual void draw(QCPPainter *painter) const Q_DECL_OVERRIDE;
589  void clear(const QColor &color) Q_DECL_OVERRIDE;
590 
591 protected:
592  // non-property members:
593  QGLPixelBuffer *mGlPBuffer;
594  int mMultisamples;
595 
596  // reimplemented virtual methods:
597  virtual void reallocateBuffer() Q_DECL_OVERRIDE;
598 };
599 #endif // QCP_OPENGL_PBUFFER
600 
601 
602 #ifdef QCP_OPENGL_FBO
603 class QCP_LIB_DECL QCPPaintBufferGlFbo : public QCPAbstractPaintBuffer
604 {
605 public:
606  explicit QCPPaintBufferGlFbo(const QSize &size, double devicePixelRatio, QWeakPointer<QOpenGLContext> glContext, QWeakPointer<QOpenGLPaintDevice> glPaintDevice);
607  virtual ~QCPPaintBufferGlFbo() Q_DECL_OVERRIDE;
608 
609  // reimplemented virtual methods:
610  virtual QCPPainter *startPainting() Q_DECL_OVERRIDE;
611  virtual void donePainting() Q_DECL_OVERRIDE;
612  virtual void draw(QCPPainter *painter) const Q_DECL_OVERRIDE;
613  void clear(const QColor &color) Q_DECL_OVERRIDE;
614 
615 protected:
616  // non-property members:
617  QWeakPointer<QOpenGLContext> mGlContext;
618  QWeakPointer<QOpenGLPaintDevice> mGlPaintDevice;
619  QOpenGLFramebufferObject *mGlFrameBuffer;
620 
621  // reimplemented virtual methods:
622  virtual void reallocateBuffer() Q_DECL_OVERRIDE;
623 };
624 #endif // QCP_OPENGL_FBO
625 
626 /* end of 'src/paintbuffer.h' */
627 
628 
629 /* including file 'src/layer.h' */
630 /* modified 2021-03-29T02:30:44, size 7038 */
631 
632 class QCP_LIB_DECL QCPLayer : public QObject
633 {
634  Q_OBJECT
636  Q_PROPERTY(QCustomPlot* parentPlot READ parentPlot)
637  Q_PROPERTY(QString name READ name)
638  Q_PROPERTY(int index READ index)
639  Q_PROPERTY(QList<QCPLayerable*> children READ children)
640  Q_PROPERTY(bool visible READ visible WRITE setVisible)
641  Q_PROPERTY(LayerMode mode READ mode WRITE setMode)
643 public:
644 
652  enum LayerMode { lmLogical
653  ,lmBuffered
654  };
655  Q_ENUMS(LayerMode)
656 
657  QCPLayer(QCustomPlot* parentPlot, const QString &layerName);
658  virtual ~QCPLayer();
659 
660  // getters:
661  QCustomPlot *parentPlot() const { return mParentPlot; }
662  QString name() const { return mName; }
663  int index() const { return mIndex; }
664  QList<QCPLayerable*> children() const { return mChildren; }
665  bool visible() const { return mVisible; }
666  LayerMode mode() const { return mMode; }
667 
668  // setters:
669  void setVisible(bool visible);
670  void setMode(LayerMode mode);
671 
672  // non-virtual methods:
673  void replot();
674 
675 protected:
676  // property members:
677  QCustomPlot *mParentPlot;
678  QString mName;
679  int mIndex;
680  QList<QCPLayerable*> mChildren;
681  bool mVisible;
682  LayerMode mMode;
683 
684  // non-property members:
685  QWeakPointer<QCPAbstractPaintBuffer> mPaintBuffer;
686 
687  // non-virtual methods:
688  void draw(QCPPainter *painter);
689  void drawToPaintBuffer();
690  void addChild(QCPLayerable *layerable, bool prepend);
691  void removeChild(QCPLayerable *layerable);
692 
693 private:
694  Q_DISABLE_COPY(QCPLayer)
695 
696  friend class QCustomPlot;
697  friend class QCPLayerable;
698 };
699 Q_DECLARE_METATYPE(QCPLayer::LayerMode)
700 
701 class QCP_LIB_DECL QCPLayerable : public QObject
702 {
703  Q_OBJECT
705  Q_PROPERTY(bool visible READ visible WRITE setVisible)
706  Q_PROPERTY(QCustomPlot* parentPlot READ parentPlot)
708  Q_PROPERTY(QCPLayer* layer READ layer WRITE setLayer NOTIFY layerChanged)
709  Q_PROPERTY(bool antialiased READ antialiased WRITE setAntialiased)
711 public:
712  QCPLayerable(QCustomPlot *plot, QString targetLayer=QString(), QCPLayerable *parentLayerable=nullptr);
713  virtual ~QCPLayerable();
714 
715  // getters:
716  bool visible() const { return mVisible; }
717  QCustomPlot *parentPlot() const { return mParentPlot; }
718  QCPLayerable *parentLayerable() const { return mParentLayerable.data(); }
719  QCPLayer *layer() const { return mLayer; }
720  bool antialiased() const { return mAntialiased; }
721 
722  // setters:
723  void setVisible(bool on);
724  Q_SLOT bool setLayer(QCPLayer *layer);
725  bool setLayer(const QString &layerName);
726  void setAntialiased(bool enabled);
727 
728  // introduced virtual methods:
729  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const;
730 
731  // non-property methods:
732  bool realVisibility() const;
733 
734 signals:
735  void layerChanged(QCPLayer *newLayer);
736 
737 protected:
738  // property members:
739  bool mVisible;
740  QCustomPlot *mParentPlot;
741  QPointer<QCPLayerable> mParentLayerable;
742  QCPLayer *mLayer;
743  bool mAntialiased;
744 
745  // introduced virtual methods:
746  virtual void parentPlotInitialized(QCustomPlot *parentPlot);
747  virtual QCP::Interaction selectionCategory() const;
748  virtual QRect clipRect() const;
749  virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const = 0;
750  virtual void draw(QCPPainter *painter) = 0;
751  // selection events:
752  virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged);
753  virtual void deselectEvent(bool *selectionStateChanged);
754  // low-level mouse events:
755  virtual void mousePressEvent(QMouseEvent *event, const QVariant &details);
756  virtual void mouseMoveEvent(QMouseEvent *event, const QPointF &startPos);
757  virtual void mouseReleaseEvent(QMouseEvent *event, const QPointF &startPos);
758  virtual void mouseDoubleClickEvent(QMouseEvent *event, const QVariant &details);
759  virtual void wheelEvent(QWheelEvent *event);
760 
761  // non-property methods:
762  void initializeParentPlot(QCustomPlot *parentPlot);
763  void setParentLayerable(QCPLayerable* parentLayerable);
764  bool moveToLayer(QCPLayer *layer, bool prepend);
765  void applyAntialiasingHint(QCPPainter *painter, bool localAntialiased, QCP::AntialiasedElement overrideElement) const;
766 
767 private:
768  Q_DISABLE_COPY(QCPLayerable)
769 
770  friend class QCustomPlot;
771  friend class QCPLayer;
772  friend class QCPAxisRect;
773 };
774 
775 /* end of 'src/layer.h' */
776 
777 
778 /* including file 'src/axis/range.h' */
779 /* modified 2021-03-29T02:30:44, size 5280 */
780 
781 class QCP_LIB_DECL QCPRange
782 {
783 public:
784  double lower, upper;
785 
786  QCPRange();
787  QCPRange(double lower, double upper);
788 
789  bool operator==(const QCPRange& other) const { return lower == other.lower && upper == other.upper; }
790  bool operator!=(const QCPRange& other) const { return !(*this == other); }
791 
792  QCPRange &operator+=(const double& value) { lower+=value; upper+=value; return *this; }
793  QCPRange &operator-=(const double& value) { lower-=value; upper-=value; return *this; }
794  QCPRange &operator*=(const double& value) { lower*=value; upper*=value; return *this; }
795  QCPRange &operator/=(const double& value) { lower/=value; upper/=value; return *this; }
796  friend inline const QCPRange operator+(const QCPRange&, double);
797  friend inline const QCPRange operator+(double, const QCPRange&);
798  friend inline const QCPRange operator-(const QCPRange& range, double value);
799  friend inline const QCPRange operator*(const QCPRange& range, double value);
800  friend inline const QCPRange operator*(double value, const QCPRange& range);
801  friend inline const QCPRange operator/(const QCPRange& range, double value);
802 
803  double size() const { return upper-lower; }
804  double center() const { return (upper+lower)*0.5; }
805  void normalize() { if (lower > upper) qSwap(lower, upper); }
806  void expand(const QCPRange &otherRange);
807  void expand(double includeCoord);
808  QCPRange expanded(const QCPRange &otherRange) const;
809  QCPRange expanded(double includeCoord) const;
810  QCPRange bounded(double lowerBound, double upperBound) const;
811  QCPRange sanitizedForLogScale() const;
812  QCPRange sanitizedForLinScale() const;
813  bool contains(double value) const { return value >= lower && value <= upper; }
814 
815  static bool validRange(double lower, double upper);
816  static bool validRange(const QCPRange &range);
817  static const double minRange;
818  static const double maxRange;
819 
820 };
821 Q_DECLARE_TYPEINFO(QCPRange, Q_MOVABLE_TYPE);
822 
827 inline QDebug operator<< (QDebug d, const QCPRange &range)
828 {
829  d.nospace() << "QCPRange(" << range.lower << ", " << range.upper << ")";
830  return d.space();
831 }
832 
836 inline const QCPRange operator+(const QCPRange& range, double value)
837 {
838  QCPRange result(range);
839  result += value;
840  return result;
841 }
842 
846 inline const QCPRange operator+(double value, const QCPRange& range)
847 {
848  QCPRange result(range);
849  result += value;
850  return result;
851 }
852 
856 inline const QCPRange operator-(const QCPRange& range, double value)
857 {
858  QCPRange result(range);
859  result -= value;
860  return result;
861 }
862 
866 inline const QCPRange operator*(const QCPRange& range, double value)
867 {
868  QCPRange result(range);
869  result *= value;
870  return result;
871 }
872 
876 inline const QCPRange operator*(double value, const QCPRange& range)
877 {
878  QCPRange result(range);
879  result *= value;
880  return result;
881 }
882 
886 inline const QCPRange operator/(const QCPRange& range, double value)
887 {
888  QCPRange result(range);
889  result /= value;
890  return result;
891 }
892 
893 /* end of 'src/axis/range.h' */
894 
895 
896 /* including file 'src/selection.h' */
897 /* modified 2021-03-29T02:30:44, size 8569 */
898 
899 class QCP_LIB_DECL QCPDataRange
900 {
901 public:
902  QCPDataRange();
903  QCPDataRange(int begin, int end);
904 
905  bool operator==(const QCPDataRange& other) const { return mBegin == other.mBegin && mEnd == other.mEnd; }
906  bool operator!=(const QCPDataRange& other) const { return !(*this == other); }
907 
908  // getters:
909  int begin() const { return mBegin; }
910  int end() const { return mEnd; }
911  int size() const { return mEnd-mBegin; }
912  int length() const { return size(); }
913 
914  // setters:
915  void setBegin(int begin) { mBegin = begin; }
916  void setEnd(int end) { mEnd = end; }
917 
918  // non-property methods:
919  bool isValid() const { return (mEnd >= mBegin) && (mBegin >= 0); }
920  bool isEmpty() const { return length() == 0; }
921  QCPDataRange bounded(const QCPDataRange &other) const;
922  QCPDataRange expanded(const QCPDataRange &other) const;
923  QCPDataRange intersection(const QCPDataRange &other) const;
924  QCPDataRange adjusted(int changeBegin, int changeEnd) const { return QCPDataRange(mBegin+changeBegin, mEnd+changeEnd); }
925  bool intersects(const QCPDataRange &other) const;
926  bool contains(const QCPDataRange &other) const;
927 
928 private:
929  // property members:
930  int mBegin, mEnd;
931 
932 };
933 Q_DECLARE_TYPEINFO(QCPDataRange, Q_MOVABLE_TYPE);
934 
935 
936 class QCP_LIB_DECL QCPDataSelection
937 {
938 public:
939  explicit QCPDataSelection();
940  explicit QCPDataSelection(const QCPDataRange &range);
941 
942  bool operator==(const QCPDataSelection& other) const;
943  bool operator!=(const QCPDataSelection& other) const { return !(*this == other); }
944  QCPDataSelection &operator+=(const QCPDataSelection& other);
945  QCPDataSelection &operator+=(const QCPDataRange& other);
946  QCPDataSelection &operator-=(const QCPDataSelection& other);
947  QCPDataSelection &operator-=(const QCPDataRange& other);
948  friend inline const QCPDataSelection operator+(const QCPDataSelection& a, const QCPDataSelection& b);
949  friend inline const QCPDataSelection operator+(const QCPDataRange& a, const QCPDataSelection& b);
950  friend inline const QCPDataSelection operator+(const QCPDataSelection& a, const QCPDataRange& b);
951  friend inline const QCPDataSelection operator+(const QCPDataRange& a, const QCPDataRange& b);
952  friend inline const QCPDataSelection operator-(const QCPDataSelection& a, const QCPDataSelection& b);
953  friend inline const QCPDataSelection operator-(const QCPDataRange& a, const QCPDataSelection& b);
954  friend inline const QCPDataSelection operator-(const QCPDataSelection& a, const QCPDataRange& b);
955  friend inline const QCPDataSelection operator-(const QCPDataRange& a, const QCPDataRange& b);
956 
957  // getters:
958  int dataRangeCount() const { return mDataRanges.size(); }
959  int dataPointCount() const;
960  QCPDataRange dataRange(int index=0) const;
961  QList<QCPDataRange> dataRanges() const { return mDataRanges; }
962  QCPDataRange span() const;
963 
964  // non-property methods:
965  void addDataRange(const QCPDataRange &dataRange, bool simplify=true);
966  void clear();
967  bool isEmpty() const { return mDataRanges.isEmpty(); }
968  void simplify();
969  void enforceType(QCP::SelectionType type);
970  bool contains(const QCPDataSelection &other) const;
971  QCPDataSelection intersection(const QCPDataRange &other) const;
972  QCPDataSelection intersection(const QCPDataSelection &other) const;
973  QCPDataSelection inverse(const QCPDataRange &outerRange) const;
974 
975 private:
976  // property members:
977  QList<QCPDataRange> mDataRanges;
978 
979  inline static bool lessThanDataRangeBegin(const QCPDataRange &a, const QCPDataRange &b) { return a.begin() < b.begin(); }
980 };
981 Q_DECLARE_METATYPE(QCPDataSelection)
982 
983 
984 
988 inline const QCPDataSelection operator+(const QCPDataSelection& a, const QCPDataSelection& b)
989 {
990  QCPDataSelection result(a);
991  result += b;
992  return result;
993 }
994 
999 inline const QCPDataSelection operator+(const QCPDataRange& a, const QCPDataSelection& b)
1000 {
1001  QCPDataSelection result(a);
1002  result += b;
1003  return result;
1004 }
1005 
1010 inline const QCPDataSelection operator+(const QCPDataSelection& a, const QCPDataRange& b)
1011 {
1012  QCPDataSelection result(a);
1013  result += b;
1014  return result;
1015 }
1016 
1021 inline const QCPDataSelection operator+(const QCPDataRange& a, const QCPDataRange& b)
1022 {
1023  QCPDataSelection result(a);
1024  result += b;
1025  return result;
1026 }
1027 
1031 inline const QCPDataSelection operator-(const QCPDataSelection& a, const QCPDataSelection& b)
1032 {
1033  QCPDataSelection result(a);
1034  result -= b;
1035  return result;
1036 }
1037 
1041 inline const QCPDataSelection operator-(const QCPDataRange& a, const QCPDataSelection& b)
1042 {
1043  QCPDataSelection result(a);
1044  result -= b;
1045  return result;
1046 }
1047 
1051 inline const QCPDataSelection operator-(const QCPDataSelection& a, const QCPDataRange& b)
1052 {
1053  QCPDataSelection result(a);
1054  result -= b;
1055  return result;
1056 }
1057 
1061 inline const QCPDataSelection operator-(const QCPDataRange& a, const QCPDataRange& b)
1062 {
1063  QCPDataSelection result(a);
1064  result -= b;
1065  return result;
1066 }
1067 
1072 inline QDebug operator<< (QDebug d, const QCPDataRange &dataRange)
1073 {
1074  d.nospace() << "QCPDataRange(" << dataRange.begin() << ", " << dataRange.end() << ")";
1075  return d;
1076 }
1077 
1082 inline QDebug operator<< (QDebug d, const QCPDataSelection &selection)
1083 {
1084  d.nospace() << "QCPDataSelection(";
1085  for (int i=0; i<selection.dataRangeCount(); ++i)
1086  {
1087  if (i != 0)
1088  d << ", ";
1089  d << selection.dataRange(i);
1090  }
1091  d << ")";
1092  return d;
1093 }
1094 
1095 
1096 
1097 /* end of 'src/selection.h' */
1098 
1099 
1100 /* including file 'src/selectionrect.h' */
1101 /* modified 2021-03-29T02:30:44, size 3354 */
1102 
1103 class QCP_LIB_DECL QCPSelectionRect : public QCPLayerable
1104 {
1105  Q_OBJECT
1106 public:
1107  explicit QCPSelectionRect(QCustomPlot *parentPlot);
1108  virtual ~QCPSelectionRect() Q_DECL_OVERRIDE;
1109 
1110  // getters:
1111  QRect rect() const { return mRect; }
1112  QCPRange range(const QCPAxis *axis) const;
1113  QPen pen() const { return mPen; }
1114  QBrush brush() const { return mBrush; }
1115  bool isActive() const { return mActive; }
1116 
1117  // setters:
1118  void setPen(const QPen &pen);
1119  void setBrush(const QBrush &brush);
1120 
1121  // non-property methods:
1122  Q_SLOT void cancel();
1123 
1124 signals:
1125  void started(QMouseEvent *event);
1126  void changed(const QRect &rect, QMouseEvent *event);
1127  void canceled(const QRect &rect, QInputEvent *event);
1128  void accepted(const QRect &rect, QMouseEvent *event);
1129 
1130 protected:
1131  // property members:
1132  QRect mRect;
1133  QPen mPen;
1134  QBrush mBrush;
1135  // non-property members:
1136  bool mActive;
1137 
1138  // introduced virtual methods:
1139  virtual void startSelection(QMouseEvent *event);
1140  virtual void moveSelection(QMouseEvent *event);
1141  virtual void endSelection(QMouseEvent *event);
1142  virtual void keyPressEvent(QKeyEvent *event);
1143 
1144  // reimplemented virtual methods
1145  virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const Q_DECL_OVERRIDE;
1146  virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
1147 
1148  friend class QCustomPlot;
1149 };
1150 
1151 /* end of 'src/selectionrect.h' */
1152 
1153 
1154 /* including file 'src/layout.h' */
1155 /* modified 2021-03-29T02:30:44, size 14279 */
1156 
1157 class QCP_LIB_DECL QCPMarginGroup : public QObject
1158 {
1159  Q_OBJECT
1160 public:
1161  explicit QCPMarginGroup(QCustomPlot *parentPlot);
1162  virtual ~QCPMarginGroup();
1163 
1164  // non-virtual methods:
1165  QList<QCPLayoutElement*> elements(QCP::MarginSide side) const { return mChildren.value(side); }
1166  bool isEmpty() const;
1167  void clear();
1168 
1169 protected:
1170  // non-property members:
1171  QCustomPlot *mParentPlot;
1173 
1174  // introduced virtual methods:
1175  virtual int commonMargin(QCP::MarginSide side) const;
1176 
1177  // non-virtual methods:
1178  void addChild(QCP::MarginSide side, QCPLayoutElement *element);
1179  void removeChild(QCP::MarginSide side, QCPLayoutElement *element);
1180 
1181 private:
1182  Q_DISABLE_COPY(QCPMarginGroup)
1183 
1184  friend class QCPLayoutElement;
1185 };
1186 
1187 
1188 class QCP_LIB_DECL QCPLayoutElement : public QCPLayerable
1189 {
1190  Q_OBJECT
1192  Q_PROPERTY(QCPLayout* layout READ layout)
1193  Q_PROPERTY(QRect rect READ rect)
1194  Q_PROPERTY(QRect outerRect READ outerRect WRITE setOuterRect)
1195  Q_PROPERTY(QMargins margins READ margins WRITE setMargins)
1196  Q_PROPERTY(QMargins minimumMargins READ minimumMargins WRITE setMinimumMargins)
1197  Q_PROPERTY(QSize minimumSize READ minimumSize WRITE setMinimumSize)
1198  Q_PROPERTY(QSize maximumSize READ maximumSize WRITE setMaximumSize)
1199  Q_PROPERTY(SizeConstraintRect sizeConstraintRect READ sizeConstraintRect WRITE setSizeConstraintRect)
1201 public:
1206  enum UpdatePhase { upPreparation
1207  ,upMargins
1208  ,upLayout
1209  };
1210  Q_ENUMS(UpdatePhase)
1211 
1212 
1220  enum SizeConstraintRect { scrInnerRect
1221  , scrOuterRect
1222  };
1223  Q_ENUMS(SizeConstraintRect)
1224 
1225  explicit QCPLayoutElement(QCustomPlot *parentPlot=nullptr);
1226  virtual ~QCPLayoutElement() Q_DECL_OVERRIDE;
1227 
1228  // getters:
1229  QCPLayout *layout() const { return mParentLayout; }
1230  QRect rect() const { return mRect; }
1231  QRect outerRect() const { return mOuterRect; }
1232  QMargins margins() const { return mMargins; }
1233  QMargins minimumMargins() const { return mMinimumMargins; }
1234  QCP::MarginSides autoMargins() const { return mAutoMargins; }
1235  QSize minimumSize() const { return mMinimumSize; }
1236  QSize maximumSize() const { return mMaximumSize; }
1237  SizeConstraintRect sizeConstraintRect() const { return mSizeConstraintRect; }
1238  QCPMarginGroup *marginGroup(QCP::MarginSide side) const { return mMarginGroups.value(side, nullptr); }
1239  QHash<QCP::MarginSide, QCPMarginGroup*> marginGroups() const { return mMarginGroups; }
1240 
1241  // setters:
1242  void setOuterRect(const QRect &rect);
1243  void setMargins(const QMargins &margins);
1244  void setMinimumMargins(const QMargins &margins);
1245  void setAutoMargins(QCP::MarginSides sides);
1246  void setMinimumSize(const QSize &size);
1247  void setMinimumSize(int width, int height);
1248  void setMaximumSize(const QSize &size);
1249  void setMaximumSize(int width, int height);
1250  void setSizeConstraintRect(SizeConstraintRect constraintRect);
1251  void setMarginGroup(QCP::MarginSides sides, QCPMarginGroup *group);
1252 
1253  // introduced virtual methods:
1254  virtual void update(UpdatePhase phase);
1255  virtual QSize minimumOuterSizeHint() const;
1256  virtual QSize maximumOuterSizeHint() const;
1257  virtual QList<QCPLayoutElement*> elements(bool recursive) const;
1258 
1259  // reimplemented virtual methods:
1260  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE;
1261 
1262 protected:
1263  // property members:
1264  QCPLayout *mParentLayout;
1265  QSize mMinimumSize, mMaximumSize;
1266  SizeConstraintRect mSizeConstraintRect;
1267  QRect mRect, mOuterRect;
1268  QMargins mMargins, mMinimumMargins;
1269  QCP::MarginSides mAutoMargins;
1270  QHash<QCP::MarginSide, QCPMarginGroup*> mMarginGroups;
1271 
1272  // introduced virtual methods:
1273  virtual int calculateAutoMargin(QCP::MarginSide side);
1274  virtual void layoutChanged();
1275 
1276  // reimplemented virtual methods:
1277  virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const Q_DECL_OVERRIDE { Q_UNUSED(painter) }
1278  virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE { Q_UNUSED(painter) }
1279  virtual void parentPlotInitialized(QCustomPlot *parentPlot) Q_DECL_OVERRIDE;
1280 
1281 private:
1282  Q_DISABLE_COPY(QCPLayoutElement)
1283 
1284  friend class QCustomPlot;
1285  friend class QCPLayout;
1286  friend class QCPMarginGroup;
1287 };
1288 Q_DECLARE_METATYPE(QCPLayoutElement::UpdatePhase)
1289 
1290 
1291 class QCP_LIB_DECL QCPLayout : public QCPLayoutElement
1292 {
1293  Q_OBJECT
1294 public:
1295  explicit QCPLayout();
1296 
1297  // reimplemented virtual methods:
1298  virtual void update(UpdatePhase phase) Q_DECL_OVERRIDE;
1299  virtual QList<QCPLayoutElement*> elements(bool recursive) const Q_DECL_OVERRIDE;
1300 
1301  // introduced virtual methods:
1302  virtual int elementCount() const = 0;
1303  virtual QCPLayoutElement* elementAt(int index) const = 0;
1304  virtual QCPLayoutElement* takeAt(int index) = 0;
1305  virtual bool take(QCPLayoutElement* element) = 0;
1306  virtual void simplify();
1307 
1308  // non-virtual methods:
1309  bool removeAt(int index);
1310  bool remove(QCPLayoutElement* element);
1311  void clear();
1312 
1313 protected:
1314  // introduced virtual methods:
1315  virtual void updateLayout();
1316 
1317  // non-virtual methods:
1318  void sizeConstraintsChanged() const;
1319  void adoptElement(QCPLayoutElement *el);
1320  void releaseElement(QCPLayoutElement *el);
1321  QVector<int> getSectionSizes(QVector<int> maxSizes, QVector<int> minSizes, QVector<double> stretchFactors, int totalSize) const;
1322  static QSize getFinalMinimumOuterSize(const QCPLayoutElement *el);
1323  static QSize getFinalMaximumOuterSize(const QCPLayoutElement *el);
1324 
1325 private:
1326  Q_DISABLE_COPY(QCPLayout)
1327  friend class QCPLayoutElement;
1328 };
1329 
1330 
1331 class QCP_LIB_DECL QCPLayoutGrid : public QCPLayout
1332 {
1333  Q_OBJECT
1335  Q_PROPERTY(int rowCount READ rowCount)
1336  Q_PROPERTY(int columnCount READ columnCount)
1337  Q_PROPERTY(QList<double> columnStretchFactors READ columnStretchFactors WRITE setColumnStretchFactors)
1338  Q_PROPERTY(QList<double> rowStretchFactors READ rowStretchFactors WRITE setRowStretchFactors)
1339  Q_PROPERTY(int columnSpacing READ columnSpacing WRITE setColumnSpacing)
1340  Q_PROPERTY(int rowSpacing READ rowSpacing WRITE setRowSpacing)
1341  Q_PROPERTY(FillOrder fillOrder READ fillOrder WRITE setFillOrder)
1342  Q_PROPERTY(int wrap READ wrap WRITE setWrap)
1344 public:
1345 
1353  enum FillOrder { foRowsFirst
1354  ,foColumnsFirst
1355  };
1356  Q_ENUMS(FillOrder)
1357 
1358  explicit QCPLayoutGrid();
1359  virtual ~QCPLayoutGrid() Q_DECL_OVERRIDE;
1360 
1361  // getters:
1362  int rowCount() const { return mElements.size(); }
1363  int columnCount() const { return mElements.size() > 0 ? mElements.first().size() : 0; }
1364  QList<double> columnStretchFactors() const { return mColumnStretchFactors; }
1365  QList<double> rowStretchFactors() const { return mRowStretchFactors; }
1366  int columnSpacing() const { return mColumnSpacing; }
1367  int rowSpacing() const { return mRowSpacing; }
1368  int wrap() const { return mWrap; }
1369  FillOrder fillOrder() const { return mFillOrder; }
1370 
1371  // setters:
1372  void setColumnStretchFactor(int column, double factor);
1373  void setColumnStretchFactors(const QList<double> &factors);
1374  void setRowStretchFactor(int row, double factor);
1375  void setRowStretchFactors(const QList<double> &factors);
1376  void setColumnSpacing(int pixels);
1377  void setRowSpacing(int pixels);
1378  void setWrap(int count);
1379  void setFillOrder(FillOrder order, bool rearrange=true);
1380 
1381  // reimplemented virtual methods:
1382  virtual void updateLayout() Q_DECL_OVERRIDE;
1383  virtual int elementCount() const Q_DECL_OVERRIDE { return rowCount()*columnCount(); }
1384  virtual QCPLayoutElement* elementAt(int index) const Q_DECL_OVERRIDE;
1385  virtual QCPLayoutElement* takeAt(int index) Q_DECL_OVERRIDE;
1386  virtual bool take(QCPLayoutElement* element) Q_DECL_OVERRIDE;
1387  virtual QList<QCPLayoutElement*> elements(bool recursive) const Q_DECL_OVERRIDE;
1388  virtual void simplify() Q_DECL_OVERRIDE;
1389  virtual QSize minimumOuterSizeHint() const Q_DECL_OVERRIDE;
1390  virtual QSize maximumOuterSizeHint() const Q_DECL_OVERRIDE;
1391 
1392  // non-virtual methods:
1393  QCPLayoutElement *element(int row, int column) const;
1394  bool addElement(int row, int column, QCPLayoutElement *element);
1395  bool addElement(QCPLayoutElement *element);
1396  bool hasElement(int row, int column);
1397  void expandTo(int newRowCount, int newColumnCount);
1398  void insertRow(int newIndex);
1399  void insertColumn(int newIndex);
1400  int rowColToIndex(int row, int column) const;
1401  void indexToRowCol(int index, int &row, int &column) const;
1402 
1403 protected:
1404  // property members:
1405  QList<QList<QCPLayoutElement*> > mElements;
1406  QList<double> mColumnStretchFactors;
1407  QList<double> mRowStretchFactors;
1408  int mColumnSpacing, mRowSpacing;
1409  int mWrap;
1410  FillOrder mFillOrder;
1411 
1412  // non-virtual methods:
1413  void getMinimumRowColSizes(QVector<int> *minColWidths, QVector<int> *minRowHeights) const;
1414  void getMaximumRowColSizes(QVector<int> *maxColWidths, QVector<int> *maxRowHeights) const;
1415 
1416 private:
1417  Q_DISABLE_COPY(QCPLayoutGrid)
1418 };
1419 Q_DECLARE_METATYPE(QCPLayoutGrid::FillOrder)
1420 
1421 
1422 class QCP_LIB_DECL QCPLayoutInset : public QCPLayout
1423 {
1424  Q_OBJECT
1425 public:
1429  enum InsetPlacement { ipFree
1430  ,ipBorderAligned
1431  };
1432  Q_ENUMS(InsetPlacement)
1433 
1434  explicit QCPLayoutInset();
1435  virtual ~QCPLayoutInset() Q_DECL_OVERRIDE;
1436 
1437  // getters:
1438  InsetPlacement insetPlacement(int index) const;
1439  Qt::Alignment insetAlignment(int index) const;
1440  QRectF insetRect(int index) const;
1441 
1442  // setters:
1443  void setInsetPlacement(int index, InsetPlacement placement);
1444  void setInsetAlignment(int index, Qt::Alignment alignment);
1445  void setInsetRect(int index, const QRectF &rect);
1446 
1447  // reimplemented virtual methods:
1448  virtual void updateLayout() Q_DECL_OVERRIDE;
1449  virtual int elementCount() const Q_DECL_OVERRIDE;
1450  virtual QCPLayoutElement* elementAt(int index) const Q_DECL_OVERRIDE;
1451  virtual QCPLayoutElement* takeAt(int index) Q_DECL_OVERRIDE;
1452  virtual bool take(QCPLayoutElement* element) Q_DECL_OVERRIDE;
1453  virtual void simplify() Q_DECL_OVERRIDE {}
1454  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE;
1455 
1456  // non-virtual methods:
1457  void addElement(QCPLayoutElement *element, Qt::Alignment alignment);
1458  void addElement(QCPLayoutElement *element, const QRectF &rect);
1459 
1460 protected:
1461  // property members:
1462  QList<QCPLayoutElement*> mElements;
1463  QList<InsetPlacement> mInsetPlacement;
1464  QList<Qt::Alignment> mInsetAlignment;
1465  QList<QRectF> mInsetRect;
1466 
1467 private:
1468  Q_DISABLE_COPY(QCPLayoutInset)
1469 };
1470 Q_DECLARE_METATYPE(QCPLayoutInset::InsetPlacement)
1471 
1472 /* end of 'src/layout.h' */
1473 
1474 
1475 /* including file 'src/lineending.h' */
1476 /* modified 2021-03-29T02:30:44, size 4426 */
1477 
1478 class QCP_LIB_DECL QCPLineEnding
1479 {
1480  Q_GADGET
1481 public:
1493  enum EndingStyle { esNone
1494  ,esFlatArrow
1495  ,esSpikeArrow
1496  ,esLineArrow
1497  ,esDisc
1498  ,esSquare
1499  ,esDiamond
1500  ,esBar
1501  ,esHalfBar
1502  ,esSkewedBar
1503  };
1504  Q_ENUMS(EndingStyle)
1505 
1506  QCPLineEnding();
1507  QCPLineEnding(EndingStyle style, double width=8, double length=10, bool inverted=false);
1508 
1509  // getters:
1510  EndingStyle style() const { return mStyle; }
1511  double width() const { return mWidth; }
1512  double length() const { return mLength; }
1513  bool inverted() const { return mInverted; }
1514 
1515  // setters:
1516  void setStyle(EndingStyle style);
1517  void setWidth(double width);
1518  void setLength(double length);
1519  void setInverted(bool inverted);
1520 
1521  // non-property methods:
1522  double boundingDistance() const;
1523  double realLength() const;
1524  void draw(QCPPainter *painter, const QCPVector2D &pos, const QCPVector2D &dir) const;
1525  void draw(QCPPainter *painter, const QCPVector2D &pos, double angle) const;
1526 
1527 protected:
1528  // property members:
1529  EndingStyle mStyle;
1530  double mWidth, mLength;
1531  bool mInverted;
1532 };
1533 Q_DECLARE_TYPEINFO(QCPLineEnding, Q_MOVABLE_TYPE);
1534 Q_DECLARE_METATYPE(QCPLineEnding::EndingStyle)
1535 
1536 /* end of 'src/lineending.h' */
1537 
1538 
1539 /* including file 'src/axis/labelpainter.h' */
1540 /* modified 2021-03-29T02:30:44, size 7086 */
1541 
1543 {
1544  Q_GADGET
1545 public:
1549  enum AnchorMode { amRectangular
1550  ,amSkewedUpright
1551  ,amSkewedRotated
1552  };
1553  Q_ENUMS(AnchorMode)
1554 
1555 
1558  enum AnchorReferenceType { artNormal
1559  ,artTangent
1560  };
1561  Q_ENUMS(AnchorReferenceType)
1562 
1563 
1566  enum AnchorSide { asLeft
1567  ,asRight
1568  ,asTop
1569  ,asBottom
1570  ,asTopLeft
1571  ,asTopRight
1572  ,asBottomRight
1573  ,asBottomLeft
1574  };
1575  Q_ENUMS(AnchorSide)
1576 
1577  explicit QCPLabelPainterPrivate(QCustomPlot *parentPlot);
1578  virtual ~QCPLabelPainterPrivate();
1579 
1580  // setters:
1581  void setAnchorSide(AnchorSide side);
1582  void setAnchorMode(AnchorMode mode);
1583  void setAnchorReference(const QPointF &pixelPoint);
1584  void setAnchorReferenceType(AnchorReferenceType type);
1585  void setFont(const QFont &font);
1586  void setColor(const QColor &color);
1587  void setPadding(int padding);
1588  void setRotation(double rotation);
1589  void setSubstituteExponent(bool enabled);
1590  void setMultiplicationSymbol(QChar symbol);
1591  void setAbbreviateDecimalPowers(bool enabled);
1592  void setCacheSize(int labelCount);
1593 
1594  // getters:
1595  AnchorMode anchorMode() const { return mAnchorMode; }
1596  AnchorSide anchorSide() const { return mAnchorSide; }
1597  QPointF anchorReference() const { return mAnchorReference; }
1598  AnchorReferenceType anchorReferenceType() const { return mAnchorReferenceType; }
1599  QFont font() const { return mFont; }
1600  QColor color() const { return mColor; }
1601  int padding() const { return mPadding; }
1602  double rotation() const { return mRotation; }
1603  bool substituteExponent() const { return mSubstituteExponent; }
1604  QChar multiplicationSymbol() const { return mMultiplicationSymbol; }
1605  bool abbreviateDecimalPowers() const { return mAbbreviateDecimalPowers; }
1606  int cacheSize() const;
1607 
1608  //virtual int size() const;
1609 
1610  // non-property methods:
1611  void drawTickLabel(QCPPainter *painter, const QPointF &tickPos, const QString &text);
1612  void clearCache();
1613 
1614  // constants that may be used with setMultiplicationSymbol:
1615  static const QChar SymbolDot;
1616  static const QChar SymbolCross;
1617 
1618 protected:
1620  {
1621  QPoint offset;
1622  QPixmap pixmap;
1623  };
1624  struct LabelData
1625  {
1626  AnchorSide side;
1627  double rotation; // angle in degrees
1628  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
1629  QString basePart, expPart, suffixPart;
1630  QRect baseBounds, expBounds, suffixBounds;
1631  QRect totalBounds; // is in a coordinate system where label top left is at (0, 0)
1632  QRect rotatedTotalBounds; // is in a coordinate system where the label anchor is at (0, 0)
1633  QFont baseFont, expFont;
1634  QColor color;
1635  };
1636 
1637  // property members:
1638  AnchorMode mAnchorMode;
1639  AnchorSide mAnchorSide;
1640  QPointF mAnchorReference;
1641  AnchorReferenceType mAnchorReferenceType;
1642  QFont mFont;
1643  QColor mColor;
1644  int mPadding;
1645  double mRotation; // this is the rotation applied uniformly to all labels, not the heterogeneous rotation in amCircularRotated mode
1646  bool mSubstituteExponent;
1647  QChar mMultiplicationSymbol;
1648  bool mAbbreviateDecimalPowers;
1649  // non-property members:
1650  QCustomPlot *mParentPlot;
1651  QByteArray mLabelParameterHash; // to determine whether mLabelCache needs to be cleared due to changed parameters
1652  QCache<QString, CachedLabel> mLabelCache;
1653  QRect mAxisSelectionBox, mTickLabelsSelectionBox, mLabelSelectionBox;
1654  int mLetterCapHeight, mLetterDescent;
1655 
1656  // introduced virtual methods:
1657  virtual void drawLabelMaybeCached(QCPPainter *painter, const QFont &font, const QColor &color, const QPointF &pos, AnchorSide side, double rotation, const QString &text);
1658  virtual QByteArray generateLabelParameterHash() const; // TODO: get rid of this in favor of invalidation flag upon setters?
1659 
1660  // non-virtual methods:
1661  QPointF getAnchorPos(const QPointF &tickPos);
1662  void drawText(QCPPainter *painter, const QPointF &pos, const LabelData &labelData) const;
1663  LabelData getTickLabelData(const QFont &font, const QColor &color, double rotation, AnchorSide side, const QString &text) const;
1664  void applyAnchorTransform(LabelData &labelData) const;
1665  //void getMaxTickLabelSize(const QFont &font, const QString &text, QSize *tickLabelsSize) const;
1666  CachedLabel *createCachedLabel(const LabelData &labelData) const;
1667  QByteArray cacheKey(const QString &text, const QColor &color, double rotation, AnchorSide side) const;
1668  AnchorSide skewedAnchorSide(const QPointF &tickPos, double sideExpandHorz, double sideExpandVert) const;
1669  AnchorSide rotationCorrectedSide(AnchorSide side, double rotation) const;
1670  void analyzeFontMetrics();
1671 };
1672 Q_DECLARE_METATYPE(QCPLabelPainterPrivate::AnchorMode)
1673 Q_DECLARE_METATYPE(QCPLabelPainterPrivate::AnchorSide)
1674 
1675 
1676 /* end of 'src/axis/labelpainter.h' */
1677 
1678 
1679 /* including file 'src/axis/axisticker.h' */
1680 /* modified 2021-03-29T02:30:44, size 4230 */
1681 
1682 class QCP_LIB_DECL QCPAxisTicker
1683 {
1684  Q_GADGET
1685 public:
1692  {
1693  tssReadability
1694  ,tssMeetTickCount
1695  };
1696  Q_ENUMS(TickStepStrategy)
1697 
1698  QCPAxisTicker();
1699  virtual ~QCPAxisTicker();
1700 
1701  // getters:
1702  TickStepStrategy tickStepStrategy() const { return mTickStepStrategy; }
1703  int tickCount() const { return mTickCount; }
1704  double tickOrigin() const { return mTickOrigin; }
1705 
1706  // setters:
1707  void setTickStepStrategy(TickStepStrategy strategy);
1708  void setTickCount(int count);
1709  void setTickOrigin(double origin);
1710 
1711  // introduced virtual methods:
1712  virtual void generate(const QCPRange &range, const QLocale &locale, QChar formatChar, int precision, QVector<double> &ticks, QVector<double> *subTicks, QVector<QString> *tickLabels);
1713 
1714 protected:
1715  // property members:
1716  TickStepStrategy mTickStepStrategy;
1717  int mTickCount;
1718  double mTickOrigin;
1719 
1720  // introduced virtual methods:
1721  virtual double getTickStep(const QCPRange &range);
1722  virtual int getSubTickCount(double tickStep);
1723  virtual QString getTickLabel(double tick, const QLocale &locale, QChar formatChar, int precision);
1724  virtual QVector<double> createTickVector(double tickStep, const QCPRange &range);
1725  virtual QVector<double> createSubTickVector(int subTickCount, const QVector<double> &ticks);
1726  virtual QVector<QString> createLabelVector(const QVector<double> &ticks, const QLocale &locale, QChar formatChar, int precision);
1727 
1728  // non-virtual methods:
1729  void trimTicks(const QCPRange &range, QVector<double> &ticks, bool keepOneOutlier) const;
1730  double pickClosest(double target, const QVector<double> &candidates) const;
1731  double getMantissa(double input, double *magnitude=nullptr) const;
1732  double cleanMantissa(double input) const;
1733 
1734 private:
1735  Q_DISABLE_COPY(QCPAxisTicker)
1736 
1737 };
1738 Q_DECLARE_METATYPE(QCPAxisTicker::TickStepStrategy)
1739 Q_DECLARE_METATYPE(QSharedPointer<QCPAxisTicker>)
1740 
1741 /* end of 'src/axis/axisticker.h' */
1742 
1743 
1744 /* including file 'src/axis/axistickerdatetime.h' */
1745 /* modified 2021-03-29T02:30:44, size 3600 */
1746 
1747 class QCP_LIB_DECL QCPAxisTickerDateTime : public QCPAxisTicker
1748 {
1749 public:
1751 
1752  // getters:
1753  QString dateTimeFormat() const { return mDateTimeFormat; }
1754  Qt::TimeSpec dateTimeSpec() const { return mDateTimeSpec; }
1755 # if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0)
1756  QTimeZone timeZone() const { return mTimeZone; }
1757 #endif
1758 
1759  // setters:
1760  void setDateTimeFormat(const QString &format);
1761  void setDateTimeSpec(Qt::TimeSpec spec);
1762 # if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0)
1763  void setTimeZone(const QTimeZone &zone);
1764 # endif
1765  void setTickOrigin(double origin); // hides base class method but calls baseclass implementation ("using" throws off IDEs and doxygen)
1766  void setTickOrigin(const QDateTime &origin);
1767 
1768  // static methods:
1769  static QDateTime keyToDateTime(double key);
1770  static double dateTimeToKey(const QDateTime &dateTime);
1771  static double dateTimeToKey(const QDate &date, Qt::TimeSpec timeSpec=Qt::LocalTime);
1772 
1773 protected:
1774  // property members:
1775  QString mDateTimeFormat;
1776  Qt::TimeSpec mDateTimeSpec;
1777 # if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0)
1778  QTimeZone mTimeZone;
1779 # endif
1780  // non-property members:
1781  enum DateStrategy {dsNone, dsUniformTimeInDay, dsUniformDayInMonth} mDateStrategy;
1782 
1783  // reimplemented virtual methods:
1784  virtual double getTickStep(const QCPRange &range) Q_DECL_OVERRIDE;
1785  virtual int getSubTickCount(double tickStep) Q_DECL_OVERRIDE;
1786  virtual QString getTickLabel(double tick, const QLocale &locale, QChar formatChar, int precision) Q_DECL_OVERRIDE;
1787  virtual QVector<double> createTickVector(double tickStep, const QCPRange &range) Q_DECL_OVERRIDE;
1788 };
1789 
1790 /* end of 'src/axis/axistickerdatetime.h' */
1791 
1792 
1793 /* including file 'src/axis/axistickertime.h' */
1794 /* modified 2021-03-29T02:30:44, size 3542 */
1795 
1796 class QCP_LIB_DECL QCPAxisTickerTime : public QCPAxisTicker
1797 {
1798  Q_GADGET
1799 public:
1805  enum TimeUnit { tuMilliseconds
1806  ,tuSeconds
1807  ,tuMinutes
1808  ,tuHours
1809  ,tuDays
1810  };
1811  Q_ENUMS(TimeUnit)
1812 
1814 
1815  // getters:
1816  QString timeFormat() const { return mTimeFormat; }
1817  int fieldWidth(TimeUnit unit) const { return mFieldWidth.value(unit); }
1818 
1819  // setters:
1820  void setTimeFormat(const QString &format);
1821  void setFieldWidth(TimeUnit unit, int width);
1822 
1823 protected:
1824  // property members:
1825  QString mTimeFormat;
1826  QHash<TimeUnit, int> mFieldWidth;
1827 
1828  // non-property members:
1829  TimeUnit mSmallestUnit, mBiggestUnit;
1830  QHash<TimeUnit, QString> mFormatPattern;
1831 
1832  // reimplemented virtual methods:
1833  virtual double getTickStep(const QCPRange &range) Q_DECL_OVERRIDE;
1834  virtual int getSubTickCount(double tickStep) Q_DECL_OVERRIDE;
1835  virtual QString getTickLabel(double tick, const QLocale &locale, QChar formatChar, int precision) Q_DECL_OVERRIDE;
1836 
1837  // non-virtual methods:
1838  void replaceUnit(QString &text, TimeUnit unit, int value) const;
1839 };
1840 Q_DECLARE_METATYPE(QCPAxisTickerTime::TimeUnit)
1841 
1842 /* end of 'src/axis/axistickertime.h' */
1843 
1844 
1845 /* including file 'src/axis/axistickerfixed.h' */
1846 /* modified 2021-03-29T02:30:44, size 3308 */
1847 
1848 class QCP_LIB_DECL QCPAxisTickerFixed : public QCPAxisTicker
1849 {
1850  Q_GADGET
1851 public:
1858  enum ScaleStrategy { ssNone
1859  ,ssMultiples
1860  ,ssPowers
1861  };
1862  Q_ENUMS(ScaleStrategy)
1863 
1865 
1866  // getters:
1867  double tickStep() const { return mTickStep; }
1868  ScaleStrategy scaleStrategy() const { return mScaleStrategy; }
1869 
1870  // setters:
1871  void setTickStep(double step);
1872  void setScaleStrategy(ScaleStrategy strategy);
1873 
1874 protected:
1875  // property members:
1876  double mTickStep;
1877  ScaleStrategy mScaleStrategy;
1878 
1879  // reimplemented virtual methods:
1880  virtual double getTickStep(const QCPRange &range) Q_DECL_OVERRIDE;
1881 };
1882 Q_DECLARE_METATYPE(QCPAxisTickerFixed::ScaleStrategy)
1883 
1884 /* end of 'src/axis/axistickerfixed.h' */
1885 
1886 
1887 /* including file 'src/axis/axistickertext.h' */
1888 /* modified 2021-03-29T02:30:44, size 3090 */
1889 
1890 class QCP_LIB_DECL QCPAxisTickerText : public QCPAxisTicker
1891 {
1892 public:
1894 
1895  // getters:
1896  QMap<double, QString> &ticks() { return mTicks; }
1897  int subTickCount() const { return mSubTickCount; }
1898 
1899  // setters:
1900  void setTicks(const QMap<double, QString> &ticks);
1901  void setTicks(const QVector<double> &positions, const QVector<QString> &labels);
1902  void setSubTickCount(int subTicks);
1903 
1904  // non-virtual methods:
1905  void clear();
1906  void addTick(double position, const QString &label);
1907  void addTicks(const QMap<double, QString> &ticks);
1908  void addTicks(const QVector<double> &positions, const QVector<QString> &labels);
1909 
1910 protected:
1911  // property members:
1912  QMap<double, QString> mTicks;
1913  int mSubTickCount;
1914 
1915  // reimplemented virtual methods:
1916  virtual double getTickStep(const QCPRange &range) Q_DECL_OVERRIDE;
1917  virtual int getSubTickCount(double tickStep) Q_DECL_OVERRIDE;
1918  virtual QString getTickLabel(double tick, const QLocale &locale, QChar formatChar, int precision) Q_DECL_OVERRIDE;
1919  virtual QVector<double> createTickVector(double tickStep, const QCPRange &range) Q_DECL_OVERRIDE;
1920 };
1921 
1922 /* end of 'src/axis/axistickertext.h' */
1923 
1924 
1925 /* including file 'src/axis/axistickerpi.h' */
1926 /* modified 2021-03-29T02:30:44, size 3911 */
1927 
1928 class QCP_LIB_DECL QCPAxisTickerPi : public QCPAxisTicker
1929 {
1930  Q_GADGET
1931 public:
1937  enum FractionStyle { fsFloatingPoint
1938  ,fsAsciiFractions
1939  ,fsUnicodeFractions
1940  };
1941  Q_ENUMS(FractionStyle)
1942 
1943  QCPAxisTickerPi();
1944 
1945  // getters:
1946  QString piSymbol() const { return mPiSymbol; }
1947  double piValue() const { return mPiValue; }
1948  bool periodicity() const { return mPeriodicity; }
1949  FractionStyle fractionStyle() const { return mFractionStyle; }
1950 
1951  // setters:
1952  void setPiSymbol(QString symbol);
1953  void setPiValue(double pi);
1954  void setPeriodicity(int multiplesOfPi);
1955  void setFractionStyle(FractionStyle style);
1956 
1957 protected:
1958  // property members:
1959  QString mPiSymbol;
1960  double mPiValue;
1961  int mPeriodicity;
1962  FractionStyle mFractionStyle;
1963 
1964  // non-property members:
1965  double mPiTickStep; // size of one tick step in units of mPiValue
1966 
1967  // reimplemented virtual methods:
1968  virtual double getTickStep(const QCPRange &range) Q_DECL_OVERRIDE;
1969  virtual int getSubTickCount(double tickStep) Q_DECL_OVERRIDE;
1970  virtual QString getTickLabel(double tick, const QLocale &locale, QChar formatChar, int precision) Q_DECL_OVERRIDE;
1971 
1972  // non-virtual methods:
1973  void simplifyFraction(int &numerator, int &denominator) const;
1974  QString fractionToString(int numerator, int denominator) const;
1975  QString unicodeFraction(int numerator, int denominator) const;
1976  QString unicodeSuperscript(int number) const;
1977  QString unicodeSubscript(int number) const;
1978 };
1979 Q_DECLARE_METATYPE(QCPAxisTickerPi::FractionStyle)
1980 
1981 /* end of 'src/axis/axistickerpi.h' */
1982 
1983 
1984 /* including file 'src/axis/axistickerlog.h' */
1985 /* modified 2021-03-29T02:30:44, size 2594 */
1986 
1987 class QCP_LIB_DECL QCPAxisTickerLog : public QCPAxisTicker
1988 {
1989 public:
1990  QCPAxisTickerLog();
1991 
1992  // getters:
1993  double logBase() const { return mLogBase; }
1994  int subTickCount() const { return mSubTickCount; }
1995 
1996  // setters:
1997  void setLogBase(double base);
1998  void setSubTickCount(int subTicks);
1999 
2000 protected:
2001  // property members:
2002  double mLogBase;
2003  int mSubTickCount;
2004 
2005  // non-property members:
2006  double mLogBaseLnInv;
2007 
2008  // reimplemented virtual methods:
2009  virtual int getSubTickCount(double tickStep) Q_DECL_OVERRIDE;
2010  virtual QVector<double> createTickVector(double tickStep, const QCPRange &range) Q_DECL_OVERRIDE;
2011 };
2012 
2013 /* end of 'src/axis/axistickerlog.h' */
2014 
2015 
2016 /* including file 'src/axis/axis.h' */
2017 /* modified 2021-03-29T02:30:44, size 20913 */
2018 
2019 class QCP_LIB_DECL QCPGrid :public QCPLayerable
2020 {
2021  Q_OBJECT
2023  Q_PROPERTY(bool subGridVisible READ subGridVisible WRITE setSubGridVisible)
2024  Q_PROPERTY(bool antialiasedSubGrid READ antialiasedSubGrid WRITE setAntialiasedSubGrid)
2025  Q_PROPERTY(bool antialiasedZeroLine READ antialiasedZeroLine WRITE setAntialiasedZeroLine)
2026  Q_PROPERTY(QPen pen READ pen WRITE setPen)
2027  Q_PROPERTY(QPen subGridPen READ subGridPen WRITE setSubGridPen)
2028  Q_PROPERTY(QPen zeroLinePen READ zeroLinePen WRITE setZeroLinePen)
2030 public:
2031  explicit QCPGrid(QCPAxis *parentAxis);
2032 
2033  // getters:
2034  bool subGridVisible() const { return mSubGridVisible; }
2035  bool antialiasedSubGrid() const { return mAntialiasedSubGrid; }
2036  bool antialiasedZeroLine() const { return mAntialiasedZeroLine; }
2037  QPen pen() const { return mPen; }
2038  QPen subGridPen() const { return mSubGridPen; }
2039  QPen zeroLinePen() const { return mZeroLinePen; }
2040 
2041  // setters:
2042  void setSubGridVisible(bool visible);
2043  void setAntialiasedSubGrid(bool enabled);
2044  void setAntialiasedZeroLine(bool enabled);
2045  void setPen(const QPen &pen);
2046  void setSubGridPen(const QPen &pen);
2047  void setZeroLinePen(const QPen &pen);
2048 
2049 protected:
2050  // property members:
2051  bool mSubGridVisible;
2052  bool mAntialiasedSubGrid, mAntialiasedZeroLine;
2053  QPen mPen, mSubGridPen, mZeroLinePen;
2054 
2055  // non-property members:
2056  QCPAxis *mParentAxis;
2057 
2058  // reimplemented virtual methods:
2059  virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const Q_DECL_OVERRIDE;
2060  virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
2061 
2062  // non-virtual methods:
2063  void drawGridLines(QCPPainter *painter) const;
2064  void drawSubGridLines(QCPPainter *painter) const;
2065 
2066  friend class QCPAxis;
2067 };
2068 
2069 
2070 class QCP_LIB_DECL QCPAxis : public QCPLayerable
2071 {
2072  Q_OBJECT
2074  Q_PROPERTY(AxisType axisType READ axisType)
2075  Q_PROPERTY(QCPAxisRect* axisRect READ axisRect)
2076  Q_PROPERTY(ScaleType scaleType READ scaleType WRITE setScaleType NOTIFY scaleTypeChanged)
2077  Q_PROPERTY(QCPRange range READ range WRITE setRange NOTIFY rangeChanged)
2078  Q_PROPERTY(bool rangeReversed READ rangeReversed WRITE setRangeReversed)
2079  Q_PROPERTY(QSharedPointer<QCPAxisTicker> ticker READ ticker WRITE setTicker)
2080  Q_PROPERTY(bool ticks READ ticks WRITE setTicks)
2081  Q_PROPERTY(bool tickLabels READ tickLabels WRITE setTickLabels)
2082  Q_PROPERTY(int tickLabelPadding READ tickLabelPadding WRITE setTickLabelPadding)
2083  Q_PROPERTY(QFont tickLabelFont READ tickLabelFont WRITE setTickLabelFont)
2084  Q_PROPERTY(QColor tickLabelColor READ tickLabelColor WRITE setTickLabelColor)
2085  Q_PROPERTY(double tickLabelRotation READ tickLabelRotation WRITE setTickLabelRotation)
2086  Q_PROPERTY(LabelSide tickLabelSide READ tickLabelSide WRITE setTickLabelSide)
2087  Q_PROPERTY(QString numberFormat READ numberFormat WRITE setNumberFormat)
2088  Q_PROPERTY(int numberPrecision READ numberPrecision WRITE setNumberPrecision)
2089  Q_PROPERTY(QVector<double> tickVector READ tickVector)
2090  Q_PROPERTY(QVector<QString> tickVectorLabels READ tickVectorLabels)
2091  Q_PROPERTY(int tickLengthIn READ tickLengthIn WRITE setTickLengthIn)
2092  Q_PROPERTY(int tickLengthOut READ tickLengthOut WRITE setTickLengthOut)
2093  Q_PROPERTY(bool subTicks READ subTicks WRITE setSubTicks)
2094  Q_PROPERTY(int subTickLengthIn READ subTickLengthIn WRITE setSubTickLengthIn)
2095  Q_PROPERTY(int subTickLengthOut READ subTickLengthOut WRITE setSubTickLengthOut)
2096  Q_PROPERTY(QPen basePen READ basePen WRITE setBasePen)
2097  Q_PROPERTY(QPen tickPen READ tickPen WRITE setTickPen)
2098  Q_PROPERTY(QPen subTickPen READ subTickPen WRITE setSubTickPen)
2099  Q_PROPERTY(QFont labelFont READ labelFont WRITE setLabelFont)
2100  Q_PROPERTY(QColor labelColor READ labelColor WRITE setLabelColor)
2101  Q_PROPERTY(QString label READ label WRITE setLabel)
2102  Q_PROPERTY(int labelPadding READ labelPadding WRITE setLabelPadding)
2103  Q_PROPERTY(int padding READ padding WRITE setPadding)
2104  Q_PROPERTY(int offset READ offset WRITE setOffset)
2105  Q_PROPERTY(SelectableParts selectedParts READ selectedParts WRITE setSelectedParts NOTIFY selectionChanged)
2106  Q_PROPERTY(SelectableParts selectableParts READ selectableParts WRITE setSelectableParts NOTIFY selectableChanged)
2107  Q_PROPERTY(QFont selectedTickLabelFont READ selectedTickLabelFont WRITE setSelectedTickLabelFont)
2108  Q_PROPERTY(QFont selectedLabelFont READ selectedLabelFont WRITE setSelectedLabelFont)
2109  Q_PROPERTY(QColor selectedTickLabelColor READ selectedTickLabelColor WRITE setSelectedTickLabelColor)
2110  Q_PROPERTY(QColor selectedLabelColor READ selectedLabelColor WRITE setSelectedLabelColor)
2111  Q_PROPERTY(QPen selectedBasePen READ selectedBasePen WRITE setSelectedBasePen)
2112  Q_PROPERTY(QPen selectedTickPen READ selectedTickPen WRITE setSelectedTickPen)
2113  Q_PROPERTY(QPen selectedSubTickPen READ selectedSubTickPen WRITE setSelectedSubTickPen)
2114  Q_PROPERTY(QCPLineEnding lowerEnding READ lowerEnding WRITE setLowerEnding)
2115  Q_PROPERTY(QCPLineEnding upperEnding READ upperEnding WRITE setUpperEnding)
2116  Q_PROPERTY(QCPGrid* grid READ grid)
2118 public:
2123  enum AxisType { atLeft = 0x01
2124  ,atRight = 0x02
2125  ,atTop = 0x04
2126  ,atBottom = 0x08
2127  };
2128  Q_ENUMS(AxisType)
2129  Q_FLAGS(AxisTypes)
2130  Q_DECLARE_FLAGS(AxisTypes, AxisType)
2136  enum LabelSide { lsInside
2137  ,lsOutside
2138  };
2139  Q_ENUMS(LabelSide)
2144  enum ScaleType { stLinear
2145  ,stLogarithmic
2146  };
2147  Q_ENUMS(ScaleType)
2152  enum SelectablePart { spNone = 0
2153  ,spAxis = 0x001
2154  ,spTickLabels = 0x002
2155  ,spAxisLabel = 0x004
2156  };
2157  Q_ENUMS(SelectablePart)
2158  Q_FLAGS(SelectableParts)
2159  Q_DECLARE_FLAGS(SelectableParts, SelectablePart)
2160 
2161  explicit QCPAxis(QCPAxisRect *parent, AxisType type);
2162  virtual ~QCPAxis() Q_DECL_OVERRIDE;
2163 
2164  // getters:
2165  AxisType axisType() const { return mAxisType; }
2166  QCPAxisRect *axisRect() const { return mAxisRect; }
2167  ScaleType scaleType() const { return mScaleType; }
2168  const QCPRange range() const { return mRange; }
2169  bool rangeReversed() const { return mRangeReversed; }
2170  QSharedPointer<QCPAxisTicker> ticker() const { return mTicker; }
2171  bool ticks() const { return mTicks; }
2172  bool tickLabels() const { return mTickLabels; }
2173  int tickLabelPadding() const;
2174  QFont tickLabelFont() const { return mTickLabelFont; }
2175  QColor tickLabelColor() const { return mTickLabelColor; }
2176  double tickLabelRotation() const;
2177  LabelSide tickLabelSide() const;
2178  QString numberFormat() const;
2179  int numberPrecision() const { return mNumberPrecision; }
2180  QVector<double> tickVector() const { return mTickVector; }
2181  QVector<QString> tickVectorLabels() const { return mTickVectorLabels; }
2182  int tickLengthIn() const;
2183  int tickLengthOut() const;
2184  bool subTicks() const { return mSubTicks; }
2185  int subTickLengthIn() const;
2186  int subTickLengthOut() const;
2187  QPen basePen() const { return mBasePen; }
2188  QPen tickPen() const { return mTickPen; }
2189  QPen subTickPen() const { return mSubTickPen; }
2190  QFont labelFont() const { return mLabelFont; }
2191  QColor labelColor() const { return mLabelColor; }
2192  QString label() const { return mLabel; }
2193  int labelPadding() const;
2194  int padding() const { return mPadding; }
2195  int offset() const;
2196  SelectableParts selectedParts() const { return mSelectedParts; }
2197  SelectableParts selectableParts() const { return mSelectableParts; }
2198  QFont selectedTickLabelFont() const { return mSelectedTickLabelFont; }
2199  QFont selectedLabelFont() const { return mSelectedLabelFont; }
2200  QColor selectedTickLabelColor() const { return mSelectedTickLabelColor; }
2201  QColor selectedLabelColor() const { return mSelectedLabelColor; }
2202  QPen selectedBasePen() const { return mSelectedBasePen; }
2203  QPen selectedTickPen() const { return mSelectedTickPen; }
2204  QPen selectedSubTickPen() const { return mSelectedSubTickPen; }
2205  QCPLineEnding lowerEnding() const;
2206  QCPLineEnding upperEnding() const;
2207  QCPGrid *grid() const { return mGrid; }
2208 
2209  // setters:
2210  Q_SLOT void setScaleType(QCPAxis::ScaleType type);
2211  Q_SLOT void setRange(const QCPRange &range);
2212  void setRange(double lower, double upper);
2213  void setRange(double position, double size, Qt::AlignmentFlag alignment);
2214  void setRangeLower(double lower);
2215  void setRangeUpper(double upper);
2216  void setRangeReversed(bool reversed);
2217  void setTicker(QSharedPointer<QCPAxisTicker> ticker);
2218  void setTicks(bool show);
2219  void setTickLabels(bool show);
2220  void setTickLabelPadding(int padding);
2221  void setTickLabelFont(const QFont &font);
2222  void setTickLabelColor(const QColor &color);
2223  void setTickLabelRotation(double degrees);
2224  void setTickLabelSide(LabelSide side);
2225  void setNumberFormat(const QString &formatCode);
2226  void setNumberPrecision(int precision);
2227  void setTickLength(int inside, int outside=0);
2228  void setTickLengthIn(int inside);
2229  void setTickLengthOut(int outside);
2230  void setSubTicks(bool show);
2231  void setSubTickLength(int inside, int outside=0);
2232  void setSubTickLengthIn(int inside);
2233  void setSubTickLengthOut(int outside);
2234  void setBasePen(const QPen &pen);
2235  void setTickPen(const QPen &pen);
2236  void setSubTickPen(const QPen &pen);
2237  void setLabelFont(const QFont &font);
2238  void setLabelColor(const QColor &color);
2239  void setLabel(const QString &str);
2240  void setLabelPadding(int padding);
2241  void setPadding(int padding);
2242  void setOffset(int offset);
2243  void setSelectedTickLabelFont(const QFont &font);
2244  void setSelectedLabelFont(const QFont &font);
2245  void setSelectedTickLabelColor(const QColor &color);
2246  void setSelectedLabelColor(const QColor &color);
2247  void setSelectedBasePen(const QPen &pen);
2248  void setSelectedTickPen(const QPen &pen);
2249  void setSelectedSubTickPen(const QPen &pen);
2250  Q_SLOT void setSelectableParts(const QCPAxis::SelectableParts &selectableParts);
2251  Q_SLOT void setSelectedParts(const QCPAxis::SelectableParts &selectedParts);
2252  void setLowerEnding(const QCPLineEnding &ending);
2253  void setUpperEnding(const QCPLineEnding &ending);
2254 
2255  // reimplemented virtual methods:
2256  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE;
2257 
2258  // non-property methods:
2259  Qt::Orientation orientation() const { return mOrientation; }
2260  int pixelOrientation() const { return rangeReversed() != (orientation()==Qt::Vertical) ? -1 : 1; }
2261  void moveRange(double diff);
2262  void scaleRange(double factor);
2263  void scaleRange(double factor, double center);
2264  void setScaleRatio(const QCPAxis *otherAxis, double ratio=1.0);
2265  void rescale(bool onlyVisiblePlottables=false);
2266  double pixelToCoord(double value) const;
2267  double coordToPixel(double value) const;
2268  SelectablePart getPartAt(const QPointF &pos) const;
2269  QList<QCPAbstractPlottable*> plottables() const;
2270  QList<QCPGraph*> graphs() const;
2271  QList<QCPAbstractItem*> items() const;
2272 
2273  static AxisType marginSideToAxisType(QCP::MarginSide side);
2274  static Qt::Orientation orientation(AxisType type) { return type==atBottom || type==atTop ? Qt::Horizontal : Qt::Vertical; }
2275  static AxisType opposite(AxisType type);
2276 
2277 signals:
2278  void rangeChanged(const QCPRange &newRange);
2279  void rangeChanged(const QCPRange &newRange, const QCPRange &oldRange);
2280  void scaleTypeChanged(QCPAxis::ScaleType scaleType);
2281  void selectionChanged(const QCPAxis::SelectableParts &parts);
2282  void selectableChanged(const QCPAxis::SelectableParts &parts);
2283 
2284 protected:
2285  // property members:
2286  // axis base:
2287  AxisType mAxisType;
2288  QCPAxisRect *mAxisRect;
2289  //int mOffset; // in QCPAxisPainter
2290  int mPadding;
2291  Qt::Orientation mOrientation;
2292  SelectableParts mSelectableParts, mSelectedParts;
2293  QPen mBasePen, mSelectedBasePen;
2294  //QCPLineEnding mLowerEnding, mUpperEnding; // in QCPAxisPainter
2295  // axis label:
2296  //int mLabelPadding; // in QCPAxisPainter
2297  QString mLabel;
2298  QFont mLabelFont, mSelectedLabelFont;
2299  QColor mLabelColor, mSelectedLabelColor;
2300  // tick labels:
2301  //int mTickLabelPadding; // in QCPAxisPainter
2302  bool mTickLabels;
2303  //double mTickLabelRotation; // in QCPAxisPainter
2304  QFont mTickLabelFont, mSelectedTickLabelFont;
2305  QColor mTickLabelColor, mSelectedTickLabelColor;
2306  int mNumberPrecision;
2307  QLatin1Char mNumberFormatChar;
2308  bool mNumberBeautifulPowers;
2309  //bool mNumberMultiplyCross; // QCPAxisPainter
2310  // ticks and subticks:
2311  bool mTicks;
2312  bool mSubTicks;
2313  //int mTickLengthIn, mTickLengthOut, mSubTickLengthIn, mSubTickLengthOut; // QCPAxisPainter
2314  QPen mTickPen, mSelectedTickPen;
2315  QPen mSubTickPen, mSelectedSubTickPen;
2316  // scale and range:
2317  QCPRange mRange;
2318  bool mRangeReversed;
2319  ScaleType mScaleType;
2320 
2321  // non-property members:
2322  QCPGrid *mGrid;
2323  QCPAxisPainterPrivate *mAxisPainter;
2324  QSharedPointer<QCPAxisTicker> mTicker;
2325  QVector<double> mTickVector;
2326  QVector<QString> mTickVectorLabels;
2327  QVector<double> mSubTickVector;
2328  bool mCachedMarginValid;
2329  int mCachedMargin;
2330  bool mDragging;
2331  QCPRange mDragStartRange;
2332  QCP::AntialiasedElements mAADragBackup, mNotAADragBackup;
2333 
2334  // introduced virtual methods:
2335  virtual int calculateMargin();
2336 
2337  // reimplemented virtual methods:
2338  virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const Q_DECL_OVERRIDE;
2339  virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
2340  virtual QCP::Interaction selectionCategory() const Q_DECL_OVERRIDE;
2341  // events:
2342  virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) Q_DECL_OVERRIDE;
2343  virtual void deselectEvent(bool *selectionStateChanged) Q_DECL_OVERRIDE;
2344  // mouse events:
2345  virtual void mousePressEvent(QMouseEvent *event, const QVariant &details) Q_DECL_OVERRIDE;
2346  virtual void mouseMoveEvent(QMouseEvent *event, const QPointF &startPos) Q_DECL_OVERRIDE;
2347  virtual void mouseReleaseEvent(QMouseEvent *event, const QPointF &startPos) Q_DECL_OVERRIDE;
2348  virtual void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE;
2349 
2350  // non-virtual methods:
2351  void setupTickVectors();
2352  QPen getBasePen() const;
2353  QPen getTickPen() const;
2354  QPen getSubTickPen() const;
2355  QFont getTickLabelFont() const;
2356  QFont getLabelFont() const;
2357  QColor getTickLabelColor() const;
2358  QColor getLabelColor() const;
2359 
2360 private:
2361  Q_DISABLE_COPY(QCPAxis)
2362 
2363  friend class QCustomPlot;
2364  friend class QCPGrid;
2365  friend class QCPAxisRect;
2366 };
2367 Q_DECLARE_OPERATORS_FOR_FLAGS(QCPAxis::SelectableParts)
2368 Q_DECLARE_OPERATORS_FOR_FLAGS(QCPAxis::AxisTypes)
2369 Q_DECLARE_METATYPE(QCPAxis::AxisType)
2370 Q_DECLARE_METATYPE(QCPAxis::LabelSide)
2371 Q_DECLARE_METATYPE(QCPAxis::ScaleType)
2372 Q_DECLARE_METATYPE(QCPAxis::SelectablePart)
2373 
2374 
2376 {
2377 public:
2378  explicit QCPAxisPainterPrivate(QCustomPlot *parentPlot);
2379  virtual ~QCPAxisPainterPrivate();
2380 
2381  virtual void draw(QCPPainter *painter);
2382  virtual int size();
2383  void clearCache();
2384 
2385  QRect axisSelectionBox() const { return mAxisSelectionBox; }
2386  QRect tickLabelsSelectionBox() const { return mTickLabelsSelectionBox; }
2387  QRect labelSelectionBox() const { return mLabelSelectionBox; }
2388 
2389  // public property members:
2390  QCPAxis::AxisType type;
2391  QPen basePen;
2392  QCPLineEnding lowerEnding, upperEnding; // directly accessed by QCPAxis setters/getters
2393  int labelPadding; // directly accessed by QCPAxis setters/getters
2394  QFont labelFont;
2395  QColor labelColor;
2396  QString label;
2397  int tickLabelPadding; // directly accessed by QCPAxis setters/getters
2398  double tickLabelRotation; // directly accessed by QCPAxis setters/getters
2399  QCPAxis::LabelSide tickLabelSide; // directly accessed by QCPAxis setters/getters
2400  bool substituteExponent;
2401  bool numberMultiplyCross; // directly accessed by QCPAxis setters/getters
2402  int tickLengthIn, tickLengthOut, subTickLengthIn, subTickLengthOut; // directly accessed by QCPAxis setters/getters
2403  QPen tickPen, subTickPen;
2404  QFont tickLabelFont;
2405  QColor tickLabelColor;
2406  QRect axisRect, viewportRect;
2407  int offset; // directly accessed by QCPAxis setters/getters
2408  bool abbreviateDecimalPowers;
2409  bool reversedEndings;
2410 
2411  QVector<double> subTickPositions;
2412  QVector<double> tickPositions;
2413  QVector<QString> tickLabels;
2414 
2415 protected:
2417  {
2418  QPointF offset;
2419  QPixmap pixmap;
2420  };
2422  {
2423  QString basePart, expPart, suffixPart;
2424  QRect baseBounds, expBounds, suffixBounds, totalBounds, rotatedTotalBounds;
2425  QFont baseFont, expFont;
2426  };
2427  QCustomPlot *mParentPlot;
2428  QByteArray mLabelParameterHash; // to determine whether mLabelCache needs to be cleared due to changed parameters
2429  QCache<QString, CachedLabel> mLabelCache;
2430  QRect mAxisSelectionBox, mTickLabelsSelectionBox, mLabelSelectionBox;
2431 
2432  virtual QByteArray generateLabelParameterHash() const;
2433 
2434  virtual void placeTickLabel(QCPPainter *painter, double position, int distanceToAxis, const QString &text, QSize *tickLabelsSize);
2435  virtual void drawTickLabel(QCPPainter *painter, double x, double y, const TickLabelData &labelData) const;
2436  virtual TickLabelData getTickLabelData(const QFont &font, const QString &text) const;
2437  virtual QPointF getTickLabelDrawOffset(const TickLabelData &labelData) const;
2438  virtual void getMaxTickLabelSize(const QFont &font, const QString &text, QSize *tickLabelsSize) const;
2439 };
2440 
2441 /* end of 'src/axis/axis.h' */
2442 
2443 
2444 /* including file 'src/scatterstyle.h' */
2445 /* modified 2021-03-29T02:30:44, size 7275 */
2446 
2447 class QCP_LIB_DECL QCPScatterStyle
2448 {
2449  Q_GADGET
2450 public:
2459  enum ScatterProperty { spNone = 0x00
2460  ,spPen = 0x01
2461  ,spBrush = 0x02
2462  ,spSize = 0x04
2463  ,spShape = 0x08
2464  ,spAll = 0xFF
2465  };
2466  Q_ENUMS(ScatterProperty)
2467  Q_FLAGS(ScatterProperties)
2468  Q_DECLARE_FLAGS(ScatterProperties, ScatterProperty)
2469 
2470 
2477  enum ScatterShape { ssNone
2478  ,ssDot
2479  ,ssCross
2480  ,ssPlus
2481  ,ssCircle
2482  ,ssDisc
2483  ,ssSquare
2484  ,ssDiamond
2485  ,ssStar
2486  ,ssTriangle
2487  ,ssTriangleInverted
2488  ,ssCrossSquare
2489  ,ssPlusSquare
2490  ,ssCrossCircle
2491  ,ssPlusCircle
2492  ,ssPeace
2493  ,ssPixmap
2494  ,ssCustom
2495  };
2496  Q_ENUMS(ScatterShape)
2497 
2498  QCPScatterStyle();
2499  QCPScatterStyle(ScatterShape shape, double size=6);
2500  QCPScatterStyle(ScatterShape shape, const QColor &color, double size);
2501  QCPScatterStyle(ScatterShape shape, const QColor &color, const QColor &fill, double size);
2502  QCPScatterStyle(ScatterShape shape, const QPen &pen, const QBrush &brush, double size);
2503  QCPScatterStyle(const QPixmap &pixmap);
2504  QCPScatterStyle(const QPainterPath &customPath, const QPen &pen, const QBrush &brush=Qt::NoBrush, double size=6);
2505 
2506  // getters:
2507  double size() const { return mSize; }
2508  ScatterShape shape() const { return mShape; }
2509  QPen pen() const { return mPen; }
2510  QBrush brush() const { return mBrush; }
2511  QPixmap pixmap() const { return mPixmap; }
2512  QPainterPath customPath() const { return mCustomPath; }
2513 
2514  // setters:
2515  void setFromOther(const QCPScatterStyle &other, ScatterProperties properties);
2516  void setSize(double size);
2517  void setShape(ScatterShape shape);
2518  void setPen(const QPen &pen);
2519  void setBrush(const QBrush &brush);
2520  void setPixmap(const QPixmap &pixmap);
2521  void setCustomPath(const QPainterPath &customPath);
2522 
2523  // non-property methods:
2524  bool isNone() const { return mShape == ssNone; }
2525  bool isPenDefined() const { return mPenDefined; }
2526  void undefinePen();
2527  void applyTo(QCPPainter *painter, const QPen &defaultPen) const;
2528  void drawShape(QCPPainter *painter, const QPointF &pos) const;
2529  void drawShape(QCPPainter *painter, double x, double y) const;
2530 
2531 protected:
2532  // property members:
2533  double mSize;
2534  ScatterShape mShape;
2535  QPen mPen;
2536  QBrush mBrush;
2537  QPixmap mPixmap;
2538  QPainterPath mCustomPath;
2539 
2540  // non-property members:
2541  bool mPenDefined;
2542 };
2543 Q_DECLARE_TYPEINFO(QCPScatterStyle, Q_MOVABLE_TYPE);
2544 Q_DECLARE_OPERATORS_FOR_FLAGS(QCPScatterStyle::ScatterProperties)
2545 Q_DECLARE_METATYPE(QCPScatterStyle::ScatterProperty)
2546 Q_DECLARE_METATYPE(QCPScatterStyle::ScatterShape)
2547 
2548 /* end of 'src/scatterstyle.h' */
2549 
2550 
2551 /* including file 'src/datacontainer.h' */
2552 /* modified 2021-03-29T02:30:44, size 34070 */
2553 
2554 
2559 template <class DataType>
2560 inline bool qcpLessThanSortKey(const DataType &a, const DataType &b) { return a.sortKey() < b.sortKey(); }
2561 
2562 template <class DataType>
2563 class QCPDataContainer // no QCP_LIB_DECL, template class ends up in header (cpp included below)
2564 {
2565 public:
2566  typedef typename QVector<DataType>::const_iterator const_iterator;
2567  typedef typename QVector<DataType>::iterator iterator;
2568 
2569  QCPDataContainer();
2570 
2571  // getters:
2572  int size() const { return mData.size()-mPreallocSize; }
2573  bool isEmpty() const { return size() == 0; }
2574  bool autoSqueeze() const { return mAutoSqueeze; }
2575 
2576  // setters:
2577  void setAutoSqueeze(bool enabled);
2578 
2579  // non-virtual methods:
2580  void set(const QCPDataContainer<DataType> &data);
2581  void set(const QVector<DataType> &data, bool alreadySorted=false);
2582  void add(const QCPDataContainer<DataType> &data);
2583  void add(const QVector<DataType> &data, bool alreadySorted=false);
2584  void add(const DataType &data);
2585  void removeBefore(double sortKey);
2586  void removeAfter(double sortKey);
2587  void remove(double sortKeyFrom, double sortKeyTo);
2588  void remove(double sortKey);
2589  void clear();
2590  void sort();
2591  void squeeze(bool preAllocation=true, bool postAllocation=true);
2592 
2593  const_iterator constBegin() const { return mData.constBegin()+mPreallocSize; }
2594  const_iterator constEnd() const { return mData.constEnd(); }
2595  iterator begin() { return mData.begin()+mPreallocSize; }
2596  iterator end() { return mData.end(); }
2597  const_iterator findBegin(double sortKey, bool expandedRange=true) const;
2598  const_iterator findEnd(double sortKey, bool expandedRange=true) const;
2599  const_iterator at(int index) const { return constBegin()+qBound(0, index, size()); }
2600  QCPRange keyRange(bool &foundRange, QCP::SignDomain signDomain=QCP::sdBoth);
2601  QCPRange valueRange(bool &foundRange, QCP::SignDomain signDomain=QCP::sdBoth, const QCPRange &inKeyRange=QCPRange());
2602  QCPDataRange dataRange() const { return QCPDataRange(0, size()); }
2603  void limitIteratorsToDataRange(const_iterator &begin, const_iterator &end, const QCPDataRange &dataRange) const;
2604 
2605 protected:
2606  // property members:
2607  bool mAutoSqueeze;
2608 
2609  // non-property memebers:
2610  QVector<DataType> mData;
2611  int mPreallocSize;
2612  int mPreallocIteration;
2613 
2614  // non-virtual methods:
2615  void preallocateGrow(int minimumPreallocSize);
2616  void performAutoSqueeze();
2617 };
2618 
2619 
2620 
2621 // include implementation in header since it is a class template:
2625 
2693 /* start documentation of inline functions */
2694 
2749 /* end documentation of inline functions */
2750 
2755 template <class DataType>
2757  mAutoSqueeze(true),
2758  mPreallocSize(0),
2759  mPreallocIteration(0)
2760 {
2761 }
2762 
2771 template <class DataType>
2773 {
2774  if (mAutoSqueeze != enabled)
2775  {
2776  mAutoSqueeze = enabled;
2777  if (mAutoSqueeze)
2778  performAutoSqueeze();
2779  }
2780 }
2781 
2788 template <class DataType>
2790 {
2791  clear();
2792  add(data);
2793 }
2794 
2804 template <class DataType>
2805 void QCPDataContainer<DataType>::set(const QVector<DataType> &data, bool alreadySorted)
2806 {
2807  mData = data;
2808  mPreallocSize = 0;
2809  mPreallocIteration = 0;
2810  if (!alreadySorted)
2811  sort();
2812 }
2813 
2820 template <class DataType>
2822 {
2823  if (data.isEmpty())
2824  return;
2825 
2826  const int n = data.size();
2827  const int oldSize = size();
2828 
2829  if (oldSize > 0 && !qcpLessThanSortKey<DataType>(*constBegin(), *(data.constEnd()-1))) // prepend if new data keys are all smaller than or equal to existing ones
2830  {
2831  if (mPreallocSize < n)
2832  preallocateGrow(n);
2833  mPreallocSize -= n;
2834  std::copy(data.constBegin(), data.constEnd(), begin());
2835  } else // don't need to prepend, so append and merge if necessary
2836  {
2837  mData.resize(mData.size()+n);
2838  std::copy(data.constBegin(), data.constEnd(), end()-n);
2839  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
2840  std::inplace_merge(begin(), end()-n, end(), qcpLessThanSortKey<DataType>);
2841  }
2842 }
2843 
2852 template <class DataType>
2853 void QCPDataContainer<DataType>::add(const QVector<DataType> &data, bool alreadySorted)
2854 {
2855  if (data.isEmpty())
2856  return;
2857  if (isEmpty())
2858  {
2859  set(data, alreadySorted);
2860  return;
2861  }
2862 
2863  const int n = data.size();
2864  const int oldSize = size();
2865 
2866  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
2867  {
2868  if (mPreallocSize < n)
2869  preallocateGrow(n);
2870  mPreallocSize -= n;
2871  std::copy(data.constBegin(), data.constEnd(), begin());
2872  } else // don't need to prepend, so append and then sort and merge if necessary
2873  {
2874  mData.resize(mData.size()+n);
2875  std::copy(data.constBegin(), data.constEnd(), end()-n);
2876  if (!alreadySorted) // sort appended subrange if it wasn't already sorted
2877  std::sort(end()-n, end(), qcpLessThanSortKey<DataType>);
2878  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
2879  std::inplace_merge(begin(), end()-n, end(), qcpLessThanSortKey<DataType>);
2880  }
2881 }
2882 
2889 template <class DataType>
2890 void QCPDataContainer<DataType>::add(const DataType &data)
2891 {
2892  if (isEmpty() || !qcpLessThanSortKey<DataType>(data, *(constEnd()-1))) // quickly handle appends if new data key is greater or equal to existing ones
2893  {
2894  mData.append(data);
2895  } else if (qcpLessThanSortKey<DataType>(data, *constBegin())) // quickly handle prepends using preallocated space
2896  {
2897  if (mPreallocSize < 1)
2898  preallocateGrow(1);
2899  --mPreallocSize;
2900  *begin() = data;
2901  } else // handle inserts, maintaining sorted keys
2902  {
2903  QCPDataContainer<DataType>::iterator insertionPoint = std::lower_bound(begin(), end(), data, qcpLessThanSortKey<DataType>);
2904  mData.insert(insertionPoint, data);
2905  }
2906 }
2907 
2913 template <class DataType>
2915 {
2916  QCPDataContainer<DataType>::iterator it = begin();
2917  QCPDataContainer<DataType>::iterator itEnd = std::lower_bound(begin(), end(), DataType::fromSortKey(sortKey), qcpLessThanSortKey<DataType>);
2918  mPreallocSize += int(itEnd-it); // don't actually delete, just add it to the preallocated block (if it gets too large, squeeze will take care of it)
2919  if (mAutoSqueeze)
2920  performAutoSqueeze();
2921 }
2922 
2928 template <class DataType>
2930 {
2931  QCPDataContainer<DataType>::iterator it = std::upper_bound(begin(), end(), DataType::fromSortKey(sortKey), qcpLessThanSortKey<DataType>);
2932  QCPDataContainer<DataType>::iterator itEnd = end();
2933  mData.erase(it, itEnd); // typically adds it to the postallocated block
2934  if (mAutoSqueeze)
2935  performAutoSqueeze();
2936 }
2937 
2945 template <class DataType>
2946 void QCPDataContainer<DataType>::remove(double sortKeyFrom, double sortKeyTo)
2947 {
2948  if (sortKeyFrom >= sortKeyTo || isEmpty())
2949  return;
2950 
2951  QCPDataContainer<DataType>::iterator it = std::lower_bound(begin(), end(), DataType::fromSortKey(sortKeyFrom), qcpLessThanSortKey<DataType>);
2952  QCPDataContainer<DataType>::iterator itEnd = std::upper_bound(it, end(), DataType::fromSortKey(sortKeyTo), qcpLessThanSortKey<DataType>);
2953  mData.erase(it, itEnd);
2954  if (mAutoSqueeze)
2955  performAutoSqueeze();
2956 }
2957 
2967 template <class DataType>
2969 {
2970  QCPDataContainer::iterator it = std::lower_bound(begin(), end(), DataType::fromSortKey(sortKey), qcpLessThanSortKey<DataType>);
2971  if (it != end() && it->sortKey() == sortKey)
2972  {
2973  if (it == begin())
2974  ++mPreallocSize; // don't actually delete, just add it to the preallocated block (if it gets too large, squeeze will take care of it)
2975  else
2976  mData.erase(it);
2977  }
2978  if (mAutoSqueeze)
2979  performAutoSqueeze();
2980 }
2981 
2987 template <class DataType>
2989 {
2990  mData.clear();
2991  mPreallocIteration = 0;
2992  mPreallocSize = 0;
2993 }
2994 
3006 template <class DataType>
3008 {
3009  std::sort(begin(), end(), qcpLessThanSortKey<DataType>);
3010 }
3011 
3022 template <class DataType>
3023 void QCPDataContainer<DataType>::squeeze(bool preAllocation, bool postAllocation)
3024 {
3025  if (preAllocation)
3026  {
3027  if (mPreallocSize > 0)
3028  {
3029  std::copy(begin(), end(), mData.begin());
3030  mData.resize(size());
3031  mPreallocSize = 0;
3032  }
3033  mPreallocIteration = 0;
3034  }
3035  if (postAllocation)
3036  mData.squeeze();
3037 }
3038 
3054 template <class DataType>
3055 typename QCPDataContainer<DataType>::const_iterator QCPDataContainer<DataType>::findBegin(double sortKey, bool expandedRange) const
3056 {
3057  if (isEmpty())
3058  return constEnd();
3059 
3060  QCPDataContainer<DataType>::const_iterator it = std::lower_bound(constBegin(), constEnd(), DataType::fromSortKey(sortKey), qcpLessThanSortKey<DataType>);
3061  if (expandedRange && it != constBegin()) // also covers it == constEnd case, and we know --constEnd is valid because mData isn't empty
3062  --it;
3063  return it;
3064 }
3065 
3081 template <class DataType>
3082 typename QCPDataContainer<DataType>::const_iterator QCPDataContainer<DataType>::findEnd(double sortKey, bool expandedRange) const
3083 {
3084  if (isEmpty())
3085  return constEnd();
3086 
3087  QCPDataContainer<DataType>::const_iterator it = std::upper_bound(constBegin(), constEnd(), DataType::fromSortKey(sortKey), qcpLessThanSortKey<DataType>);
3088  if (expandedRange && it != constEnd())
3089  ++it;
3090  return it;
3091 }
3092 
3108 template <class DataType>
3110 {
3111  if (isEmpty())
3112  {
3113  foundRange = false;
3114  return QCPRange();
3115  }
3116  QCPRange range;
3117  bool haveLower = false;
3118  bool haveUpper = false;
3119  double current;
3120 
3121  QCPDataContainer<DataType>::const_iterator it = constBegin();
3122  QCPDataContainer<DataType>::const_iterator itEnd = constEnd();
3123  if (signDomain == QCP::sdBoth) // range may be anywhere
3124  {
3125  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
3126  {
3127  while (it != itEnd) // find first non-nan going up from left
3128  {
3129  if (!qIsNaN(it->mainValue()))
3130  {
3131  range.lower = it->mainKey();
3132  haveLower = true;
3133  break;
3134  }
3135  ++it;
3136  }
3137  it = itEnd;
3138  while (it != constBegin()) // find first non-nan going down from right
3139  {
3140  --it;
3141  if (!qIsNaN(it->mainValue()))
3142  {
3143  range.upper = it->mainKey();
3144  haveUpper = true;
3145  break;
3146  }
3147  }
3148  } else // DataType is not sorted by main key, go through all data points and accordingly expand range
3149  {
3150  while (it != itEnd)
3151  {
3152  if (!qIsNaN(it->mainValue()))
3153  {
3154  current = it->mainKey();
3155  if (current < range.lower || !haveLower)
3156  {
3157  range.lower = current;
3158  haveLower = true;
3159  }
3160  if (current > range.upper || !haveUpper)
3161  {
3162  range.upper = current;
3163  haveUpper = true;
3164  }
3165  }
3166  ++it;
3167  }
3168  }
3169  } else if (signDomain == QCP::sdNegative) // range may only be in the negative sign domain
3170  {
3171  while (it != itEnd)
3172  {
3173  if (!qIsNaN(it->mainValue()))
3174  {
3175  current = it->mainKey();
3176  if ((current < range.lower || !haveLower) && current < 0)
3177  {
3178  range.lower = current;
3179  haveLower = true;
3180  }
3181  if ((current > range.upper || !haveUpper) && current < 0)
3182  {
3183  range.upper = current;
3184  haveUpper = true;
3185  }
3186  }
3187  ++it;
3188  }
3189  } else if (signDomain == QCP::sdPositive) // range may only be in the positive sign domain
3190  {
3191  while (it != itEnd)
3192  {
3193  if (!qIsNaN(it->mainValue()))
3194  {
3195  current = it->mainKey();
3196  if ((current < range.lower || !haveLower) && current > 0)
3197  {
3198  range.lower = current;
3199  haveLower = true;
3200  }
3201  if ((current > range.upper || !haveUpper) && current > 0)
3202  {
3203  range.upper = current;
3204  haveUpper = true;
3205  }
3206  }
3207  ++it;
3208  }
3209  }
3210 
3211  foundRange = haveLower && haveUpper;
3212  return range;
3213 }
3214 
3231 template <class DataType>
3232 QCPRange QCPDataContainer<DataType>::valueRange(bool &foundRange, QCP::SignDomain signDomain, const QCPRange &inKeyRange)
3233 {
3234  if (isEmpty())
3235  {
3236  foundRange = false;
3237  return QCPRange();
3238  }
3239  QCPRange range;
3240  const bool restrictKeyRange = inKeyRange != QCPRange();
3241  bool haveLower = false;
3242  bool haveUpper = false;
3243  QCPRange current;
3244  QCPDataContainer<DataType>::const_iterator itBegin = constBegin();
3245  QCPDataContainer<DataType>::const_iterator itEnd = constEnd();
3246  if (DataType::sortKeyIsMainKey() && restrictKeyRange)
3247  {
3248  itBegin = findBegin(inKeyRange.lower, false);
3249  itEnd = findEnd(inKeyRange.upper, false);
3250  }
3251  if (signDomain == QCP::sdBoth) // range may be anywhere
3252  {
3253  for (QCPDataContainer<DataType>::const_iterator it = itBegin; it != itEnd; ++it)
3254  {
3255  if (restrictKeyRange && (it->mainKey() < inKeyRange.lower || it->mainKey() > inKeyRange.upper))
3256  continue;
3257  current = it->valueRange();
3258  if ((current.lower < range.lower || !haveLower) && !qIsNaN(current.lower))
3259  {
3260  range.lower = current.lower;
3261  haveLower = true;
3262  }
3263  if ((current.upper > range.upper || !haveUpper) && !qIsNaN(current.upper))
3264  {
3265  range.upper = current.upper;
3266  haveUpper = true;
3267  }
3268  }
3269  } else if (signDomain == QCP::sdNegative) // range may only be in the negative sign domain
3270  {
3271  for (QCPDataContainer<DataType>::const_iterator it = itBegin; it != itEnd; ++it)
3272  {
3273  if (restrictKeyRange && (it->mainKey() < inKeyRange.lower || it->mainKey() > inKeyRange.upper))
3274  continue;
3275  current = it->valueRange();
3276  if ((current.lower < range.lower || !haveLower) && current.lower < 0 && !qIsNaN(current.lower))
3277  {
3278  range.lower = current.lower;
3279  haveLower = true;
3280  }
3281  if ((current.upper > range.upper || !haveUpper) && current.upper < 0 && !qIsNaN(current.upper))
3282  {
3283  range.upper = current.upper;
3284  haveUpper = true;
3285  }
3286  }
3287  } else if (signDomain == QCP::sdPositive) // range may only be in the positive sign domain
3288  {
3289  for (QCPDataContainer<DataType>::const_iterator it = itBegin; it != itEnd; ++it)
3290  {
3291  if (restrictKeyRange && (it->mainKey() < inKeyRange.lower || it->mainKey() > inKeyRange.upper))
3292  continue;
3293  current = it->valueRange();
3294  if ((current.lower < range.lower || !haveLower) && current.lower > 0 && !qIsNaN(current.lower))
3295  {
3296  range.lower = current.lower;
3297  haveLower = true;
3298  }
3299  if ((current.upper > range.upper || !haveUpper) && current.upper > 0 && !qIsNaN(current.upper))
3300  {
3301  range.upper = current.upper;
3302  haveUpper = true;
3303  }
3304  }
3305  }
3306 
3307  foundRange = haveLower && haveUpper;
3308  return range;
3309 }
3310 
3319 template <class DataType>
3320 void QCPDataContainer<DataType>::limitIteratorsToDataRange(const_iterator &begin, const_iterator &end, const QCPDataRange &dataRange) const
3321 {
3322  QCPDataRange iteratorRange(int(begin-constBegin()), int(end-constBegin()));
3323  iteratorRange = iteratorRange.bounded(dataRange.bounded(this->dataRange()));
3324  begin = constBegin()+iteratorRange.begin();
3325  end = constBegin()+iteratorRange.end();
3326 }
3327 
3337 template <class DataType>
3338 void QCPDataContainer<DataType>::preallocateGrow(int minimumPreallocSize)
3339 {
3340  if (minimumPreallocSize <= mPreallocSize)
3341  return;
3342 
3343  int newPreallocSize = minimumPreallocSize;
3344  newPreallocSize += (1u<<qBound(4, mPreallocIteration+4, 15)) - 12; // do 4 up to 32768-12 preallocation, doubling in each intermediate iteration
3345  ++mPreallocIteration;
3346 
3347  int sizeDifference = newPreallocSize-mPreallocSize;
3348  mData.resize(mData.size()+sizeDifference);
3349  std::copy_backward(mData.begin()+mPreallocSize, mData.end()-sizeDifference, mData.end());
3350  mPreallocSize = newPreallocSize;
3351 }
3352 
3367 template <class DataType>
3369 {
3370  const int totalAlloc = mData.capacity();
3371  const int postAllocSize = totalAlloc-mData.size();
3372  const int usedSize = size();
3373  bool shrinkPostAllocation = false;
3374  bool shrinkPreAllocation = false;
3375  if (totalAlloc > 650000) // if allocation is larger, shrink earlier with respect to total used size
3376  {
3377  shrinkPostAllocation = postAllocSize > usedSize*1.5; // QVector grow strategy is 2^n for static data. Watch out not to oscillate!
3378  shrinkPreAllocation = mPreallocSize*10 > usedSize;
3379  } else if (totalAlloc > 1000) // below 10 MiB raw data be generous with preallocated memory, below 1k points don't even bother
3380  {
3381  shrinkPostAllocation = postAllocSize > usedSize*5;
3382  shrinkPreAllocation = mPreallocSize > usedSize*1.5; // preallocation can grow into postallocation, so can be smaller
3383  }
3384 
3385  if (shrinkPreAllocation || shrinkPostAllocation)
3386  squeeze(shrinkPreAllocation, shrinkPostAllocation);
3387 }
3388 
3389 
3390 /* end of 'src/datacontainer.h' */
3391 
3392 
3393 /* including file 'src/plottable.h' */
3394 /* modified 2021-03-29T02:30:44, size 8461 */
3395 
3396 class QCP_LIB_DECL QCPSelectionDecorator
3397 {
3398  Q_GADGET
3399 public:
3401  virtual ~QCPSelectionDecorator();
3402 
3403  // getters:
3404  QPen pen() const { return mPen; }
3405  QBrush brush() const { return mBrush; }
3406  QCPScatterStyle scatterStyle() const { return mScatterStyle; }
3407  QCPScatterStyle::ScatterProperties usedScatterProperties() const { return mUsedScatterProperties; }
3408 
3409  // setters:
3410  void setPen(const QPen &pen);
3411  void setBrush(const QBrush &brush);
3412  void setScatterStyle(const QCPScatterStyle &scatterStyle, QCPScatterStyle::ScatterProperties usedProperties=QCPScatterStyle::spPen);
3413  void setUsedScatterProperties(const QCPScatterStyle::ScatterProperties &properties);
3414 
3415  // non-virtual methods:
3416  void applyPen(QCPPainter *painter) const;
3417  void applyBrush(QCPPainter *painter) const;
3418  QCPScatterStyle getFinalScatterStyle(const QCPScatterStyle &unselectedStyle) const;
3419 
3420  // introduced virtual methods:
3421  virtual void copyFrom(const QCPSelectionDecorator *other);
3422  virtual void drawDecoration(QCPPainter *painter, QCPDataSelection selection);
3423 
3424 protected:
3425  // property members:
3426  QPen mPen;
3427  QBrush mBrush;
3428  QCPScatterStyle mScatterStyle;
3429  QCPScatterStyle::ScatterProperties mUsedScatterProperties;
3430  // non-property members:
3431  QCPAbstractPlottable *mPlottable;
3432 
3433  // introduced virtual methods:
3434  virtual bool registerWithPlottable(QCPAbstractPlottable *plottable);
3435 
3436 private:
3437  Q_DISABLE_COPY(QCPSelectionDecorator)
3438  friend class QCPAbstractPlottable;
3439 };
3440 Q_DECLARE_METATYPE(QCPSelectionDecorator*)
3441 
3442 
3443 class QCP_LIB_DECL QCPAbstractPlottable : public QCPLayerable
3444 {
3445  Q_OBJECT
3447  Q_PROPERTY(QString name READ name WRITE setName)
3448  Q_PROPERTY(bool antialiasedFill READ antialiasedFill WRITE setAntialiasedFill)
3449  Q_PROPERTY(bool antialiasedScatters READ antialiasedScatters WRITE setAntialiasedScatters)
3450  Q_PROPERTY(QPen pen READ pen WRITE setPen)
3451  Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
3452  Q_PROPERTY(QCPAxis* keyAxis READ keyAxis WRITE setKeyAxis)
3453  Q_PROPERTY(QCPAxis* valueAxis READ valueAxis WRITE setValueAxis)
3454  Q_PROPERTY(QCP::SelectionType selectable READ selectable WRITE setSelectable NOTIFY selectableChanged)
3455  Q_PROPERTY(QCPDataSelection selection READ selection WRITE setSelection NOTIFY selectionChanged)
3458 public:
3459  QCPAbstractPlottable(QCPAxis *keyAxis, QCPAxis *valueAxis);
3460  virtual ~QCPAbstractPlottable() Q_DECL_OVERRIDE;
3461 
3462  // getters:
3463  QString name() const { return mName; }
3464  bool antialiasedFill() const { return mAntialiasedFill; }
3465  bool antialiasedScatters() const { return mAntialiasedScatters; }
3466  QPen pen() const { return mPen; }
3467  QBrush brush() const { return mBrush; }
3468  QCPAxis *keyAxis() const { return mKeyAxis.data(); }
3469  QCPAxis *valueAxis() const { return mValueAxis.data(); }
3470  QCP::SelectionType selectable() const { return mSelectable; }
3471  bool selected() const { return !mSelection.isEmpty(); }
3472  QCPDataSelection selection() const { return mSelection; }
3473  QCPSelectionDecorator *selectionDecorator() const { return mSelectionDecorator; }
3474 
3475  // setters:
3476  void setName(const QString &name);
3477  void setAntialiasedFill(bool enabled);
3478  void setAntialiasedScatters(bool enabled);
3479  void setPen(const QPen &pen);
3480  void setBrush(const QBrush &brush);
3481  void setKeyAxis(QCPAxis *axis);
3482  void setValueAxis(QCPAxis *axis);
3483  Q_SLOT void setSelectable(QCP::SelectionType selectable);
3486 
3487  // introduced virtual methods:
3488  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
3489  virtual QCPPlottableInterface1D *interface1D() { return nullptr; }
3490  virtual QCPRange getKeyRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth) const = 0;
3491  virtual QCPRange getValueRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth, const QCPRange &inKeyRange=QCPRange()) const = 0;
3492 
3493  // non-property methods:
3494  void coordsToPixels(double key, double value, double &x, double &y) const;
3495  const QPointF coordsToPixels(double key, double value) const;
3496  void pixelsToCoords(double x, double y, double &key, double &value) const;
3497  void pixelsToCoords(const QPointF &pixelPos, double &key, double &value) const;
3498  void rescaleAxes(bool onlyEnlarge=false) const;
3499  void rescaleKeyAxis(bool onlyEnlarge=false) const;
3500  void rescaleValueAxis(bool onlyEnlarge=false, bool inKeyRange=false) const;
3501  bool addToLegend(QCPLegend *legend);
3502  bool addToLegend();
3503  bool removeFromLegend(QCPLegend *legend) const;
3504  bool removeFromLegend() const;
3505 
3506 signals:
3507  void selectionChanged(bool selected);
3509  void selectableChanged(QCP::SelectionType selectable);
3510 
3511 protected:
3512  // property members:
3513  QString mName;
3514  bool mAntialiasedFill, mAntialiasedScatters;
3515  QPen mPen;
3516  QBrush mBrush;
3517  QPointer<QCPAxis> mKeyAxis, mValueAxis;
3518  QCP::SelectionType mSelectable;
3519  QCPDataSelection mSelection;
3520  QCPSelectionDecorator *mSelectionDecorator;
3521 
3522  // reimplemented virtual methods:
3523  virtual QRect clipRect() const Q_DECL_OVERRIDE;
3524  virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE = 0;
3525  virtual QCP::Interaction selectionCategory() const Q_DECL_OVERRIDE;
3526  void applyDefaultAntialiasingHint(QCPPainter *painter) const Q_DECL_OVERRIDE;
3527  // events:
3528  virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) Q_DECL_OVERRIDE;
3529  virtual void deselectEvent(bool *selectionStateChanged) Q_DECL_OVERRIDE;
3530 
3531  // introduced virtual methods:
3532  virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const = 0;
3533 
3534  // non-virtual methods:
3535  void applyFillAntialiasingHint(QCPPainter *painter) const;
3536  void applyScattersAntialiasingHint(QCPPainter *painter) const;
3537 
3538 private:
3539  Q_DISABLE_COPY(QCPAbstractPlottable)
3540 
3541  friend class QCustomPlot;
3542  friend class QCPAxis;
3543  friend class QCPPlottableLegendItem;
3544 };
3545 
3546 
3547 /* end of 'src/plottable.h' */
3548 
3549 
3550 /* including file 'src/item.h' */
3551 /* modified 2021-03-29T02:30:44, size 9425 */
3552 
3553 class QCP_LIB_DECL QCPItemAnchor
3554 {
3555  Q_GADGET
3556 public:
3557  QCPItemAnchor(QCustomPlot *parentPlot, QCPAbstractItem *parentItem, const QString &name, int anchorId=-1);
3558  virtual ~QCPItemAnchor();
3559 
3560  // getters:
3561  QString name() const { return mName; }
3562  virtual QPointF pixelPosition() const;
3563 
3564 protected:
3565  // property members:
3566  QString mName;
3567 
3568  // non-property members:
3569  QCustomPlot *mParentPlot;
3570  QCPAbstractItem *mParentItem;
3571  int mAnchorId;
3572  QSet<QCPItemPosition*> mChildrenX, mChildrenY;
3573 
3574  // introduced virtual methods:
3575  virtual QCPItemPosition *toQCPItemPosition() { return nullptr; }
3576 
3577  // non-virtual methods:
3578  void addChildX(QCPItemPosition* pos); // called from pos when this anchor is set as parent
3579  void removeChildX(QCPItemPosition *pos); // called from pos when its parent anchor is reset or pos deleted
3580  void addChildY(QCPItemPosition* pos); // called from pos when this anchor is set as parent
3581  void removeChildY(QCPItemPosition *pos); // called from pos when its parent anchor is reset or pos deleted
3582 
3583 private:
3584  Q_DISABLE_COPY(QCPItemAnchor)
3585 
3586  friend class QCPItemPosition;
3587 };
3588 
3589 
3590 
3591 class QCP_LIB_DECL QCPItemPosition : public QCPItemAnchor
3592 {
3593  Q_GADGET
3594 public:
3601  enum PositionType { ptAbsolute
3602  ,ptViewportRatio
3603  ,ptAxisRectRatio
3606  ,ptPlotCoords
3609  };
3610  Q_ENUMS(PositionType)
3611 
3612  QCPItemPosition(QCustomPlot *parentPlot, QCPAbstractItem *parentItem, const QString &name);
3613  virtual ~QCPItemPosition() Q_DECL_OVERRIDE;
3614 
3615  // getters:
3616  PositionType type() const { return typeX(); }
3617  PositionType typeX() const { return mPositionTypeX; }
3618  PositionType typeY() const { return mPositionTypeY; }
3619  QCPItemAnchor *parentAnchor() const { return parentAnchorX(); }
3620  QCPItemAnchor *parentAnchorX() const { return mParentAnchorX; }
3621  QCPItemAnchor *parentAnchorY() const { return mParentAnchorY; }
3622  double key() const { return mKey; }
3623  double value() const { return mValue; }
3624  QPointF coords() const { return QPointF(mKey, mValue); }
3625  QCPAxis *keyAxis() const { return mKeyAxis.data(); }
3626  QCPAxis *valueAxis() const { return mValueAxis.data(); }
3627  QCPAxisRect *axisRect() const;
3628  virtual QPointF pixelPosition() const Q_DECL_OVERRIDE;
3629 
3630  // setters:
3631  void setType(PositionType type);
3632  void setTypeX(PositionType type);
3633  void setTypeY(PositionType type);
3634  bool setParentAnchor(QCPItemAnchor *parentAnchor, bool keepPixelPosition=false);
3635  bool setParentAnchorX(QCPItemAnchor *parentAnchor, bool keepPixelPosition=false);
3636  bool setParentAnchorY(QCPItemAnchor *parentAnchor, bool keepPixelPosition=false);
3637  void setCoords(double key, double value);
3638  void setCoords(const QPointF &pos);
3639  void setAxes(QCPAxis* keyAxis, QCPAxis* valueAxis);
3640  void setAxisRect(QCPAxisRect *axisRect);
3641  void setPixelPosition(const QPointF &pixelPosition);
3642 
3643 protected:
3644  // property members:
3645  PositionType mPositionTypeX, mPositionTypeY;
3646  QPointer<QCPAxis> mKeyAxis, mValueAxis;
3647  QPointer<QCPAxisRect> mAxisRect;
3648  double mKey, mValue;
3649  QCPItemAnchor *mParentAnchorX, *mParentAnchorY;
3650 
3651  // reimplemented virtual methods:
3652  virtual QCPItemPosition *toQCPItemPosition() Q_DECL_OVERRIDE { return this; }
3653 
3654 private:
3655  Q_DISABLE_COPY(QCPItemPosition)
3656 
3657 };
3658 Q_DECLARE_METATYPE(QCPItemPosition::PositionType)
3659 
3660 
3661 class QCP_LIB_DECL QCPAbstractItem : public QCPLayerable
3662 {
3663  Q_OBJECT
3665  Q_PROPERTY(bool clipToAxisRect READ clipToAxisRect WRITE setClipToAxisRect)
3666  Q_PROPERTY(QCPAxisRect* clipAxisRect READ clipAxisRect WRITE setClipAxisRect)
3667  Q_PROPERTY(bool selectable READ selectable WRITE setSelectable NOTIFY selectableChanged)
3668  Q_PROPERTY(bool selected READ selected WRITE setSelected NOTIFY selectionChanged)
3670 public:
3671  explicit QCPAbstractItem(QCustomPlot *parentPlot);
3672  virtual ~QCPAbstractItem() Q_DECL_OVERRIDE;
3673 
3674  // getters:
3675  bool clipToAxisRect() const { return mClipToAxisRect; }
3676  QCPAxisRect *clipAxisRect() const;
3677  bool selectable() const { return mSelectable; }
3678  bool selected() const { return mSelected; }
3679 
3680  // setters:
3681  void setClipToAxisRect(bool clip);
3682  void setClipAxisRect(QCPAxisRect *rect);
3683  Q_SLOT void setSelectable(bool selectable);
3684  Q_SLOT void setSelected(bool selected);
3685 
3686  // reimplemented virtual methods:
3687  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE = 0;
3688 
3689  // non-virtual methods:
3690  QList<QCPItemPosition*> positions() const { return mPositions; }
3691  QList<QCPItemAnchor*> anchors() const { return mAnchors; }
3692  QCPItemPosition *position(const QString &name) const;
3693  QCPItemAnchor *anchor(const QString &name) const;
3694  bool hasAnchor(const QString &name) const;
3695 
3696 signals:
3697  void selectionChanged(bool selected);
3698  void selectableChanged(bool selectable);
3699 
3700 protected:
3701  // property members:
3702  bool mClipToAxisRect;
3703  QPointer<QCPAxisRect> mClipAxisRect;
3704  QList<QCPItemPosition*> mPositions;
3705  QList<QCPItemAnchor*> mAnchors;
3706  bool mSelectable, mSelected;
3707 
3708  // reimplemented virtual methods:
3709  virtual QCP::Interaction selectionCategory() const Q_DECL_OVERRIDE;
3710  virtual QRect clipRect() const Q_DECL_OVERRIDE;
3711  virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const Q_DECL_OVERRIDE;
3712  virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE = 0;
3713  // events:
3714  virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) Q_DECL_OVERRIDE;
3715  virtual void deselectEvent(bool *selectionStateChanged) Q_DECL_OVERRIDE;
3716 
3717  // introduced virtual methods:
3718  virtual QPointF anchorPixelPosition(int anchorId) const;
3719 
3720  // non-virtual methods:
3721  double rectDistance(const QRectF &rect, const QPointF &pos, bool filledRect) const;
3722  QCPItemPosition *createPosition(const QString &name);
3723  QCPItemAnchor *createAnchor(const QString &name, int anchorId);
3724 
3725 private:
3726  Q_DISABLE_COPY(QCPAbstractItem)
3727 
3728  friend class QCustomPlot;
3729  friend class QCPItemAnchor;
3730 };
3731 
3732 /* end of 'src/item.h' */
3733 
3734 
3735 /* including file 'src/core.h' */
3736 /* modified 2021-03-29T02:30:44, size 19304 */
3737 
3738 class QCP_LIB_DECL QCustomPlot : public QWidget
3739 {
3740  Q_OBJECT
3742  Q_PROPERTY(QRect viewport READ viewport WRITE setViewport)
3743  Q_PROPERTY(QPixmap background READ background WRITE setBackground)
3744  Q_PROPERTY(bool backgroundScaled READ backgroundScaled WRITE setBackgroundScaled)
3745  Q_PROPERTY(Qt::AspectRatioMode backgroundScaledMode READ backgroundScaledMode WRITE setBackgroundScaledMode)
3746  Q_PROPERTY(QCPLayoutGrid* plotLayout READ plotLayout)
3747  Q_PROPERTY(bool autoAddPlottableToLegend READ autoAddPlottableToLegend WRITE setAutoAddPlottableToLegend)
3748  Q_PROPERTY(int selectionTolerance READ selectionTolerance WRITE setSelectionTolerance)
3749  Q_PROPERTY(bool noAntialiasingOnDrag READ noAntialiasingOnDrag WRITE setNoAntialiasingOnDrag)
3750  Q_PROPERTY(Qt::KeyboardModifier multiSelectModifier READ multiSelectModifier WRITE setMultiSelectModifier)
3751  Q_PROPERTY(bool openGl READ openGl WRITE setOpenGl)
3753 public:
3759  enum LayerInsertMode { limBelow
3760  ,limAbove
3761  };
3762  Q_ENUMS(LayerInsertMode)
3763 
3764 
3769  enum RefreshPriority { rpImmediateRefresh
3770  ,rpQueuedRefresh
3771  ,rpRefreshHint
3772  ,rpQueuedReplot
3773  };
3774  Q_ENUMS(RefreshPriority)
3775 
3776  explicit QCustomPlot(QWidget *parent = nullptr);
3777  virtual ~QCustomPlot() Q_DECL_OVERRIDE;
3778 
3779  // getters:
3780  QRect viewport() const { return mViewport; }
3781  double bufferDevicePixelRatio() const { return mBufferDevicePixelRatio; }
3782  QPixmap background() const { return mBackgroundPixmap; }
3783  bool backgroundScaled() const { return mBackgroundScaled; }
3784  Qt::AspectRatioMode backgroundScaledMode() const { return mBackgroundScaledMode; }
3785  QCPLayoutGrid *plotLayout() const { return mPlotLayout; }
3786  QCP::AntialiasedElements antialiasedElements() const { return mAntialiasedElements; }
3787  QCP::AntialiasedElements notAntialiasedElements() const { return mNotAntialiasedElements; }
3788  bool autoAddPlottableToLegend() const { return mAutoAddPlottableToLegend; }
3789  const QCP::Interactions interactions() const { return mInteractions; }
3790  int selectionTolerance() const { return mSelectionTolerance; }
3791  bool noAntialiasingOnDrag() const { return mNoAntialiasingOnDrag; }
3792  QCP::PlottingHints plottingHints() const { return mPlottingHints; }
3793  Qt::KeyboardModifier multiSelectModifier() const { return mMultiSelectModifier; }
3794  QCP::SelectionRectMode selectionRectMode() const { return mSelectionRectMode; }
3795  QCPSelectionRect *selectionRect() const { return mSelectionRect; }
3796  bool openGl() const { return mOpenGl; }
3797 
3798  // setters:
3799  void setViewport(const QRect &rect);
3800  void setBufferDevicePixelRatio(double ratio);
3801  void setBackground(const QPixmap &pm);
3802  void setBackground(const QPixmap &pm, bool scaled, Qt::AspectRatioMode mode=Qt::KeepAspectRatioByExpanding);
3803  void setBackground(const QBrush &brush);
3804  void setBackgroundScaled(bool scaled);
3805  void setBackgroundScaledMode(Qt::AspectRatioMode mode);
3806  void setAntialiasedElements(const QCP::AntialiasedElements &antialiasedElements);
3807  void setAntialiasedElement(QCP::AntialiasedElement antialiasedElement, bool enabled=true);
3808  void setNotAntialiasedElements(const QCP::AntialiasedElements &notAntialiasedElements);
3809  void setNotAntialiasedElement(QCP::AntialiasedElement notAntialiasedElement, bool enabled=true);
3810  void setAutoAddPlottableToLegend(bool on);
3811  void setInteractions(const QCP::Interactions &interactions);
3812  void setInteraction(const QCP::Interaction &interaction, bool enabled=true);
3813  void setSelectionTolerance(int pixels);
3814  void setNoAntialiasingOnDrag(bool enabled);
3815  void setPlottingHints(const QCP::PlottingHints &hints);
3816  void setPlottingHint(QCP::PlottingHint hint, bool enabled=true);
3817  void setMultiSelectModifier(Qt::KeyboardModifier modifier);
3818  void setSelectionRectMode(QCP::SelectionRectMode mode);
3819  void setSelectionRect(QCPSelectionRect *selectionRect);
3820  void setOpenGl(bool enabled, int multisampling=16);
3821 
3822  // non-property methods:
3823  // plottable interface:
3824  QCPAbstractPlottable *plottable(int index);
3825  QCPAbstractPlottable *plottable();
3826  bool removePlottable(QCPAbstractPlottable *plottable);
3827  bool removePlottable(int index);
3828  int clearPlottables();
3829  int plottableCount() const;
3830  QList<QCPAbstractPlottable*> selectedPlottables() const;
3831  template<class PlottableType>
3832  PlottableType *plottableAt(const QPointF &pos, bool onlySelectable=false, int *dataIndex=nullptr) const;
3833  QCPAbstractPlottable *plottableAt(const QPointF &pos, bool onlySelectable=false, int *dataIndex=nullptr) const;
3834  bool hasPlottable(QCPAbstractPlottable *plottable) const;
3835 
3836  // specialized interface for QCPGraph:
3837  QCPGraph *graph(int index) const;
3838  QCPGraph *graph() const;
3839  QCPGraph *addGraph(QCPAxis *keyAxis=nullptr, QCPAxis *valueAxis=nullptr);
3840  bool removeGraph(QCPGraph *graph);
3841  bool removeGraph(int index);
3842  int clearGraphs();
3843  int graphCount() const;
3844  QList<QCPGraph*> selectedGraphs() const;
3845 
3846  // item interface:
3847  QCPAbstractItem *item(int index) const;
3848  QCPAbstractItem *item() const;
3849  bool removeItem(QCPAbstractItem *item);
3850  bool removeItem(int index);
3851  int clearItems();
3852  int itemCount() const;
3853  QList<QCPAbstractItem*> selectedItems() const;
3854  template<class ItemType>
3855  ItemType *itemAt(const QPointF &pos, bool onlySelectable=false) const;
3856  QCPAbstractItem *itemAt(const QPointF &pos, bool onlySelectable=false) const;
3857  bool hasItem(QCPAbstractItem *item) const;
3858 
3859  // layer interface:
3860  QCPLayer *layer(const QString &name) const;
3861  QCPLayer *layer(int index) const;
3862  QCPLayer *currentLayer() const;
3863  bool setCurrentLayer(const QString &name);
3864  bool setCurrentLayer(QCPLayer *layer);
3865  int layerCount() const;
3866  bool addLayer(const QString &name, QCPLayer *otherLayer=nullptr, LayerInsertMode insertMode=limAbove);
3867  bool removeLayer(QCPLayer *layer);
3868  bool moveLayer(QCPLayer *layer, QCPLayer *otherLayer, LayerInsertMode insertMode=limAbove);
3869 
3870  // axis rect/layout interface:
3871  int axisRectCount() const;
3872  QCPAxisRect* axisRect(int index=0) const;
3873  QList<QCPAxisRect*> axisRects() const;
3874  QCPLayoutElement* layoutElementAt(const QPointF &pos) const;
3875  QCPAxisRect* axisRectAt(const QPointF &pos) const;
3876  Q_SLOT void rescaleAxes(bool onlyVisiblePlottables=false);
3877 
3878  QList<QCPAxis*> selectedAxes() const;
3879  QList<QCPLegend*> selectedLegends() const;
3880  Q_SLOT void deselectAll();
3881 
3882  bool savePdf(const QString &fileName, int width=0, int height=0, QCP::ExportPen exportPen=QCP::epAllowCosmetic, const QString &pdfCreator=QString(), const QString &pdfTitle=QString());
3883  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);
3884  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);
3885  bool saveBmp(const QString &fileName, int width=0, int height=0, double scale=1.0, int resolution=96, QCP::ResolutionUnit resolutionUnit=QCP::ruDotsPerInch);
3886  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);
3887  QPixmap toPixmap(int width=0, int height=0, double scale=1.0);
3888  void toPainter(QCPPainter *painter, int width=0, int height=0);
3889  Q_SLOT void replot(QCustomPlot::RefreshPriority refreshPriority=QCustomPlot::rpRefreshHint);
3890  double replotTime(bool average=false) const;
3891 
3892  QCPAxis *xAxis, *yAxis, *xAxis2, *yAxis2;
3894 
3895 signals:
3896  void mouseDoubleClick(QMouseEvent *event);
3897  void mousePress(QMouseEvent *event);
3898  void mouseMove(QMouseEvent *event);
3899  void mouseRelease(QMouseEvent *event);
3900  void mouseWheel(QWheelEvent *event);
3901 
3902  void plottableClick(QCPAbstractPlottable *plottable, int dataIndex, QMouseEvent *event);
3903  void plottableDoubleClick(QCPAbstractPlottable *plottable, int dataIndex, QMouseEvent *event);
3904  void itemClick(QCPAbstractItem *item, QMouseEvent *event);
3905  void itemDoubleClick(QCPAbstractItem *item, QMouseEvent *event);
3906  void axisClick(QCPAxis *axis, QCPAxis::SelectablePart part, QMouseEvent *event);
3907  void axisDoubleClick(QCPAxis *axis, QCPAxis::SelectablePart part, QMouseEvent *event);
3908  void legendClick(QCPLegend *legend, QCPAbstractLegendItem *item, QMouseEvent *event);
3909  void legendDoubleClick(QCPLegend *legend, QCPAbstractLegendItem *item, QMouseEvent *event);
3910 
3911  void selectionChangedByUser();
3912  void beforeReplot();
3913  void afterLayout();
3914  void afterReplot();
3915 
3916 protected:
3917  // property members:
3918  QRect mViewport;
3919  double mBufferDevicePixelRatio;
3920  QCPLayoutGrid *mPlotLayout;
3921  bool mAutoAddPlottableToLegend;
3922  QList<QCPAbstractPlottable*> mPlottables;
3923  QList<QCPGraph*> mGraphs; // extra list of plottables also in mPlottables that are of type QCPGraph
3924  QList<QCPAbstractItem*> mItems;
3925  QList<QCPLayer*> mLayers;
3926  QCP::AntialiasedElements mAntialiasedElements, mNotAntialiasedElements;
3927  QCP::Interactions mInteractions;
3928  int mSelectionTolerance;
3929  bool mNoAntialiasingOnDrag;
3930  QBrush mBackgroundBrush;
3931  QPixmap mBackgroundPixmap;
3932  QPixmap mScaledBackgroundPixmap;
3933  bool mBackgroundScaled;
3934  Qt::AspectRatioMode mBackgroundScaledMode;
3935  QCPLayer *mCurrentLayer;
3936  QCP::PlottingHints mPlottingHints;
3937  Qt::KeyboardModifier mMultiSelectModifier;
3938  QCP::SelectionRectMode mSelectionRectMode;
3939  QCPSelectionRect *mSelectionRect;
3940  bool mOpenGl;
3941 
3942  // non-property members:
3944  QPoint mMousePressPos;
3945  bool mMouseHasMoved;
3946  QPointer<QCPLayerable> mMouseEventLayerable;
3947  QPointer<QCPLayerable> mMouseSignalLayerable;
3948  QVariant mMouseEventLayerableDetails;
3949  QVariant mMouseSignalLayerableDetails;
3950  bool mReplotting;
3951  bool mReplotQueued;
3952  double mReplotTime, mReplotTimeAverage;
3953  int mOpenGlMultisamples;
3954  QCP::AntialiasedElements mOpenGlAntialiasedElementsBackup;
3955  bool mOpenGlCacheLabelsBackup;
3956 #ifdef QCP_OPENGL_FBO
3957  QSharedPointer<QOpenGLContext> mGlContext;
3958  QSharedPointer<QSurface> mGlSurface;
3959  QSharedPointer<QOpenGLPaintDevice> mGlPaintDevice;
3960 #endif
3961 
3962  // reimplemented virtual methods:
3963  virtual QSize minimumSizeHint() const Q_DECL_OVERRIDE;
3964  virtual QSize sizeHint() const Q_DECL_OVERRIDE;
3965  virtual void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
3966  virtual void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
3967  virtual void mouseDoubleClickEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
3968  virtual void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
3969  virtual void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
3970  virtual void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
3971  virtual void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE;
3972 
3973  // introduced virtual methods:
3974  virtual void draw(QCPPainter *painter);
3975  virtual void updateLayout();
3976  virtual void axisRemoved(QCPAxis *axis);
3977  virtual void legendRemoved(QCPLegend *legend);
3978  Q_SLOT virtual void processRectSelection(QRect rect, QMouseEvent *event);
3979  Q_SLOT virtual void processRectZoom(QRect rect, QMouseEvent *event);
3980  Q_SLOT virtual void processPointSelection(QMouseEvent *event);
3981 
3982  // non-virtual methods:
3983  bool registerPlottable(QCPAbstractPlottable *plottable);
3984  bool registerGraph(QCPGraph *graph);
3985  bool registerItem(QCPAbstractItem* item);
3986  void updateLayerIndices() const;
3987  QCPLayerable *layerableAt(const QPointF &pos, bool onlySelectable, QVariant *selectionDetails=nullptr) const;
3988  QList<QCPLayerable*> layerableListAt(const QPointF &pos, bool onlySelectable, QList<QVariant> *selectionDetails=nullptr) const;
3989  void drawBackground(QCPPainter *painter);
3990  void setupPaintBuffers();
3991  QCPAbstractPaintBuffer *createPaintBuffer();
3992  bool hasInvalidatedPaintBuffers();
3993  bool setupOpenGl();
3994  void freeOpenGl();
3995 
3996  friend class QCPLegend;
3997  friend class QCPAxis;
3998  friend class QCPLayer;
3999  friend class QCPAxisRect;
4000  friend class QCPAbstractPlottable;
4001  friend class QCPGraph;
4002  friend class QCPAbstractItem;
4003 };
4004 Q_DECLARE_METATYPE(QCustomPlot::LayerInsertMode)
4005 Q_DECLARE_METATYPE(QCustomPlot::RefreshPriority)
4006 
4007 
4008 // implementation of template functions:
4009 
4028 template<class PlottableType>
4029 PlottableType *QCustomPlot::plottableAt(const QPointF &pos, bool onlySelectable, int *dataIndex) const
4030 {
4031  PlottableType *resultPlottable = 0;
4032  QVariant resultDetails;
4033  double resultDistance = mSelectionTolerance; // only regard clicks with distances smaller than mSelectionTolerance as selections, so initialize with that value
4034 
4035  foreach (QCPAbstractPlottable *plottable, mPlottables)
4036  {
4037  PlottableType *currentPlottable = qobject_cast<PlottableType*>(plottable);
4038  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
4039  continue;
4040  if (currentPlottable->clipRect().contains(pos.toPoint())) // only consider clicks where the plottable is actually visible
4041  {
4042  QVariant details;
4043  double currentDistance = currentPlottable->selectTest(pos, false, dataIndex ? &details : nullptr);
4044  if (currentDistance >= 0 && currentDistance < resultDistance)
4045  {
4046  resultPlottable = currentPlottable;
4047  resultDetails = details;
4048  resultDistance = currentDistance;
4049  }
4050  }
4051  }
4052 
4053  if (resultPlottable && dataIndex)
4054  {
4055  QCPDataSelection sel = resultDetails.value<QCPDataSelection>();
4056  if (!sel.isEmpty())
4057  *dataIndex = sel.dataRange(0).begin();
4058  }
4059  return resultPlottable;
4060 }
4061 
4075 template<class ItemType>
4076 ItemType *QCustomPlot::itemAt(const QPointF &pos, bool onlySelectable) const
4077 {
4078  ItemType *resultItem = 0;
4079  double resultDistance = mSelectionTolerance; // only regard clicks with distances smaller than mSelectionTolerance as selections, so initialize with that value
4080 
4081  foreach (QCPAbstractItem *item, mItems)
4082  {
4083  ItemType *currentItem = qobject_cast<ItemType*>(item);
4084  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
4085  continue;
4086  if (!currentItem->clipToAxisRect() || currentItem->clipRect().contains(pos.toPoint())) // only consider clicks inside axis cliprect of the item if actually clipped to it
4087  {
4088  double currentDistance = currentItem->selectTest(pos, false);
4089  if (currentDistance >= 0 && currentDistance < resultDistance)
4090  {
4091  resultItem = currentItem;
4092  resultDistance = currentDistance;
4093  }
4094  }
4095  }
4096 
4097  return resultItem;
4098 }
4099 
4100 
4101 
4102 /* end of 'src/core.h' */
4103 
4104 
4105 /* including file 'src/plottable1d.h' */
4106 /* modified 2021-03-29T02:30:44, size 25638 */
4107 
4109 {
4110 public:
4111  virtual ~QCPPlottableInterface1D() = default;
4112  // introduced pure virtual methods:
4113  virtual int dataCount() const = 0;
4114  virtual double dataMainKey(int index) const = 0;
4115  virtual double dataSortKey(int index) const = 0;
4116  virtual double dataMainValue(int index) const = 0;
4117  virtual QCPRange dataValueRange(int index) const = 0;
4118  virtual QPointF dataPixelPosition(int index) const = 0;
4119  virtual bool sortKeyIsMainKey() const = 0;
4120  virtual QCPDataSelection selectTestRect(const QRectF &rect, bool onlySelectable) const = 0;
4121  virtual int findBegin(double sortKey, bool expandedRange=true) const = 0;
4122  virtual int findEnd(double sortKey, bool expandedRange=true) const = 0;
4123 };
4124 
4125 template <class DataType>
4126 class QCPAbstractPlottable1D : public QCPAbstractPlottable, public QCPPlottableInterface1D // no QCP_LIB_DECL, template class ends up in header (cpp included below)
4127 {
4128  // No Q_OBJECT macro due to template class
4129 
4130 public:
4131  QCPAbstractPlottable1D(QCPAxis *keyAxis, QCPAxis *valueAxis);
4132  virtual ~QCPAbstractPlottable1D() Q_DECL_OVERRIDE;
4133 
4134  // virtual methods of 1d plottable interface:
4135  virtual int dataCount() const Q_DECL_OVERRIDE;
4136  virtual double dataMainKey(int index) const Q_DECL_OVERRIDE;
4137  virtual double dataSortKey(int index) const Q_DECL_OVERRIDE;
4138  virtual double dataMainValue(int index) const Q_DECL_OVERRIDE;
4139  virtual QCPRange dataValueRange(int index) const Q_DECL_OVERRIDE;
4140  virtual QPointF dataPixelPosition(int index) const Q_DECL_OVERRIDE;
4141  virtual bool sortKeyIsMainKey() const Q_DECL_OVERRIDE;
4142  virtual QCPDataSelection selectTestRect(const QRectF &rect, bool onlySelectable) const Q_DECL_OVERRIDE;
4143  virtual int findBegin(double sortKey, bool expandedRange=true) const Q_DECL_OVERRIDE;
4144  virtual int findEnd(double sortKey, bool expandedRange=true) const Q_DECL_OVERRIDE;
4145 
4146  // reimplemented virtual methods:
4147  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE;
4148  virtual QCPPlottableInterface1D *interface1D() Q_DECL_OVERRIDE { return this; }
4149 
4150 protected:
4151  // property members:
4152  QSharedPointer<QCPDataContainer<DataType> > mDataContainer;
4153 
4154  // helpers for subclasses:
4155  void getDataSegments(QList<QCPDataRange> &selectedSegments, QList<QCPDataRange> &unselectedSegments) const;
4156  void drawPolyline(QCPPainter *painter, const QVector<QPointF> &lineData) const;
4157 
4158 private:
4159  Q_DISABLE_COPY(QCPAbstractPlottable1D)
4160 
4161 };
4162 
4163 
4164 
4165 // include implementation in header since it is a class template:
4169 
4193 /* start documentation of pure virtual functions */
4194 
4304 /* end documentation of pure virtual functions */
4305 
4306 
4310 
4335 /* start documentation of inline functions */
4336 
4345 /* end documentation of inline functions */
4346 
4351 template <class DataType>
4353  QCPAbstractPlottable(keyAxis, valueAxis),
4354  mDataContainer(new QCPDataContainer<DataType>)
4355 {
4356 }
4357 
4358 template <class DataType>
4360 {
4361 }
4362 
4366 template <class DataType>
4368 {
4369  return mDataContainer->size();
4370 }
4371 
4375 template <class DataType>
4377 {
4378  if (index >= 0 && index < mDataContainer->size())
4379  {
4380  return (mDataContainer->constBegin()+index)->mainKey();
4381  } else
4382  {
4383  qDebug() << Q_FUNC_INFO << "Index out of bounds" << index;
4384  return 0;
4385  }
4386 }
4387 
4391 template <class DataType>
4393 {
4394  if (index >= 0 && index < mDataContainer->size())
4395  {
4396  return (mDataContainer->constBegin()+index)->sortKey();
4397  } else
4398  {
4399  qDebug() << Q_FUNC_INFO << "Index out of bounds" << index;
4400  return 0;
4401  }
4402 }
4403 
4407 template <class DataType>
4409 {
4410  if (index >= 0 && index < mDataContainer->size())
4411  {
4412  return (mDataContainer->constBegin()+index)->mainValue();
4413  } else
4414  {
4415  qDebug() << Q_FUNC_INFO << "Index out of bounds" << index;
4416  return 0;
4417  }
4418 }
4419 
4423 template <class DataType>
4425 {
4426  if (index >= 0 && index < mDataContainer->size())
4427  {
4428  return (mDataContainer->constBegin()+index)->valueRange();
4429  } else
4430  {
4431  qDebug() << Q_FUNC_INFO << "Index out of bounds" << index;
4432  return QCPRange(0, 0);
4433  }
4434 }
4435 
4439 template <class DataType>
4441 {
4442  if (index >= 0 && index < mDataContainer->size())
4443  {
4444  const typename QCPDataContainer<DataType>::const_iterator it = mDataContainer->constBegin()+index;
4445  return coordsToPixels(it->mainKey(), it->mainValue());
4446  } else
4447  {
4448  qDebug() << Q_FUNC_INFO << "Index out of bounds" << index;
4449  return QPointF();
4450  }
4451 }
4452 
4456 template <class DataType>
4458 {
4459  return DataType::sortKeyIsMainKey();
4460 }
4461 
4469 template <class DataType>
4471 {
4472  QCPDataSelection result;
4473  if ((onlySelectable && mSelectable == QCP::stNone) || mDataContainer->isEmpty())
4474  return result;
4475  if (!mKeyAxis || !mValueAxis)
4476  return result;
4477 
4478  // convert rect given in pixels to ranges given in plot coordinates:
4479  double key1, value1, key2, value2;
4480  pixelsToCoords(rect.topLeft(), key1, value1);
4481  pixelsToCoords(rect.bottomRight(), key2, value2);
4482  QCPRange keyRange(key1, key2); // QCPRange normalizes internally so we don't have to care about whether key1 < key2
4483  QCPRange valueRange(value1, value2);
4484  typename QCPDataContainer<DataType>::const_iterator begin = mDataContainer->constBegin();
4485  typename QCPDataContainer<DataType>::const_iterator end = mDataContainer->constEnd();
4486  if (DataType::sortKeyIsMainKey()) // we can assume that data is sorted by main key, so can reduce the searched key interval:
4487  {
4488  begin = mDataContainer->findBegin(keyRange.lower, false);
4489  end = mDataContainer->findEnd(keyRange.upper, false);
4490  }
4491  if (begin == end)
4492  return result;
4493 
4494  int currentSegmentBegin = -1; // -1 means we're currently not in a segment that's contained in rect
4495  for (typename QCPDataContainer<DataType>::const_iterator it=begin; it!=end; ++it)
4496  {
4497  if (currentSegmentBegin == -1)
4498  {
4499  if (valueRange.contains(it->mainValue()) && keyRange.contains(it->mainKey())) // start segment
4500  currentSegmentBegin = int(it-mDataContainer->constBegin());
4501  } else if (!valueRange.contains(it->mainValue()) || !keyRange.contains(it->mainKey())) // segment just ended
4502  {
4503  result.addDataRange(QCPDataRange(currentSegmentBegin, int(it-mDataContainer->constBegin())), false);
4504  currentSegmentBegin = -1;
4505  }
4506  }
4507  // process potential last segment:
4508  if (currentSegmentBegin != -1)
4509  result.addDataRange(QCPDataRange(currentSegmentBegin, int(end-mDataContainer->constBegin())), false);
4510 
4511  result.simplify();
4512  return result;
4513 }
4514 
4518 template <class DataType>
4519 int QCPAbstractPlottable1D<DataType>::findBegin(double sortKey, bool expandedRange) const
4520 {
4521  return int(mDataContainer->findBegin(sortKey, expandedRange)-mDataContainer->constBegin());
4522 }
4523 
4527 template <class DataType>
4528 int QCPAbstractPlottable1D<DataType>::findEnd(double sortKey, bool expandedRange) const
4529 {
4530  return int(mDataContainer->findEnd(sortKey, expandedRange)-mDataContainer->constBegin());
4531 }
4532 
4543 template <class DataType>
4544 double QCPAbstractPlottable1D<DataType>::selectTest(const QPointF &pos, bool onlySelectable, QVariant *details) const
4545 {
4546  if ((onlySelectable && mSelectable == QCP::stNone) || mDataContainer->isEmpty())
4547  return -1;
4548  if (!mKeyAxis || !mValueAxis)
4549  return -1;
4550 
4551  QCPDataSelection selectionResult;
4552  double minDistSqr = (std::numeric_limits<double>::max)();
4553  int minDistIndex = mDataContainer->size();
4554 
4555  typename QCPDataContainer<DataType>::const_iterator begin = mDataContainer->constBegin();
4556  typename QCPDataContainer<DataType>::const_iterator end = mDataContainer->constEnd();
4557  if (DataType::sortKeyIsMainKey()) // we can assume that data is sorted by main key, so can reduce the searched key interval:
4558  {
4559  // determine which key range comes into question, taking selection tolerance around pos into account:
4560  double posKeyMin, posKeyMax, dummy;
4561  pixelsToCoords(pos-QPointF(mParentPlot->selectionTolerance(), mParentPlot->selectionTolerance()), posKeyMin, dummy);
4562  pixelsToCoords(pos+QPointF(mParentPlot->selectionTolerance(), mParentPlot->selectionTolerance()), posKeyMax, dummy);
4563  if (posKeyMin > posKeyMax)
4564  qSwap(posKeyMin, posKeyMax);
4565  begin = mDataContainer->findBegin(posKeyMin, true);
4566  end = mDataContainer->findEnd(posKeyMax, true);
4567  }
4568  if (begin == end)
4569  return -1;
4570  QCPRange keyRange(mKeyAxis->range());
4571  QCPRange valueRange(mValueAxis->range());
4572  for (typename QCPDataContainer<DataType>::const_iterator it=begin; it!=end; ++it)
4573  {
4574  const double mainKey = it->mainKey();
4575  const double mainValue = it->mainValue();
4576  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
4577  {
4578  const double currentDistSqr = QCPVector2D(coordsToPixels(mainKey, mainValue)-pos).lengthSquared();
4579  if (currentDistSqr < minDistSqr)
4580  {
4581  minDistSqr = currentDistSqr;
4582  minDistIndex = int(it-mDataContainer->constBegin());
4583  }
4584  }
4585  }
4586  if (minDistIndex != mDataContainer->size())
4587  selectionResult.addDataRange(QCPDataRange(minDistIndex, minDistIndex+1), false);
4588 
4589  selectionResult.simplify();
4590  if (details)
4591  details->setValue(selectionResult);
4592  return qSqrt(minDistSqr);
4593 }
4594 
4605 template <class DataType>
4607 {
4608  selectedSegments.clear();
4609  unselectedSegments.clear();
4610  if (mSelectable == QCP::stWhole) // stWhole selection type draws the entire plottable with selected style if mSelection isn't empty
4611  {
4612  if (selected())
4613  selectedSegments << QCPDataRange(0, dataCount());
4614  else
4615  unselectedSegments << QCPDataRange(0, dataCount());
4616  } else
4617  {
4618  QCPDataSelection sel(selection());
4619  sel.simplify();
4620  selectedSegments = sel.dataRanges();
4621  unselectedSegments = sel.inverse(QCPDataRange(0, dataCount())).dataRanges();
4622  }
4623 }
4624 
4635 template <class DataType>
4637 {
4638  // if drawing lines in plot (instead of PDF), reduce 1px lines to cosmetic, because at least in
4639  // Qt6 drawing of "1px" width lines is much slower even though it has same appearance apart from
4640  // High-DPI. In High-DPI cases people must set a pen width slightly larger than 1.0 to get
4641  // correct DPI scaling of width, but of course with performance penalty.
4642  if (!painter->modes().testFlag(QCPPainter::pmVectorized) &&
4643  qFuzzyCompare(painter->pen().widthF(), 1.0))
4644  {
4645  QPen newPen = painter->pen();
4646  newPen.setWidth(0);
4647  painter->setPen(newPen);
4648  }
4649 
4650  // if drawing solid line and not in PDF, use much faster line drawing instead of polyline:
4651  if (mParentPlot->plottingHints().testFlag(QCP::phFastPolylines) &&
4652  painter->pen().style() == Qt::SolidLine &&
4653  !painter->modes().testFlag(QCPPainter::pmVectorized) &&
4654  !painter->modes().testFlag(QCPPainter::pmNoCaching))
4655  {
4656  int i = 0;
4657  bool lastIsNan = false;
4658  const int lineDataSize = lineData.size();
4659  while (i < lineDataSize && (qIsNaN(lineData.at(i).y()) || qIsNaN(lineData.at(i).x()))) // make sure first point is not NaN
4660  ++i;
4661  ++i; // because drawing works in 1 point retrospect
4662  while (i < lineDataSize)
4663  {
4664  if (!qIsNaN(lineData.at(i).y()) && !qIsNaN(lineData.at(i).x())) // NaNs create a gap in the line
4665  {
4666  if (!lastIsNan)
4667  painter->drawLine(lineData.at(i-1), lineData.at(i));
4668  else
4669  lastIsNan = false;
4670  } else
4671  lastIsNan = true;
4672  ++i;
4673  }
4674  } else
4675  {
4676  int segmentStart = 0;
4677  int i = 0;
4678  const int lineDataSize = lineData.size();
4679  while (i < lineDataSize)
4680  {
4681  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
4682  {
4683  painter->drawPolyline(lineData.constData()+segmentStart, i-segmentStart); // i, because we don't want to include the current NaN point
4684  segmentStart = i+1;
4685  }
4686  ++i;
4687  }
4688  // draw last segment:
4689  painter->drawPolyline(lineData.constData()+segmentStart, lineDataSize-segmentStart);
4690  }
4691 }
4692 
4693 
4694 /* end of 'src/plottable1d.h' */
4695 
4696 
4697 /* including file 'src/colorgradient.h' */
4698 /* modified 2021-03-29T02:30:44, size 7262 */
4699 
4700 class QCP_LIB_DECL QCPColorGradient
4701 {
4702  Q_GADGET
4703 public:
4709  enum ColorInterpolation { ciRGB
4710  ,ciHSV
4711  };
4712  Q_ENUMS(ColorInterpolation)
4713 
4714 
4719  enum NanHandling { nhNone
4720  ,nhLowestColor
4721  ,nhHighestColor
4722  ,nhTransparent
4723  ,nhNanColor
4724  };
4725  Q_ENUMS(NanHandling)
4726 
4727 
4731  enum GradientPreset { gpGrayscale
4732  ,gpHot
4733  ,gpCold
4734  ,gpNight
4735  ,gpCandy
4736  ,gpGeography
4737  ,gpIon
4738  ,gpThermal
4739  ,gpPolar
4740  ,gpSpectrum
4741  ,gpJet
4742  ,gpHues
4743  };
4744  Q_ENUMS(GradientPreset)
4745 
4746  QCPColorGradient();
4747  QCPColorGradient(GradientPreset preset);
4748  bool operator==(const QCPColorGradient &other) const;
4749  bool operator!=(const QCPColorGradient &other) const { return !(*this == other); }
4750 
4751  // getters:
4752  int levelCount() const { return mLevelCount; }
4753  QMap<double, QColor> colorStops() const { return mColorStops; }
4754  ColorInterpolation colorInterpolation() const { return mColorInterpolation; }
4755  NanHandling nanHandling() const { return mNanHandling; }
4756  QColor nanColor() const { return mNanColor; }
4757  bool periodic() const { return mPeriodic; }
4758 
4759  // setters:
4760  void setLevelCount(int n);
4761  void setColorStops(const QMap<double, QColor> &colorStops);
4762  void setColorStopAt(double position, const QColor &color);
4763  void setColorInterpolation(ColorInterpolation interpolation);
4764  void setNanHandling(NanHandling handling);
4765  void setNanColor(const QColor &color);
4766  void setPeriodic(bool enabled);
4767 
4768  // non-property methods:
4769  void colorize(const double *data, const QCPRange &range, QRgb *scanLine, int n, int dataIndexFactor=1, bool logarithmic=false);
4770  void colorize(const double *data, const unsigned char *alpha, const QCPRange &range, QRgb *scanLine, int n, int dataIndexFactor=1, bool logarithmic=false);
4771  QRgb color(double position, const QCPRange &range, bool logarithmic=false);
4772  void loadPreset(GradientPreset preset);
4773  void clearColorStops();
4774  QCPColorGradient inverted() const;
4775 
4776 protected:
4777  // property members:
4778  int mLevelCount;
4779  QMap<double, QColor> mColorStops;
4780  ColorInterpolation mColorInterpolation;
4781  NanHandling mNanHandling;
4782  QColor mNanColor;
4783  bool mPeriodic;
4784 
4785  // non-property members:
4786  QVector<QRgb> mColorBuffer; // have colors premultiplied with alpha (for usage with QImage::Format_ARGB32_Premultiplied)
4787  bool mColorBufferInvalidated;
4788 
4789  // non-virtual methods:
4790  bool stopsUseAlpha() const;
4791  void updateColorBuffer();
4792 };
4793 Q_DECLARE_METATYPE(QCPColorGradient::ColorInterpolation)
4794 Q_DECLARE_METATYPE(QCPColorGradient::NanHandling)
4795 Q_DECLARE_METATYPE(QCPColorGradient::GradientPreset)
4796 
4797 /* end of 'src/colorgradient.h' */
4798 
4799 
4800 /* including file 'src/selectiondecorator-bracket.h' */
4801 /* modified 2021-03-29T02:30:44, size 4458 */
4802 
4804 {
4805  Q_GADGET
4806 public:
4807 
4814  enum BracketStyle { bsSquareBracket
4815  ,bsHalfEllipse
4816  ,bsEllipse
4817  ,bsPlus
4818  ,bsUserStyle
4819  };
4820  Q_ENUMS(BracketStyle)
4821 
4823  virtual ~QCPSelectionDecoratorBracket() Q_DECL_OVERRIDE;
4824 
4825  // getters:
4826  QPen bracketPen() const { return mBracketPen; }
4827  QBrush bracketBrush() const { return mBracketBrush; }
4828  int bracketWidth() const { return mBracketWidth; }
4829  int bracketHeight() const { return mBracketHeight; }
4830  BracketStyle bracketStyle() const { return mBracketStyle; }
4831  bool tangentToData() const { return mTangentToData; }
4832  int tangentAverage() const { return mTangentAverage; }
4833 
4834  // setters:
4835  void setBracketPen(const QPen &pen);
4836  void setBracketBrush(const QBrush &brush);
4837  void setBracketWidth(int width);
4838  void setBracketHeight(int height);
4839  void setBracketStyle(BracketStyle style);
4840  void setTangentToData(bool enabled);
4841  void setTangentAverage(int pointCount);
4842 
4843  // introduced virtual methods:
4844  virtual void drawBracket(QCPPainter *painter, int direction) const;
4845 
4846  // virtual methods:
4847  virtual void drawDecoration(QCPPainter *painter, QCPDataSelection selection) Q_DECL_OVERRIDE;
4848 
4849 protected:
4850  // property members:
4851  QPen mBracketPen;
4852  QBrush mBracketBrush;
4853  int mBracketWidth;
4854  int mBracketHeight;
4855  BracketStyle mBracketStyle;
4856  bool mTangentToData;
4857  int mTangentAverage;
4858 
4859  // non-virtual methods:
4860  double getTangentAngle(const QCPPlottableInterface1D *interface1d, int dataIndex, int direction) const;
4861  QPointF getPixelCoordinates(const QCPPlottableInterface1D *interface1d, int dataIndex) const;
4862 
4863 };
4865 
4866 /* end of 'src/selectiondecorator-bracket.h' */
4867 
4868 
4869 /* including file 'src/layoutelements/layoutelement-axisrect.h' */
4870 /* modified 2021-03-29T02:30:44, size 7529 */
4871 
4872 class QCP_LIB_DECL QCPAxisRect : public QCPLayoutElement
4873 {
4874  Q_OBJECT
4876  Q_PROPERTY(QPixmap background READ background WRITE setBackground)
4877  Q_PROPERTY(bool backgroundScaled READ backgroundScaled WRITE setBackgroundScaled)
4878  Q_PROPERTY(Qt::AspectRatioMode backgroundScaledMode READ backgroundScaledMode WRITE setBackgroundScaledMode)
4879  Q_PROPERTY(Qt::Orientations rangeDrag READ rangeDrag WRITE setRangeDrag)
4880  Q_PROPERTY(Qt::Orientations rangeZoom READ rangeZoom WRITE setRangeZoom)
4882 public:
4883  explicit QCPAxisRect(QCustomPlot *parentPlot, bool setupDefaultAxes=true);
4884  virtual ~QCPAxisRect() Q_DECL_OVERRIDE;
4885 
4886  // getters:
4887  QPixmap background() const { return mBackgroundPixmap; }
4888  QBrush backgroundBrush() const { return mBackgroundBrush; }
4889  bool backgroundScaled() const { return mBackgroundScaled; }
4890  Qt::AspectRatioMode backgroundScaledMode() const { return mBackgroundScaledMode; }
4891  Qt::Orientations rangeDrag() const { return mRangeDrag; }
4892  Qt::Orientations rangeZoom() const { return mRangeZoom; }
4893  QCPAxis *rangeDragAxis(Qt::Orientation orientation);
4894  QCPAxis *rangeZoomAxis(Qt::Orientation orientation);
4895  QList<QCPAxis*> rangeDragAxes(Qt::Orientation orientation);
4896  QList<QCPAxis*> rangeZoomAxes(Qt::Orientation orientation);
4897  double rangeZoomFactor(Qt::Orientation orientation);
4898 
4899  // setters:
4900  void setBackground(const QPixmap &pm);
4901  void setBackground(const QPixmap &pm, bool scaled, Qt::AspectRatioMode mode=Qt::KeepAspectRatioByExpanding);
4902  void setBackground(const QBrush &brush);
4903  void setBackgroundScaled(bool scaled);
4904  void setBackgroundScaledMode(Qt::AspectRatioMode mode);
4905  void setRangeDrag(Qt::Orientations orientations);
4906  void setRangeZoom(Qt::Orientations orientations);
4907  void setRangeDragAxes(QCPAxis *horizontal, QCPAxis *vertical);
4908  void setRangeDragAxes(QList<QCPAxis*> axes);
4909  void setRangeDragAxes(QList<QCPAxis*> horizontal, QList<QCPAxis*> vertical);
4910  void setRangeZoomAxes(QCPAxis *horizontal, QCPAxis *vertical);
4911  void setRangeZoomAxes(QList<QCPAxis*> axes);
4912  void setRangeZoomAxes(QList<QCPAxis*> horizontal, QList<QCPAxis*> vertical);
4913  void setRangeZoomFactor(double horizontalFactor, double verticalFactor);
4914  void setRangeZoomFactor(double factor);
4915 
4916  // non-property methods:
4917  int axisCount(QCPAxis::AxisType type) const;
4918  QCPAxis *axis(QCPAxis::AxisType type, int index=0) const;
4919  QList<QCPAxis*> axes(QCPAxis::AxisTypes types) const;
4920  QList<QCPAxis*> axes() const;
4921  QCPAxis *addAxis(QCPAxis::AxisType type, QCPAxis *axis=nullptr);
4922  QList<QCPAxis*> addAxes(QCPAxis::AxisTypes types);
4923  bool removeAxis(QCPAxis *axis);
4924  QCPLayoutInset *insetLayout() const { return mInsetLayout; }
4925 
4926  void zoom(const QRectF &pixelRect);
4927  void zoom(const QRectF &pixelRect, const QList<QCPAxis*> &affectedAxes);
4928  void setupFullAxesBox(bool connectRanges=false);
4929  QList<QCPAbstractPlottable*> plottables() const;
4930  QList<QCPGraph*> graphs() const;
4931  QList<QCPAbstractItem*> items() const;
4932 
4933  // read-only interface imitating a QRect:
4934  int left() const { return mRect.left(); }
4935  int right() const { return mRect.right(); }
4936  int top() const { return mRect.top(); }
4937  int bottom() const { return mRect.bottom(); }
4938  int width() const { return mRect.width(); }
4939  int height() const { return mRect.height(); }
4940  QSize size() const { return mRect.size(); }
4941  QPoint topLeft() const { return mRect.topLeft(); }
4942  QPoint topRight() const { return mRect.topRight(); }
4943  QPoint bottomLeft() const { return mRect.bottomLeft(); }
4944  QPoint bottomRight() const { return mRect.bottomRight(); }
4945  QPoint center() const { return mRect.center(); }
4946 
4947  // reimplemented virtual methods:
4948  virtual void update(UpdatePhase phase) Q_DECL_OVERRIDE;
4949  virtual QList<QCPLayoutElement*> elements(bool recursive) const Q_DECL_OVERRIDE;
4950 
4951 protected:
4952  // property members:
4953  QBrush mBackgroundBrush;
4954  QPixmap mBackgroundPixmap;
4955  QPixmap mScaledBackgroundPixmap;
4956  bool mBackgroundScaled;
4957  Qt::AspectRatioMode mBackgroundScaledMode;
4958  QCPLayoutInset *mInsetLayout;
4959  Qt::Orientations mRangeDrag, mRangeZoom;
4960  QList<QPointer<QCPAxis> > mRangeDragHorzAxis, mRangeDragVertAxis;
4961  QList<QPointer<QCPAxis> > mRangeZoomHorzAxis, mRangeZoomVertAxis;
4962  double mRangeZoomFactorHorz, mRangeZoomFactorVert;
4963 
4964  // non-property members:
4965  QList<QCPRange> mDragStartHorzRange, mDragStartVertRange;
4966  QCP::AntialiasedElements mAADragBackup, mNotAADragBackup;
4967  bool mDragging;
4969 
4970  // reimplemented virtual methods:
4971  virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const Q_DECL_OVERRIDE;
4972  virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
4973  virtual int calculateAutoMargin(QCP::MarginSide side) Q_DECL_OVERRIDE;
4974  virtual void layoutChanged() Q_DECL_OVERRIDE;
4975  // events:
4976  virtual void mousePressEvent(QMouseEvent *event, const QVariant &details) Q_DECL_OVERRIDE;
4977  virtual void mouseMoveEvent(QMouseEvent *event, const QPointF &startPos) Q_DECL_OVERRIDE;
4978  virtual void mouseReleaseEvent(QMouseEvent *event, const QPointF &startPos) Q_DECL_OVERRIDE;
4979  virtual void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE;
4980 
4981  // non-property methods:
4982  void drawBackground(QCPPainter *painter);
4983  void updateAxesOffset(QCPAxis::AxisType type);
4984 
4985 private:
4986  Q_DISABLE_COPY(QCPAxisRect)
4987 
4988  friend class QCustomPlot;
4989 };
4990 
4991 
4992 /* end of 'src/layoutelements/layoutelement-axisrect.h' */
4993 
4994 
4995 /* including file 'src/layoutelements/layoutelement-legend.h' */
4996 /* modified 2021-03-29T02:30:44, size 10425 */
4997 
4998 class QCP_LIB_DECL QCPAbstractLegendItem : public QCPLayoutElement
4999 {
5000  Q_OBJECT
5002  Q_PROPERTY(QCPLegend* parentLegend READ parentLegend)
5003  Q_PROPERTY(QFont font READ font WRITE setFont)
5004  Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor)
5005  Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont)
5006  Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE setSelectedTextColor)
5007  Q_PROPERTY(bool selectable READ selectable WRITE setSelectable NOTIFY selectionChanged)
5008  Q_PROPERTY(bool selected READ selected WRITE setSelected NOTIFY selectableChanged)
5010 public:
5011  explicit QCPAbstractLegendItem(QCPLegend *parent);
5012 
5013  // getters:
5014  QCPLegend *parentLegend() const { return mParentLegend; }
5015  QFont font() const { return mFont; }
5016  QColor textColor() const { return mTextColor; }
5017  QFont selectedFont() const { return mSelectedFont; }
5018  QColor selectedTextColor() const { return mSelectedTextColor; }
5019  bool selectable() const { return mSelectable; }
5020  bool selected() const { return mSelected; }
5021 
5022  // setters:
5023  void setFont(const QFont &font);
5024  void setTextColor(const QColor &color);
5025  void setSelectedFont(const QFont &font);
5026  void setSelectedTextColor(const QColor &color);
5027  Q_SLOT void setSelectable(bool selectable);
5028  Q_SLOT void setSelected(bool selected);
5029 
5030  // reimplemented virtual methods:
5031  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE;
5032 
5033 signals:
5034  void selectionChanged(bool selected);
5035  void selectableChanged(bool selectable);
5036 
5037 protected:
5038  // property members:
5039  QCPLegend *mParentLegend;
5040  QFont mFont;
5041  QColor mTextColor;
5042  QFont mSelectedFont;
5043  QColor mSelectedTextColor;
5044  bool mSelectable, mSelected;
5045 
5046  // reimplemented virtual methods:
5047  virtual QCP::Interaction selectionCategory() const Q_DECL_OVERRIDE;
5048  virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const Q_DECL_OVERRIDE;
5049  virtual QRect clipRect() const Q_DECL_OVERRIDE;
5050  virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE = 0;
5051  // events:
5052  virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) Q_DECL_OVERRIDE;
5053  virtual void deselectEvent(bool *selectionStateChanged) Q_DECL_OVERRIDE;
5054 
5055 private:
5056  Q_DISABLE_COPY(QCPAbstractLegendItem)
5057 
5058  friend class QCPLegend;
5059 };
5060 
5061 
5063 {
5064  Q_OBJECT
5065 public:
5067 
5068  // getters:
5069  QCPAbstractPlottable *plottable() { return mPlottable; }
5070 
5071 protected:
5072  // property members:
5073  QCPAbstractPlottable *mPlottable;
5074 
5075  // reimplemented virtual methods:
5076  virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
5077  virtual QSize minimumOuterSizeHint() const Q_DECL_OVERRIDE;
5078 
5079  // non-virtual methods:
5080  QPen getIconBorderPen() const;
5081  QColor getTextColor() const;
5082  QFont getFont() const;
5083 };
5084 
5085 
5086 class QCP_LIB_DECL QCPLegend : public QCPLayoutGrid
5087 {
5088  Q_OBJECT
5090  Q_PROPERTY(QPen borderPen READ borderPen WRITE setBorderPen)
5091  Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
5092  Q_PROPERTY(QFont font READ font WRITE setFont)
5093  Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor)
5094  Q_PROPERTY(QSize iconSize READ iconSize WRITE setIconSize)
5095  Q_PROPERTY(int iconTextPadding READ iconTextPadding WRITE setIconTextPadding)
5096  Q_PROPERTY(QPen iconBorderPen READ iconBorderPen WRITE setIconBorderPen)
5097  Q_PROPERTY(SelectableParts selectableParts READ selectableParts WRITE setSelectableParts NOTIFY selectionChanged)
5098  Q_PROPERTY(SelectableParts selectedParts READ selectedParts WRITE setSelectedParts NOTIFY selectableChanged)
5099  Q_PROPERTY(QPen selectedBorderPen READ selectedBorderPen WRITE setSelectedBorderPen)
5100  Q_PROPERTY(QPen selectedIconBorderPen READ selectedIconBorderPen WRITE setSelectedIconBorderPen)
5101  Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
5102  Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont)
5103  Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE setSelectedTextColor)
5105 public:
5111  enum SelectablePart { spNone = 0x000
5112  ,spLegendBox = 0x001
5113  ,spItems = 0x002
5114  };
5115  Q_ENUMS(SelectablePart)
5116  Q_FLAGS(SelectableParts)
5117  Q_DECLARE_FLAGS(SelectableParts, SelectablePart)
5118 
5119  explicit QCPLegend();
5120  virtual ~QCPLegend() Q_DECL_OVERRIDE;
5121 
5122  // getters:
5123  QPen borderPen() const { return mBorderPen; }
5124  QBrush brush() const { return mBrush; }
5125  QFont font() const { return mFont; }
5126  QColor textColor() const { return mTextColor; }
5127  QSize iconSize() const { return mIconSize; }
5128  int iconTextPadding() const { return mIconTextPadding; }
5129  QPen iconBorderPen() const { return mIconBorderPen; }
5130  SelectableParts selectableParts() const { return mSelectableParts; }
5131  SelectableParts selectedParts() const;
5132  QPen selectedBorderPen() const { return mSelectedBorderPen; }
5133  QPen selectedIconBorderPen() const { return mSelectedIconBorderPen; }
5134  QBrush selectedBrush() const { return mSelectedBrush; }
5135  QFont selectedFont() const { return mSelectedFont; }
5136  QColor selectedTextColor() const { return mSelectedTextColor; }
5137 
5138  // setters:
5139  void setBorderPen(const QPen &pen);
5140  void setBrush(const QBrush &brush);
5141  void setFont(const QFont &font);
5142  void setTextColor(const QColor &color);
5143  void setIconSize(const QSize &size);
5144  void setIconSize(int width, int height);
5145  void setIconTextPadding(int padding);
5146  void setIconBorderPen(const QPen &pen);
5147  Q_SLOT void setSelectableParts(const SelectableParts &selectableParts);
5148  Q_SLOT void setSelectedParts(const SelectableParts &selectedParts);
5149  void setSelectedBorderPen(const QPen &pen);
5150  void setSelectedIconBorderPen(const QPen &pen);
5151  void setSelectedBrush(const QBrush &brush);
5152  void setSelectedFont(const QFont &font);
5153  void setSelectedTextColor(const QColor &color);
5154 
5155  // reimplemented virtual methods:
5156  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE;
5157 
5158  // non-virtual methods:
5159  QCPAbstractLegendItem *item(int index) const;
5160  QCPPlottableLegendItem *itemWithPlottable(const QCPAbstractPlottable *plottable) const;
5161  int itemCount() const;
5162  bool hasItem(QCPAbstractLegendItem *item) const;
5163  bool hasItemWithPlottable(const QCPAbstractPlottable *plottable) const;
5164  bool addItem(QCPAbstractLegendItem *item);
5165  bool removeItem(int index);
5166  bool removeItem(QCPAbstractLegendItem *item);
5167  void clearItems();
5168  QList<QCPAbstractLegendItem*> selectedItems() const;
5169 
5170 signals:
5171  void selectionChanged(QCPLegend::SelectableParts parts);
5172  void selectableChanged(QCPLegend::SelectableParts parts);
5173 
5174 protected:
5175  // property members:
5176  QPen mBorderPen, mIconBorderPen;
5177  QBrush mBrush;
5178  QFont mFont;
5179  QColor mTextColor;
5180  QSize mIconSize;
5181  int mIconTextPadding;
5182  SelectableParts mSelectedParts, mSelectableParts;
5183  QPen mSelectedBorderPen, mSelectedIconBorderPen;
5184  QBrush mSelectedBrush;
5185  QFont mSelectedFont;
5186  QColor mSelectedTextColor;
5187 
5188  // reimplemented virtual methods:
5189  virtual void parentPlotInitialized(QCustomPlot *parentPlot) Q_DECL_OVERRIDE;
5190  virtual QCP::Interaction selectionCategory() const Q_DECL_OVERRIDE;
5191  virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const Q_DECL_OVERRIDE;
5192  virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
5193  // events:
5194  virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) Q_DECL_OVERRIDE;
5195  virtual void deselectEvent(bool *selectionStateChanged) Q_DECL_OVERRIDE;
5196 
5197  // non-virtual methods:
5198  QPen getBorderPen() const;
5199  QBrush getBrush() const;
5200 
5201 private:
5202  Q_DISABLE_COPY(QCPLegend)
5203 
5204  friend class QCustomPlot;
5205  friend class QCPAbstractLegendItem;
5206 };
5207 Q_DECLARE_OPERATORS_FOR_FLAGS(QCPLegend::SelectableParts)
5208 Q_DECLARE_METATYPE(QCPLegend::SelectablePart)
5209 
5210 /* end of 'src/layoutelements/layoutelement-legend.h' */
5211 
5212 
5213 /* including file 'src/layoutelements/layoutelement-textelement.h' */
5214 /* modified 2021-03-29T02:30:44, size 5359 */
5215 
5216 class QCP_LIB_DECL QCPTextElement : public QCPLayoutElement
5217 {
5218  Q_OBJECT
5220  Q_PROPERTY(QString text READ text WRITE setText)
5221  Q_PROPERTY(QFont font READ font WRITE setFont)
5222  Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor)
5223  Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont)
5224  Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE setSelectedTextColor)
5225  Q_PROPERTY(bool selectable READ selectable WRITE setSelectable NOTIFY selectableChanged)
5226  Q_PROPERTY(bool selected READ selected WRITE setSelected NOTIFY selectionChanged)
5228 public:
5229  explicit QCPTextElement(QCustomPlot *parentPlot);
5230  QCPTextElement(QCustomPlot *parentPlot, const QString &text);
5231  QCPTextElement(QCustomPlot *parentPlot, const QString &text, double pointSize);
5232  QCPTextElement(QCustomPlot *parentPlot, const QString &text, const QString &fontFamily, double pointSize);
5233  QCPTextElement(QCustomPlot *parentPlot, const QString &text, const QFont &font);
5234 
5235  // getters:
5236  QString text() const { return mText; }
5237  int textFlags() const { return mTextFlags; }
5238  QFont font() const { return mFont; }
5239  QColor textColor() const { return mTextColor; }
5240  QFont selectedFont() const { return mSelectedFont; }
5241  QColor selectedTextColor() const { return mSelectedTextColor; }
5242  bool selectable() const { return mSelectable; }
5243  bool selected() const { return mSelected; }
5244 
5245  // setters:
5246  void setText(const QString &text);
5247  void setTextFlags(int flags);
5248  void setFont(const QFont &font);
5249  void setTextColor(const QColor &color);
5250  void setSelectedFont(const QFont &font);
5251  void setSelectedTextColor(const QColor &color);
5252  Q_SLOT void setSelectable(bool selectable);
5253  Q_SLOT void setSelected(bool selected);
5254 
5255  // reimplemented virtual methods:
5256  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE;
5257  virtual void mousePressEvent(QMouseEvent *event, const QVariant &details) Q_DECL_OVERRIDE;
5258  virtual void mouseReleaseEvent(QMouseEvent *event, const QPointF &startPos) Q_DECL_OVERRIDE;
5259  virtual void mouseDoubleClickEvent(QMouseEvent *event, const QVariant &details) Q_DECL_OVERRIDE;
5260 
5261 signals:
5262  void selectionChanged(bool selected);
5263  void selectableChanged(bool selectable);
5264  void clicked(QMouseEvent *event);
5265  void doubleClicked(QMouseEvent *event);
5266 
5267 protected:
5268  // property members:
5269  QString mText;
5270  int mTextFlags;
5271  QFont mFont;
5272  QColor mTextColor;
5273  QFont mSelectedFont;
5274  QColor mSelectedTextColor;
5275  QRect mTextBoundingRect;
5276  bool mSelectable, mSelected;
5277 
5278  // reimplemented virtual methods:
5279  virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const Q_DECL_OVERRIDE;
5280  virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
5281  virtual QSize minimumOuterSizeHint() const Q_DECL_OVERRIDE;
5282  virtual QSize maximumOuterSizeHint() const Q_DECL_OVERRIDE;
5283  // events:
5284  virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) Q_DECL_OVERRIDE;
5285  virtual void deselectEvent(bool *selectionStateChanged) Q_DECL_OVERRIDE;
5286 
5287  // non-virtual methods:
5288  QFont mainFont() const;
5289  QColor mainTextColor() const;
5290 
5291 private:
5292  Q_DISABLE_COPY(QCPTextElement)
5293 };
5294 
5295 
5296 
5297 /* end of 'src/layoutelements/layoutelement-textelement.h' */
5298 
5299 
5300 /* including file 'src/layoutelements/layoutelement-colorscale.h' */
5301 /* modified 2021-03-29T02:30:44, size 5939 */
5302 
5303 
5305 {
5306  Q_OBJECT
5307 public:
5308  explicit QCPColorScaleAxisRectPrivate(QCPColorScale *parentColorScale);
5309 protected:
5310  QCPColorScale *mParentColorScale;
5311  QImage mGradientImage;
5312  bool mGradientImageInvalidated;
5313  // re-using some methods of QCPAxisRect to make them available to friend class QCPColorScale
5314  using QCPAxisRect::calculateAutoMargin;
5319  using QCPAxisRect::update;
5320  virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
5321  void updateGradientImage();
5322  Q_SLOT void axisSelectionChanged(QCPAxis::SelectableParts selectedParts);
5323  Q_SLOT void axisSelectableChanged(QCPAxis::SelectableParts selectableParts);
5324  friend class QCPColorScale;
5325 };
5326 
5327 
5328 class QCP_LIB_DECL QCPColorScale : public QCPLayoutElement
5329 {
5330  Q_OBJECT
5332  Q_PROPERTY(QCPAxis::AxisType type READ type WRITE setType)
5333  Q_PROPERTY(QCPRange dataRange READ dataRange WRITE setDataRange NOTIFY dataRangeChanged)
5334  Q_PROPERTY(QCPAxis::ScaleType dataScaleType READ dataScaleType WRITE setDataScaleType NOTIFY dataScaleTypeChanged)
5335  Q_PROPERTY(QCPColorGradient gradient READ gradient WRITE setGradient NOTIFY gradientChanged)
5336  Q_PROPERTY(QString label READ label WRITE setLabel)
5337  Q_PROPERTY(int barWidth READ barWidth WRITE setBarWidth)
5338  Q_PROPERTY(bool rangeDrag READ rangeDrag WRITE setRangeDrag)
5339  Q_PROPERTY(bool rangeZoom READ rangeZoom WRITE setRangeZoom)
5341 public:
5342  explicit QCPColorScale(QCustomPlot *parentPlot);
5343  virtual ~QCPColorScale() Q_DECL_OVERRIDE;
5344 
5345  // getters:
5346  QCPAxis *axis() const { return mColorAxis.data(); }
5347  QCPAxis::AxisType type() const { return mType; }
5348  QCPRange dataRange() const { return mDataRange; }
5349  QCPAxis::ScaleType dataScaleType() const { return mDataScaleType; }
5350  QCPColorGradient gradient() const { return mGradient; }
5351  QString label() const;
5352  int barWidth () const { return mBarWidth; }
5353  bool rangeDrag() const;
5354  bool rangeZoom() const;
5355 
5356  // setters:
5357  void setType(QCPAxis::AxisType type);
5358  Q_SLOT void setDataRange(const QCPRange &dataRange);
5359  Q_SLOT void setDataScaleType(QCPAxis::ScaleType scaleType);
5360  Q_SLOT void setGradient(const QCPColorGradient &gradient);
5361  void setLabel(const QString &str);
5362  void setBarWidth(int width);
5363  void setRangeDrag(bool enabled);
5364  void setRangeZoom(bool enabled);
5365 
5366  // non-property methods:
5367  QList<QCPColorMap*> colorMaps() const;
5368  void rescaleDataRange(bool onlyVisibleMaps);
5369 
5370  // reimplemented virtual methods:
5371  virtual void update(UpdatePhase phase) Q_DECL_OVERRIDE;
5372 
5373 signals:
5374  void dataRangeChanged(const QCPRange &newRange);
5375  void dataScaleTypeChanged(QCPAxis::ScaleType scaleType);
5376  void gradientChanged(const QCPColorGradient &newGradient);
5377 
5378 protected:
5379  // property members:
5380  QCPAxis::AxisType mType;
5381  QCPRange mDataRange;
5382  QCPAxis::ScaleType mDataScaleType;
5383  QCPColorGradient mGradient;
5384  int mBarWidth;
5385 
5386  // non-property members:
5387  QPointer<QCPColorScaleAxisRectPrivate> mAxisRect;
5388  QPointer<QCPAxis> mColorAxis;
5389 
5390  // reimplemented virtual methods:
5391  virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const Q_DECL_OVERRIDE;
5392  // events:
5393  virtual void mousePressEvent(QMouseEvent *event, const QVariant &details) Q_DECL_OVERRIDE;
5394  virtual void mouseMoveEvent(QMouseEvent *event, const QPointF &startPos) Q_DECL_OVERRIDE;
5395  virtual void mouseReleaseEvent(QMouseEvent *event, const QPointF &startPos) Q_DECL_OVERRIDE;
5396  virtual void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE;
5397 
5398 private:
5399  Q_DISABLE_COPY(QCPColorScale)
5400 
5401  friend class QCPColorScaleAxisRectPrivate;
5402 };
5403 
5404 
5405 /* end of 'src/layoutelements/layoutelement-colorscale.h' */
5406 
5407 
5408 /* including file 'src/plottables/plottable-graph.h' */
5409 /* modified 2021-03-29T02:30:44, size 9316 */
5410 
5411 class QCP_LIB_DECL QCPGraphData
5412 {
5413 public:
5414  QCPGraphData();
5415  QCPGraphData(double key, double value);
5416 
5417  inline double sortKey() const { return key; }
5418  inline static QCPGraphData fromSortKey(double sortKey) { return QCPGraphData(sortKey, 0); }
5419  inline static bool sortKeyIsMainKey() { return true; }
5420 
5421  inline double mainKey() const { return key; }
5422  inline double mainValue() const { return value; }
5423 
5424  inline QCPRange valueRange() const { return QCPRange(value, value); }
5425 
5426  double key, value;
5427 };
5428 Q_DECLARE_TYPEINFO(QCPGraphData, Q_PRIMITIVE_TYPE);
5429 
5430 
5441 
5442 class QCP_LIB_DECL QCPGraph : public QCPAbstractPlottable1D<QCPGraphData>
5443 {
5444  Q_OBJECT
5446  Q_PROPERTY(LineStyle lineStyle READ lineStyle WRITE setLineStyle)
5447  Q_PROPERTY(QCPScatterStyle scatterStyle READ scatterStyle WRITE setScatterStyle)
5448  Q_PROPERTY(int scatterSkip READ scatterSkip WRITE setScatterSkip)
5449  Q_PROPERTY(QCPGraph* channelFillGraph READ channelFillGraph WRITE setChannelFillGraph)
5450  Q_PROPERTY(bool adaptiveSampling READ adaptiveSampling WRITE setAdaptiveSampling)
5452 public:
5458  enum LineStyle { lsNone
5459  ,lsLine
5461  ,lsStepLeft
5462  ,lsStepRight
5463  ,lsStepCenter
5464  ,lsImpulse
5465  };
5466  Q_ENUMS(LineStyle)
5467 
5468  explicit QCPGraph(QCPAxis *keyAxis, QCPAxis *valueAxis);
5469  virtual ~QCPGraph() Q_DECL_OVERRIDE;
5470 
5471  // getters:
5472  QSharedPointer<QCPGraphDataContainer> data() const { return mDataContainer; }
5473  LineStyle lineStyle() const { return mLineStyle; }
5474  QCPScatterStyle scatterStyle() const { return mScatterStyle; }
5475  int scatterSkip() const { return mScatterSkip; }
5476  QCPGraph *channelFillGraph() const { return mChannelFillGraph.data(); }
5477  bool adaptiveSampling() const { return mAdaptiveSampling; }
5478 
5479  // setters:
5480  void setData(QSharedPointer<QCPGraphDataContainer> data);
5481  void setData(const QVector<double> &keys, const QVector<double> &values, bool alreadySorted=false);
5482  void setLineStyle(LineStyle ls);
5483  void setScatterStyle(const QCPScatterStyle &style);
5484  void setScatterSkip(int skip);
5485  void setChannelFillGraph(QCPGraph *targetGraph);
5486  void setAdaptiveSampling(bool enabled);
5487 
5488  // non-property methods:
5489  void addData(const QVector<double> &keys, const QVector<double> &values, bool alreadySorted=false);
5490  void addData(double key, double value);
5491 
5492  // reimplemented virtual methods:
5493  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE;
5494  virtual QCPRange getKeyRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth) const Q_DECL_OVERRIDE;
5495  virtual QCPRange getValueRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth, const QCPRange &inKeyRange=QCPRange()) const Q_DECL_OVERRIDE;
5496 
5497 protected:
5498  // property members:
5499  LineStyle mLineStyle;
5500  QCPScatterStyle mScatterStyle;
5501  int mScatterSkip;
5502  QPointer<QCPGraph> mChannelFillGraph;
5503  bool mAdaptiveSampling;
5504 
5505  // reimplemented virtual methods:
5506  virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
5507  virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const Q_DECL_OVERRIDE;
5508 
5509  // introduced virtual methods:
5510  virtual void drawFill(QCPPainter *painter, QVector<QPointF> *lines) const;
5511  virtual void drawScatterPlot(QCPPainter *painter, const QVector<QPointF> &scatters, const QCPScatterStyle &style) const;
5512  virtual void drawLinePlot(QCPPainter *painter, const QVector<QPointF> &lines) const;
5513  virtual void drawImpulsePlot(QCPPainter *painter, const QVector<QPointF> &lines) const;
5514 
5515  virtual void getOptimizedLineData(QVector<QCPGraphData> *lineData, const QCPGraphDataContainer::const_iterator &begin, const QCPGraphDataContainer::const_iterator &end) const;
5516  virtual void getOptimizedScatterData(QVector<QCPGraphData> *scatterData, QCPGraphDataContainer::const_iterator begin, QCPGraphDataContainer::const_iterator end) const;
5517 
5518  // non-virtual methods:
5519  void getVisibleDataBounds(QCPGraphDataContainer::const_iterator &begin, QCPGraphDataContainer::const_iterator &end, const QCPDataRange &rangeRestriction) const;
5520  void getLines(QVector<QPointF> *lines, const QCPDataRange &dataRange) const;
5521  void getScatters(QVector<QPointF> *scatters, const QCPDataRange &dataRange) const;
5522  QVector<QPointF> dataToLines(const QVector<QCPGraphData> &data) const;
5523  QVector<QPointF> dataToStepLeftLines(const QVector<QCPGraphData> &data) const;
5524  QVector<QPointF> dataToStepRightLines(const QVector<QCPGraphData> &data) const;
5525  QVector<QPointF> dataToStepCenterLines(const QVector<QCPGraphData> &data) const;
5526  QVector<QPointF> dataToImpulseLines(const QVector<QCPGraphData> &data) const;
5527  QVector<QCPDataRange> getNonNanSegments(const QVector<QPointF> *lineData, Qt::Orientation keyOrientation) const;
5528  QVector<QPair<QCPDataRange, QCPDataRange> > getOverlappingSegments(QVector<QCPDataRange> thisSegments, const QVector<QPointF> *thisData, QVector<QCPDataRange> otherSegments, const QVector<QPointF> *otherData) const;
5529  bool segmentsIntersect(double aLower, double aUpper, double bLower, double bUpper, int &bPrecedence) const;
5530  QPointF getFillBasePoint(QPointF matchingDataPoint) const;
5531  const QPolygonF getFillPolygon(const QVector<QPointF> *lineData, QCPDataRange segment) const;
5532  const QPolygonF getChannelFillPolygon(const QVector<QPointF> *thisData, QCPDataRange thisSegment, const QVector<QPointF> *otherData, QCPDataRange otherSegment) const;
5533  int findIndexBelowX(const QVector<QPointF> *data, double x) const;
5534  int findIndexAboveX(const QVector<QPointF> *data, double x) const;
5535  int findIndexBelowY(const QVector<QPointF> *data, double y) const;
5536  int findIndexAboveY(const QVector<QPointF> *data, double y) const;
5537  double pointDistance(const QPointF &pixelPoint, QCPGraphDataContainer::const_iterator &closestData) const;
5538 
5539  friend class QCustomPlot;
5540  friend class QCPLegend;
5541 };
5542 Q_DECLARE_METATYPE(QCPGraph::LineStyle)
5543 
5544 /* end of 'src/plottables/plottable-graph.h' */
5545 
5546 
5547 /* including file 'src/plottables/plottable-curve.h' */
5548 /* modified 2021-03-29T02:30:44, size 7434 */
5549 
5550 class QCP_LIB_DECL QCPCurveData
5551 {
5552 public:
5553  QCPCurveData();
5554  QCPCurveData(double t, double key, double value);
5555 
5556  inline double sortKey() const { return t; }
5557  inline static QCPCurveData fromSortKey(double sortKey) { return QCPCurveData(sortKey, 0, 0); }
5558  inline static bool sortKeyIsMainKey() { return false; }
5559 
5560  inline double mainKey() const { return key; }
5561  inline double mainValue() const { return value; }
5562 
5563  inline QCPRange valueRange() const { return QCPRange(value, value); }
5564 
5565  double t, key, value;
5566 };
5567 Q_DECLARE_TYPEINFO(QCPCurveData, Q_PRIMITIVE_TYPE);
5568 
5569 
5581 
5582 class QCP_LIB_DECL QCPCurve : public QCPAbstractPlottable1D<QCPCurveData>
5583 {
5584  Q_OBJECT
5586  Q_PROPERTY(QCPScatterStyle scatterStyle READ scatterStyle WRITE setScatterStyle)
5587  Q_PROPERTY(int scatterSkip READ scatterSkip WRITE setScatterSkip)
5588  Q_PROPERTY(LineStyle lineStyle READ lineStyle WRITE setLineStyle)
5590 public:
5596  enum LineStyle { lsNone
5597  ,lsLine
5598  };
5599  Q_ENUMS(LineStyle)
5600 
5601  explicit QCPCurve(QCPAxis *keyAxis, QCPAxis *valueAxis);
5602  virtual ~QCPCurve() Q_DECL_OVERRIDE;
5603 
5604  // getters:
5605  QSharedPointer<QCPCurveDataContainer> data() const { return mDataContainer; }
5606  QCPScatterStyle scatterStyle() const { return mScatterStyle; }
5607  int scatterSkip() const { return mScatterSkip; }
5608  LineStyle lineStyle() const { return mLineStyle; }
5609 
5610  // setters:
5611  void setData(QSharedPointer<QCPCurveDataContainer> data);
5612  void setData(const QVector<double> &t, const QVector<double> &keys, const QVector<double> &values, bool alreadySorted=false);
5613  void setData(const QVector<double> &keys, const QVector<double> &values);
5614  void setScatterStyle(const QCPScatterStyle &style);
5615  void setScatterSkip(int skip);
5616  void setLineStyle(LineStyle style);
5617 
5618  // non-property methods:
5619  void addData(const QVector<double> &t, const QVector<double> &keys, const QVector<double> &values, bool alreadySorted=false);
5620  void addData(const QVector<double> &keys, const QVector<double> &values);
5621  void addData(double t, double key, double value);
5622  void addData(double key, double value);
5623 
5624  // reimplemented virtual methods:
5625  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE;
5626  virtual QCPRange getKeyRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth) const Q_DECL_OVERRIDE;
5627  virtual QCPRange getValueRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth, const QCPRange &inKeyRange=QCPRange()) const Q_DECL_OVERRIDE;
5628 
5629 protected:
5630  // property members:
5631  QCPScatterStyle mScatterStyle;
5632  int mScatterSkip;
5633  LineStyle mLineStyle;
5634 
5635  // reimplemented virtual methods:
5636  virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
5637  virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const Q_DECL_OVERRIDE;
5638 
5639  // introduced virtual methods:
5640  virtual void drawCurveLine(QCPPainter *painter, const QVector<QPointF> &lines) const;
5641  virtual void drawScatterPlot(QCPPainter *painter, const QVector<QPointF> &points, const QCPScatterStyle &style) const;
5642 
5643  // non-virtual methods:
5644  void getCurveLines(QVector<QPointF> *lines, const QCPDataRange &dataRange, double penWidth) const;
5645  void getScatters(QVector<QPointF> *scatters, const QCPDataRange &dataRange, double scatterWidth) const;
5646  int getRegion(double key, double value, double keyMin, double valueMax, double keyMax, double valueMin) const;
5647  QPointF getOptimizedPoint(int otherRegion, double otherKey, double otherValue, double key, double value, double keyMin, double valueMax, double keyMax, double valueMin) const;
5648  QVector<QPointF> getOptimizedCornerPoints(int prevRegion, int currentRegion, double prevKey, double prevValue, double key, double value, double keyMin, double valueMax, double keyMax, double valueMin) const;
5649  bool mayTraverse(int prevRegion, int currentRegion) const;
5650  bool getTraverse(double prevKey, double prevValue, double key, double value, double keyMin, double valueMax, double keyMax, double valueMin, QPointF &crossA, QPointF &crossB) const;
5651  void getTraverseCornerPoints(int prevRegion, int currentRegion, double keyMin, double valueMax, double keyMax, double valueMin, QVector<QPointF> &beforeTraverse, QVector<QPointF> &afterTraverse) const;
5652  double pointDistance(const QPointF &pixelPoint, QCPCurveDataContainer::const_iterator &closestData) const;
5653 
5654  friend class QCustomPlot;
5655  friend class QCPLegend;
5656 };
5657 Q_DECLARE_METATYPE(QCPCurve::LineStyle)
5658 
5659 /* end of 'src/plottables/plottable-curve.h' */
5660 
5661 
5662 /* including file 'src/plottables/plottable-bars.h' */
5663 /* modified 2021-03-29T02:30:44, size 8955 */
5664 
5665 class QCP_LIB_DECL QCPBarsGroup : public QObject
5666 {
5667  Q_OBJECT
5669  Q_PROPERTY(SpacingType spacingType READ spacingType WRITE setSpacingType)
5670  Q_PROPERTY(double spacing READ spacing WRITE setSpacing)
5672 public:
5679  enum SpacingType { stAbsolute
5680  ,stAxisRectRatio
5681  ,stPlotCoords
5682  };
5683  Q_ENUMS(SpacingType)
5684 
5685  explicit QCPBarsGroup(QCustomPlot *parentPlot);
5686  virtual ~QCPBarsGroup();
5687 
5688  // getters:
5689  SpacingType spacingType() const { return mSpacingType; }
5690  double spacing() const { return mSpacing; }
5691 
5692  // setters:
5693  void setSpacingType(SpacingType spacingType);
5694  void setSpacing(double spacing);
5695 
5696  // non-virtual methods:
5697  QList<QCPBars*> bars() const { return mBars; }
5698  QCPBars* bars(int index) const;
5699  int size() const { return mBars.size(); }
5700  bool isEmpty() const { return mBars.isEmpty(); }
5701  void clear();
5702  bool contains(QCPBars *bars) const { return mBars.contains(bars); }
5703  void append(QCPBars *bars);
5704  void insert(int i, QCPBars *bars);
5705  void remove(QCPBars *bars);
5706 
5707 protected:
5708  // non-property members:
5709  QCustomPlot *mParentPlot;
5710  SpacingType mSpacingType;
5711  double mSpacing;
5712  QList<QCPBars*> mBars;
5713 
5714  // non-virtual methods:
5715  void registerBars(QCPBars *bars);
5716  void unregisterBars(QCPBars *bars);
5717 
5718  // virtual methods:
5719  double keyPixelOffset(const QCPBars *bars, double keyCoord);
5720  double getPixelSpacing(const QCPBars *bars, double keyCoord);
5721 
5722 private:
5723  Q_DISABLE_COPY(QCPBarsGroup)
5724 
5725  friend class QCPBars;
5726 };
5727 Q_DECLARE_METATYPE(QCPBarsGroup::SpacingType)
5728 
5729 
5730 class QCP_LIB_DECL QCPBarsData
5731 {
5732 public:
5733  QCPBarsData();
5734  QCPBarsData(double key, double value);
5735 
5736  inline double sortKey() const { return key; }
5737  inline static QCPBarsData fromSortKey(double sortKey) { return QCPBarsData(sortKey, 0); }
5738  inline static bool sortKeyIsMainKey() { return true; }
5739 
5740  inline double mainKey() const { return key; }
5741  inline double mainValue() const { return value; }
5742 
5743  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
5744 
5745  double key, value;
5746 };
5747 Q_DECLARE_TYPEINFO(QCPBarsData, Q_PRIMITIVE_TYPE);
5748 
5749 
5760 
5761 class QCP_LIB_DECL QCPBars : public QCPAbstractPlottable1D<QCPBarsData>
5762 {
5763  Q_OBJECT
5765  Q_PROPERTY(double width READ width WRITE setWidth)
5766  Q_PROPERTY(WidthType widthType READ widthType WRITE setWidthType)
5767  Q_PROPERTY(QCPBarsGroup* barsGroup READ barsGroup WRITE setBarsGroup)
5768  Q_PROPERTY(double baseValue READ baseValue WRITE setBaseValue)
5769  Q_PROPERTY(double stackingGap READ stackingGap WRITE setStackingGap)
5770  Q_PROPERTY(QCPBars* barBelow READ barBelow)
5771  Q_PROPERTY(QCPBars* barAbove READ barAbove)
5773 public:
5780  enum WidthType { wtAbsolute
5781  ,wtAxisRectRatio
5782  ,wtPlotCoords
5783  };
5784  Q_ENUMS(WidthType)
5785 
5786  explicit QCPBars(QCPAxis *keyAxis, QCPAxis *valueAxis);
5787  virtual ~QCPBars() Q_DECL_OVERRIDE;
5788 
5789  // getters:
5790  double width() const { return mWidth; }
5791  WidthType widthType() const { return mWidthType; }
5792  QCPBarsGroup *barsGroup() const { return mBarsGroup; }
5793  double baseValue() const { return mBaseValue; }
5794  double stackingGap() const { return mStackingGap; }
5795  QCPBars *barBelow() const { return mBarBelow.data(); }
5796  QCPBars *barAbove() const { return mBarAbove.data(); }
5797  QSharedPointer<QCPBarsDataContainer> data() const { return mDataContainer; }
5798 
5799  // setters:
5800  void setData(QSharedPointer<QCPBarsDataContainer> data);
5801  void setData(const QVector<double> &keys, const QVector<double> &values, bool alreadySorted=false);
5802  void setWidth(double width);
5803  void setWidthType(WidthType widthType);
5804  void setBarsGroup(QCPBarsGroup *barsGroup);
5805  void setBaseValue(double baseValue);
5806  void setStackingGap(double pixels);
5807 
5808  // non-property methods:
5809  void addData(const QVector<double> &keys, const QVector<double> &values, bool alreadySorted=false);
5810  void addData(double key, double value);
5811  void moveBelow(QCPBars *bars);
5812  void moveAbove(QCPBars *bars);
5813 
5814  // reimplemented virtual methods:
5815  virtual QCPDataSelection selectTestRect(const QRectF &rect, bool onlySelectable) const Q_DECL_OVERRIDE;
5816  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE;
5817  virtual QCPRange getKeyRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth) const Q_DECL_OVERRIDE;
5818  virtual QCPRange getValueRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth, const QCPRange &inKeyRange=QCPRange()) const Q_DECL_OVERRIDE;
5819  virtual QPointF dataPixelPosition(int index) const Q_DECL_OVERRIDE;
5820 
5821 protected:
5822  // property members:
5823  double mWidth;
5824  WidthType mWidthType;
5825  QCPBarsGroup *mBarsGroup;
5826  double mBaseValue;
5827  double mStackingGap;
5828  QPointer<QCPBars> mBarBelow, mBarAbove;
5829 
5830  // reimplemented virtual methods:
5831  virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
5832  virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const Q_DECL_OVERRIDE;
5833 
5834  // non-virtual methods:
5835  void getVisibleDataBounds(QCPBarsDataContainer::const_iterator &begin, QCPBarsDataContainer::const_iterator &end) const;
5836  QRectF getBarRect(double key, double value) const;
5837  void getPixelWidth(double key, double &lower, double &upper) const;
5838  double getStackedBaseValue(double key, bool positive) const;
5839  static void connectBars(QCPBars* lower, QCPBars* upper);
5840 
5841  friend class QCustomPlot;
5842  friend class QCPLegend;
5843  friend class QCPBarsGroup;
5844 };
5845 Q_DECLARE_METATYPE(QCPBars::WidthType)
5846 
5847 /* end of 'src/plottables/plottable-bars.h' */
5848 
5849 
5850 /* including file 'src/plottables/plottable-statisticalbox.h' */
5851 /* modified 2021-03-29T02:30:44, size 7522 */
5852 
5853 class QCP_LIB_DECL QCPStatisticalBoxData
5854 {
5855 public:
5857  QCPStatisticalBoxData(double key, double minimum, double lowerQuartile, double median, double upperQuartile, double maximum, const QVector<double>& outliers=QVector<double>());
5858 
5859  inline double sortKey() const { return key; }
5860  inline static QCPStatisticalBoxData fromSortKey(double sortKey) { return QCPStatisticalBoxData(sortKey, 0, 0, 0, 0, 0); }
5861  inline static bool sortKeyIsMainKey() { return true; }
5862 
5863  inline double mainKey() const { return key; }
5864  inline double mainValue() const { return median; }
5865 
5866  inline QCPRange valueRange() const
5867  {
5868  QCPRange result(minimum, maximum);
5869  for (QVector<double>::const_iterator it = outliers.constBegin(); it != outliers.constEnd(); ++it)
5870  result.expand(*it);
5871  return result;
5872  }
5873 
5874  double key, minimum, lowerQuartile, median, upperQuartile, maximum;
5875  QVector<double> outliers;
5876 };
5877 Q_DECLARE_TYPEINFO(QCPStatisticalBoxData, Q_MOVABLE_TYPE);
5878 
5879 
5891 
5892 class QCP_LIB_DECL QCPStatisticalBox : public QCPAbstractPlottable1D<QCPStatisticalBoxData>
5893 {
5894  Q_OBJECT
5896  Q_PROPERTY(double width READ width WRITE setWidth)
5897  Q_PROPERTY(double whiskerWidth READ whiskerWidth WRITE setWhiskerWidth)
5898  Q_PROPERTY(QPen whiskerPen READ whiskerPen WRITE setWhiskerPen)
5899  Q_PROPERTY(QPen whiskerBarPen READ whiskerBarPen WRITE setWhiskerBarPen)
5900  Q_PROPERTY(bool whiskerAntialiased READ whiskerAntialiased WRITE setWhiskerAntialiased)
5901  Q_PROPERTY(QPen medianPen READ medianPen WRITE setMedianPen)
5902  Q_PROPERTY(QCPScatterStyle outlierStyle READ outlierStyle WRITE setOutlierStyle)
5904 public:
5905  explicit QCPStatisticalBox(QCPAxis *keyAxis, QCPAxis *valueAxis);
5906 
5907  // getters:
5908  QSharedPointer<QCPStatisticalBoxDataContainer> data() const { return mDataContainer; }
5909  double width() const { return mWidth; }
5910  double whiskerWidth() const { return mWhiskerWidth; }
5911  QPen whiskerPen() const { return mWhiskerPen; }
5912  QPen whiskerBarPen() const { return mWhiskerBarPen; }
5913  bool whiskerAntialiased() const { return mWhiskerAntialiased; }
5914  QPen medianPen() const { return mMedianPen; }
5915  QCPScatterStyle outlierStyle() const { return mOutlierStyle; }
5916 
5917  // setters:
5918  void setData(QSharedPointer<QCPStatisticalBoxDataContainer> data);
5919  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);
5920  void setWidth(double width);
5921  void setWhiskerWidth(double width);
5922  void setWhiskerPen(const QPen &pen);
5923  void setWhiskerBarPen(const QPen &pen);
5924  void setWhiskerAntialiased(bool enabled);
5925  void setMedianPen(const QPen &pen);
5926  void setOutlierStyle(const QCPScatterStyle &style);
5927 
5928  // non-property methods:
5929  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);
5930  void addData(double key, double minimum, double lowerQuartile, double median, double upperQuartile, double maximum, const QVector<double> &outliers=QVector<double>());
5931 
5932  // reimplemented virtual methods:
5933  virtual QCPDataSelection selectTestRect(const QRectF &rect, bool onlySelectable) const Q_DECL_OVERRIDE;
5934  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE;
5935  virtual QCPRange getKeyRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth) const Q_DECL_OVERRIDE;
5936  virtual QCPRange getValueRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth, const QCPRange &inKeyRange=QCPRange()) const Q_DECL_OVERRIDE;
5937 
5938 protected:
5939  // property members:
5940  double mWidth;
5941  double mWhiskerWidth;
5942  QPen mWhiskerPen, mWhiskerBarPen;
5943  bool mWhiskerAntialiased;
5944  QPen mMedianPen;
5945  QCPScatterStyle mOutlierStyle;
5946 
5947  // reimplemented virtual methods:
5948  virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
5949  virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const Q_DECL_OVERRIDE;
5950 
5951  // introduced virtual methods:
5952  virtual void drawStatisticalBox(QCPPainter *painter, QCPStatisticalBoxDataContainer::const_iterator it, const QCPScatterStyle &outlierStyle) const;
5953 
5954  // non-virtual methods:
5955  void getVisibleDataBounds(QCPStatisticalBoxDataContainer::const_iterator &begin, QCPStatisticalBoxDataContainer::const_iterator &end) const;
5956  QRectF getQuartileBox(QCPStatisticalBoxDataContainer::const_iterator it) const;
5957  QVector<QLineF> getWhiskerBackboneLines(QCPStatisticalBoxDataContainer::const_iterator it) const;
5958  QVector<QLineF> getWhiskerBarLines(QCPStatisticalBoxDataContainer::const_iterator it) const;
5959 
5960  friend class QCustomPlot;
5961  friend class QCPLegend;
5962 };
5963 
5964 /* end of 'src/plottables/plottable-statisticalbox.h' */
5965 
5966 
5967 /* including file 'src/plottables/plottable-colormap.h' */
5968 /* modified 2021-03-29T02:30:44, size 7092 */
5969 
5970 class QCP_LIB_DECL QCPColorMapData
5971 {
5972 public:
5973  QCPColorMapData(int keySize, int valueSize, const QCPRange &keyRange, const QCPRange &valueRange);
5974  ~QCPColorMapData();
5975  QCPColorMapData(const QCPColorMapData &other);
5976  QCPColorMapData &operator=(const QCPColorMapData &other);
5977 
5978  // getters:
5979  int keySize() const { return mKeySize; }
5980  int valueSize() const { return mValueSize; }
5981  QCPRange keyRange() const { return mKeyRange; }
5982  QCPRange valueRange() const { return mValueRange; }
5983  QCPRange dataBounds() const { return mDataBounds; }
5984  double data(double key, double value);
5985  double cell(int keyIndex, int valueIndex);
5986  unsigned char alpha(int keyIndex, int valueIndex);
5987 
5988  // setters:
5989  void setSize(int keySize, int valueSize);
5990  void setKeySize(int keySize);
5991  void setValueSize(int valueSize);
5992  void setRange(const QCPRange &keyRange, const QCPRange &valueRange);
5993  void setKeyRange(const QCPRange &keyRange);
5994  void setValueRange(const QCPRange &valueRange);
5995  void setData(double key, double value, double z);
5996  void setCell(int keyIndex, int valueIndex, double z);
5997  void setAlpha(int keyIndex, int valueIndex, unsigned char alpha);
5998 
5999  // non-property methods:
6000  void recalculateDataBounds();
6001  void clear();
6002  void clearAlpha();
6003  void fill(double z);
6004  void fillAlpha(unsigned char alpha);
6005  bool isEmpty() const { return mIsEmpty; }
6006  void coordToCell(double key, double value, int *keyIndex, int *valueIndex) const;
6007  void cellToCoord(int keyIndex, int valueIndex, double *key, double *value) const;
6008 
6009 protected:
6010  // property members:
6011  int mKeySize, mValueSize;
6012  QCPRange mKeyRange, mValueRange;
6013  bool mIsEmpty;
6014 
6015  // non-property members:
6016  double *mData;
6017  unsigned char *mAlpha;
6018  QCPRange mDataBounds;
6019  bool mDataModified;
6020 
6021  bool createAlpha(bool initializeOpaque=true);
6022 
6023  friend class QCPColorMap;
6024 };
6025 
6026 
6027 class QCP_LIB_DECL QCPColorMap : public QCPAbstractPlottable
6028 {
6029  Q_OBJECT
6031  Q_PROPERTY(QCPRange dataRange READ dataRange WRITE setDataRange NOTIFY dataRangeChanged)
6032  Q_PROPERTY(QCPAxis::ScaleType dataScaleType READ dataScaleType WRITE setDataScaleType NOTIFY dataScaleTypeChanged)
6033  Q_PROPERTY(QCPColorGradient gradient READ gradient WRITE setGradient NOTIFY gradientChanged)
6034  Q_PROPERTY(bool interpolate READ interpolate WRITE setInterpolate)
6035  Q_PROPERTY(bool tightBoundary READ tightBoundary WRITE setTightBoundary)
6036  Q_PROPERTY(QCPColorScale* colorScale READ colorScale WRITE setColorScale)
6038 public:
6039  explicit QCPColorMap(QCPAxis *keyAxis, QCPAxis *valueAxis);
6040  virtual ~QCPColorMap() Q_DECL_OVERRIDE;
6041 
6042  // getters:
6043  QCPColorMapData *data() const { return mMapData; }
6044  QCPRange dataRange() const { return mDataRange; }
6045  QCPAxis::ScaleType dataScaleType() const { return mDataScaleType; }
6046  bool interpolate() const { return mInterpolate; }
6047  bool tightBoundary() const { return mTightBoundary; }
6048  QCPColorGradient gradient() const { return mGradient; }
6049  QCPColorScale *colorScale() const { return mColorScale.data(); }
6050 
6051  // setters:
6052  void setData(QCPColorMapData *data, bool copy=false);
6053  Q_SLOT void setDataRange(const QCPRange &dataRange);
6054  Q_SLOT void setDataScaleType(QCPAxis::ScaleType scaleType);
6055  Q_SLOT void setGradient(const QCPColorGradient &gradient);
6056  void setInterpolate(bool enabled);
6057  void setTightBoundary(bool enabled);
6058  void setColorScale(QCPColorScale *colorScale);
6059 
6060  // non-property methods:
6061  void rescaleDataRange(bool recalculateDataBounds=false);
6062  Q_SLOT void updateLegendIcon(Qt::TransformationMode transformMode=Qt::SmoothTransformation, const QSize &thumbSize=QSize(32, 18));
6063 
6064  // reimplemented virtual methods:
6065  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE;
6066  virtual QCPRange getKeyRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth) const Q_DECL_OVERRIDE;
6067  virtual QCPRange getValueRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth, const QCPRange &inKeyRange=QCPRange()) const Q_DECL_OVERRIDE;
6068 
6069 signals:
6070  void dataRangeChanged(const QCPRange &newRange);
6071  void dataScaleTypeChanged(QCPAxis::ScaleType scaleType);
6072  void gradientChanged(const QCPColorGradient &newGradient);
6073 
6074 protected:
6075  // property members:
6076  QCPRange mDataRange;
6077  QCPAxis::ScaleType mDataScaleType;
6078  QCPColorMapData *mMapData;
6079  QCPColorGradient mGradient;
6080  bool mInterpolate;
6081  bool mTightBoundary;
6082  QPointer<QCPColorScale> mColorScale;
6083 
6084  // non-property members:
6085  QImage mMapImage, mUndersampledMapImage;
6086  QPixmap mLegendIcon;
6087  bool mMapImageInvalidated;
6088 
6089  // introduced virtual methods:
6090  virtual void updateMapImage();
6091 
6092  // reimplemented virtual methods:
6093  virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
6094  virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const Q_DECL_OVERRIDE;
6095 
6096  friend class QCustomPlot;
6097  friend class QCPLegend;
6098 };
6099 
6100 /* end of 'src/plottables/plottable-colormap.h' */
6101 
6102 
6103 /* including file 'src/plottables/plottable-financial.h' */
6104 /* modified 2021-03-29T02:30:44, size 8644 */
6105 
6106 class QCP_LIB_DECL QCPFinancialData
6107 {
6108 public:
6109  QCPFinancialData();
6110  QCPFinancialData(double key, double open, double high, double low, double close);
6111 
6112  inline double sortKey() const { return key; }
6113  inline static QCPFinancialData fromSortKey(double sortKey) { return QCPFinancialData(sortKey, 0, 0, 0, 0); }
6114  inline static bool sortKeyIsMainKey() { return true; }
6115 
6116  inline double mainKey() const { return key; }
6117  inline double mainValue() const { return open; }
6118 
6119  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
6120 
6121  double key, open, high, low, close;
6122 };
6123 Q_DECLARE_TYPEINFO(QCPFinancialData, Q_PRIMITIVE_TYPE);
6124 
6125 
6136 
6137 class QCP_LIB_DECL QCPFinancial : public QCPAbstractPlottable1D<QCPFinancialData>
6138 {
6139  Q_OBJECT
6141  Q_PROPERTY(ChartStyle chartStyle READ chartStyle WRITE setChartStyle)
6142  Q_PROPERTY(double width READ width WRITE setWidth)
6143  Q_PROPERTY(WidthType widthType READ widthType WRITE setWidthType)
6144  Q_PROPERTY(bool twoColored READ twoColored WRITE setTwoColored)
6145  Q_PROPERTY(QBrush brushPositive READ brushPositive WRITE setBrushPositive)
6146  Q_PROPERTY(QBrush brushNegative READ brushNegative WRITE setBrushNegative)
6147  Q_PROPERTY(QPen penPositive READ penPositive WRITE setPenPositive)
6148  Q_PROPERTY(QPen penNegative READ penNegative WRITE setPenNegative)
6150 public:
6157  enum WidthType { wtAbsolute
6158  ,wtAxisRectRatio
6159  ,wtPlotCoords
6160  };
6161  Q_ENUMS(WidthType)
6162 
6163 
6168  enum ChartStyle { csOhlc
6169  ,csCandlestick
6170  };
6171  Q_ENUMS(ChartStyle)
6172 
6173  explicit QCPFinancial(QCPAxis *keyAxis, QCPAxis *valueAxis);
6174  virtual ~QCPFinancial() Q_DECL_OVERRIDE;
6175 
6176  // getters:
6177  QSharedPointer<QCPFinancialDataContainer> data() const { return mDataContainer; }
6178  ChartStyle chartStyle() const { return mChartStyle; }
6179  double width() const { return mWidth; }
6180  WidthType widthType() const { return mWidthType; }
6181  bool twoColored() const { return mTwoColored; }
6182  QBrush brushPositive() const { return mBrushPositive; }
6183  QBrush brushNegative() const { return mBrushNegative; }
6184  QPen penPositive() const { return mPenPositive; }
6185  QPen penNegative() const { return mPenNegative; }
6186 
6187  // setters:
6188  void setData(QSharedPointer<QCPFinancialDataContainer> data);
6189  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);
6190  void setChartStyle(ChartStyle style);
6191  void setWidth(double width);
6192  void setWidthType(WidthType widthType);
6193  void setTwoColored(bool twoColored);
6194  void setBrushPositive(const QBrush &brush);
6195  void setBrushNegative(const QBrush &brush);
6196  void setPenPositive(const QPen &pen);
6197  void setPenNegative(const QPen &pen);
6198 
6199  // non-property methods:
6200  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);
6201  void addData(double key, double open, double high, double low, double close);
6202 
6203  // reimplemented virtual methods:
6204  virtual QCPDataSelection selectTestRect(const QRectF &rect, bool onlySelectable) const Q_DECL_OVERRIDE;
6205  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE;
6206  virtual QCPRange getKeyRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth) const Q_DECL_OVERRIDE;
6207  virtual QCPRange getValueRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth, const QCPRange &inKeyRange=QCPRange()) const Q_DECL_OVERRIDE;
6208 
6209  // static methods:
6210  static QCPFinancialDataContainer timeSeriesToOhlc(const QVector<double> &time, const QVector<double> &value, double timeBinSize, double timeBinOffset = 0);
6211 
6212 protected:
6213  // property members:
6214  ChartStyle mChartStyle;
6215  double mWidth;
6216  WidthType mWidthType;
6217  bool mTwoColored;
6218  QBrush mBrushPositive, mBrushNegative;
6219  QPen mPenPositive, mPenNegative;
6220 
6221  // reimplemented virtual methods:
6222  virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
6223  virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const Q_DECL_OVERRIDE;
6224 
6225  // non-virtual methods:
6226  void drawOhlcPlot(QCPPainter *painter, const QCPFinancialDataContainer::const_iterator &begin, const QCPFinancialDataContainer::const_iterator &end, bool isSelected);
6227  void drawCandlestickPlot(QCPPainter *painter, const QCPFinancialDataContainer::const_iterator &begin, const QCPFinancialDataContainer::const_iterator &end, bool isSelected);
6228  double getPixelWidth(double key, double keyPixel) const;
6229  double ohlcSelectTest(const QPointF &pos, const QCPFinancialDataContainer::const_iterator &begin, const QCPFinancialDataContainer::const_iterator &end, QCPFinancialDataContainer::const_iterator &closestDataPoint) const;
6230  double candlestickSelectTest(const QPointF &pos, const QCPFinancialDataContainer::const_iterator &begin, const QCPFinancialDataContainer::const_iterator &end, QCPFinancialDataContainer::const_iterator &closestDataPoint) const;
6231  void getVisibleDataBounds(QCPFinancialDataContainer::const_iterator &begin, QCPFinancialDataContainer::const_iterator &end) const;
6232  QRectF selectionHitBox(QCPFinancialDataContainer::const_iterator it) const;
6233 
6234  friend class QCustomPlot;
6235  friend class QCPLegend;
6236 };
6237 Q_DECLARE_METATYPE(QCPFinancial::ChartStyle)
6238 
6239 /* end of 'src/plottables/plottable-financial.h' */
6240 
6241 
6242 /* including file 'src/plottables/plottable-errorbar.h' */
6243 /* modified 2021-03-29T02:30:44, size 7749 */
6244 
6245 class QCP_LIB_DECL QCPErrorBarsData
6246 {
6247 public:
6248  QCPErrorBarsData();
6249  explicit QCPErrorBarsData(double error);
6250  QCPErrorBarsData(double errorMinus, double errorPlus);
6251 
6252  double errorMinus, errorPlus;
6253 };
6254 Q_DECLARE_TYPEINFO(QCPErrorBarsData, Q_PRIMITIVE_TYPE);
6255 
6256 
6273 
6274 class QCP_LIB_DECL QCPErrorBars : public QCPAbstractPlottable, public QCPPlottableInterface1D
6275 {
6276  Q_OBJECT
6278  Q_PROPERTY(QSharedPointer<QCPErrorBarsDataContainer> data READ data WRITE setData)
6279  Q_PROPERTY(QCPAbstractPlottable* dataPlottable READ dataPlottable WRITE setDataPlottable)
6280  Q_PROPERTY(ErrorType errorType READ errorType WRITE setErrorType)
6281  Q_PROPERTY(double whiskerWidth READ whiskerWidth WRITE setWhiskerWidth)
6282  Q_PROPERTY(double symbolGap READ symbolGap WRITE setSymbolGap)
6284 public:
6285 
6292  enum ErrorType { etKeyError
6293  ,etValueError
6294  };
6295  Q_ENUMS(ErrorType)
6296 
6297  explicit QCPErrorBars(QCPAxis *keyAxis, QCPAxis *valueAxis);
6298  virtual ~QCPErrorBars() Q_DECL_OVERRIDE;
6299  // getters:
6300  QSharedPointer<QCPErrorBarsDataContainer> data() const { return mDataContainer; }
6301  QCPAbstractPlottable *dataPlottable() const { return mDataPlottable.data(); }
6302  ErrorType errorType() const { return mErrorType; }
6303  double whiskerWidth() const { return mWhiskerWidth; }
6304  double symbolGap() const { return mSymbolGap; }
6305 
6306  // setters:
6307  void setData(QSharedPointer<QCPErrorBarsDataContainer> data);
6308  void setData(const QVector<double> &error);
6309  void setData(const QVector<double> &errorMinus, const QVector<double> &errorPlus);
6310  void setDataPlottable(QCPAbstractPlottable* plottable);
6311  void setErrorType(ErrorType type);
6312  void setWhiskerWidth(double pixels);
6313  void setSymbolGap(double pixels);
6314 
6315  // non-property methods:
6316  void addData(const QVector<double> &error);
6317  void addData(const QVector<double> &errorMinus, const QVector<double> &errorPlus);
6318  void addData(double error);
6319  void addData(double errorMinus, double errorPlus);
6320 
6321  // virtual methods of 1d plottable interface:
6322  virtual int dataCount() const Q_DECL_OVERRIDE;
6323  virtual double dataMainKey(int index) const Q_DECL_OVERRIDE;
6324  virtual double dataSortKey(int index) const Q_DECL_OVERRIDE;
6325  virtual double dataMainValue(int index) const Q_DECL_OVERRIDE;
6326  virtual QCPRange dataValueRange(int index) const Q_DECL_OVERRIDE;
6327  virtual QPointF dataPixelPosition(int index) const Q_DECL_OVERRIDE;
6328  virtual bool sortKeyIsMainKey() const Q_DECL_OVERRIDE;
6329  virtual QCPDataSelection selectTestRect(const QRectF &rect, bool onlySelectable) const Q_DECL_OVERRIDE;
6330  virtual int findBegin(double sortKey, bool expandedRange=true) const Q_DECL_OVERRIDE;
6331  virtual int findEnd(double sortKey, bool expandedRange=true) const Q_DECL_OVERRIDE;
6332 
6333  // reimplemented virtual methods:
6334  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE;
6335  virtual QCPPlottableInterface1D *interface1D() Q_DECL_OVERRIDE { return this; }
6336 
6337 protected:
6338  // property members:
6339  QSharedPointer<QCPErrorBarsDataContainer> mDataContainer;
6340  QPointer<QCPAbstractPlottable> mDataPlottable;
6341  ErrorType mErrorType;
6342  double mWhiskerWidth;
6343  double mSymbolGap;
6344 
6345  // reimplemented virtual methods:
6346  virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
6347  virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const Q_DECL_OVERRIDE;
6348  virtual QCPRange getKeyRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth) const Q_DECL_OVERRIDE;
6349  virtual QCPRange getValueRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth, const QCPRange &inKeyRange=QCPRange()) const Q_DECL_OVERRIDE;
6350 
6351  // non-virtual methods:
6352  void getErrorBarLines(QCPErrorBarsDataContainer::const_iterator it, QVector<QLineF> &backbones, QVector<QLineF> &whiskers) const;
6353  void getVisibleDataBounds(QCPErrorBarsDataContainer::const_iterator &begin, QCPErrorBarsDataContainer::const_iterator &end, const QCPDataRange &rangeRestriction) const;
6354  double pointDistance(const QPointF &pixelPoint, QCPErrorBarsDataContainer::const_iterator &closestData) const;
6355  // helpers:
6356  void getDataSegments(QList<QCPDataRange> &selectedSegments, QList<QCPDataRange> &unselectedSegments) const;
6357  bool errorBarVisible(int index) const;
6358  bool rectIntersectsLine(const QRectF &pixelRect, const QLineF &line) const;
6359 
6360  friend class QCustomPlot;
6361  friend class QCPLegend;
6362 };
6363 
6364 /* end of 'src/plottables/plottable-errorbar.h' */
6365 
6366 
6367 /* including file 'src/items/item-straightline.h' */
6368 /* modified 2021-03-29T02:30:44, size 3137 */
6369 
6370 class QCP_LIB_DECL QCPItemStraightLine : public QCPAbstractItem
6371 {
6372  Q_OBJECT
6374  Q_PROPERTY(QPen pen READ pen WRITE setPen)
6375  Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
6377 public:
6378  explicit QCPItemStraightLine(QCustomPlot *parentPlot);
6379  virtual ~QCPItemStraightLine() Q_DECL_OVERRIDE;
6380 
6381  // getters:
6382  QPen pen() const { return mPen; }
6383  QPen selectedPen() const { return mSelectedPen; }
6384 
6385  // setters;
6386  void setPen(const QPen &pen);
6387  void setSelectedPen(const QPen &pen);
6388 
6389  // reimplemented virtual methods:
6390  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE;
6391 
6392  QCPItemPosition * const point1;
6393  QCPItemPosition * const point2;
6394 
6395 protected:
6396  // property members:
6397  QPen mPen, mSelectedPen;
6398 
6399  // reimplemented virtual methods:
6400  virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
6401 
6402  // non-virtual methods:
6403  QLineF getRectClippedStraightLine(const QCPVector2D &base, const QCPVector2D &vec, const QRect &rect) const;
6404  QPen mainPen() const;
6405 };
6406 
6407 /* end of 'src/items/item-straightline.h' */
6408 
6409 
6410 /* including file 'src/items/item-line.h' */
6411 /* modified 2021-03-29T02:30:44, size 3429 */
6412 
6413 class QCP_LIB_DECL QCPItemLine : public QCPAbstractItem
6414 {
6415  Q_OBJECT
6417  Q_PROPERTY(QPen pen READ pen WRITE setPen)
6418  Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
6419  Q_PROPERTY(QCPLineEnding head READ head WRITE setHead)
6420  Q_PROPERTY(QCPLineEnding tail READ tail WRITE setTail)
6422 public:
6423  explicit QCPItemLine(QCustomPlot *parentPlot);
6424  virtual ~QCPItemLine() Q_DECL_OVERRIDE;
6425 
6426  // getters:
6427  QPen pen() const { return mPen; }
6428  QPen selectedPen() const { return mSelectedPen; }
6429  QCPLineEnding head() const { return mHead; }
6430  QCPLineEnding tail() const { return mTail; }
6431 
6432  // setters;
6433  void setPen(const QPen &pen);
6434  void setSelectedPen(const QPen &pen);
6435  void setHead(const QCPLineEnding &head);
6436  void setTail(const QCPLineEnding &tail);
6437 
6438  // reimplemented virtual methods:
6439  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE;
6440 
6441  QCPItemPosition * const start;
6442  QCPItemPosition * const end;
6443 
6444 protected:
6445  // property members:
6446  QPen mPen, mSelectedPen;
6447  QCPLineEnding mHead, mTail;
6448 
6449  // reimplemented virtual methods:
6450  virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
6451 
6452  // non-virtual methods:
6453  QLineF getRectClippedLine(const QCPVector2D &start, const QCPVector2D &end, const QRect &rect) const;
6454  QPen mainPen() const;
6455 };
6456 
6457 /* end of 'src/items/item-line.h' */
6458 
6459 
6460 /* including file 'src/items/item-curve.h' */
6461 /* modified 2021-03-29T02:30:44, size 3401 */
6462 
6463 class QCP_LIB_DECL QCPItemCurve : public QCPAbstractItem
6464 {
6465  Q_OBJECT
6467  Q_PROPERTY(QPen pen READ pen WRITE setPen)
6468  Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
6469  Q_PROPERTY(QCPLineEnding head READ head WRITE setHead)
6470  Q_PROPERTY(QCPLineEnding tail READ tail WRITE setTail)
6472 public:
6473  explicit QCPItemCurve(QCustomPlot *parentPlot);
6474  virtual ~QCPItemCurve() Q_DECL_OVERRIDE;
6475 
6476  // getters:
6477  QPen pen() const { return mPen; }
6478  QPen selectedPen() const { return mSelectedPen; }
6479  QCPLineEnding head() const { return mHead; }
6480  QCPLineEnding tail() const { return mTail; }
6481 
6482  // setters;
6483  void setPen(const QPen &pen);
6484  void setSelectedPen(const QPen &pen);
6485  void setHead(const QCPLineEnding &head);
6486  void setTail(const QCPLineEnding &tail);
6487 
6488  // reimplemented virtual methods:
6489  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE;
6490 
6491  QCPItemPosition * const start;
6492  QCPItemPosition * const startDir;
6493  QCPItemPosition * const endDir;
6494  QCPItemPosition * const end;
6495 
6496 protected:
6497  // property members:
6498  QPen mPen, mSelectedPen;
6499  QCPLineEnding mHead, mTail;
6500 
6501  // reimplemented virtual methods:
6502  virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
6503 
6504  // non-virtual methods:
6505  QPen mainPen() const;
6506 };
6507 
6508 /* end of 'src/items/item-curve.h' */
6509 
6510 
6511 /* including file 'src/items/item-rect.h' */
6512 /* modified 2021-03-29T02:30:44, size 3710 */
6513 
6514 class QCP_LIB_DECL QCPItemRect : public QCPAbstractItem
6515 {
6516  Q_OBJECT
6518  Q_PROPERTY(QPen pen READ pen WRITE setPen)
6519  Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
6520  Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
6521  Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
6523 public:
6524  explicit QCPItemRect(QCustomPlot *parentPlot);
6525  virtual ~QCPItemRect() Q_DECL_OVERRIDE;
6526 
6527  // getters:
6528  QPen pen() const { return mPen; }
6529  QPen selectedPen() const { return mSelectedPen; }
6530  QBrush brush() const { return mBrush; }
6531  QBrush selectedBrush() const { return mSelectedBrush; }
6532 
6533  // setters;
6534  void setPen(const QPen &pen);
6535  void setSelectedPen(const QPen &pen);
6536  void setBrush(const QBrush &brush);
6537  void setSelectedBrush(const QBrush &brush);
6538 
6539  // reimplemented virtual methods:
6540  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE;
6541 
6542  QCPItemPosition * const topLeft;
6543  QCPItemPosition * const bottomRight;
6544  QCPItemAnchor * const top;
6545  QCPItemAnchor * const topRight;
6546  QCPItemAnchor * const right;
6547  QCPItemAnchor * const bottom;
6548  QCPItemAnchor * const bottomLeft;
6549  QCPItemAnchor * const left;
6550 
6551 protected:
6552  enum AnchorIndex {aiTop, aiTopRight, aiRight, aiBottom, aiBottomLeft, aiLeft};
6553 
6554  // property members:
6555  QPen mPen, mSelectedPen;
6556  QBrush mBrush, mSelectedBrush;
6557 
6558  // reimplemented virtual methods:
6559  virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
6560  virtual QPointF anchorPixelPosition(int anchorId) const Q_DECL_OVERRIDE;
6561 
6562  // non-virtual methods:
6563  QPen mainPen() const;
6564  QBrush mainBrush() const;
6565 };
6566 
6567 /* end of 'src/items/item-rect.h' */
6568 
6569 
6570 /* including file 'src/items/item-text.h' */
6571 /* modified 2021-03-29T02:30:44, size 5576 */
6572 
6573 class QCP_LIB_DECL QCPItemText : public QCPAbstractItem
6574 {
6575  Q_OBJECT
6577  Q_PROPERTY(QColor color READ color WRITE setColor)
6578  Q_PROPERTY(QColor selectedColor READ selectedColor WRITE setSelectedColor)
6579  Q_PROPERTY(QPen pen READ pen WRITE setPen)
6580  Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
6581  Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
6582  Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
6583  Q_PROPERTY(QFont font READ font WRITE setFont)
6584  Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont)
6585  Q_PROPERTY(QString text READ text WRITE setText)
6586  Q_PROPERTY(Qt::Alignment positionAlignment READ positionAlignment WRITE setPositionAlignment)
6587  Q_PROPERTY(Qt::Alignment textAlignment READ textAlignment WRITE setTextAlignment)
6588  Q_PROPERTY(double rotation READ rotation WRITE setRotation)
6589  Q_PROPERTY(QMargins padding READ padding WRITE setPadding)
6591 public:
6592  explicit QCPItemText(QCustomPlot *parentPlot);
6593  virtual ~QCPItemText() Q_DECL_OVERRIDE;
6594 
6595  // getters:
6596  QColor color() const { return mColor; }
6597  QColor selectedColor() const { return mSelectedColor; }
6598  QPen pen() const { return mPen; }
6599  QPen selectedPen() const { return mSelectedPen; }
6600  QBrush brush() const { return mBrush; }
6601  QBrush selectedBrush() const { return mSelectedBrush; }
6602  QFont font() const { return mFont; }
6603  QFont selectedFont() const { return mSelectedFont; }
6604  QString text() const { return mText; }
6605  Qt::Alignment positionAlignment() const { return mPositionAlignment; }
6606  Qt::Alignment textAlignment() const { return mTextAlignment; }
6607  double rotation() const { return mRotation; }
6608  QMargins padding() const { return mPadding; }
6609 
6610  // setters;
6611  void setColor(const QColor &color);
6612  void setSelectedColor(const QColor &color);
6613  void setPen(const QPen &pen);
6614  void setSelectedPen(const QPen &pen);
6615  void setBrush(const QBrush &brush);
6616  void setSelectedBrush(const QBrush &brush);
6617  void setFont(const QFont &font);
6618  void setSelectedFont(const QFont &font);
6619  void setText(const QString &text);
6620  void setPositionAlignment(Qt::Alignment alignment);
6621  void setTextAlignment(Qt::Alignment alignment);
6622  void setRotation(double degrees);
6623  void setPadding(const QMargins &padding);
6624 
6625  // reimplemented virtual methods:
6626  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE;
6627 
6628  QCPItemPosition * const position;
6629  QCPItemAnchor * const topLeft;
6630  QCPItemAnchor * const top;
6631  QCPItemAnchor * const topRight;
6632  QCPItemAnchor * const right;
6633  QCPItemAnchor * const bottomRight;
6634  QCPItemAnchor * const bottom;
6635  QCPItemAnchor * const bottomLeft;
6636  QCPItemAnchor * const left;
6637 
6638 protected:
6639  enum AnchorIndex {aiTopLeft, aiTop, aiTopRight, aiRight, aiBottomRight, aiBottom, aiBottomLeft, aiLeft};
6640 
6641  // property members:
6642  QColor mColor, mSelectedColor;
6643  QPen mPen, mSelectedPen;
6644  QBrush mBrush, mSelectedBrush;
6645  QFont mFont, mSelectedFont;
6646  QString mText;
6647  Qt::Alignment mPositionAlignment;
6648  Qt::Alignment mTextAlignment;
6649  double mRotation;
6650  QMargins mPadding;
6651 
6652  // reimplemented virtual methods:
6653  virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
6654  virtual QPointF anchorPixelPosition(int anchorId) const Q_DECL_OVERRIDE;
6655 
6656  // non-virtual methods:
6657  QPointF getTextDrawPoint(const QPointF &pos, const QRectF &rect, Qt::Alignment positionAlignment) const;
6658  QFont mainFont() const;
6659  QColor mainColor() const;
6660  QPen mainPen() const;
6661  QBrush mainBrush() const;
6662 };
6663 
6664 /* end of 'src/items/item-text.h' */
6665 
6666 
6667 /* including file 'src/items/item-ellipse.h' */
6668 /* modified 2021-03-29T02:30:44, size 3890 */
6669 
6670 class QCP_LIB_DECL QCPItemEllipse : public QCPAbstractItem
6671 {
6672  Q_OBJECT
6674  Q_PROPERTY(QPen pen READ pen WRITE setPen)
6675  Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
6676  Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
6677  Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
6679 public:
6680  explicit QCPItemEllipse(QCustomPlot *parentPlot);
6681  virtual ~QCPItemEllipse() Q_DECL_OVERRIDE;
6682 
6683  // getters:
6684  QPen pen() const { return mPen; }
6685  QPen selectedPen() const { return mSelectedPen; }
6686  QBrush brush() const { return mBrush; }
6687  QBrush selectedBrush() const { return mSelectedBrush; }
6688 
6689  // setters;
6690  void setPen(const QPen &pen);
6691  void setSelectedPen(const QPen &pen);
6692  void setBrush(const QBrush &brush);
6693  void setSelectedBrush(const QBrush &brush);
6694 
6695  // reimplemented virtual methods:
6696  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE;
6697 
6698  QCPItemPosition * const topLeft;
6699  QCPItemPosition * const bottomRight;
6700  QCPItemAnchor * const topLeftRim;
6701  QCPItemAnchor * const top;
6702  QCPItemAnchor * const topRightRim;
6703  QCPItemAnchor * const right;
6704  QCPItemAnchor * const bottomRightRim;
6705  QCPItemAnchor * const bottom;
6706  QCPItemAnchor * const bottomLeftRim;
6707  QCPItemAnchor * const left;
6708  QCPItemAnchor * const center;
6709 
6710 protected:
6711  enum AnchorIndex {aiTopLeftRim, aiTop, aiTopRightRim, aiRight, aiBottomRightRim, aiBottom, aiBottomLeftRim, aiLeft, aiCenter};
6712 
6713  // property members:
6714  QPen mPen, mSelectedPen;
6715  QBrush mBrush, mSelectedBrush;
6716 
6717  // reimplemented virtual methods:
6718  virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
6719  virtual QPointF anchorPixelPosition(int anchorId) const Q_DECL_OVERRIDE;
6720 
6721  // non-virtual methods:
6722  QPen mainPen() const;
6723  QBrush mainBrush() const;
6724 };
6725 
6726 /* end of 'src/items/item-ellipse.h' */
6727 
6728 
6729 /* including file 'src/items/item-pixmap.h' */
6730 /* modified 2021-03-29T02:30:44, size 4407 */
6731 
6732 class QCP_LIB_DECL QCPItemPixmap : public QCPAbstractItem
6733 {
6734  Q_OBJECT
6736  Q_PROPERTY(QPixmap pixmap READ pixmap WRITE setPixmap)
6737  Q_PROPERTY(bool scaled READ scaled WRITE setScaled)
6738  Q_PROPERTY(Qt::AspectRatioMode aspectRatioMode READ aspectRatioMode)
6739  Q_PROPERTY(Qt::TransformationMode transformationMode READ transformationMode)
6740  Q_PROPERTY(QPen pen READ pen WRITE setPen)
6741  Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
6743 public:
6744  explicit QCPItemPixmap(QCustomPlot *parentPlot);
6745  virtual ~QCPItemPixmap() Q_DECL_OVERRIDE;
6746 
6747  // getters:
6748  QPixmap pixmap() const { return mPixmap; }
6749  bool scaled() const { return mScaled; }
6750  Qt::AspectRatioMode aspectRatioMode() const { return mAspectRatioMode; }
6751  Qt::TransformationMode transformationMode() const { return mTransformationMode; }
6752  QPen pen() const { return mPen; }
6753  QPen selectedPen() const { return mSelectedPen; }
6754 
6755  // setters;
6756  void setPixmap(const QPixmap &pixmap);
6757  void setScaled(bool scaled, Qt::AspectRatioMode aspectRatioMode=Qt::KeepAspectRatio, Qt::TransformationMode transformationMode=Qt::SmoothTransformation);
6758  void setPen(const QPen &pen);
6759  void setSelectedPen(const QPen &pen);
6760 
6761  // reimplemented virtual methods:
6762  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE;
6763 
6764  QCPItemPosition * const topLeft;
6765  QCPItemPosition * const bottomRight;
6766  QCPItemAnchor * const top;
6767  QCPItemAnchor * const topRight;
6768  QCPItemAnchor * const right;
6769  QCPItemAnchor * const bottom;
6770  QCPItemAnchor * const bottomLeft;
6771  QCPItemAnchor * const left;
6772 
6773 protected:
6774  enum AnchorIndex {aiTop, aiTopRight, aiRight, aiBottom, aiBottomLeft, aiLeft};
6775 
6776  // property members:
6777  QPixmap mPixmap;
6778  QPixmap mScaledPixmap;
6779  bool mScaled;
6780  bool mScaledPixmapInvalidated;
6781  Qt::AspectRatioMode mAspectRatioMode;
6782  Qt::TransformationMode mTransformationMode;
6783  QPen mPen, mSelectedPen;
6784 
6785  // reimplemented virtual methods:
6786  virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
6787  virtual QPointF anchorPixelPosition(int anchorId) const Q_DECL_OVERRIDE;
6788 
6789  // non-virtual methods:
6790  void updateScaledPixmap(QRect finalRect=QRect(), bool flipHorz=false, bool flipVert=false);
6791  QRect getFinalRect(bool *flippedHorz=nullptr, bool *flippedVert=nullptr) const;
6792  QPen mainPen() const;
6793 };
6794 
6795 /* end of 'src/items/item-pixmap.h' */
6796 
6797 
6798 /* including file 'src/items/item-tracer.h' */
6799 /* modified 2021-03-29T02:30:44, size 4811 */
6800 
6801 class QCP_LIB_DECL QCPItemTracer : public QCPAbstractItem
6802 {
6803  Q_OBJECT
6805  Q_PROPERTY(QPen pen READ pen WRITE setPen)
6806  Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
6807  Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
6808  Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
6809  Q_PROPERTY(double size READ size WRITE setSize)
6810  Q_PROPERTY(TracerStyle style READ style WRITE setStyle)
6811  Q_PROPERTY(QCPGraph* graph READ graph WRITE setGraph)
6812  Q_PROPERTY(double graphKey READ graphKey WRITE setGraphKey)
6813  Q_PROPERTY(bool interpolating READ interpolating WRITE setInterpolating)
6815 public:
6821  enum TracerStyle { tsNone
6822  ,tsPlus
6823  ,tsCrosshair
6824  ,tsCircle
6825  ,tsSquare
6826  };
6827  Q_ENUMS(TracerStyle)
6828 
6829  explicit QCPItemTracer(QCustomPlot *parentPlot);
6830  virtual ~QCPItemTracer() Q_DECL_OVERRIDE;
6831 
6832  // getters:
6833  QPen pen() const { return mPen; }
6834  QPen selectedPen() const { return mSelectedPen; }
6835  QBrush brush() const { return mBrush; }
6836  QBrush selectedBrush() const { return mSelectedBrush; }
6837  double size() const { return mSize; }
6838  TracerStyle style() const { return mStyle; }
6839  QCPGraph *graph() const { return mGraph; }
6840  double graphKey() const { return mGraphKey; }
6841  bool interpolating() const { return mInterpolating; }
6842 
6843  // setters;
6844  void setPen(const QPen &pen);
6845  void setSelectedPen(const QPen &pen);
6846  void setBrush(const QBrush &brush);
6847  void setSelectedBrush(const QBrush &brush);
6848  void setSize(double size);
6849  void setStyle(TracerStyle style);
6850  void setGraph(QCPGraph *graph);
6851  void setGraphKey(double key);
6852  void setInterpolating(bool enabled);
6853 
6854  // reimplemented virtual methods:
6855  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE;
6856 
6857  // non-virtual methods:
6858  void updatePosition();
6859 
6860  QCPItemPosition * const position;
6861 
6862 protected:
6863  // property members:
6864  QPen mPen, mSelectedPen;
6865  QBrush mBrush, mSelectedBrush;
6866  double mSize;
6867  TracerStyle mStyle;
6868  QCPGraph *mGraph;
6869  double mGraphKey;
6870  bool mInterpolating;
6871 
6872  // reimplemented virtual methods:
6873  virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
6874 
6875  // non-virtual methods:
6876  QPen mainPen() const;
6877  QBrush mainBrush() const;
6878 };
6879 Q_DECLARE_METATYPE(QCPItemTracer::TracerStyle)
6880 
6881 /* end of 'src/items/item-tracer.h' */
6882 
6883 
6884 /* including file 'src/items/item-bracket.h' */
6885 /* modified 2021-03-29T02:30:44, size 3991 */
6886 
6887 class QCP_LIB_DECL QCPItemBracket : public QCPAbstractItem
6888 {
6889  Q_OBJECT
6891  Q_PROPERTY(QPen pen READ pen WRITE setPen)
6892  Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
6893  Q_PROPERTY(double length READ length WRITE setLength)
6894  Q_PROPERTY(BracketStyle style READ style WRITE setStyle)
6896 public:
6903  enum BracketStyle { bsSquare
6904  ,bsRound
6905  ,bsCurly
6906  ,bsCalligraphic
6907  };
6908  Q_ENUMS(BracketStyle)
6909 
6910  explicit QCPItemBracket(QCustomPlot *parentPlot);
6911  virtual ~QCPItemBracket() Q_DECL_OVERRIDE;
6912 
6913  // getters:
6914  QPen pen() const { return mPen; }
6915  QPen selectedPen() const { return mSelectedPen; }
6916  double length() const { return mLength; }
6917  BracketStyle style() const { return mStyle; }
6918 
6919  // setters;
6920  void setPen(const QPen &pen);
6921  void setSelectedPen(const QPen &pen);
6922  void setLength(double length);
6923  void setStyle(BracketStyle style);
6924 
6925  // reimplemented virtual methods:
6926  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE;
6927 
6928  QCPItemPosition * const left;
6929  QCPItemPosition * const right;
6930  QCPItemAnchor * const center;
6931 
6932 protected:
6933  // property members:
6934  enum AnchorIndex {aiCenter};
6935  QPen mPen, mSelectedPen;
6936  double mLength;
6937  BracketStyle mStyle;
6938 
6939  // reimplemented virtual methods:
6940  virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
6941  virtual QPointF anchorPixelPosition(int anchorId) const Q_DECL_OVERRIDE;
6942 
6943  // non-virtual methods:
6944  QPen mainPen() const;
6945 };
6946 Q_DECLARE_METATYPE(QCPItemBracket::BracketStyle)
6947 
6948 /* end of 'src/items/item-bracket.h' */
6949 
6950 
6951 /* including file 'src/polar/radialaxis.h' */
6952 /* modified 2021-03-29T02:30:44, size 12227 */
6953 
6954 
6955 class QCP_LIB_DECL QCPPolarAxisRadial : public QCPLayerable
6956 {
6957  Q_OBJECT
6959 
6961 public:
6965  enum AngleReference { arAbsolute
6966  ,arAngularAxis
6967  };
6968  Q_ENUMS(AngleReference)
6973  enum ScaleType { stLinear
6974  ,stLogarithmic
6975  };
6976  Q_ENUMS(ScaleType)
6981  enum SelectablePart { spNone = 0
6982  ,spAxis = 0x001
6983  ,spTickLabels = 0x002
6984  ,spAxisLabel = 0x004
6985  };
6986  Q_ENUMS(SelectablePart)
6987  Q_FLAGS(SelectableParts)
6988  Q_DECLARE_FLAGS(SelectableParts, SelectablePart)
6989 
6990  enum LabelMode { lmUpright
6991  ,lmRotated
6992  };
6993  Q_ENUMS(LabelMode)
6994 
6995  explicit QCPPolarAxisRadial(QCPPolarAxisAngular *parent);
6996  virtual ~QCPPolarAxisRadial();
6997 
6998  // getters:
6999  bool rangeDrag() const { return mRangeDrag; }
7000  bool rangeZoom() const { return mRangeZoom; }
7001  double rangeZoomFactor() const { return mRangeZoomFactor; }
7002 
7003  QCPPolarAxisAngular *angularAxis() const { return mAngularAxis; }
7004  ScaleType scaleType() const { return mScaleType; }
7005  const QCPRange range() const { return mRange; }
7006  bool rangeReversed() const { return mRangeReversed; }
7007  double angle() const { return mAngle; }
7008  AngleReference angleReference() const { return mAngleReference; }
7009  QSharedPointer<QCPAxisTicker> ticker() const { return mTicker; }
7010  bool ticks() const { return mTicks; }
7011  bool tickLabels() const { return mTickLabels; }
7012  int tickLabelPadding() const { return mLabelPainter.padding(); }
7013  QFont tickLabelFont() const { return mTickLabelFont; }
7014  QColor tickLabelColor() const { return mTickLabelColor; }
7015  double tickLabelRotation() const { return mLabelPainter.rotation(); }
7016  LabelMode tickLabelMode() const;
7017  QString numberFormat() const;
7018  int numberPrecision() const { return mNumberPrecision; }
7019  QVector<double> tickVector() const { return mTickVector; }
7020  QVector<double> subTickVector() const { return mSubTickVector; }
7021  QVector<QString> tickVectorLabels() const { return mTickVectorLabels; }
7022  int tickLengthIn() const;
7023  int tickLengthOut() const;
7024  bool subTicks() const { return mSubTicks; }
7025  int subTickLengthIn() const;
7026  int subTickLengthOut() const;
7027  QPen basePen() const { return mBasePen; }
7028  QPen tickPen() const { return mTickPen; }
7029  QPen subTickPen() const { return mSubTickPen; }
7030  QFont labelFont() const { return mLabelFont; }
7031  QColor labelColor() const { return mLabelColor; }
7032  QString label() const { return mLabel; }
7033  int labelPadding() const;
7034  SelectableParts selectedParts() const { return mSelectedParts; }
7035  SelectableParts selectableParts() const { return mSelectableParts; }
7036  QFont selectedTickLabelFont() const { return mSelectedTickLabelFont; }
7037  QFont selectedLabelFont() const { return mSelectedLabelFont; }
7038  QColor selectedTickLabelColor() const { return mSelectedTickLabelColor; }
7039  QColor selectedLabelColor() const { return mSelectedLabelColor; }
7040  QPen selectedBasePen() const { return mSelectedBasePen; }
7041  QPen selectedTickPen() const { return mSelectedTickPen; }
7042  QPen selectedSubTickPen() const { return mSelectedSubTickPen; }
7043 
7044  // setters:
7045  void setRangeDrag(bool enabled);
7046  void setRangeZoom(bool enabled);
7047  void setRangeZoomFactor(double factor);
7048 
7049  Q_SLOT void setScaleType(QCPPolarAxisRadial::ScaleType type);
7050  Q_SLOT void setRange(const QCPRange &range);
7051  void setRange(double lower, double upper);
7052  void setRange(double position, double size, Qt::AlignmentFlag alignment);
7053  void setRangeLower(double lower);
7054  void setRangeUpper(double upper);
7055  void setRangeReversed(bool reversed);
7056  void setAngle(double degrees);
7057  void setAngleReference(AngleReference reference);
7058  void setTicker(QSharedPointer<QCPAxisTicker> ticker);
7059  void setTicks(bool show);
7060  void setTickLabels(bool show);
7061  void setTickLabelPadding(int padding);
7062  void setTickLabelFont(const QFont &font);
7063  void setTickLabelColor(const QColor &color);
7064  void setTickLabelRotation(double degrees);
7065  void setTickLabelMode(LabelMode mode);
7066  void setNumberFormat(const QString &formatCode);
7067  void setNumberPrecision(int precision);
7068  void setTickLength(int inside, int outside=0);
7069  void setTickLengthIn(int inside);
7070  void setTickLengthOut(int outside);
7071  void setSubTicks(bool show);
7072  void setSubTickLength(int inside, int outside=0);
7073  void setSubTickLengthIn(int inside);
7074  void setSubTickLengthOut(int outside);
7075  void setBasePen(const QPen &pen);
7076  void setTickPen(const QPen &pen);
7077  void setSubTickPen(const QPen &pen);
7078  void setLabelFont(const QFont &font);
7079  void setLabelColor(const QColor &color);
7080  void setLabel(const QString &str);
7081  void setLabelPadding(int padding);
7082  void setSelectedTickLabelFont(const QFont &font);
7083  void setSelectedLabelFont(const QFont &font);
7084  void setSelectedTickLabelColor(const QColor &color);
7085  void setSelectedLabelColor(const QColor &color);
7086  void setSelectedBasePen(const QPen &pen);
7087  void setSelectedTickPen(const QPen &pen);
7088  void setSelectedSubTickPen(const QPen &pen);
7089  Q_SLOT void setSelectableParts(const QCPPolarAxisRadial::SelectableParts &selectableParts);
7090  Q_SLOT void setSelectedParts(const QCPPolarAxisRadial::SelectableParts &selectedParts);
7091 
7092  // reimplemented virtual methods:
7093  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const Q_DECL_OVERRIDE;
7094 
7095  // non-property methods:
7096  void moveRange(double diff);
7097  void scaleRange(double factor);
7098  void scaleRange(double factor, double center);
7099  void rescale(bool onlyVisiblePlottables=false);
7100  void pixelToCoord(QPointF pixelPos, double &angleCoord, double &radiusCoord) const;
7101  QPointF coordToPixel(double angleCoord, double radiusCoord) const;
7102  double coordToRadius(double coord) const;
7103  double radiusToCoord(double radius) const;
7104  SelectablePart getPartAt(const QPointF &pos) const;
7105 
7106 signals:
7107  void rangeChanged(const QCPRange &newRange);
7108  void rangeChanged(const QCPRange &newRange, const QCPRange &oldRange);
7109  void scaleTypeChanged(QCPPolarAxisRadial::ScaleType scaleType);
7110  void selectionChanged(const QCPPolarAxisRadial::SelectableParts &parts);
7111  void selectableChanged(const QCPPolarAxisRadial::SelectableParts &parts);
7112 
7113 protected:
7114  // property members:
7115  bool mRangeDrag;
7116  bool mRangeZoom;
7117  double mRangeZoomFactor;
7118 
7119  // axis base:
7120  QCPPolarAxisAngular *mAngularAxis;
7121  double mAngle;
7122  AngleReference mAngleReference;
7123  SelectableParts mSelectableParts, mSelectedParts;
7124  QPen mBasePen, mSelectedBasePen;
7125  // axis label:
7126  int mLabelPadding;
7127  QString mLabel;
7128  QFont mLabelFont, mSelectedLabelFont;
7129  QColor mLabelColor, mSelectedLabelColor;
7130  // tick labels:
7131  //int mTickLabelPadding; in label painter
7132  bool mTickLabels;
7133  //double mTickLabelRotation; in label painter
7134  QFont mTickLabelFont, mSelectedTickLabelFont;
7135  QColor mTickLabelColor, mSelectedTickLabelColor;
7136  int mNumberPrecision;
7137  QLatin1Char mNumberFormatChar;
7138  bool mNumberBeautifulPowers;
7139  bool mNumberMultiplyCross;
7140  // ticks and subticks:
7141  bool mTicks;
7142  bool mSubTicks;
7143  int mTickLengthIn, mTickLengthOut, mSubTickLengthIn, mSubTickLengthOut;
7144  QPen mTickPen, mSelectedTickPen;
7145  QPen mSubTickPen, mSelectedSubTickPen;
7146  // scale and range:
7147  QCPRange mRange;
7148  bool mRangeReversed;
7149  ScaleType mScaleType;
7150 
7151  // non-property members:
7152  QPointF mCenter;
7153  double mRadius;
7154  QSharedPointer<QCPAxisTicker> mTicker;
7155  QVector<double> mTickVector;
7156  QVector<QString> mTickVectorLabels;
7157  QVector<double> mSubTickVector;
7158  bool mDragging;
7159  QCPRange mDragStartRange;
7160  QCP::AntialiasedElements mAADragBackup, mNotAADragBackup;
7161  QCPLabelPainterPrivate mLabelPainter;
7162 
7163  // reimplemented virtual methods:
7164  virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const Q_DECL_OVERRIDE;
7165  virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
7166  virtual QCP::Interaction selectionCategory() const Q_DECL_OVERRIDE;
7167  // events:
7168  virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) Q_DECL_OVERRIDE;
7169  virtual void deselectEvent(bool *selectionStateChanged) Q_DECL_OVERRIDE;
7170  // mouse events:
7171  virtual void mousePressEvent(QMouseEvent *event, const QVariant &details) Q_DECL_OVERRIDE;
7172  virtual void mouseMoveEvent(QMouseEvent *event, const QPointF &startPos) Q_DECL_OVERRIDE;
7173  virtual void mouseReleaseEvent(QMouseEvent *event, const QPointF &startPos) Q_DECL_OVERRIDE;
7174  virtual void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE;
7175 
7176  // non-virtual methods:
7177  void updateGeometry(const QPointF &center, double radius);
7178  void setupTickVectors();
7179  QPen getBasePen() const;
7180  QPen getTickPen() const;
7181  QPen getSubTickPen() const;
7182  QFont getTickLabelFont() const;
7183  QFont getLabelFont() const;
7184  QColor getTickLabelColor() const;
7185  QColor getLabelColor() const;
7186 
7187 private:
7188  Q_DISABLE_COPY(QCPPolarAxisRadial)
7189 
7190  friend class QCustomPlot;
7191  friend class QCPPolarAxisAngular;
7192 };
7193 Q_DECLARE_OPERATORS_FOR_FLAGS(QCPPolarAxisRadial::SelectableParts)
7194 Q_DECLARE_METATYPE(QCPPolarAxisRadial::AngleReference)
7195 Q_DECLARE_METATYPE(QCPPolarAxisRadial::ScaleType)
7196 Q_DECLARE_METATYPE(QCPPolarAxisRadial::SelectablePart)
7197 
7198 
7199 
7200 /* end of 'src/polar/radialaxis.h' */
7201 
7202 
7203 /* including file 'src/polar/layoutelement-angularaxis.h' */
7204 /* modified 2021-03-29T02:30:44, size 13461 */
7205 
7206 class QCP_LIB_DECL QCPPolarAxisAngular : public QCPLayoutElement
7207 {
7208  Q_OBJECT
7210 
7212 public:
7217  enum SelectablePart { spNone = 0
7218  ,spAxis = 0x001
7219  ,spTickLabels = 0x002
7220  ,spAxisLabel = 0x004
7221  };
7222  Q_ENUMS(SelectablePart)
7223  Q_FLAGS(SelectableParts)
7224  Q_DECLARE_FLAGS(SelectableParts, SelectablePart)
7225 
7226 
7229  enum LabelMode { lmUpright
7230  ,lmRotated
7231  };
7232  Q_ENUMS(LabelMode)
7233 
7234  explicit QCPPolarAxisAngular(QCustomPlot *parentPlot);
7235  virtual ~QCPPolarAxisAngular();
7236 
7237  // getters:
7238  QPixmap background() const { return mBackgroundPixmap; }
7239  QBrush backgroundBrush() const { return mBackgroundBrush; }
7240  bool backgroundScaled() const { return mBackgroundScaled; }
7241  Qt::AspectRatioMode backgroundScaledMode() const { return mBackgroundScaledMode; }
7242  bool rangeDrag() const { return mRangeDrag; }
7243  bool rangeZoom() const { return mRangeZoom; }
7244  double rangeZoomFactor() const { return mRangeZoomFactor; }
7245 
7246  const QCPRange range() const { return mRange; }
7247  bool rangeReversed() const { return mRangeReversed; }
7248  double angle() const { return mAngle; }
7249  QSharedPointer<QCPAxisTicker> ticker() const { return mTicker; }
7250  bool ticks() const { return mTicks; }
7251  bool tickLabels() const { return mTickLabels; }
7252  int tickLabelPadding() const { return mLabelPainter.padding(); }
7253  QFont tickLabelFont() const { return mTickLabelFont; }
7254  QColor tickLabelColor() const { return mTickLabelColor; }
7255  double tickLabelRotation() const { return mLabelPainter.rotation(); }
7256  LabelMode tickLabelMode() const;
7257  QString numberFormat() const;
7258  int numberPrecision() const { return mNumberPrecision; }
7259  QVector<double> tickVector() const { return mTickVector; }
7260  QVector<QString> tickVectorLabels() const { return mTickVectorLabels; }
7261  int tickLengthIn() const { return mTickLengthIn; }
7262  int tickLengthOut() const { return mTickLengthOut; }
7263  bool subTicks() const { return mSubTicks; }
7264  int subTickLengthIn() const { return mSubTickLengthIn; }
7265  int subTickLengthOut() const { return mSubTickLengthOut; }
7266  QPen basePen() const { return mBasePen; }
7267  QPen tickPen() const { return mTickPen; }
7268  QPen subTickPen() const { return mSubTickPen; }
7269  QFont labelFont() const { return mLabelFont; }
7270  QColor labelColor() const { return mLabelColor; }
7271  QString label() const { return mLabel; }
7272  int labelPadding() const { return mLabelPadding; }
7273  SelectableParts selectedParts() const { return mSelectedParts; }
7274  SelectableParts selectableParts() const { return mSelectableParts; }
7275  QFont selectedTickLabelFont() const { return mSelectedTickLabelFont; }
7276  QFont selectedLabelFont() const { return mSelectedLabelFont; }
7277  QColor selectedTickLabelColor() const { return mSelectedTickLabelColor; }
7278  QColor selectedLabelColor() const { return mSelectedLabelColor; }
7279  QPen selectedBasePen() const { return mSelectedBasePen; }
7280  QPen selectedTickPen() const { return mSelectedTickPen; }
7281  QPen selectedSubTickPen() const { return mSelectedSubTickPen; }
7282  QCPPolarGrid *grid() const { return mGrid; }
7283 
7284  // setters:
7285  void setBackground(const QPixmap &pm);
7286  void setBackground(const QPixmap &pm, bool scaled, Qt::AspectRatioMode mode=Qt::KeepAspectRatioByExpanding);
7287  void setBackground(const QBrush &brush);
7288  void setBackgroundScaled(bool scaled);
7289  void setBackgroundScaledMode(Qt::AspectRatioMode mode);
7290  void setRangeDrag(bool enabled);
7291  void setRangeZoom(bool enabled);
7292  void setRangeZoomFactor(double factor);
7293 
7294  Q_SLOT void setRange(const QCPRange &range);
7295  void setRange(double lower, double upper);
7296  void setRange(double position, double size, Qt::AlignmentFlag alignment);
7297  void setRangeLower(double lower);
7298  void setRangeUpper(double upper);
7299  void setRangeReversed(bool reversed);
7300  void setAngle(double degrees);
7301  void setTicker(QSharedPointer<QCPAxisTicker> ticker);
7302  void setTicks(bool show);
7303  void setTickLabels(bool show);
7304  void setTickLabelPadding(int padding);
7305  void setTickLabelFont(const QFont &font);
7306  void setTickLabelColor(const QColor &color);
7307  void setTickLabelRotation(double degrees);
7308  void setTickLabelMode(LabelMode mode);
7309  void setNumberFormat(const QString &formatCode);
7310  void setNumberPrecision(int precision);
7311  void setTickLength(int inside, int outside=0);
7312  void setTickLengthIn(int inside);
7313  void setTickLengthOut(int outside);
7314  void setSubTicks(bool show);
7315  void setSubTickLength(int inside, int outside=0);
7316  void setSubTickLengthIn(int inside);
7317  void setSubTickLengthOut(int outside);
7318  void setBasePen(const QPen &pen);
7319  void setTickPen(const QPen &pen);
7320  void setSubTickPen(const QPen &pen);
7321  void setLabelFont(const QFont &font);
7322  void setLabelColor(const QColor &color);
7323  void setLabel(const QString &str);
7324  void setLabelPadding(int padding);
7325  void setLabelPosition(Qt::AlignmentFlag position);
7326  void setSelectedTickLabelFont(const QFont &font);
7327  void setSelectedLabelFont(const QFont &font);
7328  void setSelectedTickLabelColor(const QColor &color);
7329  void setSelectedLabelColor(const QColor &color);
7330  void setSelectedBasePen(const QPen &pen);
7331  void setSelectedTickPen(const QPen &pen);
7332  void setSelectedSubTickPen(const QPen &pen);
7333  Q_SLOT void setSelectableParts(const QCPPolarAxisAngular::SelectableParts &selectableParts);
7334  Q_SLOT void setSelectedParts(const QCPPolarAxisAngular::SelectableParts &selectedParts);
7335 
7336  // reimplemented virtual methods:
7337  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const Q_DECL_OVERRIDE;
7338  virtual void update(UpdatePhase phase) Q_DECL_OVERRIDE;
7339  virtual QList<QCPLayoutElement*> elements(bool recursive) const Q_DECL_OVERRIDE;
7340 
7341  // non-property methods:
7342  bool removeGraph(QCPPolarGraph *graph);
7343  int radialAxisCount() const;
7344  QCPPolarAxisRadial *radialAxis(int index=0) const;
7345  QList<QCPPolarAxisRadial*> radialAxes() const;
7346  QCPPolarAxisRadial *addRadialAxis(QCPPolarAxisRadial *axis=0);
7347  bool removeRadialAxis(QCPPolarAxisRadial *axis);
7348  QCPLayoutInset *insetLayout() const { return mInsetLayout; }
7349  QRegion exactClipRegion() const;
7350 
7351  void moveRange(double diff);
7352  void scaleRange(double factor);
7353  void scaleRange(double factor, double center);
7354  void rescale(bool onlyVisiblePlottables=false);
7355  double coordToAngleRad(double coord) const { return mAngleRad+(coord-mRange.lower)/mRange.size()*(mRangeReversed ? -2.0*M_PI : 2.0*M_PI); } // mention in doc that return doesn't wrap
7356  double angleRadToCoord(double angleRad) const { return mRange.lower+(angleRad-mAngleRad)/(mRangeReversed ? -2.0*M_PI : 2.0*M_PI)*mRange.size(); }
7357  void pixelToCoord(QPointF pixelPos, double &angleCoord, double &radiusCoord) const;
7358  QPointF coordToPixel(double angleCoord, double radiusCoord) const;
7359  SelectablePart getPartAt(const QPointF &pos) const;
7360 
7361  // read-only interface imitating a QRect:
7362  int left() const { return mRect.left(); }
7363  int right() const { return mRect.right(); }
7364  int top() const { return mRect.top(); }
7365  int bottom() const { return mRect.bottom(); }
7366  int width() const { return mRect.width(); }
7367  int height() const { return mRect.height(); }
7368  QSize size() const { return mRect.size(); }
7369  QPoint topLeft() const { return mRect.topLeft(); }
7370  QPoint topRight() const { return mRect.topRight(); }
7371  QPoint bottomLeft() const { return mRect.bottomLeft(); }
7372  QPoint bottomRight() const { return mRect.bottomRight(); }
7373  QPointF center() const { return mCenter; }
7374  double radius() const { return mRadius; }
7375 
7376 signals:
7377  void rangeChanged(const QCPRange &newRange);
7378  void rangeChanged(const QCPRange &newRange, const QCPRange &oldRange);
7379  void selectionChanged(const QCPPolarAxisAngular::SelectableParts &parts);
7380  void selectableChanged(const QCPPolarAxisAngular::SelectableParts &parts);
7381 
7382 protected:
7383  // property members:
7384  QBrush mBackgroundBrush;
7385  QPixmap mBackgroundPixmap;
7386  QPixmap mScaledBackgroundPixmap;
7387  bool mBackgroundScaled;
7388  Qt::AspectRatioMode mBackgroundScaledMode;
7389  QCPLayoutInset *mInsetLayout;
7390  bool mRangeDrag;
7391  bool mRangeZoom;
7392  double mRangeZoomFactor;
7393 
7394  // axis base:
7395  double mAngle, mAngleRad;
7396  SelectableParts mSelectableParts, mSelectedParts;
7397  QPen mBasePen, mSelectedBasePen;
7398  // axis label:
7399  int mLabelPadding;
7400  QString mLabel;
7401  QFont mLabelFont, mSelectedLabelFont;
7402  QColor mLabelColor, mSelectedLabelColor;
7403  // tick labels:
7404  //int mTickLabelPadding; in label painter
7405  bool mTickLabels;
7406  //double mTickLabelRotation; in label painter
7407  QFont mTickLabelFont, mSelectedTickLabelFont;
7408  QColor mTickLabelColor, mSelectedTickLabelColor;
7409  int mNumberPrecision;
7410  QLatin1Char mNumberFormatChar;
7411  bool mNumberBeautifulPowers;
7412  bool mNumberMultiplyCross;
7413  // ticks and subticks:
7414  bool mTicks;
7415  bool mSubTicks;
7416  int mTickLengthIn, mTickLengthOut, mSubTickLengthIn, mSubTickLengthOut;
7417  QPen mTickPen, mSelectedTickPen;
7418  QPen mSubTickPen, mSelectedSubTickPen;
7419  // scale and range:
7420  QCPRange mRange;
7421  bool mRangeReversed;
7422 
7423  // non-property members:
7424  QPointF mCenter;
7425  double mRadius;
7426  QList<QCPPolarAxisRadial*> mRadialAxes;
7427  QCPPolarGrid *mGrid;
7428  QList<QCPPolarGraph*> mGraphs;
7429  QSharedPointer<QCPAxisTicker> mTicker;
7430  QVector<double> mTickVector;
7431  QVector<QString> mTickVectorLabels;
7432  QVector<QPointF> mTickVectorCosSin;
7433  QVector<double> mSubTickVector;
7434  QVector<QPointF> mSubTickVectorCosSin;
7435  bool mDragging;
7436  QCPRange mDragAngularStart;
7437  QList<QCPRange> mDragRadialStart;
7438  QCP::AntialiasedElements mAADragBackup, mNotAADragBackup;
7439  QCPLabelPainterPrivate mLabelPainter;
7440 
7441  // reimplemented virtual methods:
7442  virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const Q_DECL_OVERRIDE;
7443  virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
7444  virtual QCP::Interaction selectionCategory() const Q_DECL_OVERRIDE;
7445  // events:
7446  virtual void mousePressEvent(QMouseEvent *event, const QVariant &details) Q_DECL_OVERRIDE;
7447  virtual void mouseMoveEvent(QMouseEvent *event, const QPointF &startPos) Q_DECL_OVERRIDE;
7448  virtual void mouseReleaseEvent(QMouseEvent *event, const QPointF &startPos) Q_DECL_OVERRIDE;
7449  virtual void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE;
7450 
7451  // non-virtual methods:
7452  bool registerPolarGraph(QCPPolarGraph *graph);
7453  void drawBackground(QCPPainter *painter, const QPointF &center, double radius);
7454  void setupTickVectors();
7455  QPen getBasePen() const;
7456  QPen getTickPen() const;
7457  QPen getSubTickPen() const;
7458  QFont getTickLabelFont() const;
7459  QFont getLabelFont() const;
7460  QColor getTickLabelColor() const;
7461  QColor getLabelColor() const;
7462 
7463 private:
7464  Q_DISABLE_COPY(QCPPolarAxisAngular)
7465 
7466  friend class QCustomPlot;
7467  friend class QCPPolarGrid;
7468  friend class QCPPolarGraph;
7469 };
7470 Q_DECLARE_OPERATORS_FOR_FLAGS(QCPPolarAxisAngular::SelectableParts)
7471 Q_DECLARE_METATYPE(QCPPolarAxisAngular::SelectablePart)
7472 
7473 /* end of 'src/polar/layoutelement-angularaxis.h' */
7474 
7475 
7476 /* including file 'src/polar/polargrid.h' */
7477 /* modified 2021-03-29T02:30:44, size 4506 */
7478 
7479 class QCP_LIB_DECL QCPPolarGrid :public QCPLayerable
7480 {
7481  Q_OBJECT
7483 
7485 public:
7489  enum GridType { gtAngular = 0x01
7490  ,gtRadial = 0x02
7491  ,gtAll = 0xFF
7492  ,gtNone = 0x00
7493  };
7494  Q_ENUMS(GridType)
7495  Q_FLAGS(GridTypes)
7496  Q_DECLARE_FLAGS(GridTypes, GridType)
7497 
7498  explicit QCPPolarGrid(QCPPolarAxisAngular *parentAxis);
7499 
7500  // getters:
7501  QCPPolarAxisRadial *radialAxis() const { return mRadialAxis.data(); }
7502  GridTypes type() const { return mType; }
7503  GridTypes subGridType() const { return mSubGridType; }
7504  bool antialiasedSubGrid() const { return mAntialiasedSubGrid; }
7505  bool antialiasedZeroLine() const { return mAntialiasedZeroLine; }
7506  QPen angularPen() const { return mAngularPen; }
7507  QPen angularSubGridPen() const { return mAngularSubGridPen; }
7508  QPen radialPen() const { return mRadialPen; }
7509  QPen radialSubGridPen() const { return mRadialSubGridPen; }
7510  QPen radialZeroLinePen() const { return mRadialZeroLinePen; }
7511 
7512  // setters:
7513  void setRadialAxis(QCPPolarAxisRadial *axis);
7514  void setType(GridTypes type);
7515  void setSubGridType(GridTypes type);
7516  void setAntialiasedSubGrid(bool enabled);
7517  void setAntialiasedZeroLine(bool enabled);
7518  void setAngularPen(const QPen &pen);
7519  void setAngularSubGridPen(const QPen &pen);
7520  void setRadialPen(const QPen &pen);
7521  void setRadialSubGridPen(const QPen &pen);
7522  void setRadialZeroLinePen(const QPen &pen);
7523 
7524 protected:
7525  // property members:
7526  GridTypes mType;
7527  GridTypes mSubGridType;
7528  bool mAntialiasedSubGrid, mAntialiasedZeroLine;
7529  QPen mAngularPen, mAngularSubGridPen;
7530  QPen mRadialPen, mRadialSubGridPen, mRadialZeroLinePen;
7531 
7532  // non-property members:
7533  QCPPolarAxisAngular *mParentAxis;
7534  QPointer<QCPPolarAxisRadial> mRadialAxis;
7535 
7536  // reimplemented virtual methods:
7537  virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const Q_DECL_OVERRIDE;
7538  virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
7539 
7540  // non-virtual methods:
7541  void drawRadialGrid(QCPPainter *painter, const QPointF &center, const QVector<double> &coords, const QPen &pen, const QPen &zeroPen=Qt::NoPen);
7542  void drawAngularGrid(QCPPainter *painter, const QPointF &center, double radius, const QVector<QPointF> &ticksCosSin, const QPen &pen);
7543 
7544 private:
7545  Q_DISABLE_COPY(QCPPolarGrid)
7546 
7547 };
7548 
7549 Q_DECLARE_OPERATORS_FOR_FLAGS(QCPPolarGrid::GridTypes)
7550 Q_DECLARE_METATYPE(QCPPolarGrid::GridType)
7551 
7552 
7553 /* end of 'src/polar/polargrid.h' */
7554 
7555 
7556 /* including file 'src/polar/polargraph.h' */
7557 /* modified 2021-03-29T02:30:44, size 9606 */
7558 
7559 
7560 class QCP_LIB_DECL QCPPolarLegendItem : public QCPAbstractLegendItem
7561 {
7562  Q_OBJECT
7563 public:
7564  QCPPolarLegendItem(QCPLegend *parent, QCPPolarGraph *graph);
7565 
7566  // getters:
7567  QCPPolarGraph *polarGraph() { return mPolarGraph; }
7568 
7569 protected:
7570  // property members:
7571  QCPPolarGraph *mPolarGraph;
7572 
7573  // reimplemented virtual methods:
7574  virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
7575  virtual QSize minimumOuterSizeHint() const Q_DECL_OVERRIDE;
7576 
7577  // non-virtual methods:
7578  QPen getIconBorderPen() const;
7579  QColor getTextColor() const;
7580  QFont getFont() const;
7581 };
7582 
7583 
7584 class QCP_LIB_DECL QCPPolarGraph : public QCPLayerable
7585 {
7586  Q_OBJECT
7588 
7590 public:
7596  enum LineStyle { lsNone
7597  ,lsLine
7599  };
7600  Q_ENUMS(LineStyle)
7601 
7603  virtual ~QCPPolarGraph();
7604 
7605  // getters:
7606  QString name() const { return mName; }
7607  bool antialiasedFill() const { return mAntialiasedFill; }
7608  bool antialiasedScatters() const { return mAntialiasedScatters; }
7609  QPen pen() const { return mPen; }
7610  QBrush brush() const { return mBrush; }
7611  bool periodic() const { return mPeriodic; }
7612  QCPPolarAxisAngular *keyAxis() const { return mKeyAxis.data(); }
7613  QCPPolarAxisRadial *valueAxis() const { return mValueAxis.data(); }
7614  QCP::SelectionType selectable() const { return mSelectable; }
7615  bool selected() const { return !mSelection.isEmpty(); }
7616  QCPDataSelection selection() const { return mSelection; }
7617  //QCPSelectionDecorator *selectionDecorator() const { return mSelectionDecorator; }
7618  QSharedPointer<QCPGraphDataContainer> data() const { return mDataContainer; }
7619  LineStyle lineStyle() const { return mLineStyle; }
7620  QCPScatterStyle scatterStyle() const { return mScatterStyle; }
7621 
7622  // setters:
7623  void setName(const QString &name);
7624  void setAntialiasedFill(bool enabled);
7625  void setAntialiasedScatters(bool enabled);
7626  void setPen(const QPen &pen);
7627  void setBrush(const QBrush &brush);
7628  void setPeriodic(bool enabled);
7629  void setKeyAxis(QCPPolarAxisAngular *axis);
7630  void setValueAxis(QCPPolarAxisRadial *axis);
7631  Q_SLOT void setSelectable(QCP::SelectionType selectable);
7632  Q_SLOT void setSelection(QCPDataSelection selection);
7633  //void setSelectionDecorator(QCPSelectionDecorator *decorator);
7634  void setData(QSharedPointer<QCPGraphDataContainer> data);
7635  void setData(const QVector<double> &keys, const QVector<double> &values, bool alreadySorted=false);
7636  void setLineStyle(LineStyle ls);
7637  void setScatterStyle(const QCPScatterStyle &style);
7638 
7639  // non-property methods:
7640  void addData(const QVector<double> &keys, const QVector<double> &values, bool alreadySorted=false);
7641  void addData(double key, double value);
7642  void coordsToPixels(double key, double value, double &x, double &y) const;
7643  const QPointF coordsToPixels(double key, double value) const;
7644  void pixelsToCoords(double x, double y, double &key, double &value) const;
7645  void pixelsToCoords(const QPointF &pixelPos, double &key, double &value) const;
7646  void rescaleAxes(bool onlyEnlarge=false) const;
7647  void rescaleKeyAxis(bool onlyEnlarge=false) const;
7648  void rescaleValueAxis(bool onlyEnlarge=false, bool inKeyRange=false) const;
7649  bool addToLegend(QCPLegend *legend);
7650  bool addToLegend();
7651  bool removeFromLegend(QCPLegend *legend) const;
7652  bool removeFromLegend() const;
7653 
7654  // introduced virtual methods:
7655  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
7656  virtual QCPPlottableInterface1D *interface1D() { return 0; } // TODO: return this later, when QCPAbstractPolarPlottable is created
7657  virtual QCPRange getKeyRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth) const;
7658  virtual QCPRange getValueRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth, const QCPRange &inKeyRange=QCPRange()) const;
7659 
7660 signals:
7661  void selectionChanged(bool selected);
7662  void selectionChanged(const QCPDataSelection &selection);
7663  void selectableChanged(QCP::SelectionType selectable);
7664 
7665 protected:
7666  // property members:
7667  QSharedPointer<QCPGraphDataContainer> mDataContainer;
7668  LineStyle mLineStyle;
7669  QCPScatterStyle mScatterStyle;
7670  QString mName;
7671  bool mAntialiasedFill, mAntialiasedScatters;
7672  QPen mPen;
7673  QBrush mBrush;
7674  bool mPeriodic;
7675  QPointer<QCPPolarAxisAngular> mKeyAxis;
7676  QPointer<QCPPolarAxisRadial> mValueAxis;
7677  QCP::SelectionType mSelectable;
7678  QCPDataSelection mSelection;
7679  //QCPSelectionDecorator *mSelectionDecorator;
7680 
7681  // introduced virtual methods (later reimplemented TODO from QCPAbstractPolarPlottable):
7682  virtual QRect clipRect() const;
7683  virtual void draw(QCPPainter *painter);
7684  virtual QCP::Interaction selectionCategory() const;
7685  void applyDefaultAntialiasingHint(QCPPainter *painter) const;
7686  // events:
7687  virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged);
7688  virtual void deselectEvent(bool *selectionStateChanged);
7689  // virtual drawing helpers:
7690  virtual void drawLinePlot(QCPPainter *painter, const QVector<QPointF> &lines) const;
7691  virtual void drawFill(QCPPainter *painter, QVector<QPointF> *lines) const;
7692  virtual void drawScatterPlot(QCPPainter *painter, const QVector<QPointF> &scatters, const QCPScatterStyle &style) const;
7693 
7694  // introduced virtual methods:
7695  virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const;
7696 
7697  // non-virtual methods:
7698  void applyFillAntialiasingHint(QCPPainter *painter) const;
7699  void applyScattersAntialiasingHint(QCPPainter *painter) const;
7700  double pointDistance(const QPointF &pixelPoint, QCPGraphDataContainer::const_iterator &closestData) const;
7701  // drawing helpers:
7702  virtual int dataCount() const;
7703  void getDataSegments(QList<QCPDataRange> &selectedSegments, QList<QCPDataRange> &unselectedSegments) const;
7704  void drawPolyline(QCPPainter *painter, const QVector<QPointF> &lineData) const;
7705  void getVisibleDataBounds(QCPGraphDataContainer::const_iterator &begin, QCPGraphDataContainer::const_iterator &end, const QCPDataRange &rangeRestriction) const;
7706  void getLines(QVector<QPointF> *lines, const QCPDataRange &dataRange) const;
7707  void getScatters(QVector<QPointF> *scatters, const QCPDataRange &dataRange) const;
7708  void getOptimizedLineData(QVector<QCPGraphData> *lineData, const QCPGraphDataContainer::const_iterator &begin, const QCPGraphDataContainer::const_iterator &end) const;
7709  void getOptimizedScatterData(QVector<QCPGraphData> *scatterData, QCPGraphDataContainer::const_iterator begin, QCPGraphDataContainer::const_iterator end) const;
7710  QVector<QPointF> dataToLines(const QVector<QCPGraphData> &data) const;
7711 
7712 private:
7713  Q_DISABLE_COPY(QCPPolarGraph)
7714 
7715  friend class QCPPolarLegendItem;
7716 };
7717 
7718 /* end of 'src/polar/polargraph.h' */
7719 
7720 
7721 #endif // QCUSTOMPLOT_H
7722 
0x02 right margin
Definition: qcustomplot.h:200
LineStyle
Definition: qcustomplot.h:7596
ColorInterpolation
Definition: qcustomplot.h:4709
virtual QSize minimumOuterSizeHint() const
Definition: qcustomplot.cpp:3477
QPointF center() const
Definition: qcustomplot.h:7373
void setBrush(const QBrush &brush)
Definition: qcustomplot.cpp:11497
bool isEmpty() const
Definition: qcustomplot.h:6005
BracketStyle
Definition: qcustomplot.h:6903
const_iterator constBegin() const
Definition: qcustomplot.h:2593
bool addToLegend()
Definition: qcustomplot.cpp:11833
The base class tick generator used by QCPAxis to create tick positions and tick labels.
Definition: qcustomplot.h:1682
0x001 Axis ranges are draggable (see QCPAxisRect::setRangeDrag, QCPAxisRect::setRangeDragAxes) ...
Definition: qcustomplot.h:255
int right() const
Definition: qcustomplot.h:7363
double mainValue() const
Definition: qcustomplot.h:5561
QCPRange valueRange() const
Definition: qcustomplot.h:5424
Manages the position of an item.
Definition: qcustomplot.h:3591
EndingStyle
Definition: qcustomplot.h:1493
QCPRange & operator/=(const double &value)
Definition: qcustomplot.h:795
virtual int findBegin(double sortKey, bool expandedRange=true) const Q_DECL_OVERRIDE
Definition: qcustomplot.h:4519
A text label.
Definition: qcustomplot.h:6573
int size() const
Definition: qcustomplot.h:2572
Definition: qcustomplot.h:2421
QCPDataRange dataRange() const
Definition: qcustomplot.h:2602
double mainValue() const
Definition: qcustomplot.h:5422
0x0200 Zero-lines, see QCPGrid::setZeroLinePen
Definition: qcustomplot.h:226
SelectablePart
Definition: qcustomplot.h:6981
int top() const
Definition: qcustomplot.h:4936
void setName(const QString &name)
Definition: qcustomplot.cpp:11448
void setX(double x)
Definition: qcustomplot.h:405
int dataRangeCount() const
Definition: qcustomplot.h:958
bool isEmpty() const
Definition: qcustomplot.h:967
Any combination of data points/ranges can be selected.
Definition: qcustomplot.h:300
The abstract base class for layouts.
Definition: qcustomplot.h:1291
Resolution is given in dots per inch (DPI/PPI)
Definition: qcustomplot.h:170
bool realVisibility() const
Definition: qcustomplot.cpp:1459
void selectionChanged(bool selected)
int height() const
Definition: qcustomplot.h:7367
Specialized axis ticker to display ticks in units of an arbitrary constant, for example pi...
Definition: qcustomplot.h:1928
void setBegin(int begin)
Definition: qcustomplot.h:915
void setKeyAxis(QCPAxis *axis)
Definition: qcustomplot.cpp:11513
QPoint topRight() const
Definition: qcustomplot.h:7370
QCPLayerable * parentLayerable() const
Definition: qcustomplot.h:718
Cosmetic pens are converted to pens with pixel width 1 when exporting.
Definition: qcustomplot.h:178
A curved line from one point to another.
Definition: qcustomplot.h:6463
QList< QCPDataRange > dataRanges() const
Definition: qcustomplot.h:961
int length() const
Definition: qcustomplot.h:912
virtual double dataMainValue(int index) const =0
Controls how a plottable&#39;s data selection is drawn.
Definition: qcustomplot.h:3396
void remove(double sortKeyFrom, double sortKeyTo)
Definition: qcustomplot.h:2946
Represents the range an axis is encompassing.
Definition: qcustomplot.h:781
virtual QCPItemPosition * toQCPItemPosition()
Definition: qcustomplot.h:3575
QSize size() const
Definition: qcustomplot.h:7368
An arbitrary pixmap.
Definition: qcustomplot.h:6732
LineStyle
Definition: qcustomplot.h:5458
LayerMode
Definition: qcustomplot.h:652
void setPen(const QPen &pen)
Definition: qcustomplot.cpp:328
A straight line that spans infinitely in both directions.
Definition: qcustomplot.h:6370
virtual void mousePressEvent(QMouseEvent *event, const QVariant &details)
Definition: qcustomplot.cpp:1740
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE
Definition: qcustomplot.h:4544
const_iterator at(int index) const
Definition: qcustomplot.h:2599
static bool sortKeyIsMainKey()
Definition: qcustomplot.h:5738
bool isActive() const
Definition: qcustomplot.h:1115
Definition: qcustomplot.h:159
AngleReference
Definition: qcustomplot.h:6965
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE=0
Holds the data of one single data point for QCPCurve.
Definition: qcustomplot.h:5550
QCPLayerable(QCustomPlot *plot, QString targetLayer=QString(), QCPLayerable *parentLayerable=nullptr)
Definition: qcustomplot.cpp:1366
int index() const
Definition: qcustomplot.h:663
0x004 axis (tick) labels will be cached as pixmaps, increasing replot performance.
Definition: qcustomplot.h:243
GridType
Definition: qcustomplot.h:7489
bool contains(QCPBars *bars) const
Definition: qcustomplot.h:5702
QCPRange & operator+=(const double &value)
Definition: qcustomplot.h:792
Holds the data of one single data point (one bar) for QCPBars.
Definition: qcustomplot.h:5730
InsetPlacement
Definition: qcustomplot.h:1429
QCPRange valueRange(bool &foundRange, QCP::SignDomain signDomain=QCP::sdBoth, const QCPRange &inKeyRange=QCPRange())
Definition: qcustomplot.h:3232
Provides rect/rubber-band data selection and range zoom interaction.
Definition: qcustomplot.h:1103
0x0000 No elements
Definition: qcustomplot.h:229
ErrorType
Definition: qcustomplot.h:6292
int size() const
Definition: qcustomplot.h:911
Definition: qcustomplot.h:5304
Represents the visual appearance of scatter points.
Definition: qcustomplot.h:2447
static QCPStatisticalBoxData fromSortKey(double sortKey)
Definition: qcustomplot.h:5860
QSharedPointer< QCPAxisTicker > ticker() const
Definition: qcustomplot.h:2170
void removeBefore(double sortKey)
Definition: qcustomplot.h:2914
double sortKey() const
Definition: qcustomplot.h:5859
QRect outerRect() const
Definition: qcustomplot.h:1231
void set(const QCPDataContainer< DataType > &data)
Definition: qcustomplot.h:2789
Specialized axis ticker for calendar dates and times as axis ticks.
Definition: qcustomplot.h:1747
Defines an abstract interface for one-dimensional plottables.
Definition: qcustomplot.h:4108
ResolutionUnit
Definition: qcustomplot.h:168
virtual QSize maximumOuterSizeHint() const Q_DECL_OVERRIDE
Definition: qcustomplot.cpp:4765
0x000 None of the interactions are possible
Definition: qcustomplot.h:254
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE
Definition: qcustomplot.cpp:3525
Specialized axis ticker suited for logarithmic axes.
Definition: qcustomplot.h:1987
0x04 top margin
Definition: qcustomplot.h:201
A plottable representing a single statistical box in a plot.
Definition: qcustomplot.h:5892
SignDomain
Definition: qcustomplot.h:189
0x0020 Main lines of plottables
Definition: qcustomplot.h:222
virtual void update(UpdatePhase phase) Q_DECL_OVERRIDE
Definition: qcustomplot.cpp:17972
void simplify()
Definition: qcustomplot.cpp:2600
QCPLayoutInset * insetLayout() const
Definition: qcustomplot.h:4924
ScaleType
Definition: qcustomplot.h:6973
A rectangle.
Definition: qcustomplot.h:6514
int top() const
Definition: qcustomplot.h:7364
static bool sortKeyIsMainKey()
Definition: qcustomplot.h:5861
bool isEmpty() const
Definition: qcustomplot.h:920
QCPGrid * grid() const
Definition: qcustomplot.h:2207
QSharedPointer< QCPStatisticalBoxDataContainer > data() const
Definition: qcustomplot.h:5908
virtual QCPRange dataValueRange(int index) const Q_DECL_OVERRIDE
Definition: qcustomplot.h:4424
void drawPolyline(QCPPainter *painter, const QVector< QPointF > &lineData) const
Definition: qcustomplot.h:4636
When dragging the mouse, a selection rect becomes active. Upon releasing, the axes that are currently...
Definition: qcustomplot.h:273
RefreshPriority
Definition: qcustomplot.h:3769
QMap< double, QString > & ticks()
Definition: qcustomplot.h:1896
A layout element displaying a text.
Definition: qcustomplot.h:5216
Q_SLOT void setSelection(QCPDataSelection selection)
Definition: qcustomplot.cpp:11553
const_iterator constEnd() const
Definition: qcustomplot.h:2594
virtual void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE
Definition: qcustomplot.cpp:18642
void setY(double y)
Definition: qcustomplot.h:406
A layer that may contain objects, to control the rendering order.
Definition: qcustomplot.h:632
QPoint bottomRight() const
Definition: qcustomplot.h:4944
0x02 Mode for all sorts of exports (e.g. PNG, PDF,...). For example, this prevents using cached pixma...
Definition: qcustomplot.h:475
double lengthSquared() const
Definition: qcustomplot.h:410
double mainKey() const
Definition: qcustomplot.h:5863
Handles the different ending decorations for line-like items.
Definition: qcustomplot.h:1478
The positive sign domain, i.e. numbers greater than zero.
Definition: qcustomplot.h:191
Responsible for drawing the grid of a QCPAxis.
Definition: qcustomplot.h:2019
double mainKey() const
Definition: qcustomplot.h:5560
TickStepStrategy
Definition: qcustomplot.h:1691
const_iterator findEnd(double sortKey, bool expandedRange=true) const
Definition: qcustomplot.h:3082
Describes a data set by holding multiple QCPDataRange instances.
Definition: qcustomplot.h:936
void sort()
Definition: qcustomplot.h:3007
0x004 The user can select multiple objects by holding the modifier set by QCustomPlot::setMultiSelect...
Definition: qcustomplot.h:257
0xFF all margins
Definition: qcustomplot.h:203
void expand(const QCPRange &otherRange)
Definition: qcustomplot.cpp:1959
double length() const
Definition: qcustomplot.h:409
void layerChanged(QCPLayer *newLayer)
QCPRange valueRange() const
Definition: qcustomplot.h:6119
ExportPen
Definition: qcustomplot.h:178
QCPDataRange adjusted(int changeBegin, int changeEnd) const
Definition: qcustomplot.h:924
QSharedPointer< QCPBarsDataContainer > data() const
Definition: qcustomplot.h:5797
QPoint bottomLeft() const
Definition: qcustomplot.h:4943
virtual int dataCount() const Q_DECL_OVERRIDE
Definition: qcustomplot.h:4367
Definition: qcustomplot.h:2375
Definition: qcustomplot.h:1619
0x020 Legends are selectable (or their child items, see QCPLegend::setSelectableParts) ...
Definition: qcustomplot.h:260
virtual QCPRange getValueRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth, const QCPRange &inKeyRange=QCPRange()) const =0
Q_SLOT bool setLayer(QCPLayer *layer)
Definition: qcustomplot.cpp:1411
Defines a color gradient for use with e.g. QCPColorMap.
Definition: qcustomplot.h:4700
ScatterShape
Definition: qcustomplot.h:2477
AntialiasedElement
Definition: qcustomplot.h:217
QList< QCPBars * > bars() const
Definition: qcustomplot.h:5697
Q_SLOT void setSelectable(QCP::SelectionType selectable)
Definition: qcustomplot.cpp:11599
virtual bool sortKeyIsMainKey() const =0
bool qcpLessThanSortKey(const DataType &a, const DataType &b)
Definition: qcustomplot.h:2560
An ellipse.
Definition: qcustomplot.h:6670
Holds the data of one single data point for QCPStatisticalBox.
Definition: qcustomplot.h:5853
int left() const
Definition: qcustomplot.h:4934
double mainValue() const
Definition: qcustomplot.h:5741
A radial graph used to display data in polar plots.
Definition: qcustomplot.h:7584
QSize size() const
Definition: qcustomplot.h:4940
virtual QCPLayoutElement * takeAt(int index)=0
The central class of the library. This is the QWidget which displays the plot and interacts with the ...
Definition: qcustomplot.h:3738
virtual void mouseDoubleClickEvent(QMouseEvent *event, const QVariant &details)
Definition: qcustomplot.cpp:1808
One individual data point can be selected at a time.
Definition: qcustomplot.h:298
LabelSide
Definition: qcustomplot.h:2136
virtual double dataSortKey(int index) const Q_DECL_OVERRIDE
Definition: qcustomplot.h:4392
void removeAfter(double sortKey)
Definition: qcustomplot.h:2929
QCPVector2D perpendicular() const
Definition: qcustomplot.h:418
QSharedPointer< QCPAxisTicker > ticker() const
Definition: qcustomplot.h:7009
QCPBars * barAbove() const
Definition: qcustomplot.h:5796
0x0002 Grid lines
Definition: qcustomplot.h:218
void squeeze(bool preAllocation=true, bool postAllocation=true)
Definition: qcustomplot.h:3023
Represents two doubles as a mathematical 2D vector.
Definition: qcustomplot.h:390
virtual QCPPlottableInterface1D * interface1D() Q_DECL_OVERRIDE
Definition: qcustomplot.h:4148
QCPDataSelection inverse(const QCPDataRange &outerRange) const
Definition: qcustomplot.cpp:2739
QRect rect() const
Definition: qcustomplot.h:1230
SelectablePart
Definition: qcustomplot.h:2152
ScatterProperty
Definition: qcustomplot.h:2459
The generic data container for one-dimensional plottables.
Definition: qcustomplot.h:2563
BracketStyle
Definition: qcustomplot.h:4814
Manages a legend inside a QCustomPlot.
Definition: qcustomplot.h:5086
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const Q_DECL_OVERRIDE=0
virtual int dataCount() const =0
QPointF toPointF() const
Definition: qcustomplot.h:413
QPoint bottomLeft() const
Definition: qcustomplot.h:7371
void setAntialiased(bool enabled)
Definition: qcustomplot.cpp:1444
double mainKey() const
Definition: qcustomplot.h:6116
QCPDataRange bounded(const QCPDataRange &other) const
Definition: qcustomplot.cpp:2283
QCPAxis * yAxis2
Definition: qcustomplot.h:3892
virtual void mouseReleaseEvent(QMouseEvent *event, const QPointF &startPos) Q_DECL_OVERRIDE
Definition: qcustomplot.cpp:18616
The selection rect is disabled, and all mouse events are forwarded to the underlying objects...
Definition: qcustomplot.h:272
virtual void clear(const QColor &color)=0
void setValueAxis(QCPAxis *axis)
Definition: qcustomplot.cpp:11529
double center() const
Definition: qcustomplot.h:804
virtual void mousePressEvent(QMouseEvent *event, const QVariant &details) Q_DECL_OVERRIDE
Definition: qcustomplot.cpp:18524
A layout that arranges child elements in a grid.
Definition: qcustomplot.h:1331
double sortKey() const
Definition: qcustomplot.h:6112
virtual QPointF dataPixelPosition(int index) const =0
static QCPGraphData fromSortKey(double sortKey)
Definition: qcustomplot.h:5418
QPainter subclass used internally.
Definition: qcustomplot.h:465
The abstract base class for all objects that form the layout system.
Definition: qcustomplot.h:1188
bool isNone() const
Definition: qcustomplot.h:2524
QCPItemPosition * position(const QString &name) const
Definition: qcustomplot.cpp:13032
Holds the data of one single data point for QCPGraph.
Definition: qcustomplot.h:5411
const_iterator findBegin(double sortKey, bool expandedRange=true) const
Definition: qcustomplot.h:3055
0x000 No hints are set
Definition: qcustomplot.h:238
virtual void mouseReleaseEvent(QMouseEvent *event, const QPointF &startPos)
Definition: qcustomplot.cpp:1776
Multiple contiguous data points (a data range) can be selected.
Definition: qcustomplot.h:299
Holds multiple axes and arranges them in a rectangular shape.
Definition: qcustomplot.h:4872
virtual QCPDataSelection selectTestRect(const QRectF &rect, bool onlySelectable) const Q_DECL_OVERRIDE
Definition: qcustomplot.h:4470
void setPen(const QPen &pen)
Definition: qcustomplot.cpp:11483
void rescaleKeyAxis(bool onlyEnlarge=false) const
Definition: qcustomplot.cpp:11717
virtual double dataMainValue(int index) const Q_DECL_OVERRIDE
Definition: qcustomplot.h:4408
double mainValue() const
Definition: qcustomplot.h:6117
When dragging the mouse, a selection rect becomes active. It is the programmer&#39;s responsibility to co...
Definition: qcustomplot.h:275
Both sign domains, including zero, i.e. all numbers.
Definition: qcustomplot.h:190
0x00 no margin
Definition: qcustomplot.h:204
A color scale for use with color coding data such as QCPColorMap.
Definition: qcustomplot.h:5328
virtual int findEnd(double sortKey, bool expandedRange=true) const Q_DECL_OVERRIDE
Definition: qcustomplot.h:4528
void pixelsToCoords(double x, double y, double &key, double &value) const
Definition: qcustomplot.cpp:11667
0x010 Axes are selectable (or parts of them, see QCPAxis::setSelectableParts)
Definition: qcustomplot.h:259
double angle() const
Definition: qcustomplot.h:411
Groups multiple QCPBars together so they appear side by side.
Definition: qcustomplot.h:5665
QCPBars * barBelow() const
Definition: qcustomplot.h:5795
virtual QCPDataSelection selectTestRect(const QRectF &rect, bool onlySelectable) const =0
double sortKey() const
Definition: qcustomplot.h:5736
virtual QPointF pixelPosition() const
Definition: qcustomplot.cpp:12067
void rescaleValueAxis(bool onlyEnlarge=false, bool inKeyRange=false) const
Definition: qcustomplot.cpp:11759
bool removeFromLegend() const
Definition: qcustomplot.cpp:11871
void clear()
Definition: qcustomplot.h:2988
int columnCount() const
Definition: qcustomplot.h:1363
int pixelOrientation() const
Definition: qcustomplot.h:2260
A legend item for polar plots.
Definition: qcustomplot.h:7560
0x0004 Sub grid lines
Definition: qcustomplot.h:219
A bracket for referencing/highlighting certain parts in the plot.
Definition: qcustomplot.h:6887
virtual QCPRange getKeyRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth) const =0
LayerInsertMode
Definition: qcustomplot.h:3759
The abstract base class for all entries in a QCPLegend.
Definition: qcustomplot.h:4998
SelectionRectMode
Definition: qcustomplot.h:272
Definition: qcustomplot.h:1542
WidthType
Definition: qcustomplot.h:6157
int bottom() const
Definition: qcustomplot.h:4937
Describes a data range given by begin and end index.
Definition: qcustomplot.h:899
void normalize()
Definition: qcustomplot.h:805
virtual double dataMainKey(int index) const Q_DECL_OVERRIDE
Definition: qcustomplot.h:4376
UpdatePhase
Definition: qcustomplot.h:1206
static QCPCurveData fromSortKey(double sortKey)
Definition: qcustomplot.h:5557
virtual QSize minimumOuterSizeHint() const Q_DECL_OVERRIDE
Definition: qcustomplot.cpp:4748
0x008 Plottables are selectable (e.g. graphs, curves, bars,... see QCPAbstractPlottable) ...
Definition: qcustomplot.h:258
PositionType
Definition: qcustomplot.h:3601
The abstract base class for paint buffers, which define the rendering backend.
Definition: qcustomplot.h:524
static QCPFinancialData fromSortKey(double sortKey)
Definition: qcustomplot.h:6113
A plottable representing a parametric curve in a plot.
Definition: qcustomplot.h:5582
QCPLegend * legend
Definition: qcustomplot.h:3893
void addDataRange(const QCPDataRange &dataRange, bool simplify=true)
Definition: qcustomplot.cpp:2574
static bool sortKeyIsMainKey()
Definition: qcustomplot.h:6114
A legend item representing a plottable with an icon and the plottable name.
Definition: qcustomplot.h:5062
bool isPenDefined() const
Definition: qcustomplot.h:2525
virtual double dataSortKey(int index) const =0
QPoint topLeft() const
Definition: qcustomplot.h:7369
bool selected() const
Definition: qcustomplot.h:3471
QCPRange valueRange() const
Definition: qcustomplot.h:5743
bool contains(double value) const
Definition: qcustomplot.h:813
QCPRange valueRange() const
Definition: qcustomplot.h:5866
0x0040 Main lines of items
Definition: qcustomplot.h:223
bool isEmpty() const
Definition: qcustomplot.h:2573
Manages a single axis inside a QCustomPlot.
Definition: qcustomplot.h:2070
void selectionChanged(bool selected)
void setAntialiasedFill(bool enabled)
Definition: qcustomplot.cpp:11459
Definition: qcustomplot.h:241
FractionStyle
Definition: qcustomplot.h:1937
TracerStyle
Definition: qcustomplot.h:6821
int width() const
Definition: qcustomplot.h:7366
void rescaleAxes(bool onlyEnlarge=false) const
Definition: qcustomplot.cpp:11706
virtual void draw(QCPPainter *painter) const =0
A template base class for plottables with one-dimensional data.
Definition: qcustomplot.h:4126
0x01 The pen property, see setPen
Definition: qcustomplot.h:2460
Item that sticks to QCPGraph data points.
Definition: qcustomplot.h:6801
Definition: qcustomplot.h:239
Definition: qcustomplot.h:1624
GradientPreset
Definition: qcustomplot.h:4731
int size() const
Definition: qcustomplot.h:5699
A margin group allows synchronization of margin sides if working with multiple layout elements...
Definition: qcustomplot.h:1157
QCPRange & operator-=(const double &value)
Definition: qcustomplot.h:793
LabelMode
Definition: qcustomplot.h:7229
virtual void mouseMoveEvent(QMouseEvent *event, const QPointF &startPos) Q_DECL_OVERRIDE
Definition: qcustomplot.cpp:18556
QList< QCPItemPosition * > positions() const
Definition: qcustomplot.h:3690
QCPRange keyRange(bool &foundRange, QCP::SignDomain signDomain=QCP::sdBoth)
Definition: qcustomplot.h:3109
void setVisible(bool on)
Definition: qcustomplot.cpp:1397
0x08 bottom margin
Definition: qcustomplot.h:202
virtual int findEnd(double sortKey, bool expandedRange=true) const =0
QList< QCPLayerable * > children() const
Definition: qcustomplot.h:664
An anchor of an item to which positions can be attached to.
Definition: qcustomplot.h:3553
double mainValue() const
Definition: qcustomplot.h:5864
0x0100 Borders of fills (e.g. under or between graphs)
Definition: qcustomplot.h:225
The abstract base class for all items in a plot.
Definition: qcustomplot.h:3661
QList< QCPItemAnchor * > anchors() const
Definition: qcustomplot.h:3691
static const double minRange
Definition: qcustomplot.h:817
WidthType
Definition: qcustomplot.h:5780
virtual void simplify()
Definition: qcustomplot.cpp:3724
Selection behaves like stMultipleDataRanges, but if there are any data points selected, the entire plottable is drawn as selected.
Definition: qcustomplot.h:297
QPoint toPoint() const
Definition: qcustomplot.h:412
QPoint topLeft() const
Definition: qcustomplot.h:4941
SelectionType
Definition: qcustomplot.h:296
QPoint bottomRight() const
Definition: qcustomplot.h:7372
QCPRange valueRange() const
Definition: qcustomplot.h:5563
Specialized axis ticker for time spans in units of milliseconds to days.
Definition: qcustomplot.h:1796
int width() const
Definition: qcustomplot.h:4938
A paint buffer based on QPixmap, using software raster rendering.
Definition: qcustomplot.h:559
double sortKey() const
Definition: qcustomplot.h:5556
ScaleStrategy
Definition: qcustomplot.h:1858
static bool sortKeyIsMainKey()
Definition: qcustomplot.h:5419
virtual QCPPainter * startPainting()=0
static QCPBarsData fromSortKey(double sortKey)
Definition: qcustomplot.h:5737
TimeUnit
Definition: qcustomplot.h:1805
0x0080 Scatter symbols of plottables (excluding scatter symbols of type ssPixmap) ...
Definition: qcustomplot.h:224
AnchorReferenceType
Definition: qcustomplot.h:1558
Specialized axis ticker which allows arbitrary labels at specified coordinates.
Definition: qcustomplot.h:1890
QCPSelectionRect * selectionRect() const
Definition: qcustomplot.h:3795
A layout that places child elements aligned to the border or arbitrarily positioned.
Definition: qcustomplot.h:1422
0x100 When performing plottable selection/hit tests, this flag extends the sensitive area beyond the ...
Definition: qcustomplot.h:263
double mainKey() const
Definition: qcustomplot.h:5421
0x080 All other objects are selectable (e.g. your own derived layerables, other layout elements...
Definition: qcustomplot.h:262
virtual QList< QCPLayoutElement * > elements(bool recursive) const Q_DECL_OVERRIDE
Definition: qcustomplot.cpp:3697
Whether to use immediate or queued refresh depends on whether the plotting hint QCP::phImmediateRefre...
Definition: qcustomplot.h:3771
0x002 Axis ranges are zoomable with the mouse wheel (see QCPAxisRect::setRangeZoom, QCPAxisRect::setRangeZoomAxes)
Definition: qcustomplot.h:256
The radial axis inside a radial plot.
Definition: qcustomplot.h:6955
QCPAbstractItem * item() const
Definition: qcustomplot.cpp:14542
void coordsToPixels(double key, double value, double &x, double &y) const
Definition: qcustomplot.cpp:11625
virtual int findBegin(double sortKey, bool expandedRange=true) const =0
A plottable representing a bar chart in a plot.
Definition: qcustomplot.h:5761
bool isNull() const
Definition: qcustomplot.h:415
AxisType
Definition: qcustomplot.h:2123
QCPLayoutGrid * plotLayout() const
Definition: qcustomplot.h:3785
SelectablePart
Definition: qcustomplot.h:7217
0x8000 Other elements that don&#39;t fit into any of the existing categories
Definition: qcustomplot.h:227
QDebug operator<<(QDebug d, const QCPVector2D &vec)
Definition: qcustomplot.h:453
double size() const
Definition: qcustomplot.h:803
virtual double dataMainKey(int index) const =0
void add(const QCPDataContainer< DataType > &data)
Definition: qcustomplot.h:2821
iterator end()
Definition: qcustomplot.h:2596
A selection decorator which draws brackets around each selected data segment.
Definition: qcustomplot.h:4803
0x01 Mode for vectorized painting (e.g. PDF export). For example, this prevents some antialiasing fix...
Definition: qcustomplot.h:474
virtual QPointF dataPixelPosition(int index) const Q_DECL_OVERRIDE
Definition: qcustomplot.h:4440
Base class for all drawable objects.
Definition: qcustomplot.h:701
Specialized axis ticker with a fixed tick step.
Definition: qcustomplot.h:1848
0x0008 Legend box
Definition: qcustomplot.h:220
QCPDataSelection selection() const
Definition: qcustomplot.h:3472
AnchorMode
Definition: qcustomplot.h:1549
virtual void reallocateBuffer()=0
static bool sortKeyIsMainKey()
Definition: qcustomplot.h:5558
QCPAbstractPlottable1D(QCPAxis *keyAxis, QCPAxis *valueAxis)
Definition: qcustomplot.h:4352
QCPAxis * axis() const
Definition: qcustomplot.h:5346
SelectablePart
Definition: qcustomplot.h:5111
The plottable is not selectable.
Definition: qcustomplot.h:296
Resolution is given in dots per centimeter (dpcm)
Definition: qcustomplot.h:169
QPoint topRight() const
Definition: qcustomplot.h:4942
ScaleType
Definition: qcustomplot.h:2144
virtual bool take(QCPLayoutElement *element)=0
bool isValid() const
Definition: qcustomplot.h:919
0xFFFF All elements
Definition: qcustomplot.h:228
NanHandling
Definition: qcustomplot.h:4719
QList< QCPLayoutElement * > elements(QCP::MarginSide side) const
Definition: qcustomplot.h:1165
int left() const
Definition: qcustomplot.h:7362
void setEnd(int end)
Definition: qcustomplot.h:916
SizeConstraintRect
Definition: qcustomplot.h:1220
A plottable representing a graph in a plot.
Definition: qcustomplot.h:5442
QCPAbstractPlottable(QCPAxis *keyAxis, QCPAxis *valueAxis)
Definition: qcustomplot.cpp:11414
FillOrder
Definition: qcustomplot.h:1353
The negative sign domain, i.e. numbers smaller than zero.
Definition: qcustomplot.h:189
void selectableChanged(QCP::SelectionType selectable)
0x040 Items are selectable (Rectangles, Arrows, Textitems, etc. see QCPAbstractItem) ...
Definition: qcustomplot.h:261
Holds the two-dimensional data of a QCPColorMap plottable.
Definition: qcustomplot.h:5970
virtual void donePainting()
Definition: qcustomplot.h:542
int height() const
Definition: qcustomplot.h:4939
The abstract base class for all data representing objects in a plot.
Definition: qcustomplot.h:3443
SpacingType
Definition: qcustomplot.h:5679
QCPDataContainer()
Definition: qcustomplot.h:2756
QCPDataRange dataRange(int index=0) const
Definition: qcustomplot.cpp:2544
iterator begin()
Definition: qcustomplot.h:2595
The grid in both angular and radial dimensions for polar plots.
Definition: qcustomplot.h:7479
void drawLine(const QLineF &line)
Definition: qcustomplot.cpp:371
ChartStyle
Definition: qcustomplot.h:6168
0x0001 Axis base line and tick marks
Definition: qcustomplot.h:217
void setAntialiasedScatters(bool enabled)
Definition: qcustomplot.cpp:11470
PainterMode
Definition: qcustomplot.h:473
static Qt::Orientation orientation(AxisType type)
Definition: qcustomplot.h:2274
void clear()
Definition: qcustomplot.cpp:3076
int right() const
Definition: qcustomplot.h:4935
QPoint center() const
Definition: qcustomplot.h:4945
Holds the data of one single error bar for QCPErrorBars.
Definition: qcustomplot.h:6245
Definition: qcustomplot.h:2416
PlottingHint
Definition: qcustomplot.h:238
AnchorSide
Definition: qcustomplot.h:1566
Cosmetic pens are exported normally (e.g. in PDF exports, cosmetic pens always appear as 1 pixel on s...
Definition: qcustomplot.h:179
0x01 left margin
Definition: qcustomplot.h:199
double mainKey() const
Definition: qcustomplot.h:5740
MarginSide
Definition: qcustomplot.h:199
0x0010 Legend items
Definition: qcustomplot.h:221
A plottable representing a financial stock chart.
Definition: qcustomplot.h:6137
void getDataSegments(QList< QCPDataRange > &selectedSegments, QList< QCPDataRange > &unselectedSegments) const
Definition: qcustomplot.h:4606
void setAutoSqueeze(bool enabled)
Definition: qcustomplot.h:2772
QCPSelectionDecorator * selectionDecorator() const
Definition: qcustomplot.h:3473
A plottable representing a two-dimensional color map in a plot.
Definition: qcustomplot.h:6027
The main container for polar plots, representing the angular axis as a circle.
Definition: qcustomplot.h:7206
double sortKey() const
Definition: qcustomplot.h:5417
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const
Definition: qcustomplot.cpp:1503
int bottom() const
Definition: qcustomplot.h:7365
QCPItemAnchor * parentAnchor() const
Definition: qcustomplot.h:3619
QCPRange & operator*=(const double &value)
Definition: qcustomplot.h:794
virtual QCPPlottableInterface1D * interface1D()
Definition: qcustomplot.h:3489
static const double maxRange
Definition: qcustomplot.h:818
virtual bool sortKeyIsMainKey() const Q_DECL_OVERRIDE
Definition: qcustomplot.h:4457
virtual QCPLayoutElement * elementAt(int index) const =0
LineStyle
Definition: qcustomplot.h:5596
A line from one point to another.
Definition: qcustomplot.h:6413
Holds the data of one single data point for QCPFinancial.
Definition: qcustomplot.h:6106
When dragging the mouse, a selection rect becomes active. Upon releasing, plottable data points that ...
Definition: qcustomplot.h:274
Resolution is given in dots per meter (dpm)
Definition: qcustomplot.h:168
virtual void update(UpdatePhase phase)
Definition: qcustomplot.cpp:3436
QSharedPointer< QCPGraphDataContainer > data() const
Definition: qcustomplot.h:5472
void limitIteratorsToDataRange(const_iterator &begin, const_iterator &end, const QCPDataRange &dataRange) const
Definition: qcustomplot.h:3320
A plottable that adds a set of error bars to other plottables.
Definition: qcustomplot.h:6274
virtual void wheelEvent(QWheelEvent *event)
Definition: qcustomplot.cpp:1831
ItemType * itemAt(const QPointF &pos, bool onlySelectable=false) const
Definition: qcustomplot.h:4076
virtual QCPRange dataValueRange(int index) const =0
virtual void mouseMoveEvent(QMouseEvent *event, const QPointF &startPos)
Definition: qcustomplot.cpp:1758
double dot(const QCPVector2D &vec) const
Definition: qcustomplot.h:419
Interaction
Definition: qcustomplot.h:254
void setSelectionDecorator(QCPSelectionDecorator *decorator)
Definition: qcustomplot.cpp:11573
bool isEmpty() const
Definition: qcustomplot.h:5700
QCPColorMapData * data() const
Definition: qcustomplot.h:6043