ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
qcustomplot.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #ifndef QCUSTOMPLOT_H
9 #define QCUSTOMPLOT_H
10 
11 #include <QtCore/qglobal.h>
12 
13 // some Qt version/configuration dependent macros to include or exclude certain
14 // code paths:
15 #ifdef QCUSTOMPLOT_USE_OPENGL
16 #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
17 #define QCP_OPENGL_PBUFFER
18 #else
19 #define QCP_OPENGL_FBO
20 #endif
21 #if QT_VERSION >= QT_VERSION_CHECK(5, 3, 0)
22 #define QCP_OPENGL_OFFSCREENSURFACE
23 #endif
24 #endif
25 
26 #if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0)
27 #define QCP_DEVICEPIXELRATIO_SUPPORTED
28 #if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
29 #define QCP_DEVICEPIXELRATIO_FLOAT
30 #endif
31 #endif
32 
33 #include <qmath.h>
34 
35 #include <QtCore/QCache>
36 #include <QtCore/QDateTime>
37 #include <QtCore/QDebug>
38 #include <QtCore/QFlags>
39 #include <QtCore/QMargins>
40 #include <QtCore/QMultiMap>
41 #include <QtCore/QObject>
42 #include <QtCore/QPointer>
43 #include <QtCore/QSharedPointer>
44 #include <QtCore/QStack>
45 #include <QtCore/QString>
46 #include <QtCore/QTimer>
47 #include <QtCore/QVector>
48 #include <QtGui/QMouseEvent>
49 #include <QtGui/QPaintEvent>
50 #include <QtGui/QPainter>
51 #include <QtGui/QPixmap>
52 #include <QtGui/QWheelEvent>
53 #include <algorithm>
54 #include <limits>
55 #ifdef QCP_OPENGL_FBO
56 #include <QtGui/QOpenGLContext>
57 #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
58 #include <QtGui/QOpenGLFramebufferObject>
59 #else
60 #include <QOpenGLFramebufferObject>
61 #include <QOpenGLPaintDevice>
62 #endif
63 #ifdef QCP_OPENGL_OFFSCREENSURFACE
64 #include <QtGui/QOffscreenSurface>
65 #else
66 #include <QtGui/QWindow>
67 #endif
68 #endif
69 #ifdef QCP_OPENGL_PBUFFER
70 #include <QtOpenGL/QGLPixelBuffer>
71 #endif
72 #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
73 #include <qnumeric.h>
74 
75 #include <QtGui/QPrintEngine>
76 #include <QtGui/QPrinter>
77 #include <QtGui/QWidget>
78 #else
79 #include <QtNumeric>
80 #include <QtPrintSupport/QtPrintSupport>
81 #include <QtWidgets/QWidget>
82 #endif
83 #if QT_VERSION >= QT_VERSION_CHECK(4, 8, 0)
84 #include <QtCore/QElapsedTimer>
85 #endif
86 #if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0)
87 #include <QtCore/QTimeZone>
88 #endif
89 
90 class QCPPainter;
91 class QCustomPlot;
92 class QCPLayerable;
93 class QCPLayoutElement;
94 class QCPLayout;
95 class QCPAxis;
96 class QCPAxisRect;
97 class QCPAxisPainterPrivate;
99 class QCPGraph;
100 class QCPAbstractItem;
102 class QCPLegend;
103 class QCPItemPosition;
104 class QCPLayer;
106 class QCPSelectionRect;
107 class QCPColorMap;
108 class QCPColorScale;
109 class QCPBars;
110 
111 /* including file 'src/global.h', size 16357 */
112 /* commit ce344b3f96a62e5f652585e55f1ae7c7883cd45b 2018-06-25 01:03:39 +0200 */
113 
114 #define QCUSTOMPLOT_VERSION_STR "2.0.1"
115 #define QCUSTOMPLOT_VERSION 0x020001
116 
117 // decl definitions for shared library compilation/usage:
118 #if defined(QT_STATIC_BUILD)
119 #define QCP_LIB_DECL
120 #elif defined(QCUSTOMPLOT_COMPILE_LIBRARY)
121 #define QCP_LIB_DECL Q_DECL_EXPORT
122 #elif defined(QCUSTOMPLOT_USE_LIBRARY)
123 #define QCP_LIB_DECL Q_DECL_IMPORT
124 #else
125 #define QCP_LIB_DECL
126 #endif
127 
128 // define empty macro for Q_DECL_OVERRIDE if it doesn't exist (Qt < 5)
129 #ifndef Q_DECL_OVERRIDE
130 #define Q_DECL_OVERRIDE
131 #endif
132 
140 // Qt version < 6.2.0: to get metatypes Q_GADGET/Q_ENUMS/Q_FLAGS in namespace we
141 // have to make it look like a class during moc-run
142 #if QT_VERSION >= 0x060200 // don't use QT_VERSION_CHECK here, some moc
143  // versions don't understand it
144 namespace QCP {
145 Q_NAMESPACE // this is how to add the staticMetaObject to namespaces in newer
146  // Qt versions
147 #else // Qt version older than 6.2.0
148 #ifndef Q_MOC_RUN
149 namespace QCP {
150 #else // in moc run
151 class QCP {
152  Q_GADGET
153  Q_ENUMS(ExportPen)
154  Q_ENUMS(ResolutionUnit)
155  Q_ENUMS(SignDomain)
156  Q_ENUMS(MarginSide)
157  Q_ENUMS(AntialiasedElement)
158  Q_ENUMS(PlottingHint)
159  Q_ENUMS(Interaction)
160  Q_ENUMS(SelectionRectMode)
161  Q_ENUMS(SelectionType)
162 
163  Q_FLAGS(AntialiasedElements)
164  Q_FLAGS(PlottingHints)
165  Q_FLAGS(MarginSides)
166  Q_FLAGS(Interactions)
167 public:
168 #endif
169 #endif
170 
180  ,
183  ,
185  };
186 
193 enum ExportPen {
194  epNoCosmetic
196  ,
200 };
201 
211  sdNegative
212  ,
213  sdBoth
214  ,
215  sdPositive
216 };
217 
224  msLeft = 0x01
225  ,
226  msRight = 0x02
227  ,
228  msTop = 0x04
229  ,
230  msBottom = 0x08
231  ,
232  msAll = 0xFF
233  ,
234  msNone = 0x00
235 };
236 Q_DECLARE_FLAGS(MarginSides, MarginSide)
237 
238 
250  aeAxes = 0x0001
251  ,
252  aeGrid = 0x0002
253  ,
254  aeSubGrid = 0x0004
255  ,
256  aeLegend = 0x0008
257  ,
258  aeLegendItems = 0x0010
259  ,
260  aePlottables = 0x0020
261  ,
262  aeItems = 0x0040
263  ,
264  aeScatters = 0x0080
266  ,
267  aeFills = 0x0100
269  ,
270  aeZeroLine = 0x0200
272  ,
273  aeOther = 0x8000
275  ,
276  aeAll = 0xFFFF
277  ,
278  aeNone = 0x0000
279 };
280 Q_DECLARE_FLAGS(AntialiasedElements, AntialiasedElement)
281 
282 
289  phNone = 0x000
290  ,
292  0x001
298  ,
300  0x002
307  ,
308  phCacheLabels = 0x004
310 };
311 Q_DECLARE_FLAGS(PlottingHints, PlottingHint)
312 
313 
321  iRangeDrag = 0x001
324  ,
325  iRangeZoom = 0x002
328  ,
329  iMultiSelect =
330  0x004
333  ,
335  0x008
337  ,
338  iSelectAxes = 0x010
340  ,
341  iSelectLegend = 0x020
343  ,
344  iSelectItems = 0x040
346  ,
347  iSelectOther =
348  0x080
350 };
351 Q_DECLARE_FLAGS(Interactions, Interaction)
352 
353 
360  srmNone
363  ,
364  srmZoom
368  ,
369  srmSelect
374  ,
375  srmCustom
380 };
381 
403  stNone
404  ,
405  stWhole
408  ,
409  stSingleData
410  ,
411  stDataRange
413  ,
416 };
417 
425 inline bool isInvalidData(double value) {
426  return qIsNaN(value) || qIsInf(value);
427 }
428 
434 inline bool isInvalidData(double value1, double value2) {
435  return isInvalidData(value1) || isInvalidData(value2);
436 }
437 
444 inline void setMarginValue(QMargins &margins, QCP::MarginSide side, int value) {
445  switch (side) {
446  case QCP::msLeft:
447  margins.setLeft(value);
448  break;
449  case QCP::msRight:
450  margins.setRight(value);
451  break;
452  case QCP::msTop:
453  margins.setTop(value);
454  break;
455  case QCP::msBottom:
456  margins.setBottom(value);
457  break;
458  case QCP::msAll:
459  margins = QMargins(value, value, value, value);
460  break;
461  default:
462  break;
463  }
464 }
465 
473 inline int getMarginValue(const QMargins &margins, QCP::MarginSide side) {
474  switch (side) {
475  case QCP::msLeft:
476  return margins.left();
477  case QCP::msRight:
478  return margins.right();
479  case QCP::msTop:
480  return margins.top();
481  case QCP::msBottom:
482  return margins.bottom();
483  default:
484  break;
485  }
486  return 0;
487 }
488 
489 // for newer Qt versions we have to declare the enums/flags as metatypes inside
490 // the namespace using Q_ENUM_NS/Q_FLAG_NS: if you change anything here, don't
491 // forget to change it for older Qt versions below, too, and at the start of the
492 // namespace in the fake moc-run class
493 #if QT_VERSION >= 0x060200
494 Q_ENUM_NS(ExportPen)
495 Q_ENUM_NS(ResolutionUnit)
496 Q_ENUM_NS(SignDomain)
497 Q_ENUM_NS(MarginSide)
498 Q_ENUM_NS(AntialiasedElement)
499 Q_ENUM_NS(PlottingHint)
500 Q_ENUM_NS(Interaction)
501 Q_ENUM_NS(SelectionRectMode)
502 Q_ENUM_NS(SelectionType)
503 
504 Q_FLAG_NS(AntialiasedElements)
505 Q_FLAG_NS(PlottingHints)
506 Q_FLAG_NS(MarginSides)
507 Q_FLAG_NS(Interactions)
508 #else
509 extern const QMetaObject
510  staticMetaObject; // in moc-run we create a static meta object for QCP
511  // "fake" object. This line is the link to it via
512  // QCP::staticMetaObject in normal operation as
513  // namespace
514 #endif
515 
516 } // end of namespace QCP
517 Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::AntialiasedElements)
518 Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::PlottingHints)
519 Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::MarginSides)
520 Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::Interactions)
521 
522 // for older Qt versions we have to declare the enums/flags as metatypes outside
523 // the namespace using Q_DECLARE_METATYPE: if you change anything here, don't
524 // forget to change it for newer Qt versions above, too, and at the start of the
525 // namespace in the fake moc-run class
526 #if QT_VERSION < QT_VERSION_CHECK(6, 2, 0)
536 #endif
537 
538 /* end of 'src/global.h' */
539 
540 /* including file 'src/vector2d.h', size 4928 */
541 /* commit ce344b3f96a62e5f652585e55f1ae7c7883cd45b 2018-06-25 01:03:39 +0200 */
542 
544 public:
545  QCPVector2D();
546  QCPVector2D(double x, double y);
547  QCPVector2D(const QPoint &point);
548  QCPVector2D(const QPointF &point);
549 
550  // getters:
551  double x() const { return mX; }
552  double y() const { return mY; }
553  double &rx() { return mX; }
554  double &ry() { return mY; }
555 
556  // setters:
557  void setX(double x) { mX = x; }
558  void setY(double y) { mY = y; }
559 
560  // non-virtual methods:
561  double length() const { return qSqrt(mX * mX + mY * mY); }
562  double lengthSquared() const { return mX * mX + mY * mY; }
563  QPoint toPoint() const { return QPoint(mX, mY); }
564  QPointF toPointF() const { return QPointF(mX, mY); }
565 
566  bool isNull() const { return qIsNull(mX) && qIsNull(mY); }
567  void normalize();
568  QCPVector2D normalized() const;
569  QCPVector2D perpendicular() const { return QCPVector2D(-mY, mX); }
570  double dot(const QCPVector2D &vec) const {
571  return mX * vec.mX + mY * vec.mY;
572  }
573  double distanceSquaredToLine(const QCPVector2D &start,
574  const QCPVector2D &end) const;
575  double distanceSquaredToLine(const QLineF &line) const;
576  double distanceToStraightLine(const QCPVector2D &base,
577  const QCPVector2D &direction) const;
578 
579  QCPVector2D &operator*=(double factor);
580  QCPVector2D &operator/=(double divisor);
581  QCPVector2D &operator+=(const QCPVector2D &vector);
582  QCPVector2D &operator-=(const QCPVector2D &vector);
583 
584 private:
585  // property members:
586  double mX, mY;
587 
588  friend inline const QCPVector2D operator*(double factor,
589  const QCPVector2D &vec);
590  friend inline const QCPVector2D operator*(const QCPVector2D &vec,
591  double factor);
592  friend inline const QCPVector2D operator/(const QCPVector2D &vec,
593  double divisor);
594  friend inline const QCPVector2D operator+(const QCPVector2D &vec1,
595  const QCPVector2D &vec2);
596  friend inline const QCPVector2D operator-(const QCPVector2D &vec1,
597  const QCPVector2D &vec2);
598  friend inline const QCPVector2D operator-(const QCPVector2D &vec);
599 };
601 
602 inline const QCPVector2D operator*(double factor, const QCPVector2D &vec) {
603  return QCPVector2D(vec.mX * factor, vec.mY * factor);
604 }
605 inline const QCPVector2D operator*(const QCPVector2D &vec, double factor) {
606  return QCPVector2D(vec.mX * factor, vec.mY * factor);
607 }
608 inline const QCPVector2D operator/(const QCPVector2D &vec, double divisor) {
609  return QCPVector2D(vec.mX / divisor, vec.mY / divisor);
610 }
611 inline const QCPVector2D operator+(const QCPVector2D &vec1,
612  const QCPVector2D &vec2) {
613  return QCPVector2D(vec1.mX + vec2.mX, vec1.mY + vec2.mY);
614 }
615 inline const QCPVector2D operator-(const QCPVector2D &vec1,
616  const QCPVector2D &vec2) {
617  return QCPVector2D(vec1.mX - vec2.mX, vec1.mY - vec2.mY);
618 }
619 inline const QCPVector2D operator-(const QCPVector2D &vec) {
620  return QCPVector2D(-vec.mX, -vec.mY);
621 }
622 
627 inline QDebug operator<<(QDebug d, const QCPVector2D &vec) {
628  d.nospace() << "QCPVector2D(" << vec.x() << ", " << vec.y() << ")";
629  return d.space();
630 }
631 
632 /* end of 'src/vector2d.h' */
633 
634 /* including file 'src/painter.h', size 4035 */
635 /* commit ce344b3f96a62e5f652585e55f1ae7c7883cd45b 2018-06-25 01:03:39 +0200 */
636 
637 class QCP_LIB_DECL QCPPainter : public QPainter {
638  Q_GADGET
639 public:
645  enum PainterMode {
646  pmDefault = 0x00
648  ,
649  pmVectorized = 0x01
652  ,
653  pmNoCaching = 0x02
656  ,
657  pmNonCosmetic = 0x04
661  };
662  Q_ENUMS(PainterMode)
663  Q_FLAGS(PainterModes)
664  Q_DECLARE_FLAGS(PainterModes, PainterMode)
665 
666  QCPPainter();
667  explicit QCPPainter(QPaintDevice *device);
668 
669  // getters:
670  bool antialiasing() const { return testRenderHint(QPainter::Antialiasing); }
671  PainterModes modes() const { return mModes; }
672 
673  // setters:
674  void setAntialiasing(bool enabled);
675  void setMode(PainterMode mode, bool enabled = true);
676  void setModes(PainterModes modes);
677 
678  // methods hiding non-virtual base class functions (QPainter bug
679  // workarounds):
680  bool begin(QPaintDevice *device);
681  void setPen(const QPen &pen);
682  void setPen(const QColor &color);
683  void setPen(Qt::PenStyle penStyle);
684  void drawLine(const QLineF &line);
685  void drawLine(const QPointF &p1, const QPointF &p2) {
686  drawLine(QLineF(p1, p2));
687  }
688  void save();
689  void restore();
690 
691  // non-virtual methods:
692  void makeNonCosmetic();
693 
694 protected:
695  // property members:
696  PainterModes mModes;
698 
699  // non-property members:
700  QStack<bool> mAntialiasingStack;
701 };
702 Q_DECLARE_OPERATORS_FOR_FLAGS(QCPPainter::PainterModes)
704 
705 /* end of 'src/painter.h' */
706 
707 /* including file 'src/paintbuffer.h', size 4958 */
708 /* commit ce344b3f96a62e5f652585e55f1ae7c7883cd45b 2018-06-25 01:03:39 +0200 */
709 
711 public:
712  explicit QCPAbstractPaintBuffer(const QSize &size, double devicePixelRatio);
713  virtual ~QCPAbstractPaintBuffer();
714 
715  // getters:
716  QSize size() const { return mSize; }
717  bool invalidated() const { return mInvalidated; }
718  double devicePixelRatio() const { return mDevicePixelRatio; }
719 
720  // setters:
721  void setSize(const QSize &size);
722  void setInvalidated(bool invalidated = true);
723  void setDevicePixelRatio(double ratio);
724 
725  // introduced virtual methods:
726  virtual QCPPainter *startPainting() = 0;
727  virtual void donePainting() {}
728  virtual void draw(QCPPainter *painter) const = 0;
729  virtual void clear(const QColor &color) = 0;
730 
731 protected:
732  // property members:
733  QSize mSize;
735 
736  // non-property members:
738 
739  // introduced virtual methods:
740  virtual void reallocateBuffer() = 0;
741 };
742 
744 public:
745  explicit QCPPaintBufferPixmap(const QSize &size, double devicePixelRatio);
746  virtual ~QCPPaintBufferPixmap();
747 
748  // reimplemented virtual methods:
749  virtual QCPPainter *startPainting() Q_DECL_OVERRIDE;
750  virtual void draw(QCPPainter *painter) const Q_DECL_OVERRIDE;
751  void clear(const QColor &color) Q_DECL_OVERRIDE;
752 
753 protected:
754  // non-property members:
755  QPixmap mBuffer;
756 
757  // reimplemented virtual methods:
758  virtual void reallocateBuffer() Q_DECL_OVERRIDE;
759 };
760 
761 #ifdef QCP_OPENGL_PBUFFER
762 class QCP_LIB_DECL QCPPaintBufferGlPbuffer : public QCPAbstractPaintBuffer {
763 public:
764  explicit QCPPaintBufferGlPbuffer(const QSize &size,
765  double devicePixelRatio,
766  int multisamples);
767  virtual ~QCPPaintBufferGlPbuffer();
768 
769  // reimplemented virtual methods:
770  virtual QCPPainter *startPainting() Q_DECL_OVERRIDE;
771  virtual void draw(QCPPainter *painter) const Q_DECL_OVERRIDE;
772  void clear(const QColor &color) Q_DECL_OVERRIDE;
773 
774 protected:
775  // non-property members:
776  QGLPixelBuffer *mGlPBuffer;
777  int mMultisamples;
778 
779  // reimplemented virtual methods:
780  virtual void reallocateBuffer() Q_DECL_OVERRIDE;
781 };
782 #endif // QCP_OPENGL_PBUFFER
783 
784 #ifdef QCP_OPENGL_FBO
785 class QCP_LIB_DECL QCPPaintBufferGlFbo : public QCPAbstractPaintBuffer {
786 public:
787  explicit QCPPaintBufferGlFbo(
788  const QSize &size,
789  double devicePixelRatio,
790  QWeakPointer<QOpenGLContext> glContext,
791  QWeakPointer<QOpenGLPaintDevice> glPaintDevice);
792  virtual ~QCPPaintBufferGlFbo();
793 
794  // reimplemented virtual methods:
795  virtual QCPPainter *startPainting() Q_DECL_OVERRIDE;
796  virtual void donePainting() Q_DECL_OVERRIDE;
797  virtual void draw(QCPPainter *painter) const Q_DECL_OVERRIDE;
798  void clear(const QColor &color) Q_DECL_OVERRIDE;
799 
800 protected:
801  // non-property members:
802  QWeakPointer<QOpenGLContext> mGlContext;
803  QWeakPointer<QOpenGLPaintDevice> mGlPaintDevice;
804  QOpenGLFramebufferObject *mGlFrameBuffer;
805 
806  // reimplemented virtual methods:
807  virtual void reallocateBuffer() Q_DECL_OVERRIDE;
808 };
809 #endif // QCP_OPENGL_FBO
810 
811 /* end of 'src/paintbuffer.h' */
812 
813 /* including file 'src/layer.h', size 6885 */
814 /* commit ce344b3f96a62e5f652585e55f1ae7c7883cd45b 2018-06-25 01:03:39 +0200 */
815 
816 class QCP_LIB_DECL QCPLayer : public QObject {
817  Q_OBJECT
819  Q_PROPERTY(QCustomPlot *parentPlot READ parentPlot)
820  Q_PROPERTY(QString name READ name)
821  Q_PROPERTY(int index READ index)
822  Q_PROPERTY(QList<QCPLayerable *> children READ children)
823  Q_PROPERTY(bool visible READ visible WRITE setVisible)
824  Q_PROPERTY(LayerMode mode READ mode WRITE setMode)
826 public:
834  enum LayerMode {
835  lmLogical
837  ,
838  lmBuffered
840  };
841  Q_ENUMS(LayerMode)
842 
843  QCPLayer(QCustomPlot *parentPlot, const QString &layerName);
844  virtual ~QCPLayer();
845 
846  // getters:
847  QCustomPlot *parentPlot() const { return mParentPlot; }
848  QString name() const { return mName; }
849  int index() const { return mIndex; }
850  QList<QCPLayerable *> children() const { return mChildren; }
851  bool visible() const { return mVisible; }
852  LayerMode mode() const { return mMode; }
853 
854  // setters:
855  void setVisible(bool visible);
856  void setMode(LayerMode mode);
857 
858  // non-virtual methods:
859  void replot();
860 
861 protected:
862  // property members:
864  QString mName;
865  int mIndex;
866  QList<QCPLayerable *> mChildren;
867  bool mVisible;
869 
870  // non-property members:
871  QWeakPointer<QCPAbstractPaintBuffer> mPaintBuffer;
872 
873  // non-virtual methods:
874  void draw(QCPPainter *painter);
875  void drawToPaintBuffer();
876  void addChild(QCPLayerable *layerable, bool prepend);
877  void removeChild(QCPLayerable *layerable);
878 
879 private:
880  Q_DISABLE_COPY(QCPLayer)
881 
882  friend class QCustomPlot;
883  friend class QCPLayerable;
884 };
886 
887 class QCP_LIB_DECL QCPLayerable : public QObject {
888  Q_OBJECT
890  Q_PROPERTY(bool visible READ visible WRITE setVisible)
891  Q_PROPERTY(QCustomPlot *parentPlot READ parentPlot)
892  Q_PROPERTY(QCPLayerable *parentLayerable READ parentLayerable)
893  Q_PROPERTY(QCPLayer *layer READ layer WRITE setLayer NOTIFY layerChanged)
894  Q_PROPERTY(bool antialiased READ antialiased WRITE setAntialiased)
896 public:
898  QString targetLayer = QString(),
899  QCPLayerable *parentLayerable = 0);
900  virtual ~QCPLayerable();
901 
902  // getters:
903  bool visible() const { return mVisible; }
904  QCustomPlot *parentPlot() const { return mParentPlot; }
905  QCPLayerable *parentLayerable() const { return mParentLayerable.data(); }
906  QCPLayer *layer() const { return mLayer; }
907  bool antialiased() const { return mAntialiased; }
908 
909  // setters:
910  void setVisible(bool on);
911  Q_SLOT bool setLayer(QCPLayer *layer);
912  bool setLayer(const QString &layerName);
913  void setAntialiased(bool enabled);
914 
915  // introduced virtual methods:
916  virtual double selectTest(const QPointF &pos,
917  bool onlySelectable,
918  QVariant *details = 0) const;
919 
920  // non-property methods:
921  bool realVisibility() const;
922 
923 signals:
924  void layerChanged(QCPLayer *newLayer);
925 
926 protected:
927  // property members:
928  bool mVisible;
930  QPointer<QCPLayerable> mParentLayerable;
933 
934  // introduced virtual methods:
935  virtual void parentPlotInitialized(QCustomPlot *parentPlot);
936  virtual QCP::Interaction selectionCategory() const;
937  virtual QRect clipRect() const;
938  virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const = 0;
939  virtual void draw(QCPPainter *painter) = 0;
940  // selection events:
941  virtual void selectEvent(QMouseEvent *event,
942  bool additive,
943  const QVariant &details,
944  bool *selectionStateChanged);
945  virtual void deselectEvent(bool *selectionStateChanged);
946  // low-level mouse events:
947  virtual void mousePressEvent(QMouseEvent *event, const QVariant &details);
948  virtual void mouseMoveEvent(QMouseEvent *event, const QPointF &startPos);
949  virtual void mouseReleaseEvent(QMouseEvent *event, const QPointF &startPos);
950  virtual void mouseDoubleClickEvent(QMouseEvent *event,
951  const QVariant &details);
952  virtual void wheelEvent(QWheelEvent *event);
953 
954  // non-property methods:
955  void initializeParentPlot(QCustomPlot *parentPlot);
956  void setParentLayerable(QCPLayerable *parentLayerable);
957  bool moveToLayer(QCPLayer *layer, bool prepend);
958  void applyAntialiasingHint(QCPPainter *painter,
959  bool localAntialiased,
960  QCP::AntialiasedElement overrideElement) const;
961 
962 private:
963  Q_DISABLE_COPY(QCPLayerable)
964 
965  friend class QCustomPlot;
966  friend class QCPLayer;
967  friend class QCPAxisRect;
968 };
969 
970 /* end of 'src/layer.h' */
971 
972 /* including file 'src/axis/range.h', size 5280 */
973 /* commit ce344b3f96a62e5f652585e55f1ae7c7883cd45b 2018-06-25 01:03:39 +0200 */
974 
976 public:
977  double lower, upper;
978 
979  QCPRange();
980  QCPRange(double lower, double upper);
981 
982  bool operator==(const QCPRange &other) const {
983  return lower == other.lower && upper == other.upper;
984  }
985  bool operator!=(const QCPRange &other) const { return !(*this == other); }
986 
987  QCPRange &operator+=(const double &value) {
988  lower += value;
989  upper += value;
990  return *this;
991  }
992  QCPRange &operator-=(const double &value) {
993  lower -= value;
994  upper -= value;
995  return *this;
996  }
997  QCPRange &operator*=(const double &value) {
998  lower *= value;
999  upper *= value;
1000  return *this;
1001  }
1002  QCPRange &operator/=(const double &value) {
1003  lower /= value;
1004  upper /= value;
1005  return *this;
1006  }
1007  friend inline const QCPRange operator+(const QCPRange &, double);
1008  friend inline const QCPRange operator+(double, const QCPRange &);
1009  friend inline const QCPRange operator-(const QCPRange &range, double value);
1010  friend inline const QCPRange operator*(const QCPRange &range, double value);
1011  friend inline const QCPRange operator*(double value, const QCPRange &range);
1012  friend inline const QCPRange operator/(const QCPRange &range, double value);
1013 
1014  double size() const { return upper - lower; }
1015  double center() const { return (upper + lower) * 0.5; }
1016  void normalize() {
1017  if (lower > upper) qSwap(lower, upper);
1018  }
1019  void expand(const QCPRange &otherRange);
1020  void expand(double includeCoord);
1021  QCPRange expanded(const QCPRange &otherRange) const;
1022  QCPRange expanded(double includeCoord) const;
1023  QCPRange bounded(double lowerBound, double upperBound) const;
1024  QCPRange sanitizedForLogScale() const;
1025  QCPRange sanitizedForLinScale() const;
1026  bool contains(double value) const {
1027  return value >= lower && value <= upper;
1028  }
1029 
1030  static bool validRange(double lower, double upper);
1031  static bool validRange(const QCPRange &range);
1032  static const double minRange;
1033  static const double maxRange;
1034 };
1035 Q_DECLARE_TYPEINFO(QCPRange, Q_MOVABLE_TYPE);
1036 
1041 inline QDebug operator<<(QDebug d, const QCPRange &range) {
1042  d.nospace() << "QCPRange(" << range.lower << ", " << range.upper << ")";
1043  return d.space();
1044 }
1045 
1049 inline const QCPRange operator+(const QCPRange &range, double value) {
1050  QCPRange result(range);
1051  result += value;
1052  return result;
1053 }
1054 
1058 inline const QCPRange operator+(double value, const QCPRange &range) {
1059  QCPRange result(range);
1060  result += value;
1061  return result;
1062 }
1063 
1067 inline const QCPRange operator-(const QCPRange &range, double value) {
1068  QCPRange result(range);
1069  result -= value;
1070  return result;
1071 }
1072 
1076 inline const QCPRange operator*(const QCPRange &range, double value) {
1077  QCPRange result(range);
1078  result *= value;
1079  return result;
1080 }
1081 
1085 inline const QCPRange operator*(double value, const QCPRange &range) {
1086  QCPRange result(range);
1087  result *= value;
1088  return result;
1089 }
1090 
1094 inline const QCPRange operator/(const QCPRange &range, double value) {
1095  QCPRange result(range);
1096  result /= value;
1097  return result;
1098 }
1099 
1100 /* end of 'src/axis/range.h' */
1101 
1102 /* including file 'src/selection.h', size 8569 */
1103 /* commit ce344b3f96a62e5f652585e55f1ae7c7883cd45b 2018-06-25 01:03:39 +0200 */
1104 
1106 public:
1107  QCPDataRange();
1108  QCPDataRange(int begin, int end);
1109 
1110  bool operator==(const QCPDataRange &other) const {
1111  return mBegin == other.mBegin && mEnd == other.mEnd;
1112  }
1113  bool operator!=(const QCPDataRange &other) const {
1114  return !(*this == other);
1115  }
1116 
1117  // getters:
1118  int begin() const { return mBegin; }
1119  int end() const { return mEnd; }
1120  int size() const { return mEnd - mBegin; }
1121  int length() const { return size(); }
1122 
1123  // setters:
1124  void setBegin(int begin) { mBegin = begin; }
1125  void setEnd(int end) { mEnd = end; }
1126 
1127  // non-property methods:
1128  bool isValid() const { return (mEnd >= mBegin) && (mBegin >= 0); }
1129  bool isEmpty() const { return length() == 0; }
1130  QCPDataRange bounded(const QCPDataRange &other) const;
1131  QCPDataRange expanded(const QCPDataRange &other) const;
1132  QCPDataRange intersection(const QCPDataRange &other) const;
1133  QCPDataRange adjusted(int changeBegin, int changeEnd) const {
1134  return QCPDataRange(mBegin + changeBegin, mEnd + changeEnd);
1135  }
1136  bool intersects(const QCPDataRange &other) const;
1137  bool contains(const QCPDataRange &other) const;
1138 
1139 private:
1140  // property members:
1141  int mBegin, mEnd;
1142 };
1144 
1146 public:
1147  explicit QCPDataSelection();
1148  explicit QCPDataSelection(const QCPDataRange &range);
1149 
1150  bool operator==(const QCPDataSelection &other) const;
1151  bool operator!=(const QCPDataSelection &other) const {
1152  return !(*this == other);
1153  }
1155  QCPDataSelection &operator+=(const QCPDataRange &other);
1157  QCPDataSelection &operator-=(const QCPDataRange &other);
1158  friend inline const QCPDataSelection operator+(const QCPDataSelection &a,
1159  const QCPDataSelection &b);
1160  friend inline const QCPDataSelection operator+(const QCPDataRange &a,
1161  const QCPDataSelection &b);
1162  friend inline const QCPDataSelection operator+(const QCPDataSelection &a,
1163  const QCPDataRange &b);
1164  friend inline const QCPDataSelection operator+(const QCPDataRange &a,
1165  const QCPDataRange &b);
1166  friend inline const QCPDataSelection operator-(const QCPDataSelection &a,
1167  const QCPDataSelection &b);
1168  friend inline const QCPDataSelection operator-(const QCPDataRange &a,
1169  const QCPDataSelection &b);
1170  friend inline const QCPDataSelection operator-(const QCPDataSelection &a,
1171  const QCPDataRange &b);
1172  friend inline const QCPDataSelection operator-(const QCPDataRange &a,
1173  const QCPDataRange &b);
1174 
1175  // getters:
1176  int dataRangeCount() const { return mDataRanges.size(); }
1177  int dataPointCount() const;
1178  QCPDataRange dataRange(int index = 0) const;
1179  QList<QCPDataRange> dataRanges() const { return mDataRanges; }
1180  QCPDataRange span() const;
1181 
1182  // non-property methods:
1183  void addDataRange(const QCPDataRange &dataRange, bool simplify = true);
1184  void clear();
1185  bool isEmpty() const { return mDataRanges.isEmpty(); }
1186  void simplify();
1187  void enforceType(QCP::SelectionType type);
1188  bool contains(const QCPDataSelection &other) const;
1189  QCPDataSelection intersection(const QCPDataRange &other) const;
1190  QCPDataSelection intersection(const QCPDataSelection &other) const;
1191  QCPDataSelection inverse(const QCPDataRange &outerRange) const;
1192 
1193 private:
1194  // property members:
1195  QList<QCPDataRange> mDataRanges;
1196 
1197  inline static bool lessThanDataRangeBegin(const QCPDataRange &a,
1198  const QCPDataRange &b) {
1199  return a.begin() < b.begin();
1200  }
1201 };
1203 
1204 
1209 inline const QCPDataSelection operator+(const QCPDataSelection &a,
1210  const QCPDataSelection &b) {
1212  result += b;
1213  return result;
1214 }
1215 
1222  const QCPDataSelection &b) {
1224  result += b;
1225  return result;
1226 }
1227 
1234  const QCPDataRange &b) {
1236  result += b;
1237  return result;
1238 }
1239 
1246  const QCPDataRange &b) {
1248  result += b;
1249  return result;
1250 }
1251 
1257  const QCPDataSelection &b) {
1259  result -= b;
1260  return result;
1261 }
1262 
1268  const QCPDataSelection &b) {
1270  result -= b;
1271  return result;
1272 }
1273 
1279  const QCPDataRange &b) {
1281  result -= b;
1282  return result;
1283 }
1284 
1290  const QCPDataRange &b) {
1292  result -= b;
1293  return result;
1294 }
1295 
1300 inline QDebug operator<<(QDebug d, const QCPDataRange &dataRange) {
1301  d.nospace() << "QCPDataRange(" << dataRange.begin() << ", "
1302  << dataRange.end() << ")";
1303  return d;
1304 }
1305 
1310 inline QDebug operator<<(QDebug d, const QCPDataSelection &selection) {
1311  d.nospace() << "QCPDataSelection(";
1312  for (int i = 0; i < selection.dataRangeCount(); ++i) {
1313  if (i != 0) d << ", ";
1314  d << selection.dataRange(i);
1315  }
1316  d << ")";
1317  return d;
1318 }
1319 
1320 /* end of 'src/selection.h' */
1321 
1322 /* including file 'src/selectionrect.h', size 3338 */
1323 /* commit ce344b3f96a62e5f652585e55f1ae7c7883cd45b 2018-06-25 01:03:39 +0200 */
1324 
1326  Q_OBJECT
1327 public:
1328  explicit QCPSelectionRect(QCustomPlot *parentPlot);
1329  virtual ~QCPSelectionRect();
1330 
1331  // getters:
1332  QRect rect() const { return mRect; }
1333  QCPRange range(const QCPAxis *axis) const;
1334  QPen pen() const { return mPen; }
1335  QBrush brush() const { return mBrush; }
1336  bool isActive() const { return mActive; }
1337 
1338  // setters:
1339  void setPen(const QPen &pen);
1340  void setBrush(const QBrush &brush);
1341 
1342  // non-property methods:
1343  Q_SLOT void cancel();
1344 
1345 signals:
1346  void started(QMouseEvent *event);
1347  void changed(const QRect &rect, QMouseEvent *event);
1348  void canceled(const QRect &rect, QInputEvent *event);
1349  void accepted(const QRect &rect, QMouseEvent *event);
1350 
1351 protected:
1352  // property members:
1353  QRect mRect;
1354  QPen mPen;
1355  QBrush mBrush;
1356  // non-property members:
1357  bool mActive;
1358 
1359  // introduced virtual methods:
1360  virtual void startSelection(QMouseEvent *event);
1361  virtual void moveSelection(QMouseEvent *event);
1362  virtual void endSelection(QMouseEvent *event);
1363  virtual void keyPressEvent(QKeyEvent *event);
1364 
1365  // reimplemented virtual methods
1366  virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const
1368  virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
1369 
1370  friend class QCustomPlot;
1371 };
1372 
1373 /* end of 'src/selectionrect.h' */
1374 
1375 /* including file 'src/layout.h', size 14224 */
1376 /* commit ce344b3f96a62e5f652585e55f1ae7c7883cd45b 2018-06-25 01:03:39 +0200 */
1377 
1378 class QCP_LIB_DECL QCPMarginGroup : public QObject {
1379  Q_OBJECT
1380 public:
1381  explicit QCPMarginGroup(QCustomPlot *parentPlot);
1382  virtual ~QCPMarginGroup();
1383 
1384  // non-virtual methods:
1385  QList<QCPLayoutElement *> elements(QCP::MarginSide side) const {
1386  return mChildren.value(side);
1387  }
1388  bool isEmpty() const;
1389  void clear();
1390 
1391 protected:
1392  // non-property members:
1394  QHash<QCP::MarginSide, QList<QCPLayoutElement *>> mChildren;
1395 
1396  // introduced virtual methods:
1397  virtual int commonMargin(QCP::MarginSide side) const;
1398 
1399  // non-virtual methods:
1400  void addChild(QCP::MarginSide side, QCPLayoutElement *element);
1401  void removeChild(QCP::MarginSide side, QCPLayoutElement *element);
1402 
1403 private:
1404  Q_DISABLE_COPY(QCPMarginGroup)
1405 
1406  friend class QCPLayoutElement;
1407 };
1408 
1410  Q_OBJECT
1412  Q_PROPERTY(QCPLayout *layout READ layout)
1413  Q_PROPERTY(QRect rect READ rect)
1414  Q_PROPERTY(QRect outerRect READ outerRect WRITE setOuterRect)
1415  Q_PROPERTY(QMargins margins READ margins WRITE setMargins)
1416  Q_PROPERTY(
1417  QMargins minimumMargins READ minimumMargins WRITE setMinimumMargins)
1418  Q_PROPERTY(QSize minimumSize READ minimumSize WRITE setMinimumSize)
1419  Q_PROPERTY(QSize maximumSize READ maximumSize WRITE setMaximumSize)
1420  Q_PROPERTY(SizeConstraintRect sizeConstraintRect READ sizeConstraintRect
1421  WRITE setSizeConstraintRect)
1423 public:
1430  upPreparation
1432  ,
1433  upMargins
1434  ,
1435  upLayout
1437  };
1438  Q_ENUMS(UpdatePhase)
1439 
1440 
1449  scrInnerRect
1450  ,
1451  scrOuterRect
1453  };
1454  Q_ENUMS(SizeConstraintRect)
1455 
1456  explicit QCPLayoutElement(QCustomPlot *parentPlot = 0);
1457  virtual ~QCPLayoutElement();
1458 
1459  // getters:
1460  QCPLayout *layout() const { return mParentLayout; }
1461  QRect rect() const { return mRect; }
1462  QRect outerRect() const { return mOuterRect; }
1463  QMargins margins() const { return mMargins; }
1464  QMargins minimumMargins() const { return mMinimumMargins; }
1465  QCP::MarginSides autoMargins() const { return mAutoMargins; }
1466  QSize minimumSize() const { return mMinimumSize; }
1467  QSize maximumSize() const { return mMaximumSize; }
1469  return mSizeConstraintRect;
1470  }
1472  return mMarginGroups.value(side, (QCPMarginGroup *)0);
1473  }
1474  QHash<QCP::MarginSide, QCPMarginGroup *> marginGroups() const {
1475  return mMarginGroups;
1476  }
1477 
1478  // setters:
1479  void setOuterRect(const QRect &rect);
1480  void setMargins(const QMargins &margins);
1481  void setMinimumMargins(const QMargins &margins);
1482  void setAutoMargins(QCP::MarginSides sides);
1483  void setMinimumSize(const QSize &size);
1484  void setMinimumSize(int width, int height);
1485  void setMaximumSize(const QSize &size);
1486  void setMaximumSize(int width, int height);
1487  void setSizeConstraintRect(SizeConstraintRect constraintRect);
1488  void setMarginGroup(QCP::MarginSides sides, QCPMarginGroup *group);
1489 
1490  // introduced virtual methods:
1491  virtual void update(UpdatePhase phase);
1492  virtual QSize minimumOuterSizeHint() const;
1493  virtual QSize maximumOuterSizeHint() const;
1494  virtual QList<QCPLayoutElement *> elements(bool recursive) const;
1495 
1496  // reimplemented virtual methods:
1497  virtual double selectTest(const QPointF &pos,
1498  bool onlySelectable,
1499  QVariant *details = 0) const Q_DECL_OVERRIDE;
1500 
1501 protected:
1502  // property members:
1503  QCPLayout *mParentLayout;
1504  QSize mMinimumSize, mMaximumSize;
1505  SizeConstraintRect mSizeConstraintRect;
1506  QRect mRect, mOuterRect;
1507  QMargins mMargins, mMinimumMargins;
1508  QCP::MarginSides mAutoMargins;
1509  QHash<QCP::MarginSide, QCPMarginGroup *> mMarginGroups;
1510 
1511  // introduced virtual methods:
1512  virtual int calculateAutoMargin(QCP::MarginSide side);
1513  virtual void layoutChanged();
1514 
1515  // reimplemented virtual methods:
1516  virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const
1517  Q_DECL_OVERRIDE {
1518  Q_UNUSED(painter)
1519  }
1520  virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE { Q_UNUSED(painter) }
1521  virtual void parentPlotInitialized(QCustomPlot *parentPlot) Q_DECL_OVERRIDE;
1522 
1523 private:
1524  Q_DISABLE_COPY(QCPLayoutElement)
1525 
1526  friend class QCustomPlot;
1527  friend class QCPLayout;
1528  friend class QCPMarginGroup;
1529 };
1531 
1533  Q_OBJECT
1534 public:
1535  explicit QCPLayout();
1536 
1537  // reimplemented virtual methods:
1538  virtual void update(UpdatePhase phase) Q_DECL_OVERRIDE;
1539  virtual QList<QCPLayoutElement *> elements(bool recursive) const
1541 
1542  // introduced virtual methods:
1543  virtual int elementCount() const = 0;
1544  virtual QCPLayoutElement *elementAt(int index) const = 0;
1545  virtual QCPLayoutElement *takeAt(int index) = 0;
1546  virtual bool take(QCPLayoutElement *element) = 0;
1547  virtual void simplify();
1548 
1549  // non-virtual methods:
1550  bool removeAt(int index);
1551  bool remove(QCPLayoutElement *element);
1552  void clear();
1553 
1554 protected:
1555  // introduced virtual methods:
1556  virtual void updateLayout();
1557 
1558  // non-virtual methods:
1559  void sizeConstraintsChanged() const;
1560  void adoptElement(QCPLayoutElement *el);
1561  void releaseElement(QCPLayoutElement *el);
1562  QVector<int> getSectionSizes(QVector<int> maxSizes,
1563  QVector<int> minSizes,
1564  QVector<double> stretchFactors,
1565  int totalSize) const;
1566  static QSize getFinalMinimumOuterSize(const QCPLayoutElement *el);
1567  static QSize getFinalMaximumOuterSize(const QCPLayoutElement *el);
1568 
1569 private:
1570  Q_DISABLE_COPY(QCPLayout)
1571  friend class QCPLayoutElement;
1572 };
1573 
1575  Q_OBJECT
1577  Q_PROPERTY(int rowCount READ rowCount)
1578  Q_PROPERTY(int columnCount READ columnCount)
1579  Q_PROPERTY(QList<double> columnStretchFactors READ columnStretchFactors
1580  WRITE setColumnStretchFactors)
1581  Q_PROPERTY(QList<double> rowStretchFactors READ rowStretchFactors WRITE
1582  setRowStretchFactors)
1583  Q_PROPERTY(int columnSpacing READ columnSpacing WRITE setColumnSpacing)
1584  Q_PROPERTY(int rowSpacing READ rowSpacing WRITE setRowSpacing)
1585  Q_PROPERTY(FillOrder fillOrder READ fillOrder WRITE setFillOrder)
1586  Q_PROPERTY(int wrap READ wrap WRITE setWrap)
1588 public:
1596  enum FillOrder {
1597  foRowsFirst
1600  ,
1601  foColumnsFirst
1604  };
1605  Q_ENUMS(FillOrder)
1606 
1607  explicit QCPLayoutGrid();
1608  virtual ~QCPLayoutGrid();
1609 
1610  // getters:
1611  int rowCount() const { return mElements.size(); }
1612  int columnCount() const {
1613  return mElements.size() > 0 ? mElements.first().size() : 0;
1614  }
1615  QList<double> columnStretchFactors() const { return mColumnStretchFactors; }
1616  QList<double> rowStretchFactors() const { return mRowStretchFactors; }
1617  int columnSpacing() const { return mColumnSpacing; }
1618  int rowSpacing() const { return mRowSpacing; }
1619  int wrap() const { return mWrap; }
1620  FillOrder fillOrder() const { return mFillOrder; }
1621 
1622  // setters:
1623  void setColumnStretchFactor(int column, double factor);
1624  void setColumnStretchFactors(const QList<double> &factors);
1625  void setRowStretchFactor(int row, double factor);
1626  void setRowStretchFactors(const QList<double> &factors);
1627  void setColumnSpacing(int pixels);
1628  void setRowSpacing(int pixels);
1629  void setWrap(int count);
1630  void setFillOrder(FillOrder order, bool rearrange = true);
1631 
1632  // reimplemented virtual methods:
1633  virtual void updateLayout() Q_DECL_OVERRIDE;
1634  virtual int elementCount() const Q_DECL_OVERRIDE {
1635  return rowCount() * columnCount();
1636  }
1637  virtual QCPLayoutElement *elementAt(int index) const Q_DECL_OVERRIDE;
1638  virtual QCPLayoutElement *takeAt(int index) Q_DECL_OVERRIDE;
1639  virtual bool take(QCPLayoutElement *element) Q_DECL_OVERRIDE;
1640  virtual QList<QCPLayoutElement *> elements(bool recursive) const
1642  virtual void simplify() Q_DECL_OVERRIDE;
1643  virtual QSize minimumOuterSizeHint() const Q_DECL_OVERRIDE;
1644  virtual QSize maximumOuterSizeHint() const Q_DECL_OVERRIDE;
1645 
1646  // non-virtual methods:
1647  QCPLayoutElement *element(int row, int column) const;
1648  bool addElement(int row, int column, QCPLayoutElement *element);
1649  bool addElement(QCPLayoutElement *element);
1650  bool hasElement(int row, int column);
1651  void expandTo(int newRowCount, int newColumnCount);
1652  void insertRow(int newIndex);
1653  void insertColumn(int newIndex);
1654  int rowColToIndex(int row, int column) const;
1655  void indexToRowCol(int index, int &row, int &column) const;
1656 
1657 protected:
1658  // property members:
1659  QList<QList<QCPLayoutElement *>> mElements;
1660  QList<double> mColumnStretchFactors;
1661  QList<double> mRowStretchFactors;
1662  int mColumnSpacing, mRowSpacing;
1663  int mWrap;
1664  FillOrder mFillOrder;
1665 
1666  // non-virtual methods:
1667  void getMinimumRowColSizes(QVector<int> *minColWidths,
1668  QVector<int> *minRowHeights) const;
1669  void getMaximumRowColSizes(QVector<int> *maxColWidths,
1670  QVector<int> *maxRowHeights) const;
1671 
1672 private:
1673  Q_DISABLE_COPY(QCPLayoutGrid)
1674 };
1676 
1678  Q_OBJECT
1679 public:
1685  ipFree
1687  ,
1688  ipBorderAligned
1690  };
1691  Q_ENUMS(InsetPlacement)
1692 
1693  explicit QCPLayoutInset();
1694  virtual ~QCPLayoutInset();
1695 
1696  // getters:
1697  InsetPlacement insetPlacement(int index) const;
1698  Qt::Alignment insetAlignment(int index) const;
1699  QRectF insetRect(int index) const;
1700 
1701  // setters:
1702  void setInsetPlacement(int index, InsetPlacement placement);
1703  void setInsetAlignment(int index, Qt::Alignment alignment);
1704  void setInsetRect(int index, const QRectF &rect);
1705 
1706  // reimplemented virtual methods:
1707  virtual void updateLayout() Q_DECL_OVERRIDE;
1708  virtual int elementCount() const Q_DECL_OVERRIDE;
1709  virtual QCPLayoutElement *elementAt(int index) const Q_DECL_OVERRIDE;
1710  virtual QCPLayoutElement *takeAt(int index) Q_DECL_OVERRIDE;
1711  virtual bool take(QCPLayoutElement *element) Q_DECL_OVERRIDE;
1712  virtual void simplify() Q_DECL_OVERRIDE {}
1713  virtual double selectTest(const QPointF &pos,
1714  bool onlySelectable,
1715  QVariant *details = 0) const Q_DECL_OVERRIDE;
1716 
1717  // non-virtual methods:
1718  void addElement(QCPLayoutElement *element, Qt::Alignment alignment);
1719  void addElement(QCPLayoutElement *element, const QRectF &rect);
1720 
1721 protected:
1722  // property members:
1723  QList<QCPLayoutElement *> mElements;
1724  QList<InsetPlacement> mInsetPlacement;
1725  QList<Qt::Alignment> mInsetAlignment;
1726  QList<QRectF> mInsetRect;
1727 
1728 private:
1729  Q_DISABLE_COPY(QCPLayoutInset)
1730 };
1732 
1733 /* end of 'src/layout.h' */
1734 
1735 /* including file 'src/lineending.h', size 4426 */
1736 /* commit ce344b3f96a62e5f652585e55f1ae7c7883cd45b 2018-06-25 01:03:39 +0200 */
1737 
1739  Q_GADGET
1740 public:
1755  esNone
1756  ,
1757  esFlatArrow
1759  ,
1760  esSpikeArrow
1761  ,
1762  esLineArrow
1763  ,
1764  esDisc
1765  ,
1766  esSquare
1767  ,
1768  esDiamond
1769  ,
1770  esBar
1771  ,
1772  esHalfBar
1775  ,
1776  esSkewedBar
1778  };
1779  Q_ENUMS(EndingStyle)
1780 
1781  QCPLineEnding();
1782  QCPLineEnding(EndingStyle style,
1783  double width = 8,
1784  double length = 10,
1785  bool inverted = false);
1786 
1787  // getters:
1788  EndingStyle style() const { return mStyle; }
1789  double width() const { return mWidth; }
1790  double length() const { return mLength; }
1791  bool inverted() const { return mInverted; }
1792 
1793  // setters:
1794  void setStyle(EndingStyle style);
1795  void setWidth(double width);
1796  void setLength(double length);
1797  void setInverted(bool inverted);
1798 
1799  // non-property methods:
1800  double boundingDistance() const;
1801  double realLength() const;
1802  void draw(QCPPainter *painter,
1803  const QCPVector2D &pos,
1804  const QCPVector2D &dir) const;
1805  void draw(QCPPainter *painter, const QCPVector2D &pos, double angle) const;
1806 
1807 protected:
1808  // property members:
1810  double mWidth, mLength;
1812 };
1815 
1816 /* end of 'src/lineending.h' */
1817 
1818 /* including file 'src/axis/axisticker.h', size 4224 */
1819 /* commit ce344b3f96a62e5f652585e55f1ae7c7883cd45b 2018-06-25 01:03:39 +0200 */
1820 
1822  Q_GADGET
1823 public:
1831  tssReadability
1834  ,
1835  tssMeetTickCount
1838  };
1839  Q_ENUMS(TickStepStrategy)
1840 
1841  QCPAxisTicker();
1842  virtual ~QCPAxisTicker();
1843 
1844  // getters:
1845  TickStepStrategy tickStepStrategy() const { return mTickStepStrategy; }
1846  int tickCount() const { return mTickCount; }
1847  double tickOrigin() const { return mTickOrigin; }
1848 
1849  // setters:
1850  void setTickStepStrategy(TickStepStrategy strategy);
1851  void setTickCount(int count);
1852  void setTickOrigin(double origin);
1853 
1854  // introduced virtual methods:
1855  virtual void generate(const QCPRange &range,
1856  const QLocale &locale,
1857  QChar formatChar,
1858  int precision,
1859  QVector<double> &ticks,
1860  QVector<double> *subTicks,
1861  QVector<QString> *tickLabels);
1862 
1863 protected:
1864  // property members:
1867  double mTickOrigin;
1868 
1869  // introduced virtual methods:
1870  virtual double getTickStep(const QCPRange &range);
1871  virtual int getSubTickCount(double tickStep);
1872  virtual QString getTickLabel(double tick,
1873  const QLocale &locale,
1874  QChar formatChar,
1875  int precision);
1876  virtual QVector<double> createTickVector(double tickStep,
1877  const QCPRange &range);
1878  virtual QVector<double> createSubTickVector(int subTickCount,
1879  const QVector<double> &ticks);
1880  virtual QVector<QString> createLabelVector(const QVector<double> &ticks,
1881  const QLocale &locale,
1882  QChar formatChar,
1883  int precision);
1884 
1885  // non-virtual methods:
1886  void trimTicks(const QCPRange &range,
1887  QVector<double> &ticks,
1888  bool keepOneOutlier) const;
1889  double pickClosest(double target, const QVector<double> &candidates) const;
1890  double getMantissa(double input, double *magnitude = 0) const;
1891  double cleanMantissa(double input) const;
1892 
1893 private:
1894  Q_DISABLE_COPY(QCPAxisTicker)
1895 };
1897 Q_DECLARE_METATYPE(QSharedPointer<QCPAxisTicker>)
1898 
1899 /* end of 'src/axis/axisticker.h' */
1900 
1901 /* including file 'src/axis/axistickerdatetime.h', size 3289 */
1902 /* commit ce344b3f96a62e5f652585e55f1ae7c7883cd45b 2018-06-25 01:03:39 +0200 */
1903 
1905 public:
1907 
1908  // getters:
1909  QString dateTimeFormat() const { return mDateTimeFormat; }
1910  Qt::TimeSpec dateTimeSpec() const { return mDateTimeSpec; }
1911 
1912  // setters:
1913  void setDateTimeFormat(const QString &format);
1914  void setDateTimeSpec(Qt::TimeSpec spec);
1915  void setTickOrigin(double origin); // hides base class method but calls
1916  // baseclass implementation ("using"
1917  // throws off IDEs and doxygen)
1918  void setTickOrigin(const QDateTime &origin);
1919 
1920  // static methods:
1921  static QDateTime keyToDateTime(double key);
1922  static double dateTimeToKey(const QDateTime dateTime);
1923  static double dateTimeToKey(const QDate date);
1924 
1925 protected:
1926  // property members:
1928  Qt::TimeSpec mDateTimeSpec;
1929 
1930  // non-property members:
1934  dsUniformDayInMonth
1935  } mDateStrategy;
1936 
1937  // reimplemented virtual methods:
1938  virtual double getTickStep(const QCPRange &range) Q_DECL_OVERRIDE;
1939  virtual int getSubTickCount(double tickStep) Q_DECL_OVERRIDE;
1940  virtual QString getTickLabel(double tick,
1941  const QLocale &locale,
1942  QChar formatChar,
1943  int precision) Q_DECL_OVERRIDE;
1944  virtual QVector<double> createTickVector(
1945  double tickStep, const QCPRange &range) Q_DECL_OVERRIDE;
1946 };
1947 
1948 /* end of 'src/axis/axistickerdatetime.h' */
1949 
1950 /* including file 'src/axis/axistickertime.h', size 3542 */
1951 /* commit ce344b3f96a62e5f652585e55f1ae7c7883cd45b 2018-06-25 01:03:39 +0200 */
1952 
1954  Q_GADGET
1955 public:
1962  enum TimeUnit {
1963  tuMilliseconds
1965  ,
1966  tuSeconds
1967  ,
1968  tuMinutes
1969  ,
1970  tuHours
1971  ,
1972  tuDays
1973  };
1974  Q_ENUMS(TimeUnit)
1975 
1977 
1978  // getters:
1979  QString timeFormat() const { return mTimeFormat; }
1980  int fieldWidth(TimeUnit unit) const { return mFieldWidth.value(unit); }
1981 
1982  // setters:
1983  void setTimeFormat(const QString &format);
1984  void setFieldWidth(TimeUnit unit, int width);
1985 
1986 protected:
1987  // property members:
1988  QString mTimeFormat;
1989  QHash<TimeUnit, int> mFieldWidth;
1990 
1991  // non-property members:
1992  TimeUnit mSmallestUnit, mBiggestUnit;
1993  QHash<TimeUnit, QString> mFormatPattern;
1994 
1995  // reimplemented virtual methods:
1996  virtual double getTickStep(const QCPRange &range) Q_DECL_OVERRIDE;
1997  virtual int getSubTickCount(double tickStep) Q_DECL_OVERRIDE;
1998  virtual QString getTickLabel(double tick,
1999  const QLocale &locale,
2000  QChar formatChar,
2001  int precision) Q_DECL_OVERRIDE;
2002 
2003  // non-virtual methods:
2004  void replaceUnit(QString &text, TimeUnit unit, int value) const;
2005 };
2007 
2008 /* end of 'src/axis/axistickertime.h' */
2009 
2010 /* including file 'src/axis/axistickerfixed.h', size 3308 */
2011 /* commit ce344b3f96a62e5f652585e55f1ae7c7883cd45b 2018-06-25 01:03:39 +0200 */
2012 
2014  Q_GADGET
2015 public:
2023  ssNone
2026  ,
2027  ssMultiples
2031  ,
2032  ssPowers
2033  };
2034  Q_ENUMS(ScaleStrategy)
2035 
2037 
2038  // getters:
2039  double tickStep() const { return mTickStep; }
2040  ScaleStrategy scaleStrategy() const { return mScaleStrategy; }
2041 
2042  // setters:
2043  void setTickStep(double step);
2044  void setScaleStrategy(ScaleStrategy strategy);
2045 
2046 protected:
2047  // property members:
2048  double mTickStep;
2050 
2051  // reimplemented virtual methods:
2052  virtual double getTickStep(const QCPRange &range) Q_DECL_OVERRIDE;
2053 };
2055 
2056 /* end of 'src/axis/axistickerfixed.h' */
2057 
2058 /* including file 'src/axis/axistickertext.h', size 3090 */
2059 /* commit ce344b3f96a62e5f652585e55f1ae7c7883cd45b 2018-06-25 01:03:39 +0200 */
2060 
2062 public:
2064 
2065  // getters:
2066  QMap<double, QString> &ticks() { return mTicks; }
2067  int subTickCount() const { return mSubTickCount; }
2068 
2069  // setters:
2070  void setTicks(const QMap<double, QString> &ticks);
2071  void setTicks(const QVector<double> &positions,
2072  const QVector<QString> &labels);
2073  void setSubTickCount(int subTicks);
2074 
2075  // non-virtual methods:
2076  void clear();
2077  void addTick(double position, const QString &label);
2078  void addTicks(const QMap<double, QString> &ticks);
2079  void addTicks(const QVector<double> &positions,
2080  const QVector<QString> &labels);
2081 
2082 protected:
2083  // property members:
2084  QMap<double, QString> mTicks;
2086 
2087  // reimplemented virtual methods:
2088  virtual double getTickStep(const QCPRange &range) Q_DECL_OVERRIDE;
2089  virtual int getSubTickCount(double tickStep) Q_DECL_OVERRIDE;
2090  virtual QString getTickLabel(double tick,
2091  const QLocale &locale,
2092  QChar formatChar,
2093  int precision) Q_DECL_OVERRIDE;
2094  virtual QVector<double> createTickVector(
2095  double tickStep, const QCPRange &range) Q_DECL_OVERRIDE;
2096 };
2097 
2098 /* end of 'src/axis/axistickertext.h' */
2099 
2100 /* including file 'src/axis/axistickerpi.h', size 3911 */
2101 /* commit ce344b3f96a62e5f652585e55f1ae7c7883cd45b 2018-06-25 01:03:39 +0200 */
2102 
2104  Q_GADGET
2105 public:
2112  fsFloatingPoint
2114  ,
2115  fsAsciiFractions
2117  ,
2118  fsUnicodeFractions
2121  };
2122  Q_ENUMS(FractionStyle)
2123 
2124  QCPAxisTickerPi();
2125 
2126  // getters:
2127  QString piSymbol() const { return mPiSymbol; }
2128  double piValue() const { return mPiValue; }
2129  bool periodicity() const { return mPeriodicity; }
2130  FractionStyle fractionStyle() const { return mFractionStyle; }
2131 
2132  // setters:
2133  void setPiSymbol(QString symbol);
2134  void setPiValue(double pi);
2135  void setPeriodicity(int multiplesOfPi);
2136  void setFractionStyle(FractionStyle style);
2137 
2138 protected:
2139  // property members:
2140  QString mPiSymbol;
2141  double mPiValue;
2144 
2145  // non-property members:
2146  double mPiTickStep; // size of one tick step in units of mPiValue
2147 
2148  // reimplemented virtual methods:
2149  virtual double getTickStep(const QCPRange &range) Q_DECL_OVERRIDE;
2150  virtual int getSubTickCount(double tickStep) Q_DECL_OVERRIDE;
2151  virtual QString getTickLabel(double tick,
2152  const QLocale &locale,
2153  QChar formatChar,
2154  int precision) Q_DECL_OVERRIDE;
2155 
2156  // non-virtual methods:
2157  void simplifyFraction(int &numerator, int &denominator) const;
2158  QString fractionToString(int numerator, int denominator) const;
2159  QString unicodeFraction(int numerator, int denominator) const;
2160  QString unicodeSuperscript(int number) const;
2161  QString unicodeSubscript(int number) const;
2162 };
2164 
2165 /* end of 'src/axis/axistickerpi.h' */
2166 
2167 /* including file 'src/axis/axistickerlog.h', size 2663 */
2168 /* commit ce344b3f96a62e5f652585e55f1ae7c7883cd45b 2018-06-25 01:03:39 +0200 */
2169 
2171 public:
2172  QCPAxisTickerLog();
2173 
2174  // getters:
2175  double logBase() const { return mLogBase; }
2176  int subTickCount() const { return mSubTickCount; }
2177 
2178  // setters:
2179  void setLogBase(double base);
2180  void setSubTickCount(int subTicks);
2181 
2182 protected:
2183  // property members:
2184  double mLogBase;
2186 
2187  // non-property members:
2189 
2190  // reimplemented virtual methods:
2191  virtual double getTickStep(const QCPRange &range) Q_DECL_OVERRIDE;
2192  virtual int getSubTickCount(double tickStep) Q_DECL_OVERRIDE;
2193  virtual QVector<double> createTickVector(
2194  double tickStep, const QCPRange &range) Q_DECL_OVERRIDE;
2195 };
2196 
2197 /* end of 'src/axis/axistickerlog.h' */
2198 
2199 /* including file 'src/axis/axis.h', size 20698 */
2200 /* commit ce344b3f96a62e5f652585e55f1ae7c7883cd45b 2018-06-25 01:03:39 +0200 */
2201 
2203  Q_OBJECT
2205  Q_PROPERTY(bool subGridVisible READ subGridVisible WRITE setSubGridVisible)
2206  Q_PROPERTY(bool antialiasedSubGrid READ antialiasedSubGrid WRITE
2207  setAntialiasedSubGrid)
2208  Q_PROPERTY(bool antialiasedZeroLine READ antialiasedZeroLine WRITE
2209  setAntialiasedZeroLine)
2210  Q_PROPERTY(QPen pen READ pen WRITE setPen)
2211  Q_PROPERTY(QPen subGridPen READ subGridPen WRITE setSubGridPen)
2212  Q_PROPERTY(QPen zeroLinePen READ zeroLinePen WRITE setZeroLinePen)
2214 public:
2215  explicit QCPGrid(QCPAxis *parentAxis);
2216 
2217  // getters:
2218  bool subGridVisible() const { return mSubGridVisible; }
2219  bool antialiasedSubGrid() const { return mAntialiasedSubGrid; }
2220  bool antialiasedZeroLine() const { return mAntialiasedZeroLine; }
2221  QPen pen() const { return mPen; }
2222  QPen subGridPen() const { return mSubGridPen; }
2223  QPen zeroLinePen() const { return mZeroLinePen; }
2224 
2225  // setters:
2226  void setSubGridVisible(bool visible);
2227  void setAntialiasedSubGrid(bool enabled);
2228  void setAntialiasedZeroLine(bool enabled);
2229  void setPen(const QPen &pen);
2230  void setSubGridPen(const QPen &pen);
2231  void setZeroLinePen(const QPen &pen);
2232 
2233 protected:
2234  // property members:
2236  bool mAntialiasedSubGrid, mAntialiasedZeroLine;
2237  QPen mPen, mSubGridPen, mZeroLinePen;
2238 
2239  // non-property members:
2241 
2242  // reimplemented virtual methods:
2243  virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const
2245  virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
2246 
2247  // non-virtual methods:
2248  void drawGridLines(QCPPainter *painter) const;
2249  void drawSubGridLines(QCPPainter *painter) const;
2250 
2251  friend class QCPAxis;
2252 };
2253 
2255  Q_OBJECT
2257  Q_PROPERTY(AxisType axisType READ axisType)
2258  Q_PROPERTY(QCPAxisRect *axisRect READ axisRect)
2259  Q_PROPERTY(ScaleType scaleType READ scaleType WRITE setScaleType NOTIFY
2260  scaleTypeChanged)
2261  Q_PROPERTY(QCPRange range READ range WRITE setRange NOTIFY rangeChanged)
2262  Q_PROPERTY(bool rangeReversed READ rangeReversed WRITE setRangeReversed)
2263  Q_PROPERTY(QSharedPointer<QCPAxisTicker> ticker READ ticker WRITE setTicker)
2264  Q_PROPERTY(bool ticks READ ticks WRITE setTicks)
2265  Q_PROPERTY(bool tickLabels READ tickLabels WRITE setTickLabels)
2266  Q_PROPERTY(int tickLabelPadding READ tickLabelPadding WRITE
2267  setTickLabelPadding)
2268  Q_PROPERTY(QFont tickLabelFont READ tickLabelFont WRITE setTickLabelFont)
2269  Q_PROPERTY(
2270  QColor tickLabelColor READ tickLabelColor WRITE setTickLabelColor)
2271  Q_PROPERTY(double tickLabelRotation READ tickLabelRotation WRITE
2272  setTickLabelRotation)
2273  Q_PROPERTY(
2274  LabelSide tickLabelSide READ tickLabelSide WRITE setTickLabelSide)
2275  Q_PROPERTY(QString numberFormat READ numberFormat WRITE setNumberFormat)
2276  Q_PROPERTY(
2277  int numberPrecision READ numberPrecision WRITE setNumberPrecision)
2278  Q_PROPERTY(QVector<double> tickVector READ tickVector)
2279  Q_PROPERTY(QVector<QString> tickVectorLabels READ tickVectorLabels)
2280  Q_PROPERTY(int tickLengthIn READ tickLengthIn WRITE setTickLengthIn)
2281  Q_PROPERTY(int tickLengthOut READ tickLengthOut WRITE setTickLengthOut)
2282  Q_PROPERTY(bool subTicks READ subTicks WRITE setSubTicks)
2283  Q_PROPERTY(
2284  int subTickLengthIn READ subTickLengthIn WRITE setSubTickLengthIn)
2285  Q_PROPERTY(int subTickLengthOut READ subTickLengthOut WRITE
2286  setSubTickLengthOut)
2287  Q_PROPERTY(QPen basePen READ basePen WRITE setBasePen)
2288  Q_PROPERTY(QPen tickPen READ tickPen WRITE setTickPen)
2289  Q_PROPERTY(QPen subTickPen READ subTickPen WRITE setSubTickPen)
2290  Q_PROPERTY(QFont labelFont READ labelFont WRITE setLabelFont)
2291  Q_PROPERTY(QColor labelColor READ labelColor WRITE setLabelColor)
2292  Q_PROPERTY(QString label READ label WRITE setLabel)
2293  Q_PROPERTY(int labelPadding READ labelPadding WRITE setLabelPadding)
2294  Q_PROPERTY(int padding READ padding WRITE setPadding)
2295  Q_PROPERTY(int offset READ offset WRITE setOffset)
2296  Q_PROPERTY(SelectableParts selectedParts READ selectedParts WRITE
2297  setSelectedParts NOTIFY selectionChanged)
2298  Q_PROPERTY(SelectableParts selectableParts READ selectableParts WRITE
2299  setSelectableParts NOTIFY selectableChanged)
2300  Q_PROPERTY(QFont selectedTickLabelFont READ selectedTickLabelFont WRITE
2301  setSelectedTickLabelFont)
2302  Q_PROPERTY(QFont selectedLabelFont READ selectedLabelFont WRITE
2303  setSelectedLabelFont)
2304  Q_PROPERTY(QColor selectedTickLabelColor READ selectedTickLabelColor WRITE
2305  setSelectedTickLabelColor)
2306  Q_PROPERTY(QColor selectedLabelColor READ selectedLabelColor WRITE
2307  setSelectedLabelColor)
2308  Q_PROPERTY(
2309  QPen selectedBasePen READ selectedBasePen WRITE setSelectedBasePen)
2310  Q_PROPERTY(
2311  QPen selectedTickPen READ selectedTickPen WRITE setSelectedTickPen)
2312  Q_PROPERTY(QPen selectedSubTickPen READ selectedSubTickPen WRITE
2313  setSelectedSubTickPen)
2314  Q_PROPERTY(QCPLineEnding lowerEnding READ lowerEnding WRITE setLowerEnding)
2315  Q_PROPERTY(QCPLineEnding upperEnding READ upperEnding WRITE setUpperEnding)
2316  Q_PROPERTY(QCPGrid *grid READ grid)
2318 public:
2324  enum AxisType {
2325  atLeft = 0x01
2327  ,
2328  atRight = 0x02
2330  ,
2331  atTop = 0x04
2333  ,
2334  atBottom = 0x08
2336  };
2337  Q_ENUMS(AxisType)
2338  Q_FLAGS(AxisTypes)
2339  Q_DECLARE_FLAGS(AxisTypes, AxisType)
2345  enum LabelSide {
2346  lsInside
2348  ,
2349  lsOutside
2350  };
2351  Q_ENUMS(LabelSide)
2356  enum ScaleType {
2357  stLinear
2358  ,
2359  stLogarithmic
2362  };
2363  Q_ENUMS(ScaleType)
2369  spNone = 0
2370  ,
2371  spAxis = 0x001
2372  ,
2373  spTickLabels = 0x002
2375  ,
2376  spAxisLabel = 0x004
2377  };
2378  Q_ENUMS(SelectablePart)
2379  Q_FLAGS(SelectableParts)
2380  Q_DECLARE_FLAGS(SelectableParts, SelectablePart)
2381 
2382  explicit QCPAxis(QCPAxisRect *parent, AxisType type);
2383  virtual ~QCPAxis();
2384 
2385  // getters:
2386  AxisType axisType() const { return mAxisType; }
2387  QCPAxisRect *axisRect() const { return mAxisRect; }
2388  ScaleType scaleType() const { return mScaleType; }
2389  const QCPRange range() const { return mRange; }
2390  bool rangeReversed() const { return mRangeReversed; }
2391  QSharedPointer<QCPAxisTicker> ticker() const { return mTicker; }
2392  bool ticks() const { return mTicks; }
2393  bool tickLabels() const { return mTickLabels; }
2394  int tickLabelPadding() const;
2395  QFont tickLabelFont() const { return mTickLabelFont; }
2396  QColor tickLabelColor() const { return mTickLabelColor; }
2397  double tickLabelRotation() const;
2398  LabelSide tickLabelSide() const;
2399  QString numberFormat() const;
2400  int numberPrecision() const { return mNumberPrecision; }
2401  QVector<double> tickVector() const { return mTickVector; }
2402  QVector<QString> tickVectorLabels() const { return mTickVectorLabels; }
2403  int tickLengthIn() const;
2404  int tickLengthOut() const;
2405  bool subTicks() const { return mSubTicks; }
2406  int subTickLengthIn() const;
2407  int subTickLengthOut() const;
2408  QPen basePen() const { return mBasePen; }
2409  QPen tickPen() const { return mTickPen; }
2410  QPen subTickPen() const { return mSubTickPen; }
2411  QFont labelFont() const { return mLabelFont; }
2412  QColor labelColor() const { return mLabelColor; }
2413  QString label() const { return mLabel; }
2414  int labelPadding() const;
2415  int padding() const { return mPadding; }
2416  int offset() const;
2417  SelectableParts selectedParts() const { return mSelectedParts; }
2418  SelectableParts selectableParts() const { return mSelectableParts; }
2419  QFont selectedTickLabelFont() const { return mSelectedTickLabelFont; }
2420  QFont selectedLabelFont() const { return mSelectedLabelFont; }
2421  QColor selectedTickLabelColor() const { return mSelectedTickLabelColor; }
2422  QColor selectedLabelColor() const { return mSelectedLabelColor; }
2423  QPen selectedBasePen() const { return mSelectedBasePen; }
2424  QPen selectedTickPen() const { return mSelectedTickPen; }
2425  QPen selectedSubTickPen() const { return mSelectedSubTickPen; }
2426  QCPLineEnding lowerEnding() const;
2427  QCPLineEnding upperEnding() const;
2428  QCPGrid *grid() const { return mGrid; }
2429 
2430  // setters:
2431  Q_SLOT void setScaleType(QCPAxis::ScaleType type);
2432  Q_SLOT void setRange(const QCPRange &range);
2433  void setRange(double lower, double upper);
2434  void setRange(double position, double size, Qt::AlignmentFlag alignment);
2435  void setRangeLower(double lower);
2436  void setRangeUpper(double upper);
2437  void setRangeReversed(bool reversed);
2438  void setTicker(QSharedPointer<QCPAxisTicker> ticker);
2439  void setTicks(bool show);
2440  void setTickLabels(bool show);
2441  void setTickLabelPadding(int padding);
2442  void setTickLabelFont(const QFont &font);
2443  void setTickLabelColor(const QColor &color);
2444  void setTickLabelRotation(double degrees);
2445  void setTickLabelSide(LabelSide side);
2446  void setNumberFormat(const QString &formatCode);
2447  void setNumberPrecision(int precision);
2448  void setTickLength(int inside, int outside = 0);
2449  void setTickLengthIn(int inside);
2450  void setTickLengthOut(int outside);
2451  void setSubTicks(bool show);
2452  void setSubTickLength(int inside, int outside = 0);
2453  void setSubTickLengthIn(int inside);
2454  void setSubTickLengthOut(int outside);
2455  void setBasePen(const QPen &pen);
2456  void setTickPen(const QPen &pen);
2457  void setSubTickPen(const QPen &pen);
2458  void setLabelFont(const QFont &font);
2459  void setLabelColor(const QColor &color);
2460  void setLabel(const QString &str);
2461  void setLabelPadding(int padding);
2462  void setPadding(int padding);
2463  void setOffset(int offset);
2464  void setSelectedTickLabelFont(const QFont &font);
2465  void setSelectedLabelFont(const QFont &font);
2466  void setSelectedTickLabelColor(const QColor &color);
2467  void setSelectedLabelColor(const QColor &color);
2468  void setSelectedBasePen(const QPen &pen);
2469  void setSelectedTickPen(const QPen &pen);
2470  void setSelectedSubTickPen(const QPen &pen);
2471  Q_SLOT void setSelectableParts(
2472  const QCPAxis::SelectableParts &selectableParts);
2473  Q_SLOT void setSelectedParts(const QCPAxis::SelectableParts &selectedParts);
2474  void setLowerEnding(const QCPLineEnding &ending);
2475  void setUpperEnding(const QCPLineEnding &ending);
2476 
2477  // reimplemented virtual methods:
2478  virtual double selectTest(const QPointF &pos,
2479  bool onlySelectable,
2480  QVariant *details = 0) const Q_DECL_OVERRIDE;
2481 
2482  // non-property methods:
2483  Qt::Orientation orientation() const { return mOrientation; }
2484  int pixelOrientation() const {
2485  return rangeReversed() != (orientation() == Qt::Vertical) ? -1 : 1;
2486  }
2487  void moveRange(double diff);
2488  void scaleRange(double factor);
2489  void scaleRange(double factor, double center);
2490  void setScaleRatio(const QCPAxis *otherAxis, double ratio = 1.0);
2491  void rescale(bool onlyVisiblePlottables = false);
2492  double pixelToCoord(double value) const;
2493  double coordToPixel(double value) const;
2494  SelectablePart getPartAt(const QPointF &pos) const;
2495  QList<QCPAbstractPlottable *> plottables() const;
2496  QList<QCPGraph *> graphs() const;
2497  QList<QCPAbstractItem *> items() const;
2498 
2499  static AxisType marginSideToAxisType(QCP::MarginSide side);
2500  static Qt::Orientation orientation(AxisType type) {
2501  return type == atBottom || type == atTop ? Qt::Horizontal
2502  : Qt::Vertical;
2503  }
2504  static AxisType opposite(AxisType type);
2505 
2506 signals:
2507  void rangeChanged(const QCPRange &newRange);
2508  void rangeChanged(const QCPRange &newRange, const QCPRange &oldRange);
2510  void selectionChanged(const QCPAxis::SelectableParts &parts);
2511  void selectableChanged(const QCPAxis::SelectableParts &parts);
2512 
2513 protected:
2514  // property members:
2515  // axis base:
2518  // int mOffset; // in QCPAxisPainter
2520  Qt::Orientation mOrientation;
2521  SelectableParts mSelectableParts, mSelectedParts;
2522  QPen mBasePen, mSelectedBasePen;
2523  // QCPLineEnding mLowerEnding, mUpperEnding; // in QCPAxisPainter
2524  // axis label:
2525  // int mLabelPadding; // in QCPAxisPainter
2526  QString mLabel;
2527  QFont mLabelFont, mSelectedLabelFont;
2528  QColor mLabelColor, mSelectedLabelColor;
2529  // tick labels:
2530  // int mTickLabelPadding; // in QCPAxisPainter
2532  // double mTickLabelRotation; // in QCPAxisPainter
2533  QFont mTickLabelFont, mSelectedTickLabelFont;
2534  QColor mTickLabelColor, mSelectedTickLabelColor;
2536  QLatin1Char mNumberFormatChar;
2538  // bool mNumberMultiplyCross; // QCPAxisPainter
2539  // ticks and subticks:
2540  bool mTicks;
2542  // int mTickLengthIn, mTickLengthOut, mSubTickLengthIn, mSubTickLengthOut;
2543  // // QCPAxisPainter
2544  QPen mTickPen, mSelectedTickPen;
2545  QPen mSubTickPen, mSelectedSubTickPen;
2546  // scale and range:
2550 
2551  // non-property members:
2553  QCPAxisPainterPrivate *mAxisPainter;
2554  QSharedPointer<QCPAxisTicker> mTicker;
2555  QVector<double> mTickVector;
2556  QVector<QString> mTickVectorLabels;
2557  QVector<double> mSubTickVector;
2562  QCP::AntialiasedElements mAADragBackup, mNotAADragBackup;
2563 
2564  // introduced virtual methods:
2565  virtual int calculateMargin();
2566 
2567  // reimplemented virtual methods:
2568  virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const
2570  virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
2571  virtual QCP::Interaction selectionCategory() const Q_DECL_OVERRIDE;
2572  // events:
2573  virtual void selectEvent(QMouseEvent *event,
2574  bool additive,
2575  const QVariant &details,
2576  bool *selectionStateChanged) Q_DECL_OVERRIDE;
2577  virtual void deselectEvent(bool *selectionStateChanged) Q_DECL_OVERRIDE;
2578  // mouse events:
2579  virtual void mousePressEvent(QMouseEvent *event,
2580  const QVariant &details) Q_DECL_OVERRIDE;
2581  virtual void mouseMoveEvent(QMouseEvent *event,
2582  const QPointF &startPos) Q_DECL_OVERRIDE;
2583  virtual void mouseReleaseEvent(QMouseEvent *event,
2584  const QPointF &startPos) Q_DECL_OVERRIDE;
2585  virtual void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE;
2586 
2587  // non-virtual methods:
2588  void setupTickVectors();
2589  QPen getBasePen() const;
2590  QPen getTickPen() const;
2591  QPen getSubTickPen() const;
2592  QFont getTickLabelFont() const;
2593  QFont getLabelFont() const;
2594  QColor getTickLabelColor() const;
2595  QColor getLabelColor() const;
2596 
2597 private:
2598  Q_DISABLE_COPY(QCPAxis)
2599 
2600  friend class QCustomPlot;
2601  friend class QCPGrid;
2602  friend class QCPAxisRect;
2603 };
2604 Q_DECLARE_OPERATORS_FOR_FLAGS(QCPAxis::SelectableParts)
2610 
2611 class QCPAxisPainterPrivate {
2612 public:
2613  explicit QCPAxisPainterPrivate(QCustomPlot *parentPlot);
2614  virtual ~QCPAxisPainterPrivate();
2615 
2616  virtual void draw(QCPPainter *painter);
2617  virtual int size() const;
2618  void clearCache();
2619 
2620  QRect axisSelectionBox() const { return mAxisSelectionBox; }
2621  QRect tickLabelsSelectionBox() const { return mTickLabelsSelectionBox; }
2622  QRect labelSelectionBox() const { return mLabelSelectionBox; }
2623 
2624  // public property members:
2626  QPen basePen;
2627  QCPLineEnding lowerEnding,
2628  upperEnding; // directly accessed by QCPAxis setters/getters
2629  int labelPadding; // directly accessed by QCPAxis setters/getters
2630  QFont labelFont;
2631  QColor labelColor;
2632  QString label;
2633  int tickLabelPadding; // directly accessed by QCPAxis setters/getters
2634  double tickLabelRotation; // directly accessed by QCPAxis setters/getters
2636  tickLabelSide; // directly accessed by QCPAxis setters/getters
2637  bool substituteExponent;
2638  bool numberMultiplyCross; // directly accessed by QCPAxis setters/getters
2639  int tickLengthIn, tickLengthOut, subTickLengthIn,
2640  subTickLengthOut; // directly accessed by QCPAxis setters/getters
2641  QPen tickPen, subTickPen;
2642  QFont tickLabelFont;
2643  QColor tickLabelColor;
2644  QRect axisRect, viewportRect;
2645  double offset; // directly accessed by QCPAxis setters/getters
2646  bool abbreviateDecimalPowers;
2647  bool reversedEndings;
2648 
2649  QVector<double> subTickPositions;
2650  QVector<double> tickPositions;
2651  QVector<QString> tickLabels;
2652 
2653 protected:
2654  struct CachedLabel {
2655  QPointF offset;
2656  QPixmap pixmap;
2657  };
2658  struct TickLabelData {
2659  QString basePart, expPart, suffixPart;
2660  QRect baseBounds, expBounds, suffixBounds, totalBounds,
2661  rotatedTotalBounds;
2662  QFont baseFont, expFont;
2663  };
2664  QCustomPlot *mParentPlot;
2665  QByteArray mLabelParameterHash; // to determine whether mLabelCache needs
2666  // to be cleared due to changed parameters
2667  QCache<QString, CachedLabel> mLabelCache;
2668  QRect mAxisSelectionBox, mTickLabelsSelectionBox, mLabelSelectionBox;
2669 
2670  virtual QByteArray generateLabelParameterHash() const;
2671 
2672  virtual void placeTickLabel(QCPPainter *painter,
2673  double position,
2674  int distanceToAxis,
2675  const QString &text,
2676  QSize *tickLabelsSize);
2677  virtual void drawTickLabel(QCPPainter *painter,
2678  double x,
2679  double y,
2680  const TickLabelData &labelData) const;
2681  virtual TickLabelData getTickLabelData(const QFont &font,
2682  const QString &text) const;
2683  virtual QPointF getTickLabelDrawOffset(
2684  const TickLabelData &labelData) const;
2685  virtual void getMaxTickLabelSize(const QFont &font,
2686  const QString &text,
2687  QSize *tickLabelsSize) const;
2688 };
2689 
2690 /* end of 'src/axis/axis.h' */
2691 
2692 /* including file 'src/scatterstyle.h', size 7275 */
2693 /* commit ce344b3f96a62e5f652585e55f1ae7c7883cd45b 2018-06-25 01:03:39 +0200 */
2694 
2696  Q_GADGET
2697 public:
2708  spNone = 0x00
2709  ,
2710  spPen = 0x01
2711  ,
2712  spBrush = 0x02
2713  ,
2714  spSize = 0x04
2715  ,
2716  spShape = 0x08
2717  ,
2718  spAll = 0xFF
2719  };
2720  Q_ENUMS(ScatterProperty)
2721  Q_FLAGS(ScatterProperties)
2722  Q_DECLARE_FLAGS(ScatterProperties, ScatterProperty)
2723 
2724 
2733  ssNone
2735  ,
2736  ssDot
2739  ,
2740  ssCross
2741  ,
2742  ssPlus
2743  ,
2744  ssCircle
2745  ,
2746  ssDisc
2748  ,
2749  ssSquare
2750  ,
2751  ssDiamond
2752  ,
2753  ssStar
2755  ,
2756  ssTriangle
2758  ,
2759  ssTriangleInverted
2761  ,
2762  ssCrossSquare
2764  ,
2765  ssPlusSquare
2767  ,
2768  ssCrossCircle
2770  ,
2771  ssPlusCircle
2773  ,
2774  ssPeace
2776  ,
2777  ssPixmap
2779  ,
2780  ssCustom
2782  };
2783  Q_ENUMS(ScatterShape)
2784 
2785  QCPScatterStyle();
2786  QCPScatterStyle(ScatterShape shape, double size = 6);
2787  QCPScatterStyle(ScatterShape shape, const QColor &color, double size);
2788  QCPScatterStyle(ScatterShape shape,
2789  const QColor &color,
2790  const QColor &fill,
2791  double size);
2792  QCPScatterStyle(ScatterShape shape,
2793  const QPen &pen,
2794  const QBrush &brush,
2795  double size);
2796  QCPScatterStyle(const QPixmap &pixmap);
2797  QCPScatterStyle(const QPainterPath &customPath,
2798  const QPen &pen,
2799  const QBrush &brush = Qt::NoBrush,
2800  double size = 6);
2801 
2802  // getters:
2803  double size() const { return mSize; }
2804  ScatterShape shape() const { return mShape; }
2805  QPen pen() const { return mPen; }
2806  QBrush brush() const { return mBrush; }
2807  QPixmap pixmap() const { return mPixmap; }
2808  QPainterPath customPath() const { return mCustomPath; }
2809 
2810  // setters:
2811  void setFromOther(const QCPScatterStyle &other,
2812  ScatterProperties properties);
2813  void setSize(double size);
2814  void setShape(ScatterShape shape);
2815  void setPen(const QPen &pen);
2816  void setBrush(const QBrush &brush);
2817  void setPixmap(const QPixmap &pixmap);
2818  void setCustomPath(const QPainterPath &customPath);
2819 
2820  // non-property methods:
2821  bool isNone() const { return mShape == ssNone; }
2822  bool isPenDefined() const { return mPenDefined; }
2823  void undefinePen();
2824  void applyTo(QCPPainter *painter, const QPen &defaultPen) const;
2825  void drawShape(QCPPainter *painter, const QPointF &pos) const;
2826  void drawShape(QCPPainter *painter, double x, double y) const;
2827 
2828 protected:
2829  // property members:
2830  double mSize;
2832  QPen mPen;
2833  QBrush mBrush;
2834  QPixmap mPixmap;
2835  QPainterPath mCustomPath;
2836 
2837  // non-property members:
2839 };
2841 Q_DECLARE_OPERATORS_FOR_FLAGS(QCPScatterStyle::ScatterProperties)
2844 
2845 /* end of 'src/scatterstyle.h' */
2846 
2847 /* including file 'src/datacontainer.h', size 4596 */
2848 /* commit ce344b3f96a62e5f652585e55f1ae7c7883cd45b 2018-06-25 01:03:39 +0200 */
2849 
2850 
2855 template <class DataType>
2856 inline bool qcpLessThanSortKey(const DataType &a, const DataType &b) {
2857  return a.sortKey() < b.sortKey();
2858 }
2859 
2860 template <class DataType>
2861 class QCPDataContainer // no QCP_LIB_DECL, template class ends up in header
2862  // (cpp included below)
2863 {
2864 public:
2865  typedef typename QVector<DataType>::const_iterator const_iterator;
2866  typedef typename QVector<DataType>::iterator iterator;
2867 
2868  QCPDataContainer();
2869 
2870  // getters:
2871  int size() const { return mData.size() - mPreallocSize; }
2872  bool isEmpty() const { return size() == 0; }
2873  bool autoSqueeze() const { return mAutoSqueeze; }
2874 
2875  // setters:
2876  void setAutoSqueeze(bool enabled);
2877 
2878  // non-virtual methods:
2879  void set(const QCPDataContainer<DataType> &data);
2880  void set(const QVector<DataType> &data, bool alreadySorted = false);
2881  void add(const QCPDataContainer<DataType> &data);
2882  void add(const QVector<DataType> &data, bool alreadySorted = false);
2883  void add(const DataType &data);
2884  void removeBefore(double sortKey);
2885  void removeAfter(double sortKey);
2886  void remove(double sortKeyFrom, double sortKeyTo);
2887  void remove(double sortKey);
2888  void clear();
2889  void sort();
2890  void squeeze(bool preAllocation = true, bool postAllocation = true);
2891 
2893  return mData.constBegin() + mPreallocSize;
2894  }
2895  const_iterator constEnd() const { return mData.constEnd(); }
2896  iterator begin() { return mData.begin() + mPreallocSize; }
2897  iterator end() { return mData.end(); }
2898  const_iterator findBegin(double sortKey, bool expandedRange = true) const;
2899  const_iterator findEnd(double sortKey, bool expandedRange = true) const;
2900  const_iterator at(int index) const {
2901  return constBegin() + qBound(0, index, size());
2902  }
2903  QCPRange keyRange(bool &foundRange,
2904  QCP::SignDomain signDomain = QCP::sdBoth);
2905  QCPRange valueRange(bool &foundRange,
2906  QCP::SignDomain signDomain = QCP::sdBoth,
2907  const QCPRange &inKeyRange = QCPRange());
2908  QCPDataRange dataRange() const { return QCPDataRange(0, size()); }
2909  void limitIteratorsToDataRange(const_iterator &begin,
2910  const_iterator &end,
2911  const QCPDataRange &dataRange) const;
2912 
2913 protected:
2914  // property members:
2916 
2917  // non-property memebers:
2918  QVector<DataType> mData;
2921 
2922  // non-virtual methods:
2923  void preallocateGrow(int minimumPreallocSize);
2924  void performAutoSqueeze();
2925 };
2926 
2927 // include implementation in header since it is a class template:
2928 
2929 /* including file 'src/datacontainer.cpp', size 31349 */
2930 /* commit ce344b3f96a62e5f652585e55f1ae7c7883cd45b 2018-06-25 01:03:39 +0200 */
2931 
2935 
3016 /* start documentation of inline functions */
3017 
3078 /* end documentation of inline functions */
3079 
3084 template <class DataType>
3086  : mAutoSqueeze(true), mPreallocSize(0), mPreallocIteration(0) {}
3087 
3096 template <class DataType>
3098  if (mAutoSqueeze != enabled) {
3099  mAutoSqueeze = enabled;
3100  if (mAutoSqueeze) performAutoSqueeze();
3101  }
3102 }
3103 
3110 template <class DataType>
3112  clear();
3113  add(data);
3114 }
3115 
3126 template <class DataType>
3127 void QCPDataContainer<DataType>::set(const QVector<DataType> &data,
3128  bool alreadySorted) {
3129  mData = data;
3130  mPreallocSize = 0;
3131  mPreallocIteration = 0;
3132  if (!alreadySorted) sort();
3133 }
3134 
3141 template <class DataType>
3143  if (data.isEmpty()) return;
3144 
3145  const int n = data.size();
3146  const int oldSize = size();
3147 
3148  if (oldSize > 0 &&
3149  !qcpLessThanSortKey<DataType>(
3150  *constBegin(), *(data.constEnd() -
3151  1))) // prepend if new data keys are all
3152  // smaller than or equal to existing ones
3153  {
3154  if (mPreallocSize < n) preallocateGrow(n);
3155  mPreallocSize -= n;
3156  std::copy(data.constBegin(), data.constEnd(), begin());
3157  } else // don't need to prepend, so append and merge if necessary
3158  {
3159  mData.resize(mData.size() + n);
3160  std::copy(data.constBegin(), data.constEnd(), end() - n);
3161  if (oldSize > 0 &&
3162  !qcpLessThanSortKey<DataType>(
3163  *(constEnd() - n - 1),
3164  *(constEnd() -
3165  n))) // if appended range keys aren't all greater than
3166  // existing ones, merge the two partitions
3167  std::inplace_merge(begin(), end() - n, end(),
3168  qcpLessThanSortKey<DataType>);
3169  }
3170 }
3171 
3181 template <class DataType>
3182 void QCPDataContainer<DataType>::add(const QVector<DataType> &data,
3183  bool alreadySorted) {
3184  if (data.isEmpty()) return;
3185  if (isEmpty()) {
3186  set(data, alreadySorted);
3187  return;
3188  }
3189 
3190  const int n = data.size();
3191  const int oldSize = size();
3192 
3193  if (alreadySorted && oldSize > 0 &&
3194  !qcpLessThanSortKey<DataType>(
3195  *constBegin(),
3196  *(data.constEnd() -
3197  1))) // prepend if new data is sorted and keys are all
3198  // smaller than or equal to existing ones
3199  {
3200  if (mPreallocSize < n) preallocateGrow(n);
3201  mPreallocSize -= n;
3202  std::copy(data.constBegin(), data.constEnd(), begin());
3203  } else // don't need to prepend, so append and then sort and merge if
3204  // necessary
3205  {
3206  mData.resize(mData.size() + n);
3207  std::copy(data.constBegin(), data.constEnd(), end() - n);
3208  if (!alreadySorted) // sort appended subrange if it wasn't already
3209  // sorted
3210  std::sort(end() - n, end(), qcpLessThanSortKey<DataType>);
3211  if (oldSize > 0 &&
3212  !qcpLessThanSortKey<DataType>(
3213  *(constEnd() - n - 1),
3214  *(constEnd() -
3215  n))) // if appended range keys aren't all greater than
3216  // existing ones, merge the two partitions
3217  std::inplace_merge(begin(), end() - n, end(),
3218  qcpLessThanSortKey<DataType>);
3219  }
3220 }
3221 
3228 template <class DataType>
3229 void QCPDataContainer<DataType>::add(const DataType &data) {
3230  if (isEmpty() ||
3231  !qcpLessThanSortKey<DataType>(
3232  data,
3233  *(constEnd() - 1))) // quickly handle appends if new data key
3234  // is greater or equal to existing ones
3235  {
3236  mData.append(data);
3237  } else if (qcpLessThanSortKey<DataType>(
3238  data, *constBegin())) // quickly handle prepends using
3239  // preallocated space
3240  {
3241  if (mPreallocSize < 1) preallocateGrow(1);
3242  --mPreallocSize;
3243  *begin() = data;
3244  } else // handle inserts, maintaining sorted keys
3245  {
3246  QCPDataContainer<DataType>::iterator insertionPoint = std::lower_bound(
3247  begin(), end(), data, qcpLessThanSortKey<DataType>);
3248  mData.insert(insertionPoint, data);
3249  }
3250 }
3251 
3257 template <class DataType>
3261  std::lower_bound(begin(), end(), DataType::fromSortKey(sortKey),
3262  qcpLessThanSortKey<DataType>);
3263  mPreallocSize +=
3264  itEnd -
3265  it; // don't actually delete, just add it to the preallocated block
3266  // (if it gets too large, squeeze will take care of it)
3267  if (mAutoSqueeze) performAutoSqueeze();
3268 }
3269 
3275 template <class DataType>
3278  std::upper_bound(begin(), end(), DataType::fromSortKey(sortKey),
3279  qcpLessThanSortKey<DataType>);
3281  mData.erase(it, itEnd); // typically adds it to the postallocated block
3282  if (mAutoSqueeze) performAutoSqueeze();
3283 }
3284 
3293 template <class DataType>
3294 void QCPDataContainer<DataType>::remove(double sortKeyFrom, double sortKeyTo) {
3295  if (sortKeyFrom >= sortKeyTo || isEmpty()) return;
3296 
3298  std::lower_bound(begin(), end(), DataType::fromSortKey(sortKeyFrom),
3299  qcpLessThanSortKey<DataType>);
3301  std::upper_bound(it, end(), DataType::fromSortKey(sortKeyTo),
3302  qcpLessThanSortKey<DataType>);
3303  mData.erase(it, itEnd);
3304  if (mAutoSqueeze) performAutoSqueeze();
3305 }
3306 
3316 template <class DataType>
3319  std::lower_bound(begin(), end(), DataType::fromSortKey(sortKey),
3320  qcpLessThanSortKey<DataType>);
3321  if (it != end() && it->sortKey() == sortKey) {
3322  if (it == begin())
3323  ++mPreallocSize; // don't actually delete, just add it to the
3324  // preallocated block (if it gets too large,
3325  // squeeze will take care of it)
3326  else
3327  mData.erase(it);
3328  }
3329  if (mAutoSqueeze) performAutoSqueeze();
3330 }
3331 
3337 template <class DataType>
3339  mData.clear();
3340  mPreallocIteration = 0;
3341  mPreallocSize = 0;
3342 }
3343 
3356 template <class DataType>
3358  std::sort(begin(), end(), qcpLessThanSortKey<DataType>);
3359 }
3360 
3372 template <class DataType>
3373 void QCPDataContainer<DataType>::squeeze(bool preAllocation,
3374  bool postAllocation) {
3375  if (preAllocation) {
3376  if (mPreallocSize > 0) {
3377  std::copy(begin(), end(), mData.begin());
3378  mData.resize(size());
3379  mPreallocSize = 0;
3380  }
3381  mPreallocIteration = 0;
3382  }
3383  if (postAllocation) mData.squeeze();
3384 }
3385 
3402 template <class DataType>
3405  bool expandedRange) const {
3406  if (isEmpty()) return constEnd();
3407 
3408  QCPDataContainer<DataType>::const_iterator it = std::lower_bound(
3409  constBegin(), constEnd(), DataType::fromSortKey(sortKey),
3410  qcpLessThanSortKey<DataType>);
3411  if (expandedRange &&
3412  it != constBegin()) // also covers it == constEnd case, and we know
3413  // --constEnd is valid because mData isn't empty
3414  --it;
3415  return it;
3416 }
3417 
3435 template <class DataType>
3437 QCPDataContainer<DataType>::findEnd(double sortKey, bool expandedRange) const {
3438  if (isEmpty()) return constEnd();
3439 
3440  QCPDataContainer<DataType>::const_iterator it = std::upper_bound(
3441  constBegin(), constEnd(), DataType::fromSortKey(sortKey),
3442  qcpLessThanSortKey<DataType>);
3443  if (expandedRange && it != constEnd()) ++it;
3444  return it;
3445 }
3446 
3463 template <class DataType>
3465  QCP::SignDomain signDomain) {
3466  if (isEmpty()) {
3467  foundRange = false;
3468  return QCPRange();
3469  }
3470  QCPRange range;
3471  bool haveLower = false;
3472  bool haveUpper = false;
3473  double current;
3474 
3476  QCPDataContainer<DataType>::const_iterator itEnd = constEnd();
3477  if (signDomain == QCP::sdBoth) // range may be anywhere
3478  {
3479  if (DataType::sortKeyIsMainKey()) // if DataType is sorted by main key
3480  // (e.g. QCPGraph, but not QCPCurve),
3481  // use faster algorithm by finding
3482  // just first and last key with
3483  // non-NaN value
3484  {
3485  while (it != itEnd) // find first non-nan going up from left
3486  {
3487  if (!qIsNaN(it->mainValue())) {
3488  range.lower = it->mainKey();
3489  haveLower = true;
3490  break;
3491  }
3492  ++it;
3493  }
3494  it = itEnd;
3495  while (it !=
3496  constBegin()) // find first non-nan going down from right
3497  {
3498  --it;
3499  if (!qIsNaN(it->mainValue())) {
3500  range.upper = it->mainKey();
3501  haveUpper = true;
3502  break;
3503  }
3504  }
3505  } else // DataType is not sorted by main key, go through all data
3506  // points and accordingly expand range
3507  {
3508  while (it != itEnd) {
3509  if (!qIsNaN(it->mainValue())) {
3510  current = it->mainKey();
3511  if (current < range.lower || !haveLower) {
3512  range.lower = current;
3513  haveLower = true;
3514  }
3515  if (current > range.upper || !haveUpper) {
3516  range.upper = current;
3517  haveUpper = true;
3518  }
3519  }
3520  ++it;
3521  }
3522  }
3523  } else if (signDomain == QCP::sdNegative) // range may only be in the
3524  // negative sign domain
3525  {
3526  while (it != itEnd) {
3527  if (!qIsNaN(it->mainValue())) {
3528  current = it->mainKey();
3529  if ((current < range.lower || !haveLower) && current < 0) {
3530  range.lower = current;
3531  haveLower = true;
3532  }
3533  if ((current > range.upper || !haveUpper) && current < 0) {
3534  range.upper = current;
3535  haveUpper = true;
3536  }
3537  }
3538  ++it;
3539  }
3540  } else if (signDomain == QCP::sdPositive) // range may only be in the
3541  // positive sign domain
3542  {
3543  while (it != itEnd) {
3544  if (!qIsNaN(it->mainValue())) {
3545  current = it->mainKey();
3546  if ((current < range.lower || !haveLower) && current > 0) {
3547  range.lower = current;
3548  haveLower = true;
3549  }
3550  if ((current > range.upper || !haveUpper) && current > 0) {
3551  range.upper = current;
3552  haveUpper = true;
3553  }
3554  }
3555  ++it;
3556  }
3557  }
3558 
3559  foundRange = haveLower && haveUpper;
3560  return range;
3561 }
3562 
3581 template <class DataType>
3583  QCP::SignDomain signDomain,
3584  const QCPRange &inKeyRange) {
3585  if (isEmpty()) {
3586  foundRange = false;
3587  return QCPRange();
3588  }
3589  QCPRange range;
3590  const bool restrictKeyRange = inKeyRange != QCPRange();
3591  bool haveLower = false;
3592  bool haveUpper = false;
3593  QCPRange current;
3594  QCPDataContainer<DataType>::const_iterator itBegin = constBegin();
3595  QCPDataContainer<DataType>::const_iterator itEnd = constEnd();
3596  if (DataType::sortKeyIsMainKey() && restrictKeyRange) {
3597  itBegin = findBegin(inKeyRange.lower);
3598  itEnd = findEnd(inKeyRange.upper);
3599  }
3600  if (signDomain == QCP::sdBoth) // range may be anywhere
3601  {
3603  it != itEnd; ++it) {
3604  if (restrictKeyRange && (it->mainKey() < inKeyRange.lower ||
3605  it->mainKey() > inKeyRange.upper))
3606  continue;
3607  current = it->valueRange();
3608  if ((current.lower < range.lower || !haveLower) &&
3609  !qIsNaN(current.lower)) {
3610  range.lower = current.lower;
3611  haveLower = true;
3612  }
3613  if ((current.upper > range.upper || !haveUpper) &&
3614  !qIsNaN(current.upper)) {
3615  range.upper = current.upper;
3616  haveUpper = true;
3617  }
3618  }
3619  } else if (signDomain == QCP::sdNegative) // range may only be in the
3620  // negative sign domain
3621  {
3623  it != itEnd; ++it) {
3624  if (restrictKeyRange && (it->mainKey() < inKeyRange.lower ||
3625  it->mainKey() > inKeyRange.upper))
3626  continue;
3627  current = it->valueRange();
3628  if ((current.lower < range.lower || !haveLower) &&
3629  current.lower < 0 && !qIsNaN(current.lower)) {
3630  range.lower = current.lower;
3631  haveLower = true;
3632  }
3633  if ((current.upper > range.upper || !haveUpper) &&
3634  current.upper < 0 && !qIsNaN(current.upper)) {
3635  range.upper = current.upper;
3636  haveUpper = true;
3637  }
3638  }
3639  } else if (signDomain == QCP::sdPositive) // range may only be in the
3640  // positive sign domain
3641  {
3643  it != itEnd; ++it) {
3644  if (restrictKeyRange && (it->mainKey() < inKeyRange.lower ||
3645  it->mainKey() > inKeyRange.upper))
3646  continue;
3647  current = it->valueRange();
3648  if ((current.lower < range.lower || !haveLower) &&
3649  current.lower > 0 && !qIsNaN(current.lower)) {
3650  range.lower = current.lower;
3651  haveLower = true;
3652  }
3653  if ((current.upper > range.upper || !haveUpper) &&
3654  current.upper > 0 && !qIsNaN(current.upper)) {
3655  range.upper = current.upper;
3656  haveUpper = true;
3657  }
3658  }
3659  }
3660 
3661  foundRange = haveLower && haveUpper;
3662  return range;
3663 }
3664 
3674 template <class DataType>
3676  const_iterator &begin,
3677  const_iterator &end,
3678  const QCPDataRange &dataRange) const {
3679  QCPDataRange iteratorRange(begin - constBegin(), end - constBegin());
3680  iteratorRange = iteratorRange.bounded(dataRange.bounded(this->dataRange()));
3681  begin = constBegin() + iteratorRange.begin();
3682  end = constBegin() + iteratorRange.end();
3683 }
3684 
3695 template <class DataType>
3696 void QCPDataContainer<DataType>::preallocateGrow(int minimumPreallocSize) {
3697  if (minimumPreallocSize <= mPreallocSize) return;
3698 
3699  int newPreallocSize = minimumPreallocSize;
3700  newPreallocSize += (1u << qBound(4, mPreallocIteration + 4, 15)) -
3701  12; // do 4 up to 32768-12 preallocation, doubling in
3702  // each intermediate iteration
3703  ++mPreallocIteration;
3704 
3705  int sizeDifference = newPreallocSize - mPreallocSize;
3706  mData.resize(mData.size() + sizeDifference);
3707  std::copy_backward(mData.begin() + mPreallocSize,
3708  mData.end() - sizeDifference, mData.end());
3709  mPreallocSize = newPreallocSize;
3710 }
3711 
3728 template <class DataType>
3730  const int totalAlloc = mData.capacity();
3731  const int postAllocSize = totalAlloc - mData.size();
3732  const int usedSize = size();
3733  bool shrinkPostAllocation = false;
3734  bool shrinkPreAllocation = false;
3735  if (totalAlloc > 650000) // if allocation is larger, shrink earlier with
3736  // respect to total used size
3737  {
3738  shrinkPostAllocation =
3739  postAllocSize >
3740  usedSize * 1.5; // QVector grow strategy is 2^n for static
3741  // data. Watch out not to oscillate!
3742  shrinkPreAllocation = mPreallocSize * 10 > usedSize;
3743  } else if (totalAlloc >
3744  1000) // below 10 MiB raw data be generous with preallocated
3745  // memory, below 1k points don't even bother
3746  {
3747  shrinkPostAllocation = postAllocSize > usedSize * 5;
3748  shrinkPreAllocation =
3749  mPreallocSize >
3750  usedSize * 1.5; // preallocation can grow into postallocation,
3751  // so can be smaller
3752  }
3753 
3754  if (shrinkPreAllocation || shrinkPostAllocation)
3755  squeeze(shrinkPreAllocation, shrinkPostAllocation);
3756 }
3757 /* end of 'src/datacontainer.cpp' */
3758 
3759 /* end of 'src/datacontainer.h' */
3760 
3761 /* including file 'src/plottable.h', size 8433 */
3762 /* commit ce344b3f96a62e5f652585e55f1ae7c7883cd45b 2018-06-25 01:03:39 +0200 */
3763 
3765  Q_GADGET
3766 public:
3768  virtual ~QCPSelectionDecorator();
3769 
3770  // getters:
3771  QPen pen() const { return mPen; }
3772  QBrush brush() const { return mBrush; }
3773  QCPScatterStyle scatterStyle() const { return mScatterStyle; }
3774  QCPScatterStyle::ScatterProperties usedScatterProperties() const {
3775  return mUsedScatterProperties;
3776  }
3777 
3778  // setters:
3779  void setPen(const QPen &pen);
3780  void setBrush(const QBrush &brush);
3781  void setScatterStyle(const QCPScatterStyle &scatterStyle,
3782  QCPScatterStyle::ScatterProperties usedProperties =
3784  void setUsedScatterProperties(
3785  const QCPScatterStyle::ScatterProperties &properties);
3786 
3787  // non-virtual methods:
3788  void applyPen(QCPPainter *painter) const;
3789  void applyBrush(QCPPainter *painter) const;
3790  QCPScatterStyle getFinalScatterStyle(
3791  const QCPScatterStyle &unselectedStyle) const;
3792 
3793  // introduced virtual methods:
3794  virtual void copyFrom(const QCPSelectionDecorator *other);
3795  virtual void drawDecoration(QCPPainter *painter,
3796  QCPDataSelection selection);
3797 
3798 protected:
3799  // property members:
3800  QPen mPen;
3801  QBrush mBrush;
3803  QCPScatterStyle::ScatterProperties mUsedScatterProperties;
3804  // non-property members:
3806 
3807  // introduced virtual methods:
3808  virtual bool registerWithPlottable(QCPAbstractPlottable *plottable);
3809 
3810 private:
3811  Q_DISABLE_COPY(QCPSelectionDecorator)
3812  friend class QCPAbstractPlottable;
3813 };
3815 
3817  Q_OBJECT
3819  Q_PROPERTY(QString name READ name WRITE setName)
3820  Q_PROPERTY(
3821  bool antialiasedFill READ antialiasedFill WRITE setAntialiasedFill)
3822  Q_PROPERTY(bool antialiasedScatters READ antialiasedScatters WRITE
3823  setAntialiasedScatters)
3824  Q_PROPERTY(QPen pen READ pen WRITE setPen)
3825  Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
3826  Q_PROPERTY(QCPAxis *keyAxis READ keyAxis WRITE setKeyAxis)
3827  Q_PROPERTY(QCPAxis *valueAxis READ valueAxis WRITE setValueAxis)
3828  Q_PROPERTY(QCP::SelectionType selectable READ selectable WRITE setSelectable
3829  NOTIFY selectableChanged)
3830  Q_PROPERTY(QCPDataSelection selection READ selection WRITE setSelection
3831  NOTIFY selectionChanged)
3832  Q_PROPERTY(QCPSelectionDecorator *selectionDecorator READ selectionDecorator
3833  WRITE setSelectionDecorator)
3835 public:
3836  QCPAbstractPlottable(QCPAxis *keyAxis, QCPAxis *valueAxis);
3837  virtual ~QCPAbstractPlottable();
3838 
3839  // getters:
3840  QString name() const { return mName; }
3841  bool antialiasedFill() const { return mAntialiasedFill; }
3842  bool antialiasedScatters() const { return mAntialiasedScatters; }
3843  QPen pen() const { return mPen; }
3844  QBrush brush() const { return mBrush; }
3845  QCPAxis *keyAxis() const { return mKeyAxis.data(); }
3846  QCPAxis *valueAxis() const { return mValueAxis.data(); }
3847  QCP::SelectionType selectable() const { return mSelectable; }
3848  bool selected() const { return !mSelection.isEmpty(); }
3849  QCPDataSelection selection() const { return mSelection; }
3851  return mSelectionDecorator;
3852  }
3853 
3854  // setters:
3855  void setName(const QString &name);
3856  void setAntialiasedFill(bool enabled);
3857  void setAntialiasedScatters(bool enabled);
3858  void setPen(const QPen &pen);
3859  void setBrush(const QBrush &brush);
3860  void setKeyAxis(QCPAxis *axis);
3861  void setValueAxis(QCPAxis *axis);
3862  Q_SLOT void setSelectable(QCP::SelectionType selectable);
3863  Q_SLOT void setSelection(QCPDataSelection selection);
3864  void setSelectionDecorator(QCPSelectionDecorator *decorator);
3865 
3866  // introduced virtual methods:
3867  virtual double selectTest(const QPointF &pos,
3868  bool onlySelectable,
3869  QVariant *details = 0) const
3870  Q_DECL_OVERRIDE = 0; // actually introduced in QCPLayerable as
3871  // non-pure, but we want to force
3872  // reimplementation for plottables
3873  virtual QCPPlottableInterface1D *interface1D() { return 0; }
3875  bool &foundRange,
3876  QCP::SignDomain inSignDomain = QCP::sdBoth) const = 0;
3878  bool &foundRange,
3879  QCP::SignDomain inSignDomain = QCP::sdBoth,
3880  const QCPRange &inKeyRange = QCPRange()) const = 0;
3881 
3882  // non-property methods:
3883  void coordsToPixels(double key, double value, double &x, double &y) const;
3884  const QPointF coordsToPixels(double key, double value) const;
3885  void pixelsToCoords(double x, double y, double &key, double &value) const;
3886  void pixelsToCoords(const QPointF &pixelPos,
3887  double &key,
3888  double &value) const;
3889  void rescaleAxes(bool onlyEnlarge = false) const;
3890  void rescaleKeyAxis(bool onlyEnlarge = false) const;
3891  void rescaleValueAxis(bool onlyEnlarge = false,
3892  bool inKeyRange = false) const;
3893  bool addToLegend(QCPLegend *legend);
3894  bool addToLegend();
3895  bool removeFromLegend(QCPLegend *legend) const;
3896  bool removeFromLegend() const;
3897 
3898 signals:
3899  void selectionChanged(bool selected);
3900  void selectionChanged(const QCPDataSelection &selection);
3902 
3903 protected:
3904  // property members:
3905  QString mName;
3906  bool mAntialiasedFill, mAntialiasedScatters;
3907  QPen mPen;
3908  QBrush mBrush;
3909  QPointer<QCPAxis> mKeyAxis, mValueAxis;
3913 
3914  // reimplemented virtual methods:
3915  virtual QRect clipRect() const Q_DECL_OVERRIDE;
3916  virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE = 0;
3917  virtual QCP::Interaction selectionCategory() const Q_DECL_OVERRIDE;
3918  void applyDefaultAntialiasingHint(QCPPainter *painter) const
3920  // events:
3921  virtual void selectEvent(QMouseEvent *event,
3922  bool additive,
3923  const QVariant &details,
3924  bool *selectionStateChanged) Q_DECL_OVERRIDE;
3925  virtual void deselectEvent(bool *selectionStateChanged) Q_DECL_OVERRIDE;
3926 
3927  // introduced virtual methods:
3928  virtual void drawLegendIcon(QCPPainter *painter,
3929  const QRectF &rect) const = 0;
3930 
3931  // non-virtual methods:
3932  void applyFillAntialiasingHint(QCPPainter *painter) const;
3933  void applyScattersAntialiasingHint(QCPPainter *painter) const;
3934 
3935 private:
3936  Q_DISABLE_COPY(QCPAbstractPlottable)
3937 
3938  friend class QCustomPlot;
3939  friend class QCPAxis;
3941 };
3942 
3943 /* end of 'src/plottable.h' */
3944 
3945 /* including file 'src/item.h', size 9384 */
3946 /* commit ce344b3f96a62e5f652585e55f1ae7c7883cd45b 2018-06-25 01:03:39 +0200 */
3947 
3949  Q_GADGET
3950 public:
3951  QCPItemAnchor(QCustomPlot *parentPlot,
3952  QCPAbstractItem *parentItem,
3953  const QString &name,
3954  int anchorId = -1);
3955  virtual ~QCPItemAnchor();
3956 
3957  // getters:
3958  QString name() const { return mName; }
3959  virtual QPointF pixelPosition() const;
3960 
3961 protected:
3962  // property members:
3963  QString mName;
3964 
3965  // non-property members:
3969  QSet<QCPItemPosition *> mChildrenX, mChildrenY;
3970 
3971  // introduced virtual methods:
3972  virtual QCPItemPosition *toQCPItemPosition() { return 0; }
3973 
3974  // non-virtual methods:
3975  void addChildX(QCPItemPosition *pos); // called from pos when this anchor
3976  // is set as parent
3977  void removeChildX(QCPItemPosition *pos); // called from pos when its parent
3978  // anchor is reset or pos deleted
3979  void addChildY(QCPItemPosition *pos); // called from pos when this anchor
3980  // is set as parent
3981  void removeChildY(QCPItemPosition *pos); // called from pos when its parent
3982  // anchor is reset or pos deleted
3983 
3984 private:
3985  Q_DISABLE_COPY(QCPItemAnchor)
3986 
3987  friend class QCPItemPosition;
3988 };
3989 
3991  Q_GADGET
3992 public:
4000  ptAbsolute
4002  ,
4003  ptViewportRatio
4011  ,
4012  ptAxisRectRatio
4021  ,
4022  ptPlotCoords
4024  };
4025  Q_ENUMS(PositionType)
4026 
4027  QCPItemPosition(QCustomPlot *parentPlot,
4028  QCPAbstractItem *parentItem,
4029  const QString &name);
4030  virtual ~QCPItemPosition();
4031 
4032  // getters:
4033  PositionType type() const { return typeX(); }
4034  PositionType typeX() const { return mPositionTypeX; }
4035  PositionType typeY() const { return mPositionTypeY; }
4036  QCPItemAnchor *parentAnchor() const { return parentAnchorX(); }
4037  QCPItemAnchor *parentAnchorX() const { return mParentAnchorX; }
4038  QCPItemAnchor *parentAnchorY() const { return mParentAnchorY; }
4039  double key() const { return mKey; }
4040  double value() const { return mValue; }
4041  QPointF coords() const { return QPointF(mKey, mValue); }
4042  QCPAxis *keyAxis() const { return mKeyAxis.data(); }
4043  QCPAxis *valueAxis() const { return mValueAxis.data(); }
4044  QCPAxisRect *axisRect() const;
4045  virtual QPointF pixelPosition() const Q_DECL_OVERRIDE;
4046 
4047  // setters:
4048  void setType(PositionType type);
4049  void setTypeX(PositionType type);
4050  void setTypeY(PositionType type);
4051  bool setParentAnchor(QCPItemAnchor *parentAnchor,
4052  bool keepPixelPosition = false);
4053  bool setParentAnchorX(QCPItemAnchor *parentAnchor,
4054  bool keepPixelPosition = false);
4055  bool setParentAnchorY(QCPItemAnchor *parentAnchor,
4056  bool keepPixelPosition = false);
4057  void setCoords(double key, double value);
4058  void setCoords(const QPointF &coords);
4059  void setAxes(QCPAxis *keyAxis, QCPAxis *valueAxis);
4060  void setAxisRect(QCPAxisRect *axisRect);
4061  void setPixelPosition(const QPointF &pixelPosition);
4062 
4063 protected:
4064  // property members:
4065  PositionType mPositionTypeX, mPositionTypeY;
4066  QPointer<QCPAxis> mKeyAxis, mValueAxis;
4067  QPointer<QCPAxisRect> mAxisRect;
4068  double mKey, mValue;
4069  QCPItemAnchor *mParentAnchorX, *mParentAnchorY;
4070 
4071  // reimplemented virtual methods:
4072  virtual QCPItemPosition *toQCPItemPosition() Q_DECL_OVERRIDE {
4073  return this;
4074  }
4075 
4076 private:
4077  Q_DISABLE_COPY(QCPItemPosition)
4078 };
4080 
4082  Q_OBJECT
4084  Q_PROPERTY(bool clipToAxisRect READ clipToAxisRect WRITE setClipToAxisRect)
4085  Q_PROPERTY(
4086  QCPAxisRect *clipAxisRect READ clipAxisRect WRITE setClipAxisRect)
4087  Q_PROPERTY(bool selectable READ selectable WRITE setSelectable NOTIFY
4088  selectableChanged)
4089  Q_PROPERTY(bool selected READ selected WRITE setSelected NOTIFY
4090  selectionChanged)
4092 public:
4093  explicit QCPAbstractItem(QCustomPlot *parentPlot);
4094  virtual ~QCPAbstractItem();
4095 
4096  // getters:
4097  bool clipToAxisRect() const { return mClipToAxisRect; }
4098  QCPAxisRect *clipAxisRect() const;
4099  bool selectable() const { return mSelectable; }
4100  bool selected() const { return mSelected; }
4101 
4102  // setters:
4103  void setClipToAxisRect(bool clip);
4104  void setClipAxisRect(QCPAxisRect *rect);
4105  Q_SLOT void setSelectable(bool selectable);
4106  Q_SLOT void setSelected(bool selected);
4107 
4108  // reimplemented virtual methods:
4109  virtual double selectTest(const QPointF &pos,
4110  bool onlySelectable,
4111  QVariant *details = 0) const Q_DECL_OVERRIDE = 0;
4112 
4113  // non-virtual methods:
4114  QList<QCPItemPosition *> positions() const { return mPositions; }
4115  QList<QCPItemAnchor *> anchors() const { return mAnchors; }
4116  QCPItemPosition *position(const QString &name) const;
4117  QCPItemAnchor *anchor(const QString &name) const;
4118  bool hasAnchor(const QString &name) const;
4119 
4120 signals:
4121  void selectionChanged(bool selected);
4122  void selectableChanged(bool selectable);
4123 
4124 protected:
4125  // property members:
4127  QPointer<QCPAxisRect> mClipAxisRect;
4128  QList<QCPItemPosition *> mPositions;
4129  QList<QCPItemAnchor *> mAnchors;
4130  bool mSelectable, mSelected;
4131 
4132  // reimplemented virtual methods:
4133  virtual QCP::Interaction selectionCategory() const Q_DECL_OVERRIDE;
4134  virtual QRect clipRect() const Q_DECL_OVERRIDE;
4135  virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const
4137  virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE = 0;
4138  // events:
4139  virtual void selectEvent(QMouseEvent *event,
4140  bool additive,
4141  const QVariant &details,
4142  bool *selectionStateChanged) Q_DECL_OVERRIDE;
4143  virtual void deselectEvent(bool *selectionStateChanged) Q_DECL_OVERRIDE;
4144 
4145  // introduced virtual methods:
4146  virtual QPointF anchorPixelPosition(int anchorId) const;
4147 
4148  // non-virtual methods:
4149  double rectDistance(const QRectF &rect,
4150  const QPointF &pos,
4151  bool filledRect) const;
4152  QCPItemPosition *createPosition(const QString &name);
4153  QCPItemAnchor *createAnchor(const QString &name, int anchorId);
4154 
4155 private:
4156  Q_DISABLE_COPY(QCPAbstractItem)
4157 
4158  friend class QCustomPlot;
4159  friend class QCPItemAnchor;
4160 };
4161 
4162 /* end of 'src/item.h' */
4163 
4164 /* including file 'src/core.h', size 14886 */
4165 /* commit ce344b3f96a62e5f652585e55f1ae7c7883cd45b 2018-06-25 01:03:39 +0200 */
4166 
4167 class QCP_LIB_DECL QCustomPlot : public QWidget {
4168  Q_OBJECT
4170  Q_PROPERTY(QRect viewport READ viewport WRITE setViewport)
4171  Q_PROPERTY(QPixmap background READ background WRITE setBackground)
4172  Q_PROPERTY(bool backgroundScaled READ backgroundScaled WRITE
4173  setBackgroundScaled)
4174  Q_PROPERTY(Qt::AspectRatioMode backgroundScaledMode READ
4175  backgroundScaledMode WRITE setBackgroundScaledMode)
4176  Q_PROPERTY(QCPLayoutGrid *plotLayout READ plotLayout)
4177  Q_PROPERTY(bool autoAddPlottableToLegend READ autoAddPlottableToLegend WRITE
4178  setAutoAddPlottableToLegend)
4179  Q_PROPERTY(int selectionTolerance READ selectionTolerance WRITE
4180  setSelectionTolerance)
4181  Q_PROPERTY(bool noAntialiasingOnDrag READ noAntialiasingOnDrag WRITE
4182  setNoAntialiasingOnDrag)
4183  Q_PROPERTY(Qt::KeyboardModifier multiSelectModifier READ multiSelectModifier
4184  WRITE setMultiSelectModifier)
4185  Q_PROPERTY(bool openGl READ openGl WRITE setOpenGl)
4187 public:
4194  limBelow
4195  ,
4196  limAbove
4197  };
4198  Q_ENUMS(LayerInsertMode)
4199 
4200 
4207  rpImmediateRefresh
4210  ,
4211  rpQueuedRefresh
4215  ,
4216  rpRefreshHint
4220  ,
4221  rpQueuedReplot
4225  };
4226  Q_ENUMS(RefreshPriority)
4227 
4228  explicit QCustomPlot(QWidget *parent = 0);
4229  virtual ~QCustomPlot();
4230 
4231  // getters:
4232  QRect viewport() const { return mViewport; }
4233  double bufferDevicePixelRatio() const { return mBufferDevicePixelRatio; }
4234  QPixmap background() const { return mBackgroundPixmap; }
4235  bool backgroundScaled() const { return mBackgroundScaled; }
4236  Qt::AspectRatioMode backgroundScaledMode() const {
4237  return mBackgroundScaledMode;
4238  }
4239  QCPLayoutGrid *plotLayout() const { return mPlotLayout; }
4240  QCP::AntialiasedElements antialiasedElements() const {
4241  return mAntialiasedElements;
4242  }
4243  QCP::AntialiasedElements notAntialiasedElements() const {
4244  return mNotAntialiasedElements;
4245  }
4246  bool autoAddPlottableToLegend() const { return mAutoAddPlottableToLegend; }
4247  const QCP::Interactions interactions() const { return mInteractions; }
4248  int selectionTolerance() const { return mSelectionTolerance; }
4249  bool noAntialiasingOnDrag() const { return mNoAntialiasingOnDrag; }
4250  QCP::PlottingHints plottingHints() const { return mPlottingHints; }
4251  Qt::KeyboardModifier multiSelectModifier() const {
4252  return mMultiSelectModifier;
4253  }
4255  return mSelectionRectMode;
4256  }
4257  QCPSelectionRect *selectionRect() const { return mSelectionRect; }
4258  bool openGl() const { return mOpenGl; }
4259 
4260  // setters:
4261  void setViewport(const QRect &rect);
4262  void setBufferDevicePixelRatio(double ratio);
4263  void setBackground(const QPixmap &pm);
4264  void setBackground(
4265  const QPixmap &pm,
4266  bool scaled,
4267  Qt::AspectRatioMode mode = Qt::KeepAspectRatioByExpanding);
4268  void setBackground(const QBrush &brush);
4269  void setBackgroundScaled(bool scaled);
4270  void setBackgroundScaledMode(Qt::AspectRatioMode mode);
4271  void setAntialiasedElements(
4272  const QCP::AntialiasedElements &antialiasedElements);
4273  void setAntialiasedElement(QCP::AntialiasedElement antialiasedElement,
4274  bool enabled = true);
4275  void setNotAntialiasedElements(
4276  const QCP::AntialiasedElements &notAntialiasedElements);
4277  void setNotAntialiasedElement(QCP::AntialiasedElement notAntialiasedElement,
4278  bool enabled = true);
4279  void setAutoAddPlottableToLegend(bool on);
4280  void setInteractions(const QCP::Interactions &interactions);
4281  void setInteraction(const QCP::Interaction &interaction,
4282  bool enabled = true);
4283  void setSelectionTolerance(int pixels);
4284  void setNoAntialiasingOnDrag(bool enabled);
4285  void setPlottingHints(const QCP::PlottingHints &hints);
4286  void setPlottingHint(QCP::PlottingHint hint, bool enabled = true);
4287  void setMultiSelectModifier(Qt::KeyboardModifier modifier);
4288  void setSelectionRectMode(QCP::SelectionRectMode mode);
4289  void setSelectionRect(QCPSelectionRect *selectionRect);
4290  void setOpenGl(bool enabled, int multisampling = 16);
4291 
4292  // non-property methods:
4293  // plottable interface:
4294  QCPAbstractPlottable *plottable(int index);
4295  QCPAbstractPlottable *plottable();
4296  bool removePlottable(QCPAbstractPlottable *plottable);
4297  bool removePlottable(int index);
4298  int clearPlottables();
4299  int plottableCount() const;
4300  QList<QCPAbstractPlottable *> selectedPlottables() const;
4301  QCPAbstractPlottable *plottableAt(const QPointF &pos,
4302  bool onlySelectable = false) const;
4303  bool hasPlottable(QCPAbstractPlottable *plottable) const;
4304 
4305  // specialized interface for QCPGraph:
4306  QCPGraph *graph(int index) const;
4307  QCPGraph *graph() const;
4308  QCPGraph *addGraph(QCPAxis *keyAxis = 0, QCPAxis *valueAxis = 0);
4309  bool removeGraph(QCPGraph *graph);
4310  bool removeGraph(int index);
4311  int clearGraphs();
4312  int graphCount() const;
4313  QList<QCPGraph *> selectedGraphs() const;
4314 
4315  // item interface:
4316  QCPAbstractItem *item(int index) const;
4317  QCPAbstractItem *item() const;
4318  bool removeItem(QCPAbstractItem *item);
4319  bool removeItem(int index);
4320  int clearItems();
4321  int itemCount() const;
4322  QList<QCPAbstractItem *> selectedItems() const;
4323  QCPAbstractItem *itemAt(const QPointF &pos,
4324  bool onlySelectable = false) const;
4325  bool hasItem(QCPAbstractItem *item) const;
4326 
4327  // layer interface:
4328  QCPLayer *layer(const QString &name) const;
4329  QCPLayer *layer(int index) const;
4330  QCPLayer *currentLayer() const;
4331  bool setCurrentLayer(const QString &name);
4332  bool setCurrentLayer(QCPLayer *layer);
4333  int layerCount() const;
4334  bool addLayer(const QString &name,
4335  QCPLayer *otherLayer = 0,
4336  LayerInsertMode insertMode = limAbove);
4337  bool removeLayer(QCPLayer *layer);
4338  bool moveLayer(QCPLayer *layer,
4339  QCPLayer *otherLayer,
4340  LayerInsertMode insertMode = limAbove);
4341 
4342  // axis rect/layout interface:
4343  int axisRectCount() const;
4344  QCPAxisRect *axisRect(int index = 0) const;
4345  QList<QCPAxisRect *> axisRects() const;
4346  QCPLayoutElement *layoutElementAt(const QPointF &pos) const;
4347  QCPAxisRect *axisRectAt(const QPointF &pos) const;
4348  Q_SLOT void rescaleAxes(bool onlyVisiblePlottables = false);
4349 
4350  QList<QCPAxis *> selectedAxes() const;
4351  QList<QCPLegend *> selectedLegends() const;
4352  Q_SLOT void deselectAll();
4353 
4354  bool savePdf(const QString &fileName,
4355  int width = 0,
4356  int height = 0,
4358  const QString &pdfCreator = QString(),
4359  const QString &pdfTitle = QString());
4360  bool savePng(const QString &fileName,
4361  int width = 0,
4362  int height = 0,
4363  double scale = 1.0,
4364  int quality = -1,
4365  int resolution = 96,
4366  QCP::ResolutionUnit resolutionUnit = QCP::ruDotsPerInch);
4367  bool saveJpg(const QString &fileName,
4368  int width = 0,
4369  int height = 0,
4370  double scale = 1.0,
4371  int quality = -1,
4372  int resolution = 96,
4373  QCP::ResolutionUnit resolutionUnit = QCP::ruDotsPerInch);
4374  bool saveBmp(const QString &fileName,
4375  int width = 0,
4376  int height = 0,
4377  double scale = 1.0,
4378  int resolution = 96,
4379  QCP::ResolutionUnit resolutionUnit = QCP::ruDotsPerInch);
4380  bool saveRastered(const QString &fileName,
4381  int width,
4382  int height,
4383  double scale,
4384  const char *format,
4385  int quality = -1,
4386  int resolution = 96,
4387  QCP::ResolutionUnit resolutionUnit = QCP::ruDotsPerInch);
4388  QPixmap toPixmap(int width = 0, int height = 0, double scale = 1.0);
4389  void toPainter(QCPPainter *painter, int width = 0, int height = 0);
4390  Q_SLOT void replot(QCustomPlot::RefreshPriority refreshPriority =
4392 
4393  QCPAxis *xAxis, *yAxis, *xAxis2, *yAxis2;
4395 
4396 signals:
4397  void mouseDoubleClick(QMouseEvent *event);
4398  void mousePress(QMouseEvent *event);
4399  void mouseMove(QMouseEvent *event);
4400  void mouseRelease(QMouseEvent *event);
4401  void mouseWheel(QWheelEvent *event);
4402 
4404  int dataIndex,
4405  QMouseEvent *event);
4407  int dataIndex,
4408  QMouseEvent *event);
4409  void itemClick(QCPAbstractItem *item, QMouseEvent *event);
4410  void itemDoubleClick(QCPAbstractItem *item, QMouseEvent *event);
4411  void axisClick(QCPAxis *axis,
4413  QMouseEvent *event);
4416  QMouseEvent *event);
4417  void legendClick(QCPLegend *legend,
4418  QCPAbstractLegendItem *item,
4419  QMouseEvent *event);
4421  QCPAbstractLegendItem *item,
4422  QMouseEvent *event);
4423 
4426  void afterReplot();
4427 
4428 protected:
4429  // property members:
4430  QRect mViewport;
4434  QList<QCPAbstractPlottable *> mPlottables;
4435  QList<QCPGraph *> mGraphs; // extra list of plottables also in mPlottables
4436  // that are of type QCPGraph
4437  QList<QCPAbstractItem *> mItems;
4438  QList<QCPLayer *> mLayers;
4439  QCP::AntialiasedElements mAntialiasedElements, mNotAntialiasedElements;
4440  QCP::Interactions mInteractions;
4447  Qt::AspectRatioMode mBackgroundScaledMode;
4449  QCP::PlottingHints mPlottingHints;
4450  Qt::KeyboardModifier mMultiSelectModifier;
4453  bool mOpenGl;
4454 
4455  // non-property members:
4456  QList<QSharedPointer<QCPAbstractPaintBuffer>> mPaintBuffers;
4459  QPointer<QCPLayerable> mMouseEventLayerable;
4460  QPointer<QCPLayerable> mMouseSignalLayerable;
4466  QCP::AntialiasedElements mOpenGlAntialiasedElementsBackup;
4468 #ifdef QCP_OPENGL_FBO
4469  QSharedPointer<QOpenGLContext> mGlContext;
4470  QSharedPointer<QSurface> mGlSurface;
4471  QSharedPointer<QOpenGLPaintDevice> mGlPaintDevice;
4472 #endif
4473 
4474  // reimplemented virtual methods:
4475  virtual QSize minimumSizeHint() const Q_DECL_OVERRIDE;
4476  virtual QSize sizeHint() const Q_DECL_OVERRIDE;
4477  virtual void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
4478  virtual void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
4479  virtual void mouseDoubleClickEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
4480  virtual void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
4481  virtual void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
4482  virtual void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
4483  virtual void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE;
4484 
4485  // introduced virtual methods:
4486  virtual void draw(QCPPainter *painter);
4487  virtual void updateLayout();
4488  virtual void axisRemoved(QCPAxis *axis);
4489  virtual void legendRemoved(QCPLegend *legend);
4490  Q_SLOT virtual void processRectSelection(QRect rect, QMouseEvent *event);
4491  Q_SLOT virtual void processRectZoom(QRect rect, QMouseEvent *event);
4492  Q_SLOT virtual void processPointSelection(QMouseEvent *event);
4493 
4494  // non-virtual methods:
4495  bool registerPlottable(QCPAbstractPlottable *plottable);
4496  bool registerGraph(QCPGraph *graph);
4497  bool registerItem(QCPAbstractItem *item);
4498  void updateLayerIndices() const;
4499  QCPLayerable *layerableAt(const QPointF &pos,
4500  bool onlySelectable,
4501  QVariant *selectionDetails = 0) const;
4502  QList<QCPLayerable *> layerableListAt(
4503  const QPointF &pos,
4504  bool onlySelectable,
4505  QList<QVariant> *selectionDetails = 0) const;
4506  void drawBackground(QCPPainter *painter);
4507  void setupPaintBuffers();
4508  QCPAbstractPaintBuffer *createPaintBuffer();
4509  bool hasInvalidatedPaintBuffers();
4510  bool setupOpenGl();
4511  void freeOpenGl();
4512 
4513  friend class QCPLegend;
4514  friend class QCPAxis;
4515  friend class QCPLayer;
4516  friend class QCPAxisRect;
4517  friend class QCPAbstractPlottable;
4518  friend class QCPGraph;
4519  friend class QCPAbstractItem;
4520 };
4523 
4524 /* end of 'src/core.h' */
4525 
4526 /* including file 'src/plottable1d.h', size 4544 */
4527 /* commit ce344b3f96a62e5f652585e55f1ae7c7883cd45b 2018-06-25 01:03:39 +0200 */
4528 
4530 public:
4532  // introduced pure virtual methods:
4533  virtual int dataCount() const = 0;
4534  virtual double dataMainKey(int index) const = 0;
4535  virtual double dataSortKey(int index) const = 0;
4536  virtual double dataMainValue(int index) const = 0;
4537  virtual QCPRange dataValueRange(int index) const = 0;
4538  virtual QPointF dataPixelPosition(int index) const = 0;
4539  virtual bool sortKeyIsMainKey() const = 0;
4540  virtual QCPDataSelection selectTestRect(const QRectF &rect,
4541  bool onlySelectable) const = 0;
4542  virtual int findBegin(double sortKey, bool expandedRange = true) const = 0;
4543  virtual int findEnd(double sortKey, bool expandedRange = true) const = 0;
4544 };
4545 
4546 template <class DataType>
4548  : public QCPAbstractPlottable,
4549  public QCPPlottableInterface1D // no QCP_LIB_DECL, template class ends up
4550  // in header (cpp included below)
4551 {
4552  // No Q_OBJECT macro due to template class
4553 
4554 public:
4555  QCPAbstractPlottable1D(QCPAxis *keyAxis, QCPAxis *valueAxis);
4557 
4558  // virtual methods of 1d plottable interface:
4559  virtual int dataCount() const Q_DECL_OVERRIDE;
4560  virtual double dataMainKey(int index) const Q_DECL_OVERRIDE;
4561  virtual double dataSortKey(int index) const Q_DECL_OVERRIDE;
4562  virtual double dataMainValue(int index) const Q_DECL_OVERRIDE;
4563  virtual QCPRange dataValueRange(int index) const Q_DECL_OVERRIDE;
4564  virtual QPointF dataPixelPosition(int index) const Q_DECL_OVERRIDE;
4565  virtual bool sortKeyIsMainKey() const Q_DECL_OVERRIDE;
4566  virtual QCPDataSelection selectTestRect(
4567  const QRectF &rect, bool onlySelectable) const Q_DECL_OVERRIDE;
4568  virtual int findBegin(double sortKey,
4569  bool expandedRange = true) const Q_DECL_OVERRIDE;
4570  virtual int findEnd(double sortKey,
4571  bool expandedRange = true) const Q_DECL_OVERRIDE;
4572 
4573  // reimplemented virtual methods:
4574  virtual double selectTest(const QPointF &pos,
4575  bool onlySelectable,
4576  QVariant *details = 0) const Q_DECL_OVERRIDE;
4577  virtual QCPPlottableInterface1D *interface1D() Q_DECL_OVERRIDE {
4578  return this;
4579  }
4580 
4581 protected:
4582  // property members:
4583  QSharedPointer<QCPDataContainer<DataType>> mDataContainer;
4584 
4585  // helpers for subclasses:
4586  void getDataSegments(QList<QCPDataRange> &selectedSegments,
4587  QList<QCPDataRange> &unselectedSegments) const;
4588  void drawPolyline(QCPPainter *painter,
4589  const QVector<QPointF> &lineData) const;
4590 
4591 private:
4592  Q_DISABLE_COPY(QCPAbstractPlottable1D)
4593 };
4594 
4595 // include implementation in header since it is a class template:
4596 
4597 /* including file 'src/plottable1d.cpp', size 22361 */
4598 /* commit ce344b3f96a62e5f652585e55f1ae7c7883cd45b 2018-06-25 01:03:39 +0200 */
4599 
4603 
4630 /* start documentation of pure virtual functions */
4631 
4756 /* end documentation of pure virtual functions */
4757 
4761 
4791 /* start documentation of inline functions */
4792 
4801 /* end documentation of inline functions */
4802 
4808 template <class DataType>
4810  QCPAxis *valueAxis)
4811  : QCPAbstractPlottable(keyAxis, valueAxis),
4812  mDataContainer(new QCPDataContainer<DataType>) {}
4813 
4814 template <class DataType>
4816 
4820 template <class DataType>
4822  return mDataContainer->size();
4823 }
4824 
4828 template <class DataType>
4830  if (index >= 0 && index < mDataContainer->size()) {
4831  return (mDataContainer->constBegin() + index)->mainKey();
4832  } else {
4833  qDebug() << Q_FUNC_INFO << "Index out of bounds" << index;
4834  return 0;
4835  }
4836 }
4837 
4841 template <class DataType>
4843  if (index >= 0 && index < mDataContainer->size()) {
4844  return (mDataContainer->constBegin() + index)->sortKey();
4845  } else {
4846  qDebug() << Q_FUNC_INFO << "Index out of bounds" << index;
4847  return 0;
4848  }
4849 }
4850 
4854 template <class DataType>
4856  if (index >= 0 && index < mDataContainer->size()) {
4857  return (mDataContainer->constBegin() + index)->mainValue();
4858  } else {
4859  qDebug() << Q_FUNC_INFO << "Index out of bounds" << index;
4860  return 0;
4861  }
4862 }
4863 
4867 template <class DataType>
4869  if (index >= 0 && index < mDataContainer->size()) {
4870  return (mDataContainer->constBegin() + index)->valueRange();
4871  } else {
4872  qDebug() << Q_FUNC_INFO << "Index out of bounds" << index;
4873  return QCPRange(0, 0);
4874  }
4875 }
4876 
4880 template <class DataType>
4882  if (index >= 0 && index < mDataContainer->size()) {
4883  const typename QCPDataContainer<DataType>::const_iterator it =
4884  mDataContainer->constBegin() + index;
4885  return coordsToPixels(it->mainKey(), it->mainValue());
4886  } else {
4887  qDebug() << Q_FUNC_INFO << "Index out of bounds" << index;
4888  return QPointF();
4889  }
4890 }
4891 
4895 template <class DataType>
4897  return DataType::sortKeyIsMainKey();
4898 }
4899 
4908 template <class DataType>
4910  const QRectF &rect, bool onlySelectable) const {
4912  if ((onlySelectable && mSelectable == QCP::stNone) ||
4913  mDataContainer->isEmpty())
4914  return result;
4915  if (!mKeyAxis || !mValueAxis) return result;
4916 
4917  // convert rect given in pixels to ranges given in plot coordinates:
4918  double key1, value1, key2, value2;
4919  pixelsToCoords(rect.topLeft(), key1, value1);
4920  pixelsToCoords(rect.bottomRight(), key2, value2);
4921  QCPRange keyRange(key1,
4922  key2); // QCPRange normalizes internally so we don't have
4923  // to care about whether key1 < key2
4924  QCPRange valueRange(value1, value2);
4926  mDataContainer->constBegin();
4928  mDataContainer->constEnd();
4929  if (DataType::sortKeyIsMainKey()) // we can assume that data is sorted by
4930  // main key, so can reduce the searched
4931  // key interval:
4932  {
4933  begin = mDataContainer->findBegin(keyRange.lower, false);
4934  end = mDataContainer->findEnd(keyRange.upper, false);
4935  }
4936  if (begin == end) return result;
4937 
4938  int currentSegmentBegin = -1; // -1 means we're currently not in a segment
4939  // that's contained in rect
4940  for (typename QCPDataContainer<DataType>::const_iterator it = begin;
4941  it != end; ++it) {
4942  if (currentSegmentBegin == -1) {
4943  if (valueRange.contains(it->mainValue()) &&
4944  keyRange.contains(it->mainKey())) // start segment
4945  currentSegmentBegin = it - mDataContainer->constBegin();
4946  } else if (!valueRange.contains(it->mainValue()) ||
4947  !keyRange.contains(it->mainKey())) // segment just ended
4948  {
4949  result.addDataRange(QCPDataRange(currentSegmentBegin,
4950  it - mDataContainer->constBegin()),
4951  false);
4952  currentSegmentBegin = -1;
4953  }
4954  }
4955  // process potential last segment:
4956  if (currentSegmentBegin != -1)
4957  result.addDataRange(QCPDataRange(currentSegmentBegin,
4958  end - mDataContainer->constBegin()),
4959  false);
4960 
4961  result.simplify();
4962  return result;
4963 }
4964 
4968 template <class DataType>
4970  bool expandedRange) const {
4971  return mDataContainer->findBegin(sortKey, expandedRange) -
4972  mDataContainer->constBegin();
4973 }
4974 
4978 template <class DataType>
4980  bool expandedRange) const {
4981  return mDataContainer->findEnd(sortKey, expandedRange) -
4982  mDataContainer->constBegin();
4983 }
4984 
4996 template <class DataType>
4998  bool onlySelectable,
4999  QVariant *details) const {
5000  if ((onlySelectable && mSelectable == QCP::stNone) ||
5001  mDataContainer->isEmpty())
5002  return -1;
5003  if (!mKeyAxis || !mValueAxis) return -1;
5004 
5005  QCPDataSelection selectionResult;
5006  double minDistSqr = (std::numeric_limits<double>::max)();
5007  int minDistIndex = mDataContainer->size();
5008 
5010  mDataContainer->constBegin();
5012  mDataContainer->constEnd();
5013  if (DataType::sortKeyIsMainKey()) // we can assume that data is sorted by
5014  // main key, so can reduce the searched
5015  // key interval:
5016  {
5017  // determine which key range comes into question, taking selection
5018  // tolerance around pos into account:
5019  double posKeyMin, posKeyMax, dummy;
5020  pixelsToCoords(pos - QPointF(mParentPlot->selectionTolerance(),
5021  mParentPlot->selectionTolerance()),
5022  posKeyMin, dummy);
5023  pixelsToCoords(pos + QPointF(mParentPlot->selectionTolerance(),
5024  mParentPlot->selectionTolerance()),
5025  posKeyMax, dummy);
5026  if (posKeyMin > posKeyMax) qSwap(posKeyMin, posKeyMax);
5027  begin = mDataContainer->findBegin(posKeyMin, true);
5028  end = mDataContainer->findEnd(posKeyMax, true);
5029  }
5030  if (begin == end) return -1;
5031  QCPRange keyRange(mKeyAxis->range());
5032  QCPRange valueRange(mValueAxis->range());
5033  for (typename QCPDataContainer<DataType>::const_iterator it = begin;
5034  it != end; ++it) {
5035  const double mainKey = it->mainKey();
5036  const double mainValue = it->mainValue();
5037  if (keyRange.contains(mainKey) &&
5038  valueRange.contains(
5039  mainValue)) // make sure data point is inside visible
5040  // range, for speedup in cases where sort key
5041  // isn't main key and we iterate over all
5042  // points
5043  {
5044  const double currentDistSqr =
5045  QCPVector2D(coordsToPixels(mainKey, mainValue) - pos)
5046  .lengthSquared();
5047  if (currentDistSqr < minDistSqr) {
5048  minDistSqr = currentDistSqr;
5049  minDistIndex = it - mDataContainer->constBegin();
5050  }
5051  }
5052  }
5053  if (minDistIndex != mDataContainer->size())
5054  selectionResult.addDataRange(
5055  QCPDataRange(minDistIndex, minDistIndex + 1), false);
5056 
5057  selectionResult.simplify();
5058  if (details) details->setValue(selectionResult);
5059  return qSqrt(minDistSqr);
5060 }
5061 
5072 template <class DataType>
5074  QList<QCPDataRange> &selectedSegments,
5075  QList<QCPDataRange> &unselectedSegments) const {
5076  selectedSegments.clear();
5077  unselectedSegments.clear();
5078  if (mSelectable ==
5079  QCP::stWhole) // stWhole selection type draws the entire plottable with
5080  // selected style if mSelection isn't empty
5081  {
5082  if (selected())
5083  selectedSegments << QCPDataRange(0, dataCount());
5084  else
5085  unselectedSegments << QCPDataRange(0, dataCount());
5086  } else {
5087  QCPDataSelection sel(selection());
5088  sel.simplify();
5089  selectedSegments = sel.dataRanges();
5090  unselectedSegments =
5091  sel.inverse(QCPDataRange(0, dataCount())).dataRanges();
5092  }
5093 }
5094 
5105 template <class DataType>
5107  QCPPainter *painter, const QVector<QPointF> &lineData) const {
5108  // if drawing solid line and not in PDF, use much faster line drawing
5109  // instead of polyline:
5110  if (mParentPlot->plottingHints().testFlag(QCP::phFastPolylines) &&
5111  painter->pen().style() == Qt::SolidLine &&
5112  !painter->modes().testFlag(QCPPainter::pmVectorized) &&
5113  !painter->modes().testFlag(QCPPainter::pmNoCaching)) {
5114  int i = 0;
5115  bool lastIsNan = false;
5116  const int lineDataSize = lineData.size();
5117  while (i < lineDataSize &&
5118  (qIsNaN(lineData.at(i).y()) ||
5119  qIsNaN(lineData.at(i)
5120  .x()))) // make sure first point is not NaN
5121  ++i;
5122  ++i; // because drawing works in 1 point retrospect
5123  while (i < lineDataSize) {
5124  if (!qIsNaN(lineData.at(i).y()) &&
5125  !qIsNaN(lineData.at(i).x())) // NaNs create a gap in the line
5126  {
5127  if (!lastIsNan)
5128  painter->drawLine(lineData.at(i - 1), lineData.at(i));
5129  else
5130  lastIsNan = false;
5131  } else
5132  lastIsNan = true;
5133  ++i;
5134  }
5135  } else {
5136  int segmentStart = 0;
5137  int i = 0;
5138  const int lineDataSize = lineData.size();
5139  while (i < lineDataSize) {
5140  if (qIsNaN(lineData.at(i).y()) || qIsNaN(lineData.at(i).x()) ||
5141  qIsInf(lineData.at(i).y())) // NaNs create a gap in the line.
5142  // Also filter Infs which make
5143  // drawPolyline block
5144  {
5145  painter->drawPolyline(
5146  lineData.constData() + segmentStart,
5147  i - segmentStart); // i, because we don't want to
5148  // include the current NaN point
5149  segmentStart = i + 1;
5150  }
5151  ++i;
5152  }
5153  // draw last segment:
5154  painter->drawPolyline(lineData.constData() + segmentStart,
5155  lineDataSize - segmentStart);
5156  }
5157 }
5158 /* end of 'src/plottable1d.cpp' */
5159 
5160 /* end of 'src/plottable1d.h' */
5161 
5162 /* including file 'src/colorgradient.h', size 6243 */
5163 /* commit ce344b3f96a62e5f652585e55f1ae7c7883cd45b 2018-06-25 01:03:39 +0200 */
5164 
5166  Q_GADGET
5167 public:
5175  ciRGB
5176  ,
5177  ciHSV
5180  };
5181  Q_ENUMS(ColorInterpolation)
5182 
5183 
5188  gpGrayscale
5190  ,
5191  gpHot
5193  ,
5194  gpCold
5196  ,
5197  gpNight
5199  ,
5200  gpCandy
5201  ,
5202  gpGeography
5204  ,
5205  gpIon
5208  ,
5209  gpThermal
5211  ,
5212  gpPolar
5215  ,
5216  gpSpectrum
5219  ,
5220  gpJet
5223  ,
5224  gpHues
5227  };
5228  Q_ENUMS(GradientPreset)
5229 
5230  QCPColorGradient();
5231  QCPColorGradient(GradientPreset preset);
5232  bool operator==(const QCPColorGradient &other) const;
5233  bool operator!=(const QCPColorGradient &other) const {
5234  return !(*this == other);
5235  }
5236 
5237  // getters:
5238  int levelCount() const { return mLevelCount; }
5239  QMap<double, QColor> colorStops() const { return mColorStops; }
5241  return mColorInterpolation;
5242  }
5243  bool periodic() const { return mPeriodic; }
5244 
5245  // setters:
5246  void setLevelCount(int n);
5247  void setColorStops(const QMap<double, QColor> &colorStops);
5248  void setColorStopAt(double position, const QColor &color);
5249  void setColorInterpolation(ColorInterpolation interpolation);
5250  void setPeriodic(bool enabled);
5251 
5252  // non-property methods:
5253  void colorize(const double *data,
5254  const QCPRange &range,
5255  QRgb *scanLine,
5256  int n,
5257  int dataIndexFactor = 1,
5258  bool logarithmic = false);
5259  void colorize(const double *data,
5260  const unsigned char *alpha,
5261  const QCPRange &range,
5262  QRgb *scanLine,
5263  int n,
5264  int dataIndexFactor = 1,
5265  bool logarithmic = false);
5266  QRgb color(double position,
5267  const QCPRange &range,
5268  bool logarithmic = false);
5269  void loadPreset(GradientPreset preset);
5270  void clearColorStops();
5271  QCPColorGradient inverted() const;
5272 
5273 protected:
5274  // property members:
5276  QMap<double, QColor> mColorStops;
5279 
5280  // non-property members:
5281  QVector<QRgb>
5282  mColorBuffer; // have colors premultiplied with alpha (for usage
5283  // with QImage::Format_ARGB32_Premultiplied)
5285 
5286  // non-virtual methods:
5287  bool stopsUseAlpha() const;
5288  void updateColorBuffer();
5289 };
5292 
5293 /* end of 'src/colorgradient.h' */
5294 
5295 /* including file 'src/selectiondecorator-bracket.h', size 4442 */
5296 /* commit ce344b3f96a62e5f652585e55f1ae7c7883cd45b 2018-06-25 01:03:39 +0200 */
5297 
5299  Q_GADGET
5300 public:
5308  bsSquareBracket
5309  ,
5310  bsHalfEllipse
5312  ,
5313  bsEllipse
5315  ,
5316  bsPlus
5317  ,
5318  bsUserStyle
5320  };
5321  Q_ENUMS(BracketStyle)
5322 
5324  virtual ~QCPSelectionDecoratorBracket();
5325 
5326  // getters:
5327  QPen bracketPen() const { return mBracketPen; }
5328  QBrush bracketBrush() const { return mBracketBrush; }
5329  int bracketWidth() const { return mBracketWidth; }
5330  int bracketHeight() const { return mBracketHeight; }
5331  BracketStyle bracketStyle() const { return mBracketStyle; }
5332  bool tangentToData() const { return mTangentToData; }
5333  int tangentAverage() const { return mTangentAverage; }
5334 
5335  // setters:
5336  void setBracketPen(const QPen &pen);
5337  void setBracketBrush(const QBrush &brush);
5338  void setBracketWidth(int width);
5339  void setBracketHeight(int height);
5340  void setBracketStyle(BracketStyle style);
5341  void setTangentToData(bool enabled);
5342  void setTangentAverage(int pointCount);
5343 
5344  // introduced virtual methods:
5345  virtual void drawBracket(QCPPainter *painter, int direction) const;
5346 
5347  // virtual methods:
5348  virtual void drawDecoration(QCPPainter *painter,
5349  QCPDataSelection selection) Q_DECL_OVERRIDE;
5350 
5351 protected:
5352  // property members:
5360 
5361  // non-virtual methods:
5362  double getTangentAngle(const QCPPlottableInterface1D *interface1d,
5363  int dataIndex,
5364  int direction) const;
5365  QPointF getPixelCoordinates(const QCPPlottableInterface1D *interface1d,
5366  int dataIndex) const;
5367 };
5369 
5370 /* end of 'src/selectiondecorator-bracket.h' */
5371 
5372 /* including file 'src/layoutelements/layoutelement-axisrect.h', size 7507 */
5373 /* commit ce344b3f96a62e5f652585e55f1ae7c7883cd45b 2018-06-25 01:03:39 +0200 */
5374 
5376  Q_OBJECT
5378  Q_PROPERTY(QPixmap background READ background WRITE setBackground)
5379  Q_PROPERTY(bool backgroundScaled READ backgroundScaled WRITE
5380  setBackgroundScaled)
5381  Q_PROPERTY(Qt::AspectRatioMode backgroundScaledMode READ
5382  backgroundScaledMode WRITE setBackgroundScaledMode)
5383  Q_PROPERTY(Qt::Orientations rangeDrag READ rangeDrag WRITE setRangeDrag)
5384  Q_PROPERTY(Qt::Orientations rangeZoom READ rangeZoom WRITE setRangeZoom)
5386 public:
5387  explicit QCPAxisRect(QCustomPlot *parentPlot, bool setupDefaultAxes = true);
5388  virtual ~QCPAxisRect();
5389 
5390  // getters:
5391  QPixmap background() const { return mBackgroundPixmap; }
5392  QBrush backgroundBrush() const { return mBackgroundBrush; }
5393  bool backgroundScaled() const { return mBackgroundScaled; }
5394  Qt::AspectRatioMode backgroundScaledMode() const {
5395  return mBackgroundScaledMode;
5396  }
5397  Qt::Orientations rangeDrag() const { return mRangeDrag; }
5398  Qt::Orientations rangeZoom() const { return mRangeZoom; }
5399  QCPAxis *rangeDragAxis(Qt::Orientation orientation);
5400  QCPAxis *rangeZoomAxis(Qt::Orientation orientation);
5401  QList<QCPAxis *> rangeDragAxes(Qt::Orientation orientation);
5402  QList<QCPAxis *> rangeZoomAxes(Qt::Orientation orientation);
5403  double rangeZoomFactor(Qt::Orientation orientation);
5404 
5405  // setters:
5406  void setBackground(const QPixmap &pm);
5407  void setBackground(
5408  const QPixmap &pm,
5409  bool scaled,
5410  Qt::AspectRatioMode mode = Qt::KeepAspectRatioByExpanding);
5411  void setBackground(const QBrush &brush);
5412  void setBackgroundScaled(bool scaled);
5413  void setBackgroundScaledMode(Qt::AspectRatioMode mode);
5414  void setRangeDrag(Qt::Orientations orientations);
5415  void setRangeZoom(Qt::Orientations orientations);
5416  void setRangeDragAxes(QCPAxis *horizontal, QCPAxis *vertical);
5417  void setRangeDragAxes(QList<QCPAxis *> axes);
5418  void setRangeDragAxes(QList<QCPAxis *> horizontal,
5419  QList<QCPAxis *> vertical);
5420  void setRangeZoomAxes(QCPAxis *horizontal, QCPAxis *vertical);
5421  void setRangeZoomAxes(QList<QCPAxis *> axes);
5422  void setRangeZoomAxes(QList<QCPAxis *> horizontal,
5423  QList<QCPAxis *> vertical);
5424  void setRangeZoomFactor(double horizontalFactor, double verticalFactor);
5425  void setRangeZoomFactor(double factor);
5426 
5427  // non-property methods:
5428  int axisCount(QCPAxis::AxisType type) const;
5429  QCPAxis *axis(QCPAxis::AxisType type, int index = 0) const;
5430  QList<QCPAxis *> axes(QCPAxis::AxisTypes types) const;
5431  QList<QCPAxis *> axes() const;
5432  QCPAxis *addAxis(QCPAxis::AxisType type, QCPAxis *axis = 0);
5433  QList<QCPAxis *> addAxes(QCPAxis::AxisTypes types);
5434  bool removeAxis(QCPAxis *axis);
5435  QCPLayoutInset *insetLayout() const { return mInsetLayout; }
5436 
5437  void zoom(const QRectF &pixelRect);
5438  void zoom(const QRectF &pixelRect, const QList<QCPAxis *> &affectedAxes);
5439  void setupFullAxesBox(bool connectRanges = false);
5440  QList<QCPAbstractPlottable *> plottables() const;
5441  QList<QCPGraph *> graphs() const;
5442  QList<QCPAbstractItem *> items() const;
5443 
5444  // read-only interface imitating a QRect:
5445  int left() const { return mRect.left(); }
5446  int right() const { return mRect.right(); }
5447  int top() const { return mRect.top(); }
5448  int bottom() const { return mRect.bottom(); }
5449  int width() const { return mRect.width(); }
5450  int height() const { return mRect.height(); }
5451  QSize size() const { return mRect.size(); }
5452  QPoint topLeft() const { return mRect.topLeft(); }
5453  QPoint topRight() const { return mRect.topRight(); }
5454  QPoint bottomLeft() const { return mRect.bottomLeft(); }
5455  QPoint bottomRight() const { return mRect.bottomRight(); }
5456  QPoint center() const { return mRect.center(); }
5457 
5458  // reimplemented virtual methods:
5459  virtual void update(UpdatePhase phase) Q_DECL_OVERRIDE;
5460  virtual QList<QCPLayoutElement *> elements(bool recursive) const
5462 
5463 protected:
5464  // property members:
5469  Qt::AspectRatioMode mBackgroundScaledMode;
5471  Qt::Orientations mRangeDrag, mRangeZoom;
5472  QList<QPointer<QCPAxis>> mRangeDragHorzAxis, mRangeDragVertAxis;
5473  QList<QPointer<QCPAxis>> mRangeZoomHorzAxis, mRangeZoomVertAxis;
5474  double mRangeZoomFactorHorz, mRangeZoomFactorVert;
5475 
5476  // non-property members:
5477  QList<QCPRange> mDragStartHorzRange, mDragStartVertRange;
5478  QCP::AntialiasedElements mAADragBackup, mNotAADragBackup;
5480  QHash<QCPAxis::AxisType, QList<QCPAxis *>> mAxes;
5481 
5482  // reimplemented virtual methods:
5483  virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const
5485  virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
5486  virtual int calculateAutoMargin(QCP::MarginSide side) Q_DECL_OVERRIDE;
5487  virtual void layoutChanged() Q_DECL_OVERRIDE;
5488  // events:
5489  virtual void mousePressEvent(QMouseEvent *event,
5490  const QVariant &details) Q_DECL_OVERRIDE;
5491  virtual void mouseMoveEvent(QMouseEvent *event,
5492  const QPointF &startPos) Q_DECL_OVERRIDE;
5493  virtual void mouseReleaseEvent(QMouseEvent *event,
5494  const QPointF &startPos) Q_DECL_OVERRIDE;
5495  virtual void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE;
5496 
5497  // non-property methods:
5498  void drawBackground(QCPPainter *painter);
5499  void updateAxesOffset(QCPAxis::AxisType type);
5500 
5501 private:
5502  Q_DISABLE_COPY(QCPAxisRect)
5503 
5504  friend class QCustomPlot;
5505 };
5506 
5507 /* end of 'src/layoutelements/layoutelement-axisrect.h' */
5508 
5509 /* including file 'src/layoutelements/layoutelement-legend.h', size 10397 */
5510 /* commit ce344b3f96a62e5f652585e55f1ae7c7883cd45b 2018-06-25 01:03:39 +0200 */
5511 
5513  Q_OBJECT
5515  Q_PROPERTY(QCPLegend *parentLegend READ parentLegend)
5516  Q_PROPERTY(QFont font READ font WRITE setFont)
5517  Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor)
5518  Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont)
5519  Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE
5520  setSelectedTextColor)
5521  Q_PROPERTY(bool selectable READ selectable WRITE setSelectable NOTIFY
5522  selectionChanged)
5523  Q_PROPERTY(bool selected READ selected WRITE setSelected NOTIFY
5524  selectableChanged)
5526 public:
5527  explicit QCPAbstractLegendItem(QCPLegend *parent);
5528 
5529  // getters:
5530  QCPLegend *parentLegend() const { return mParentLegend; }
5531  QFont font() const { return mFont; }
5532  QColor textColor() const { return mTextColor; }
5533  QFont selectedFont() const { return mSelectedFont; }
5534  QColor selectedTextColor() const { return mSelectedTextColor; }
5535  bool selectable() const { return mSelectable; }
5536  bool selected() const { return mSelected; }
5537 
5538  // setters:
5539  void setFont(const QFont &font);
5540  void setTextColor(const QColor &color);
5541  void setSelectedFont(const QFont &font);
5542  void setSelectedTextColor(const QColor &color);
5543  Q_SLOT void setSelectable(bool selectable);
5544  Q_SLOT void setSelected(bool selected);
5545 
5546  // reimplemented virtual methods:
5547  virtual double selectTest(const QPointF &pos,
5548  bool onlySelectable,
5549  QVariant *details = 0) const Q_DECL_OVERRIDE;
5550 
5551 signals:
5552  void selectionChanged(bool selected);
5553  void selectableChanged(bool selectable);
5554 
5555 protected:
5556  // property members:
5557  QCPLegend *mParentLegend;
5558  QFont mFont;
5559  QColor mTextColor;
5560  QFont mSelectedFont;
5561  QColor mSelectedTextColor;
5562  bool mSelectable, mSelected;
5563 
5564  // reimplemented virtual methods:
5565  virtual QCP::Interaction selectionCategory() const Q_DECL_OVERRIDE;
5566  virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const
5568  virtual QRect clipRect() const Q_DECL_OVERRIDE;
5569  virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE = 0;
5570  // events:
5571  virtual void selectEvent(QMouseEvent *event,
5572  bool additive,
5573  const QVariant &details,
5574  bool *selectionStateChanged) Q_DECL_OVERRIDE;
5575  virtual void deselectEvent(bool *selectionStateChanged) Q_DECL_OVERRIDE;
5576 
5577 private:
5578  Q_DISABLE_COPY(QCPAbstractLegendItem)
5579 
5580  friend class QCPLegend;
5581 };
5582 
5584  Q_OBJECT
5585 public:
5587 
5588  // getters:
5589  QCPAbstractPlottable *plottable() { return mPlottable; }
5590 
5591 protected:
5592  // property members:
5594 
5595  // reimplemented virtual methods:
5596  virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
5597  virtual QSize minimumOuterSizeHint() const Q_DECL_OVERRIDE;
5598 
5599  // non-virtual methods:
5600  QPen getIconBorderPen() const;
5601  QColor getTextColor() const;
5602  QFont getFont() const;
5603 };
5604 
5606  Q_OBJECT
5608  Q_PROPERTY(QPen borderPen READ borderPen WRITE setBorderPen)
5609  Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
5610  Q_PROPERTY(QFont font READ font WRITE setFont)
5611  Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor)
5612  Q_PROPERTY(QSize iconSize READ iconSize WRITE setIconSize)
5613  Q_PROPERTY(
5614  int iconTextPadding READ iconTextPadding WRITE setIconTextPadding)
5615  Q_PROPERTY(QPen iconBorderPen READ iconBorderPen WRITE setIconBorderPen)
5616  Q_PROPERTY(SelectableParts selectableParts READ selectableParts WRITE
5617  setSelectableParts NOTIFY selectionChanged)
5618  Q_PROPERTY(SelectableParts selectedParts READ selectedParts WRITE
5619  setSelectedParts NOTIFY selectableChanged)
5620  Q_PROPERTY(QPen selectedBorderPen READ selectedBorderPen WRITE
5621  setSelectedBorderPen)
5622  Q_PROPERTY(QPen selectedIconBorderPen READ selectedIconBorderPen WRITE
5623  setSelectedIconBorderPen)
5624  Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
5625  Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont)
5626  Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE
5627  setSelectedTextColor)
5629 public:
5636  spNone = 0x000
5637  ,
5638  spLegendBox = 0x001
5639  ,
5640  spItems = 0x002
5642  };
5643  Q_ENUMS(SelectablePart)
5644  Q_FLAGS(SelectableParts)
5645  Q_DECLARE_FLAGS(SelectableParts, SelectablePart)
5646 
5647  explicit QCPLegend();
5648  virtual ~QCPLegend();
5649 
5650  // getters:
5651  QPen borderPen() const { return mBorderPen; }
5652  QBrush brush() const { return mBrush; }
5653  QFont font() const { return mFont; }
5654  QColor textColor() const { return mTextColor; }
5655  QSize iconSize() const { return mIconSize; }
5656  int iconTextPadding() const { return mIconTextPadding; }
5657  QPen iconBorderPen() const { return mIconBorderPen; }
5658  SelectableParts selectableParts() const { return mSelectableParts; }
5659  SelectableParts selectedParts() const;
5660  QPen selectedBorderPen() const { return mSelectedBorderPen; }
5661  QPen selectedIconBorderPen() const { return mSelectedIconBorderPen; }
5662  QBrush selectedBrush() const { return mSelectedBrush; }
5663  QFont selectedFont() const { return mSelectedFont; }
5664  QColor selectedTextColor() const { return mSelectedTextColor; }
5665 
5666  // setters:
5667  void setBorderPen(const QPen &pen);
5668  void setBrush(const QBrush &brush);
5669  void setFont(const QFont &font);
5670  void setTextColor(const QColor &color);
5671  void setIconSize(const QSize &size);
5672  void setIconSize(int width, int height);
5673  void setIconTextPadding(int padding);
5674  void setIconBorderPen(const QPen &pen);
5675  Q_SLOT void setSelectableParts(const SelectableParts &selectableParts);
5676  Q_SLOT void setSelectedParts(const SelectableParts &selectedParts);
5677  void setSelectedBorderPen(const QPen &pen);
5678  void setSelectedIconBorderPen(const QPen &pen);
5679  void setSelectedBrush(const QBrush &brush);
5680  void setSelectedFont(const QFont &font);
5681  void setSelectedTextColor(const QColor &color);
5682 
5683  // reimplemented virtual methods:
5684  virtual double selectTest(const QPointF &pos,
5685  bool onlySelectable,
5686  QVariant *details = 0) const Q_DECL_OVERRIDE;
5687 
5688  // non-virtual methods:
5689  QCPAbstractLegendItem *item(int index) const;
5690  QCPPlottableLegendItem *itemWithPlottable(
5691  const QCPAbstractPlottable *plottable) const;
5692  int itemCount() const;
5693  bool hasItem(QCPAbstractLegendItem *item) const;
5694  bool hasItemWithPlottable(const QCPAbstractPlottable *plottable) const;
5695  bool addItem(QCPAbstractLegendItem *item);
5696  bool removeItem(int index);
5697  bool removeItem(QCPAbstractLegendItem *item);
5698  void clearItems();
5699  QList<QCPAbstractLegendItem *> selectedItems() const;
5700 
5701 signals:
5702  void selectionChanged(QCPLegend::SelectableParts parts);
5703  void selectableChanged(QCPLegend::SelectableParts parts);
5704 
5705 protected:
5706  // property members:
5707  QPen mBorderPen, mIconBorderPen;
5708  QBrush mBrush;
5709  QFont mFont;
5710  QColor mTextColor;
5711  QSize mIconSize;
5712  int mIconTextPadding;
5713  SelectableParts mSelectedParts, mSelectableParts;
5714  QPen mSelectedBorderPen, mSelectedIconBorderPen;
5715  QBrush mSelectedBrush;
5716  QFont mSelectedFont;
5717  QColor mSelectedTextColor;
5718 
5719  // reimplemented virtual methods:
5720  virtual void parentPlotInitialized(QCustomPlot *parentPlot) Q_DECL_OVERRIDE;
5721  virtual QCP::Interaction selectionCategory() const Q_DECL_OVERRIDE;
5722  virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const
5724  virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
5725  // events:
5726  virtual void selectEvent(QMouseEvent *event,
5727  bool additive,
5728  const QVariant &details,
5729  bool *selectionStateChanged) Q_DECL_OVERRIDE;
5730  virtual void deselectEvent(bool *selectionStateChanged) Q_DECL_OVERRIDE;
5731 
5732  // non-virtual methods:
5733  QPen getBorderPen() const;
5734  QBrush getBrush() const;
5735 
5736 private:
5737  Q_DISABLE_COPY(QCPLegend)
5738 
5739  friend class QCustomPlot;
5741 };
5742 Q_DECLARE_OPERATORS_FOR_FLAGS(QCPLegend::SelectableParts)
5744 
5745 /* end of 'src/layoutelements/layoutelement-legend.h' */
5746 
5747 /* including file 'src/layoutelements/layoutelement-textelement.h', size 5353 */
5748 /* commit ce344b3f96a62e5f652585e55f1ae7c7883cd45b 2018-06-25 01:03:39 +0200 */
5749 
5751  Q_OBJECT
5753  Q_PROPERTY(QString text READ text WRITE setText)
5754  Q_PROPERTY(QFont font READ font WRITE setFont)
5755  Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor)
5756  Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont)
5757  Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE
5758  setSelectedTextColor)
5759  Q_PROPERTY(bool selectable READ selectable WRITE setSelectable NOTIFY
5760  selectableChanged)
5761  Q_PROPERTY(bool selected READ selected WRITE setSelected NOTIFY
5762  selectionChanged)
5764 public:
5765  explicit QCPTextElement(QCustomPlot *parentPlot);
5766  QCPTextElement(QCustomPlot *parentPlot, const QString &text);
5767  QCPTextElement(QCustomPlot *parentPlot,
5768  const QString &text,
5769  double pointSize);
5770  QCPTextElement(QCustomPlot *parentPlot,
5771  const QString &text,
5772  const QString &fontFamily,
5773  double pointSize);
5774  QCPTextElement(QCustomPlot *parentPlot,
5775  const QString &text,
5776  const QFont &font);
5777 
5778  // getters:
5779  QString text() const { return mText; }
5780  int textFlags() const { return mTextFlags; }
5781  QFont font() const { return mFont; }
5782  QColor textColor() const { return mTextColor; }
5783  QFont selectedFont() const { return mSelectedFont; }
5784  QColor selectedTextColor() const { return mSelectedTextColor; }
5785  bool selectable() const { return mSelectable; }
5786  bool selected() const { return mSelected; }
5787 
5788  // setters:
5789  void setText(const QString &text);
5790  void setTextFlags(int flags);
5791  void setFont(const QFont &font);
5792  void setTextColor(const QColor &color);
5793  void setSelectedFont(const QFont &font);
5794  void setSelectedTextColor(const QColor &color);
5795  Q_SLOT void setSelectable(bool selectable);
5796  Q_SLOT void setSelected(bool selected);
5797 
5798  // reimplemented virtual methods:
5799  virtual double selectTest(const QPointF &pos,
5800  bool onlySelectable,
5801  QVariant *details = 0) const Q_DECL_OVERRIDE;
5802  virtual void mousePressEvent(QMouseEvent *event,
5803  const QVariant &details) Q_DECL_OVERRIDE;
5804  virtual void mouseReleaseEvent(QMouseEvent *event,
5805  const QPointF &startPos) Q_DECL_OVERRIDE;
5806  virtual void mouseDoubleClickEvent(QMouseEvent *event,
5807  const QVariant &details) Q_DECL_OVERRIDE;
5808 
5809 signals:
5810  void selectionChanged(bool selected);
5811  void selectableChanged(bool selectable);
5812  void clicked(QMouseEvent *event);
5813  void doubleClicked(QMouseEvent *event);
5814 
5815 protected:
5816  // property members:
5817  QString mText;
5818  int mTextFlags;
5819  QFont mFont;
5820  QColor mTextColor;
5821  QFont mSelectedFont;
5822  QColor mSelectedTextColor;
5823  QRect mTextBoundingRect;
5824  bool mSelectable, mSelected;
5825 
5826  // reimplemented virtual methods:
5827  virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const
5829  virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
5830  virtual QSize minimumOuterSizeHint() const Q_DECL_OVERRIDE;
5831  virtual QSize maximumOuterSizeHint() const Q_DECL_OVERRIDE;
5832  // events:
5833  virtual void selectEvent(QMouseEvent *event,
5834  bool additive,
5835  const QVariant &details,
5836  bool *selectionStateChanged) Q_DECL_OVERRIDE;
5837  virtual void deselectEvent(bool *selectionStateChanged) Q_DECL_OVERRIDE;
5838 
5839  // non-virtual methods:
5840  QFont mainFont() const;
5841  QColor mainTextColor() const;
5842 
5843 private:
5844  Q_DISABLE_COPY(QCPTextElement)
5845 };
5846 
5847 /* end of 'src/layoutelements/layoutelement-textelement.h' */
5848 
5849 /* including file 'src/layoutelements/layoutelement-colorscale.h', size 5923 */
5850 /* commit ce344b3f96a62e5f652585e55f1ae7c7883cd45b 2018-06-25 01:03:39 +0200 */
5851 
5852 class QCPColorScaleAxisRectPrivate : public QCPAxisRect {
5853  Q_OBJECT
5854 public:
5855  explicit QCPColorScaleAxisRectPrivate(QCPColorScale *parentColorScale);
5856 
5857 protected:
5858  QCPColorScale *mParentColorScale;
5859  QImage mGradientImage;
5860  bool mGradientImageInvalidated;
5861  // re-using some methods of QCPAxisRect to make them available to friend
5862  // class QCPColorScale
5867  using QCPAxisRect::update;
5869  virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
5870  void updateGradientImage();
5871  Q_SLOT void axisSelectionChanged(QCPAxis::SelectableParts selectedParts);
5872  Q_SLOT void axisSelectableChanged(QCPAxis::SelectableParts selectableParts);
5873  friend class QCPColorScale;
5874 };
5875 
5877  Q_OBJECT
5879  Q_PROPERTY(QCPAxis::AxisType type READ type WRITE setType)
5880  Q_PROPERTY(QCPRange dataRange READ dataRange WRITE setDataRange NOTIFY
5881  dataRangeChanged)
5882  Q_PROPERTY(QCPAxis::ScaleType dataScaleType READ dataScaleType WRITE
5883  setDataScaleType NOTIFY dataScaleTypeChanged)
5884  Q_PROPERTY(QCPColorGradient gradient READ gradient WRITE setGradient NOTIFY
5885  gradientChanged)
5886  Q_PROPERTY(QString label READ label WRITE setLabel)
5887  Q_PROPERTY(int barWidth READ barWidth WRITE setBarWidth)
5888  Q_PROPERTY(bool rangeDrag READ rangeDrag WRITE setRangeDrag)
5889  Q_PROPERTY(bool rangeZoom READ rangeZoom WRITE setRangeZoom)
5891 public:
5892  explicit QCPColorScale(QCustomPlot *parentPlot);
5893  virtual ~QCPColorScale();
5894 
5895  // getters:
5896  QCPAxis *axis() const { return mColorAxis.data(); }
5897  QCPAxis::AxisType type() const { return mType; }
5898  QCPRange dataRange() const { return mDataRange; }
5899  QCPAxis::ScaleType dataScaleType() const { return mDataScaleType; }
5900  QCPColorGradient gradient() const { return mGradient; }
5901  QString label() const;
5902  int barWidth() const { return mBarWidth; }
5903  bool rangeDrag() const;
5904  bool rangeZoom() const;
5905 
5906  // setters:
5907  void setType(QCPAxis::AxisType type);
5908  Q_SLOT void setDataRange(const QCPRange &dataRange);
5909  Q_SLOT void setDataScaleType(QCPAxis::ScaleType scaleType);
5910  Q_SLOT void setGradient(const QCPColorGradient &gradient);
5911  void setLabel(const QString &str);
5912  void setBarWidth(int width);
5913  void setRangeDrag(bool enabled);
5914  void setRangeZoom(bool enabled);
5915 
5916  // non-property methods:
5917  QList<QCPColorMap *> colorMaps() const;
5918  void rescaleDataRange(bool onlyVisibleMaps);
5919 
5920  // reimplemented virtual methods:
5921  virtual void update(UpdatePhase phase) Q_DECL_OVERRIDE;
5922 
5923 signals:
5924  void dataRangeChanged(const QCPRange &newRange);
5926  void gradientChanged(const QCPColorGradient &newGradient);
5927 
5928 protected:
5929  // property members:
5935 
5936  // non-property members:
5937  QPointer<QCPColorScaleAxisRectPrivate> mAxisRect;
5938  QPointer<QCPAxis> mColorAxis;
5939 
5940  // reimplemented virtual methods:
5941  virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const
5943  // events:
5944  virtual void mousePressEvent(QMouseEvent *event,
5945  const QVariant &details) Q_DECL_OVERRIDE;
5946  virtual void mouseMoveEvent(QMouseEvent *event,
5947  const QPointF &startPos) Q_DECL_OVERRIDE;
5948  virtual void mouseReleaseEvent(QMouseEvent *event,
5949  const QPointF &startPos) Q_DECL_OVERRIDE;
5950  virtual void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE;
5951 
5952 private:
5953  Q_DISABLE_COPY(QCPColorScale)
5954 
5955  friend class QCPColorScaleAxisRectPrivate;
5956 };
5957 
5958 /* end of 'src/layoutelements/layoutelement-colorscale.h' */
5959 
5960 /* including file 'src/plottables/plottable-graph.h', size 9294 */
5961 /* commit ce344b3f96a62e5f652585e55f1ae7c7883cd45b 2018-06-25 01:03:39 +0200 */
5962 
5964 public:
5965  QCPGraphData();
5966  QCPGraphData(double key, double value);
5967 
5968  inline double sortKey() const { return key; }
5969  inline static QCPGraphData fromSortKey(double sortKey) {
5970  return QCPGraphData(sortKey, 0);
5971  }
5972  inline static bool sortKeyIsMainKey() { return true; }
5973 
5974  inline double mainKey() const { return key; }
5975  inline double mainValue() const { return value; }
5976 
5977  inline QCPRange valueRange() const { return QCPRange(value, value); }
5978 
5979  double key, value;
5980 };
5982 
5995 
5996 class QCP_LIB_DECL QCPGraph : public QCPAbstractPlottable1D<QCPGraphData> {
5997  Q_OBJECT
5999  Q_PROPERTY(LineStyle lineStyle READ lineStyle WRITE setLineStyle)
6000  Q_PROPERTY(QCPScatterStyle scatterStyle READ scatterStyle WRITE
6001  setScatterStyle)
6002  Q_PROPERTY(int scatterSkip READ scatterSkip WRITE setScatterSkip)
6003  Q_PROPERTY(QCPGraph *channelFillGraph READ channelFillGraph WRITE
6004  setChannelFillGraph)
6005  Q_PROPERTY(bool adaptiveSampling READ adaptiveSampling WRITE
6006  setAdaptiveSampling)
6008 public:
6014  enum LineStyle {
6015  lsNone
6018  ,
6019  lsLine
6020  ,
6021  lsStepLeft
6023  ,
6024  lsStepRight
6026  ,
6027  lsStepCenter
6029  ,
6030  lsImpulse
6033  };
6034  Q_ENUMS(LineStyle)
6035 
6036  explicit QCPGraph(QCPAxis *keyAxis, QCPAxis *valueAxis);
6037  virtual ~QCPGraph();
6038 
6039  // getters:
6040  QSharedPointer<QCPGraphDataContainer> data() const {
6041  return mDataContainer;
6042  }
6043  LineStyle lineStyle() const { return mLineStyle; }
6044  QCPScatterStyle scatterStyle() const { return mScatterStyle; }
6045  int scatterSkip() const { return mScatterSkip; }
6046  QCPGraph *channelFillGraph() const { return mChannelFillGraph.data(); }
6047  bool adaptiveSampling() const { return mAdaptiveSampling; }
6048 
6049  // setters:
6050  void setData(QSharedPointer<QCPGraphDataContainer> data);
6051  void setData(const QVector<double> &keys,
6052  const QVector<double> &values,
6053  bool alreadySorted = false);
6054  void setLineStyle(LineStyle ls);
6055  void setScatterStyle(const QCPScatterStyle &style);
6056  void setScatterSkip(int skip);
6057  void setChannelFillGraph(QCPGraph *targetGraph);
6058  void setAdaptiveSampling(bool enabled);
6059 
6060  // non-property methods:
6061  void addData(const QVector<double> &keys,
6062  const QVector<double> &values,
6063  bool alreadySorted = false);
6064  void addData(double key, double value);
6065 
6066  // reimplemented virtual methods:
6067  virtual double selectTest(const QPointF &pos,
6068  bool onlySelectable,
6069  QVariant *details = 0) const Q_DECL_OVERRIDE;
6070  virtual QCPRange getKeyRange(
6071  bool &foundRange,
6072  QCP::SignDomain inSignDomain = QCP::sdBoth) const Q_DECL_OVERRIDE;
6073  virtual QCPRange getValueRange(
6074  bool &foundRange,
6075  QCP::SignDomain inSignDomain = QCP::sdBoth,
6076  const QCPRange &inKeyRange = QCPRange()) const Q_DECL_OVERRIDE;
6077 
6078 protected:
6079  // property members:
6080  LineStyle mLineStyle;
6081  QCPScatterStyle mScatterStyle;
6082  int mScatterSkip;
6083  QPointer<QCPGraph> mChannelFillGraph;
6084  bool mAdaptiveSampling;
6085 
6086  // reimplemented virtual methods:
6087  virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
6088  virtual void drawLegendIcon(QCPPainter *painter,
6089  const QRectF &rect) const Q_DECL_OVERRIDE;
6090 
6091  // introduced virtual methods:
6092  virtual void drawFill(QCPPainter *painter, QVector<QPointF> *lines) const;
6093  virtual void drawScatterPlot(QCPPainter *painter,
6094  const QVector<QPointF> &scatters,
6095  const QCPScatterStyle &style) const;
6096  virtual void drawLinePlot(QCPPainter *painter,
6097  const QVector<QPointF> &lines) const;
6098  virtual void drawImpulsePlot(QCPPainter *painter,
6099  const QVector<QPointF> &lines) const;
6100 
6101  virtual void getOptimizedLineData(
6102  QVector<QCPGraphData> *lineData,
6103  const QCPGraphDataContainer::const_iterator &begin,
6104  const QCPGraphDataContainer::const_iterator &end) const;
6105  virtual void getOptimizedScatterData(
6106  QVector<QCPGraphData> *scatterData,
6107  QCPGraphDataContainer::const_iterator begin,
6108  QCPGraphDataContainer::const_iterator end) const;
6109 
6110  // non-virtual methods:
6111  void getVisibleDataBounds(QCPGraphDataContainer::const_iterator &begin,
6112  QCPGraphDataContainer::const_iterator &end,
6113  const QCPDataRange &rangeRestriction) const;
6114  void getLines(QVector<QPointF> *lines, const QCPDataRange &dataRange) const;
6115  void getScatters(QVector<QPointF> *scatters,
6116  const QCPDataRange &dataRange) const;
6117  QVector<QPointF> dataToLines(const QVector<QCPGraphData> &data) const;
6118  QVector<QPointF> dataToStepLeftLines(
6119  const QVector<QCPGraphData> &data) const;
6120  QVector<QPointF> dataToStepRightLines(
6121  const QVector<QCPGraphData> &data) const;
6122  QVector<QPointF> dataToStepCenterLines(
6123  const QVector<QCPGraphData> &data) const;
6124  QVector<QPointF> dataToImpulseLines(
6125  const QVector<QCPGraphData> &data) const;
6126  QVector<QCPDataRange> getNonNanSegments(
6127  const QVector<QPointF> *lineData,
6128  Qt::Orientation keyOrientation) const;
6129  QVector<QPair<QCPDataRange, QCPDataRange>> getOverlappingSegments(
6130  QVector<QCPDataRange> thisSegments,
6131  const QVector<QPointF> *thisData,
6132  QVector<QCPDataRange> otherSegments,
6133  const QVector<QPointF> *otherData) const;
6134  bool segmentsIntersect(double aLower,
6135  double aUpper,
6136  double bLower,
6137  double bUpper,
6138  int &bPrecedence) const;
6139  QPointF getFillBasePoint(QPointF matchingDataPoint) const;
6140  const QPolygonF getFillPolygon(const QVector<QPointF> *lineData,
6141  QCPDataRange segment) const;
6142  const QPolygonF getChannelFillPolygon(const QVector<QPointF> *lineData,
6143  QCPDataRange thisSegment,
6144  const QVector<QPointF> *otherData,
6145  QCPDataRange otherSegment) const;
6146  int findIndexBelowX(const QVector<QPointF> *data, double x) const;
6147  int findIndexAboveX(const QVector<QPointF> *data, double x) const;
6148  int findIndexBelowY(const QVector<QPointF> *data, double y) const;
6149  int findIndexAboveY(const QVector<QPointF> *data, double y) const;
6150  double pointDistance(
6151  const QPointF &pixelPoint,
6152  QCPGraphDataContainer::const_iterator &closestData) const;
6153 
6154  friend class QCustomPlot;
6155  friend class QCPLegend;
6156 };
6158 
6159 /* end of 'src/plottables/plottable-graph.h' */
6160 
6161 /* including file 'src/plottables/plottable-curve.h', size 7409 */
6162 /* commit ce344b3f96a62e5f652585e55f1ae7c7883cd45b 2018-06-25 01:03:39 +0200 */
6163 
6165 public:
6166  QCPCurveData();
6167  QCPCurveData(double t, double key, double value);
6168 
6169  inline double sortKey() const { return t; }
6170  inline static QCPCurveData fromSortKey(double sortKey) {
6171  return QCPCurveData(sortKey, 0, 0);
6172  }
6173  inline static bool sortKeyIsMainKey() { return false; }
6174 
6175  inline double mainKey() const { return key; }
6176  inline double mainValue() const { return value; }
6177 
6178  inline QCPRange valueRange() const { return QCPRange(value, value); }
6179 
6180  double t, key, value;
6181 };
6183 
6197 
6198 class QCP_LIB_DECL QCPCurve : public QCPAbstractPlottable1D<QCPCurveData> {
6199  Q_OBJECT
6201  Q_PROPERTY(QCPScatterStyle scatterStyle READ scatterStyle WRITE
6202  setScatterStyle)
6203  Q_PROPERTY(int scatterSkip READ scatterSkip WRITE setScatterSkip)
6204  Q_PROPERTY(LineStyle lineStyle READ lineStyle WRITE setLineStyle)
6206 public:
6212  enum LineStyle {
6213  lsNone
6214  ,
6215  lsLine
6216  };
6217  Q_ENUMS(LineStyle)
6218 
6219  explicit QCPCurve(QCPAxis *keyAxis, QCPAxis *valueAxis);
6220  virtual ~QCPCurve();
6221 
6222  // getters:
6223  QSharedPointer<QCPCurveDataContainer> data() const {
6224  return mDataContainer;
6225  }
6226  QCPScatterStyle scatterStyle() const { return mScatterStyle; }
6227  int scatterSkip() const { return mScatterSkip; }
6228  LineStyle lineStyle() const { return mLineStyle; }
6229 
6230  // setters:
6231  void setData(QSharedPointer<QCPCurveDataContainer> data);
6232  void setData(const QVector<double> &t,
6233  const QVector<double> &keys,
6234  const QVector<double> &values,
6235  bool alreadySorted = false);
6236  void setData(const QVector<double> &keys, const QVector<double> &values);
6237  void setScatterStyle(const QCPScatterStyle &style);
6238  void setScatterSkip(int skip);
6239  void setLineStyle(LineStyle style);
6240 
6241  // non-property methods:
6242  void addData(const QVector<double> &t,
6243  const QVector<double> &keys,
6244  const QVector<double> &values,
6245  bool alreadySorted = false);
6246  void addData(const QVector<double> &keys, const QVector<double> &values);
6247  void addData(double t, double key, double value);
6248  void addData(double key, double value);
6249 
6250  // reimplemented virtual methods:
6251  virtual double selectTest(const QPointF &pos,
6252  bool onlySelectable,
6253  QVariant *details = 0) const Q_DECL_OVERRIDE;
6254  virtual QCPRange getKeyRange(
6255  bool &foundRange,
6256  QCP::SignDomain inSignDomain = QCP::sdBoth) const Q_DECL_OVERRIDE;
6257  virtual QCPRange getValueRange(
6258  bool &foundRange,
6259  QCP::SignDomain inSignDomain = QCP::sdBoth,
6260  const QCPRange &inKeyRange = QCPRange()) const Q_DECL_OVERRIDE;
6261 
6262 protected:
6263  // property members:
6264  QCPScatterStyle mScatterStyle;
6265  int mScatterSkip;
6266  LineStyle mLineStyle;
6267 
6268  // reimplemented virtual methods:
6269  virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
6270  virtual void drawLegendIcon(QCPPainter *painter,
6271  const QRectF &rect) const Q_DECL_OVERRIDE;
6272 
6273  // introduced virtual methods:
6274  virtual void drawCurveLine(QCPPainter *painter,
6275  const QVector<QPointF> &lines) const;
6276  virtual void drawScatterPlot(QCPPainter *painter,
6277  const QVector<QPointF> &points,
6278  const QCPScatterStyle &style) const;
6279 
6280  // non-virtual methods:
6281  void getCurveLines(QVector<QPointF> *lines,
6282  const QCPDataRange &dataRange,
6283  double penWidth) const;
6284  void getScatters(QVector<QPointF> *scatters,
6285  const QCPDataRange &dataRange,
6286  double scatterWidth) const;
6287  int getRegion(double key,
6288  double value,
6289  double keyMin,
6290  double valueMax,
6291  double keyMax,
6292  double valueMin) const;
6293  QPointF getOptimizedPoint(int prevRegion,
6294  double prevKey,
6295  double prevValue,
6296  double key,
6297  double value,
6298  double keyMin,
6299  double valueMax,
6300  double keyMax,
6301  double valueMin) const;
6302  QVector<QPointF> getOptimizedCornerPoints(int prevRegion,
6303  int currentRegion,
6304  double prevKey,
6305  double prevValue,
6306  double key,
6307  double value,
6308  double keyMin,
6309  double valueMax,
6310  double keyMax,
6311  double valueMin) const;
6312  bool mayTraverse(int prevRegion, int currentRegion) const;
6313  bool getTraverse(double prevKey,
6314  double prevValue,
6315  double key,
6316  double value,
6317  double keyMin,
6318  double valueMax,
6319  double keyMax,
6320  double valueMin,
6321  QPointF &crossA,
6322  QPointF &crossB) const;
6323  void getTraverseCornerPoints(int prevRegion,
6324  int currentRegion,
6325  double keyMin,
6326  double valueMax,
6327  double keyMax,
6328  double valueMin,
6329  QVector<QPointF> &beforeTraverse,
6330  QVector<QPointF> &afterTraverse) const;
6331  double pointDistance(
6332  const QPointF &pixelPoint,
6333  QCPCurveDataContainer::const_iterator &closestData) const;
6334 
6335  friend class QCustomPlot;
6336  friend class QCPLegend;
6337 };
6339 
6340 /* end of 'src/plottables/plottable-curve.h' */
6341 
6342 /* including file 'src/plottables/plottable-bars.h', size 8933 */
6343 /* commit ce344b3f96a62e5f652585e55f1ae7c7883cd45b 2018-06-25 01:03:39 +0200 */
6344 
6345 class QCP_LIB_DECL QCPBarsGroup : public QObject {
6346  Q_OBJECT
6348  Q_PROPERTY(SpacingType spacingType READ spacingType WRITE setSpacingType)
6349  Q_PROPERTY(double spacing READ spacing WRITE setSpacing)
6351 public:
6359  stAbsolute
6360  ,
6361  stAxisRectRatio
6363  ,
6364  stPlotCoords
6366  };
6367  Q_ENUMS(SpacingType)
6368 
6369  explicit QCPBarsGroup(QCustomPlot *parentPlot);
6370  virtual ~QCPBarsGroup();
6371 
6372  // getters:
6373  SpacingType spacingType() const { return mSpacingType; }
6374  double spacing() const { return mSpacing; }
6375 
6376  // setters:
6377  void setSpacingType(SpacingType spacingType);
6378  void setSpacing(double spacing);
6379 
6380  // non-virtual methods:
6381  QList<QCPBars *> bars() const { return mBars; }
6382  QCPBars *bars(int index) const;
6383  int size() const { return mBars.size(); }
6384  bool isEmpty() const { return mBars.isEmpty(); }
6385  void clear();
6386  bool contains(QCPBars *bars) const { return mBars.contains(bars); }
6387  void append(QCPBars *bars);
6388  void insert(int i, QCPBars *bars);
6389  void remove(QCPBars *bars);
6390 
6391 protected:
6392  // non-property members:
6395  double mSpacing;
6396  QList<QCPBars *> mBars;
6397 
6398  // non-virtual methods:
6399  void registerBars(QCPBars *bars);
6400  void unregisterBars(QCPBars *bars);
6401 
6402  // virtual methods:
6403  double keyPixelOffset(const QCPBars *bars, double keyCoord);
6404  double getPixelSpacing(const QCPBars *bars, double keyCoord);
6405 
6406 private:
6407  Q_DISABLE_COPY(QCPBarsGroup)
6408 
6409  friend class QCPBars;
6410 };
6412 
6414 public:
6415  QCPBarsData();
6416  QCPBarsData(double key, double value);
6417 
6418  inline double sortKey() const { return key; }
6419  inline static QCPBarsData fromSortKey(double sortKey) {
6420  return QCPBarsData(sortKey, 0);
6421  }
6422  inline static bool sortKeyIsMainKey() { return true; }
6423 
6424  inline double mainKey() const { return key; }
6425  inline double mainValue() const { return value; }
6426 
6427  inline QCPRange valueRange() const {
6428  return QCPRange(value, value);
6429  } // note that bar base value isn't held in each QCPBarsData and thus
6430  // can't/shouldn't be returned here
6431 
6432  double key, value;
6433 };
6434 Q_DECLARE_TYPEINFO(QCPBarsData, Q_PRIMITIVE_TYPE);
6435 
6448 
6449 class QCP_LIB_DECL QCPBars : public QCPAbstractPlottable1D<QCPBarsData> {
6450  Q_OBJECT
6452  Q_PROPERTY(double width READ width WRITE setWidth)
6453  Q_PROPERTY(WidthType widthType READ widthType WRITE setWidthType)
6454  Q_PROPERTY(QCPBarsGroup *barsGroup READ barsGroup WRITE setBarsGroup)
6455  Q_PROPERTY(double baseValue READ baseValue WRITE setBaseValue)
6456  Q_PROPERTY(double stackingGap READ stackingGap WRITE setStackingGap)
6457  Q_PROPERTY(QCPBars *barBelow READ barBelow)
6458  Q_PROPERTY(QCPBars *barAbove READ barAbove)
6460 public:
6467  enum WidthType {
6468  wtAbsolute
6469  ,
6470  wtAxisRectRatio
6472  ,
6473  wtPlotCoords
6475  };
6476  Q_ENUMS(WidthType)
6477 
6478  explicit QCPBars(QCPAxis *keyAxis, QCPAxis *valueAxis);
6479  virtual ~QCPBars();
6480 
6481  // getters:
6482  double width() const { return mWidth; }
6483  WidthType widthType() const { return mWidthType; }
6484  QCPBarsGroup *barsGroup() const { return mBarsGroup; }
6485  double baseValue() const { return mBaseValue; }
6486  double stackingGap() const { return mStackingGap; }
6487  QCPBars *barBelow() const { return mBarBelow.data(); }
6488  QCPBars *barAbove() const { return mBarAbove.data(); }
6489  QSharedPointer<QCPBarsDataContainer> data() const { return mDataContainer; }
6490 
6491  // setters:
6492  void setData(QSharedPointer<QCPBarsDataContainer> data);
6493  void setData(const QVector<double> &keys,
6494  const QVector<double> &values,
6495  bool alreadySorted = false);
6496  void setWidth(double width);
6497  void setWidthType(WidthType widthType);
6498  void setBarsGroup(QCPBarsGroup *barsGroup);
6499  void setBaseValue(double baseValue);
6500  void setStackingGap(double pixels);
6501 
6502  // non-property methods:
6503  void addData(const QVector<double> &keys,
6504  const QVector<double> &values,
6505  bool alreadySorted = false);
6506  void addData(double key, double value);
6507  void moveBelow(QCPBars *bars);
6508  void moveAbove(QCPBars *bars);
6509 
6510  // reimplemented virtual methods:
6511  virtual QCPDataSelection selectTestRect(
6512  const QRectF &rect, bool onlySelectable) const Q_DECL_OVERRIDE;
6513  virtual double selectTest(const QPointF &pos,
6514  bool onlySelectable,
6515  QVariant *details = 0) const Q_DECL_OVERRIDE;
6516  virtual QCPRange getKeyRange(
6517  bool &foundRange,
6518  QCP::SignDomain inSignDomain = QCP::sdBoth) const Q_DECL_OVERRIDE;
6519  virtual QCPRange getValueRange(
6520  bool &foundRange,
6521  QCP::SignDomain inSignDomain = QCP::sdBoth,
6522  const QCPRange &inKeyRange = QCPRange()) const Q_DECL_OVERRIDE;
6523  virtual QPointF dataPixelPosition(int index) const Q_DECL_OVERRIDE;
6524 
6525 protected:
6526  // property members:
6527  double mWidth;
6528  WidthType mWidthType;
6529  QCPBarsGroup *mBarsGroup;
6530  double mBaseValue;
6531  double mStackingGap;
6532  QPointer<QCPBars> mBarBelow, mBarAbove;
6533 
6534  // reimplemented virtual methods:
6535  virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
6536  virtual void drawLegendIcon(QCPPainter *painter,
6537  const QRectF &rect) const Q_DECL_OVERRIDE;
6538 
6539  // non-virtual methods:
6540  void getVisibleDataBounds(QCPBarsDataContainer::const_iterator &begin,
6541  QCPBarsDataContainer::const_iterator &end) const;
6542  QRectF getBarRect(double key, double value) const;
6543  void getPixelWidth(double key, double &lower, double &upper) const;
6544  double getStackedBaseValue(double key, bool positive) const;
6545  static void connectBars(QCPBars *lower, QCPBars *upper);
6546 
6547  friend class QCustomPlot;
6548  friend class QCPLegend;
6549  friend class QCPBarsGroup;
6550 };
6552 
6553 /* end of 'src/plottables/plottable-bars.h' */
6554 
6555 /* including file 'src/plottables/plottable-statisticalbox.h', size 7516 */
6556 /* commit ce344b3f96a62e5f652585e55f1ae7c7883cd45b 2018-06-25 01:03:39 +0200 */
6557 
6559 public:
6561  QCPStatisticalBoxData(double key,
6562  double minimum,
6563  double lowerQuartile,
6564  double median,
6565  double upperQuartile,
6566  double maximum,
6567  const QVector<double> &outliers = QVector<double>());
6568 
6569  inline double sortKey() const { return key; }
6570  inline static QCPStatisticalBoxData fromSortKey(double sortKey) {
6571  return QCPStatisticalBoxData(sortKey, 0, 0, 0, 0, 0);
6572  }
6573  inline static bool sortKeyIsMainKey() { return true; }
6574 
6575  inline double mainKey() const { return key; }
6576  inline double mainValue() const { return median; }
6577 
6578  inline QCPRange valueRange() const {
6579  QCPRange result(minimum, maximum);
6580  for (QVector<double>::const_iterator it = outliers.constBegin();
6581  it != outliers.constEnd(); ++it)
6582  result.expand(*it);
6583  return result;
6584  }
6585 
6586  double key, minimum, lowerQuartile, median, upperQuartile, maximum;
6587  QVector<double> outliers;
6588 };
6590 
6603 
6605  : public QCPAbstractPlottable1D<QCPStatisticalBoxData> {
6606  Q_OBJECT
6608  Q_PROPERTY(double width READ width WRITE setWidth)
6609  Q_PROPERTY(double whiskerWidth READ whiskerWidth WRITE setWhiskerWidth)
6610  Q_PROPERTY(QPen whiskerPen READ whiskerPen WRITE setWhiskerPen)
6611  Q_PROPERTY(QPen whiskerBarPen READ whiskerBarPen WRITE setWhiskerBarPen)
6612  Q_PROPERTY(bool whiskerAntialiased READ whiskerAntialiased WRITE
6613  setWhiskerAntialiased)
6614  Q_PROPERTY(QPen medianPen READ medianPen WRITE setMedianPen)
6615  Q_PROPERTY(QCPScatterStyle outlierStyle READ outlierStyle WRITE
6616  setOutlierStyle)
6618 public:
6619  explicit QCPStatisticalBox(QCPAxis *keyAxis, QCPAxis *valueAxis);
6620 
6621  // getters:
6622  QSharedPointer<QCPStatisticalBoxDataContainer> data() const {
6623  return mDataContainer;
6624  }
6625  double width() const { return mWidth; }
6626  double whiskerWidth() const { return mWhiskerWidth; }
6627  QPen whiskerPen() const { return mWhiskerPen; }
6628  QPen whiskerBarPen() const { return mWhiskerBarPen; }
6629  bool whiskerAntialiased() const { return mWhiskerAntialiased; }
6630  QPen medianPen() const { return mMedianPen; }
6631  QCPScatterStyle outlierStyle() const { return mOutlierStyle; }
6632 
6633  // setters:
6634  void setData(QSharedPointer<QCPStatisticalBoxDataContainer> data);
6635  void setData(const QVector<double> &keys,
6636  const QVector<double> &minimum,
6637  const QVector<double> &lowerQuartile,
6638  const QVector<double> &median,
6639  const QVector<double> &upperQuartile,
6640  const QVector<double> &maximum,
6641  bool alreadySorted = false);
6642  void setWidth(double width);
6643  void setWhiskerWidth(double width);
6644  void setWhiskerPen(const QPen &pen);
6645  void setWhiskerBarPen(const QPen &pen);
6646  void setWhiskerAntialiased(bool enabled);
6647  void setMedianPen(const QPen &pen);
6648  void setOutlierStyle(const QCPScatterStyle &style);
6649 
6650  // non-property methods:
6651  void addData(const QVector<double> &keys,
6652  const QVector<double> &minimum,
6653  const QVector<double> &lowerQuartile,
6654  const QVector<double> &median,
6655  const QVector<double> &upperQuartile,
6656  const QVector<double> &maximum,
6657  bool alreadySorted = false);
6658  void addData(double key,
6659  double minimum,
6660  double lowerQuartile,
6661  double median,
6662  double upperQuartile,
6663  double maximum,
6664  const QVector<double> &outliers = QVector<double>());
6665 
6666  // reimplemented virtual methods:
6667  virtual QCPDataSelection selectTestRect(
6668  const QRectF &rect, bool onlySelectable) const Q_DECL_OVERRIDE;
6669  virtual double selectTest(const QPointF &pos,
6670  bool onlySelectable,
6671  QVariant *details = 0) const Q_DECL_OVERRIDE;
6672  virtual QCPRange getKeyRange(
6673  bool &foundRange,
6674  QCP::SignDomain inSignDomain = QCP::sdBoth) const Q_DECL_OVERRIDE;
6675  virtual QCPRange getValueRange(
6676  bool &foundRange,
6677  QCP::SignDomain inSignDomain = QCP::sdBoth,
6678  const QCPRange &inKeyRange = QCPRange()) const Q_DECL_OVERRIDE;
6679 
6680 protected:
6681  // property members:
6682  double mWidth;
6683  double mWhiskerWidth;
6684  QPen mWhiskerPen, mWhiskerBarPen;
6685  bool mWhiskerAntialiased;
6686  QPen mMedianPen;
6687  QCPScatterStyle mOutlierStyle;
6688 
6689  // reimplemented virtual methods:
6690  virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
6691  virtual void drawLegendIcon(QCPPainter *painter,
6692  const QRectF &rect) const Q_DECL_OVERRIDE;
6693 
6694  // introduced virtual methods:
6695  virtual void drawStatisticalBox(
6696  QCPPainter *painter,
6697  QCPStatisticalBoxDataContainer::const_iterator it,
6698  const QCPScatterStyle &outlierStyle) const;
6699 
6700  // non-virtual methods:
6701  void getVisibleDataBounds(
6702  QCPStatisticalBoxDataContainer::const_iterator &begin,
6703  QCPStatisticalBoxDataContainer::const_iterator &end) const;
6704  QRectF getQuartileBox(
6705  QCPStatisticalBoxDataContainer::const_iterator it) const;
6706  QVector<QLineF> getWhiskerBackboneLines(
6707  QCPStatisticalBoxDataContainer::const_iterator it) const;
6708  QVector<QLineF> getWhiskerBarLines(
6709  QCPStatisticalBoxDataContainer::const_iterator it) const;
6710 
6711  friend class QCustomPlot;
6712  friend class QCPLegend;
6713 };
6714 
6715 /* end of 'src/plottables/plottable-statisticalbox.h' */
6716 
6717 /* including file 'src/plottables/plottable-colormap.h', size 7070 */
6718 /* commit ce344b3f96a62e5f652585e55f1ae7c7883cd45b 2018-06-25 01:03:39 +0200 */
6719 
6721 public:
6722  QCPColorMapData(int keySize,
6723  int valueSize,
6724  const QCPRange &keyRange,
6725  const QCPRange &valueRange);
6726  ~QCPColorMapData();
6727  QCPColorMapData(const QCPColorMapData &other);
6728  QCPColorMapData &operator=(const QCPColorMapData &other);
6729 
6730  // getters:
6731  int keySize() const { return mKeySize; }
6732  int valueSize() const { return mValueSize; }
6733  QCPRange keyRange() const { return mKeyRange; }
6734  QCPRange valueRange() const { return mValueRange; }
6735  QCPRange dataBounds() const { return mDataBounds; }
6736  double data(double key, double value);
6737  double cell(int keyIndex, int valueIndex);
6738  unsigned char alpha(int keyIndex, int valueIndex);
6739 
6740  // setters:
6741  void setSize(int keySize, int valueSize);
6742  void setKeySize(int keySize);
6743  void setValueSize(int valueSize);
6744  void setRange(const QCPRange &keyRange, const QCPRange &valueRange);
6745  void setKeyRange(const QCPRange &keyRange);
6746  void setValueRange(const QCPRange &valueRange);
6747  void setData(double key, double value, double z);
6748  void setCell(int keyIndex, int valueIndex, double z);
6749  void setAlpha(int keyIndex, int valueIndex, unsigned char alpha);
6750 
6751  // non-property methods:
6752  void recalculateDataBounds();
6753  void clear();
6754  void clearAlpha();
6755  void fill(double z);
6756  void fillAlpha(unsigned char alpha);
6757  bool isEmpty() const { return mIsEmpty; }
6758  void coordToCell(double key,
6759  double value,
6760  int *keyIndex,
6761  int *valueIndex) const;
6762  void cellToCoord(int keyIndex,
6763  int valueIndex,
6764  double *key,
6765  double *value) const;
6766 
6767 protected:
6768  // property members:
6769  int mKeySize, mValueSize;
6770  QCPRange mKeyRange, mValueRange;
6771  bool mIsEmpty;
6772 
6773  // non-property members:
6774  double *mData;
6775  unsigned char *mAlpha;
6778 
6779  bool createAlpha(bool initializeOpaque = true);
6780 
6781  friend class QCPColorMap;
6782 };
6783 
6785  Q_OBJECT
6787  Q_PROPERTY(QCPRange dataRange READ dataRange WRITE setDataRange NOTIFY
6788  dataRangeChanged)
6789  Q_PROPERTY(QCPAxis::ScaleType dataScaleType READ dataScaleType WRITE
6790  setDataScaleType NOTIFY dataScaleTypeChanged)
6791  Q_PROPERTY(QCPColorGradient gradient READ gradient WRITE setGradient NOTIFY
6792  gradientChanged)
6793  Q_PROPERTY(bool interpolate READ interpolate WRITE setInterpolate)
6794  Q_PROPERTY(bool tightBoundary READ tightBoundary WRITE setTightBoundary)
6795  Q_PROPERTY(QCPColorScale *colorScale READ colorScale WRITE setColorScale)
6797 public:
6798  explicit QCPColorMap(QCPAxis *keyAxis, QCPAxis *valueAxis);
6799  virtual ~QCPColorMap();
6800 
6801  // getters:
6802  QCPColorMapData *data() const { return mMapData; }
6803  QCPRange dataRange() const { return mDataRange; }
6804  QCPAxis::ScaleType dataScaleType() const { return mDataScaleType; }
6805  bool interpolate() const { return mInterpolate; }
6806  bool tightBoundary() const { return mTightBoundary; }
6807  QCPColorGradient gradient() const { return mGradient; }
6808  QCPColorScale *colorScale() const { return mColorScale.data(); }
6809 
6810  // setters:
6811  void setData(QCPColorMapData *data, bool copy = false);
6812  Q_SLOT void setDataRange(const QCPRange &dataRange);
6813  Q_SLOT void setDataScaleType(QCPAxis::ScaleType scaleType);
6814  Q_SLOT void setGradient(const QCPColorGradient &gradient);
6815  void setInterpolate(bool enabled);
6816  void setTightBoundary(bool enabled);
6817  void setColorScale(QCPColorScale *colorScale);
6818 
6819  // non-property methods:
6820  void rescaleDataRange(bool recalculateDataBounds = false);
6821  Q_SLOT void updateLegendIcon(
6822  Qt::TransformationMode transformMode = Qt::SmoothTransformation,
6823  const QSize &thumbSize = QSize(32, 18));
6824 
6825  // reimplemented virtual methods:
6826  virtual double selectTest(const QPointF &pos,
6827  bool onlySelectable,
6828  QVariant *details = 0) const Q_DECL_OVERRIDE;
6829  virtual QCPRange getKeyRange(
6830  bool &foundRange,
6831  QCP::SignDomain inSignDomain = QCP::sdBoth) const Q_DECL_OVERRIDE;
6832  virtual QCPRange getValueRange(
6833  bool &foundRange,
6834  QCP::SignDomain inSignDomain = QCP::sdBoth,
6835  const QCPRange &inKeyRange = QCPRange()) const Q_DECL_OVERRIDE;
6836 
6837 signals:
6838  void dataRangeChanged(const QCPRange &newRange);
6839  void dataScaleTypeChanged(QCPAxis::ScaleType scaleType);
6840  void gradientChanged(const QCPColorGradient &newGradient);
6841 
6842 protected:
6843  // property members:
6844  QCPRange mDataRange;
6845  QCPAxis::ScaleType mDataScaleType;
6846  QCPColorMapData *mMapData;
6847  QCPColorGradient mGradient;
6848  bool mInterpolate;
6849  bool mTightBoundary;
6850  QPointer<QCPColorScale> mColorScale;
6851 
6852  // non-property members:
6853  QImage mMapImage, mUndersampledMapImage;
6854  QPixmap mLegendIcon;
6855  bool mMapImageInvalidated;
6856 
6857  // introduced virtual methods:
6858  virtual void updateMapImage();
6859 
6860  // reimplemented virtual methods:
6861  virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
6862  virtual void drawLegendIcon(QCPPainter *painter,
6863  const QRectF &rect) const Q_DECL_OVERRIDE;
6864 
6865  friend class QCustomPlot;
6866  friend class QCPLegend;
6867 };
6868 
6869 /* end of 'src/plottables/plottable-colormap.h' */
6870 
6871 /* including file 'src/plottables/plottable-financial.h', size 8622 */
6872 /* commit ce344b3f96a62e5f652585e55f1ae7c7883cd45b 2018-06-25 01:03:39 +0200 */
6873 
6875 public:
6876  QCPFinancialData();
6878  double key, double open, double high, double low, double close);
6879 
6880  inline double sortKey() const { return key; }
6881  inline static QCPFinancialData fromSortKey(double sortKey) {
6882  return QCPFinancialData(sortKey, 0, 0, 0, 0);
6883  }
6884  inline static bool sortKeyIsMainKey() { return true; }
6885 
6886  inline double mainKey() const { return key; }
6887  inline double mainValue() const { return open; }
6888 
6889  inline QCPRange valueRange() const {
6890  return QCPRange(low, high);
6891  } // open and close must lie between low and high, so we don't need to
6892  // check them
6893 
6894  double key, open, high, low, close;
6895 };
6897 
6910 
6912  : public QCPAbstractPlottable1D<QCPFinancialData> {
6913  Q_OBJECT
6915  Q_PROPERTY(ChartStyle chartStyle READ chartStyle WRITE setChartStyle)
6916  Q_PROPERTY(double width READ width WRITE setWidth)
6917  Q_PROPERTY(WidthType widthType READ widthType WRITE setWidthType)
6918  Q_PROPERTY(bool twoColored READ twoColored WRITE setTwoColored)
6919  Q_PROPERTY(QBrush brushPositive READ brushPositive WRITE setBrushPositive)
6920  Q_PROPERTY(QBrush brushNegative READ brushNegative WRITE setBrushNegative)
6921  Q_PROPERTY(QPen penPositive READ penPositive WRITE setPenPositive)
6922  Q_PROPERTY(QPen penNegative READ penNegative WRITE setPenNegative)
6924 public:
6931  enum WidthType {
6932  wtAbsolute
6933  ,
6934  wtAxisRectRatio
6935  ,
6936  wtPlotCoords
6938  };
6939  Q_ENUMS(WidthType)
6940 
6941 
6946  enum ChartStyle {
6947  csOhlc
6948  ,
6949  csCandlestick
6950  };
6951  Q_ENUMS(ChartStyle)
6952 
6953  explicit QCPFinancial(QCPAxis *keyAxis, QCPAxis *valueAxis);
6954  virtual ~QCPFinancial();
6955 
6956  // getters:
6957  QSharedPointer<QCPFinancialDataContainer> data() const {
6958  return mDataContainer;
6959  }
6960  ChartStyle chartStyle() const { return mChartStyle; }
6961  double width() const { return mWidth; }
6962  WidthType widthType() const { return mWidthType; }
6963  bool twoColored() const { return mTwoColored; }
6964  QBrush brushPositive() const { return mBrushPositive; }
6965  QBrush brushNegative() const { return mBrushNegative; }
6966  QPen penPositive() const { return mPenPositive; }
6967  QPen penNegative() const { return mPenNegative; }
6968 
6969  // setters:
6970  void setData(QSharedPointer<QCPFinancialDataContainer> data);
6971  void setData(const QVector<double> &keys,
6972  const QVector<double> &open,
6973  const QVector<double> &high,
6974  const QVector<double> &low,
6975  const QVector<double> &close,
6976  bool alreadySorted = false);
6977  void setChartStyle(ChartStyle style);
6978  void setWidth(double width);
6979  void setWidthType(WidthType widthType);
6980  void setTwoColored(bool twoColored);
6981  void setBrushPositive(const QBrush &brush);
6982  void setBrushNegative(const QBrush &brush);
6983  void setPenPositive(const QPen &pen);
6984  void setPenNegative(const QPen &pen);
6985 
6986  // non-property methods:
6987  void addData(const QVector<double> &keys,
6988  const QVector<double> &open,
6989  const QVector<double> &high,
6990  const QVector<double> &low,
6991  const QVector<double> &close,
6992  bool alreadySorted = false);
6993  void addData(
6994  double key, double open, double high, double low, double close);
6995 
6996  // reimplemented virtual methods:
6997  virtual QCPDataSelection selectTestRect(
6998  const QRectF &rect, bool onlySelectable) const Q_DECL_OVERRIDE;
6999  virtual double selectTest(const QPointF &pos,
7000  bool onlySelectable,
7001  QVariant *details = 0) const Q_DECL_OVERRIDE;
7002  virtual QCPRange getKeyRange(
7003  bool &foundRange,
7004  QCP::SignDomain inSignDomain = QCP::sdBoth) const Q_DECL_OVERRIDE;
7005  virtual QCPRange getValueRange(
7006  bool &foundRange,
7007  QCP::SignDomain inSignDomain = QCP::sdBoth,
7008  const QCPRange &inKeyRange = QCPRange()) const Q_DECL_OVERRIDE;
7009 
7010  // static methods:
7011  static QCPFinancialDataContainer timeSeriesToOhlc(
7012  const QVector<double> &time,
7013  const QVector<double> &value,
7014  double timeBinSize,
7015  double timeBinOffset = 0);
7016 
7017 protected:
7018  // property members:
7019  ChartStyle mChartStyle;
7020  double mWidth;
7021  WidthType mWidthType;
7022  bool mTwoColored;
7023  QBrush mBrushPositive, mBrushNegative;
7024  QPen mPenPositive, mPenNegative;
7025 
7026  // reimplemented virtual methods:
7027  virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
7028  virtual void drawLegendIcon(QCPPainter *painter,
7029  const QRectF &rect) const Q_DECL_OVERRIDE;
7030 
7031  // non-virtual methods:
7032  void drawOhlcPlot(QCPPainter *painter,
7033  const QCPFinancialDataContainer::const_iterator &begin,
7034  const QCPFinancialDataContainer::const_iterator &end,
7035  bool isSelected);
7036  void drawCandlestickPlot(
7037  QCPPainter *painter,
7038  const QCPFinancialDataContainer::const_iterator &begin,
7039  const QCPFinancialDataContainer::const_iterator &end,
7040  bool isSelected);
7041  double getPixelWidth(double key, double keyPixel) const;
7042  double ohlcSelectTest(
7043  const QPointF &pos,
7044  const QCPFinancialDataContainer::const_iterator &begin,
7045  const QCPFinancialDataContainer::const_iterator &end,
7046  QCPFinancialDataContainer::const_iterator &closestDataPoint) const;
7047  double candlestickSelectTest(
7048  const QPointF &pos,
7049  const QCPFinancialDataContainer::const_iterator &begin,
7050  const QCPFinancialDataContainer::const_iterator &end,
7051  QCPFinancialDataContainer::const_iterator &closestDataPoint) const;
7052  void getVisibleDataBounds(
7053  QCPFinancialDataContainer::const_iterator &begin,
7054  QCPFinancialDataContainer::const_iterator &end) const;
7055  QRectF selectionHitBox(QCPFinancialDataContainer::const_iterator it) const;
7056 
7057  friend class QCustomPlot;
7058  friend class QCPLegend;
7059 };
7061 
7062 /* end of 'src/plottables/plottable-financial.h' */
7063 
7064 /* including file 'src/plottables/plottable-errorbar.h', size 7727 */
7065 /* commit ce344b3f96a62e5f652585e55f1ae7c7883cd45b 2018-06-25 01:03:39 +0200 */
7066 
7068 public:
7069  QCPErrorBarsData();
7070  explicit QCPErrorBarsData(double error);
7071  QCPErrorBarsData(double errorMinus, double errorPlus);
7072 
7073  double errorMinus, errorPlus;
7074 };
7076 
7093 typedef QVector<QCPErrorBarsData> QCPErrorBarsDataContainer;
7094 
7096  public QCPPlottableInterface1D {
7097  Q_OBJECT
7099  Q_PROPERTY(QSharedPointer<QCPErrorBarsDataContainer> data READ data WRITE
7100  setData)
7101  Q_PROPERTY(QCPAbstractPlottable *dataPlottable READ dataPlottable WRITE
7102  setDataPlottable)
7103  Q_PROPERTY(ErrorType errorType READ errorType WRITE setErrorType)
7104  Q_PROPERTY(double whiskerWidth READ whiskerWidth WRITE setWhiskerWidth)
7105  Q_PROPERTY(double symbolGap READ symbolGap WRITE setSymbolGap)
7107 public:
7115  enum ErrorType {
7116  etKeyError
7118  ,
7119  etValueError
7121  };
7122  Q_ENUMS(ErrorType)
7123 
7124  explicit QCPErrorBars(QCPAxis *keyAxis, QCPAxis *valueAxis);
7125  virtual ~QCPErrorBars();
7126  // getters:
7127  QSharedPointer<QCPErrorBarsDataContainer> data() const {
7128  return mDataContainer;
7129  }
7131  return mDataPlottable.data();
7132  }
7133  ErrorType errorType() const { return mErrorType; }
7134  double whiskerWidth() const { return mWhiskerWidth; }
7135  double symbolGap() const { return mSymbolGap; }
7136 
7137  // setters:
7138  void setData(QSharedPointer<QCPErrorBarsDataContainer> data);
7139  void setData(const QVector<double> &error);
7140  void setData(const QVector<double> &errorMinus,
7141  const QVector<double> &errorPlus);
7142  void setDataPlottable(QCPAbstractPlottable *plottable);
7143  void setErrorType(ErrorType type);
7144  void setWhiskerWidth(double pixels);
7145  void setSymbolGap(double pixels);
7146 
7147  // non-property methods:
7148  void addData(const QVector<double> &error);
7149  void addData(const QVector<double> &errorMinus,
7150  const QVector<double> &errorPlus);
7151  void addData(double error);
7152  void addData(double errorMinus, double errorPlus);
7153 
7154  // virtual methods of 1d plottable interface:
7155  virtual int dataCount() const Q_DECL_OVERRIDE;
7156  virtual double dataMainKey(int index) const Q_DECL_OVERRIDE;
7157  virtual double dataSortKey(int index) const Q_DECL_OVERRIDE;
7158  virtual double dataMainValue(int index) const Q_DECL_OVERRIDE;
7159  virtual QCPRange dataValueRange(int index) const Q_DECL_OVERRIDE;
7160  virtual QPointF dataPixelPosition(int index) const Q_DECL_OVERRIDE;
7161  virtual bool sortKeyIsMainKey() const Q_DECL_OVERRIDE;
7162  virtual QCPDataSelection selectTestRect(
7163  const QRectF &rect, bool onlySelectable) const Q_DECL_OVERRIDE;
7164  virtual int findBegin(double sortKey,
7165  bool expandedRange = true) const Q_DECL_OVERRIDE;
7166  virtual int findEnd(double sortKey,
7167  bool expandedRange = true) const Q_DECL_OVERRIDE;
7168 
7169  // reimplemented virtual methods:
7170  virtual double selectTest(const QPointF &pos,
7171  bool onlySelectable,
7172  QVariant *details = 0) const Q_DECL_OVERRIDE;
7173  virtual QCPPlottableInterface1D *interface1D() Q_DECL_OVERRIDE {
7174  return this;
7175  }
7176 
7177 protected:
7178  // property members:
7179  QSharedPointer<QCPErrorBarsDataContainer> mDataContainer;
7180  QPointer<QCPAbstractPlottable> mDataPlottable;
7183  double mSymbolGap;
7184 
7185  // reimplemented virtual methods:
7186  virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
7187  virtual void drawLegendIcon(QCPPainter *painter,
7188  const QRectF &rect) const Q_DECL_OVERRIDE;
7189  virtual QCPRange getKeyRange(
7190  bool &foundRange,
7191  QCP::SignDomain inSignDomain = QCP::sdBoth) const Q_DECL_OVERRIDE;
7192  virtual QCPRange getValueRange(
7193  bool &foundRange,
7194  QCP::SignDomain inSignDomain = QCP::sdBoth,
7195  const QCPRange &inKeyRange = QCPRange()) const Q_DECL_OVERRIDE;
7196 
7197  // non-virtual methods:
7198  void getErrorBarLines(QCPErrorBarsDataContainer::const_iterator it,
7199  QVector<QLineF> &backbones,
7200  QVector<QLineF> &whiskers) const;
7201  void getVisibleDataBounds(QCPErrorBarsDataContainer::const_iterator &begin,
7202  QCPErrorBarsDataContainer::const_iterator &end,
7203  const QCPDataRange &rangeRestriction) const;
7204  double pointDistance(
7205  const QPointF &pixelPoint,
7206  QCPErrorBarsDataContainer::const_iterator &closestData) const;
7207  // helpers:
7208  void getDataSegments(QList<QCPDataRange> &selectedSegments,
7209  QList<QCPDataRange> &unselectedSegments) const;
7210  bool errorBarVisible(int index) const;
7211  bool rectIntersectsLine(const QRectF &pixelRect, const QLineF &line) const;
7212 
7213  friend class QCustomPlot;
7214  friend class QCPLegend;
7215 };
7216 
7217 /* end of 'src/plottables/plottable-errorbar.h' */
7218 
7219 /* including file 'src/items/item-straightline.h', size 3117 */
7220 /* commit ce344b3f96a62e5f652585e55f1ae7c7883cd45b 2018-06-25 01:03:39 +0200 */
7221 
7223  Q_OBJECT
7225  Q_PROPERTY(QPen pen READ pen WRITE setPen)
7226  Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
7228 public:
7229  explicit QCPItemStraightLine(QCustomPlot *parentPlot);
7230  virtual ~QCPItemStraightLine();
7231 
7232  // getters:
7233  QPen pen() const { return mPen; }
7234  QPen selectedPen() const { return mSelectedPen; }
7235 
7236  // setters;
7237  void setPen(const QPen &pen);
7238  void setSelectedPen(const QPen &pen);
7239 
7240  // reimplemented virtual methods:
7241  virtual double selectTest(const QPointF &pos,
7242  bool onlySelectable,
7243  QVariant *details = 0) const Q_DECL_OVERRIDE;
7244 
7245  QCPItemPosition *const point1;
7246  QCPItemPosition *const point2;
7247 
7248 protected:
7249  // property members:
7250  QPen mPen, mSelectedPen;
7251 
7252  // reimplemented virtual methods:
7253  virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
7254 
7255  // non-virtual methods:
7256  QLineF getRectClippedStraightLine(const QCPVector2D &point1,
7257  const QCPVector2D &vec,
7258  const QRect &rect) const;
7259  QPen mainPen() const;
7260 };
7261 
7262 /* end of 'src/items/item-straightline.h' */
7263 
7264 /* including file 'src/items/item-line.h', size 3407 */
7265 /* commit ce344b3f96a62e5f652585e55f1ae7c7883cd45b 2018-06-25 01:03:39 +0200 */
7266 
7268  Q_OBJECT
7270  Q_PROPERTY(QPen pen READ pen WRITE setPen)
7271  Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
7272  Q_PROPERTY(QCPLineEnding head READ head WRITE setHead)
7273  Q_PROPERTY(QCPLineEnding tail READ tail WRITE setTail)
7275 public:
7276  explicit QCPItemLine(QCustomPlot *parentPlot);
7277  virtual ~QCPItemLine();
7278 
7279  // getters:
7280  QPen pen() const { return mPen; }
7281  QPen selectedPen() const { return mSelectedPen; }
7282  QCPLineEnding head() const { return mHead; }
7283  QCPLineEnding tail() const { return mTail; }
7284 
7285  // setters;
7286  void setPen(const QPen &pen);
7287  void setSelectedPen(const QPen &pen);
7288  void setHead(const QCPLineEnding &head);
7289  void setTail(const QCPLineEnding &tail);
7290 
7291  // reimplemented virtual methods:
7292  virtual double selectTest(const QPointF &pos,
7293  bool onlySelectable,
7294  QVariant *details = 0) const Q_DECL_OVERRIDE;
7295 
7296  QCPItemPosition *const start;
7297  QCPItemPosition *const end;
7298 
7299 protected:
7300  // property members:
7301  QPen mPen, mSelectedPen;
7302  QCPLineEnding mHead, mTail;
7303 
7304  // reimplemented virtual methods:
7305  virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
7306 
7307  // non-virtual methods:
7308  QLineF getRectClippedLine(const QCPVector2D &start,
7309  const QCPVector2D &end,
7310  const QRect &rect) const;
7311  QPen mainPen() const;
7312 };
7313 
7314 /* end of 'src/items/item-line.h' */
7315 
7316 /* including file 'src/items/item-curve.h', size 3379 */
7317 /* commit ce344b3f96a62e5f652585e55f1ae7c7883cd45b 2018-06-25 01:03:39 +0200 */
7318 
7320  Q_OBJECT
7322  Q_PROPERTY(QPen pen READ pen WRITE setPen)
7323  Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
7324  Q_PROPERTY(QCPLineEnding head READ head WRITE setHead)
7325  Q_PROPERTY(QCPLineEnding tail READ tail WRITE setTail)
7327 public:
7328  explicit QCPItemCurve(QCustomPlot *parentPlot);
7329  virtual ~QCPItemCurve();
7330 
7331  // getters:
7332  QPen pen() const { return mPen; }
7333  QPen selectedPen() const { return mSelectedPen; }
7334  QCPLineEnding head() const { return mHead; }
7335  QCPLineEnding tail() const { return mTail; }
7336 
7337  // setters;
7338  void setPen(const QPen &pen);
7339  void setSelectedPen(const QPen &pen);
7340  void setHead(const QCPLineEnding &head);
7341  void setTail(const QCPLineEnding &tail);
7342 
7343  // reimplemented virtual methods:
7344  virtual double selectTest(const QPointF &pos,
7345  bool onlySelectable,
7346  QVariant *details = 0) const Q_DECL_OVERRIDE;
7347 
7348  QCPItemPosition *const start;
7349  QCPItemPosition *const startDir;
7350  QCPItemPosition *const endDir;
7351  QCPItemPosition *const end;
7352 
7353 protected:
7354  // property members:
7355  QPen mPen, mSelectedPen;
7356  QCPLineEnding mHead, mTail;
7357 
7358  // reimplemented virtual methods:
7359  virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
7360 
7361  // non-virtual methods:
7362  QPen mainPen() const;
7363 };
7364 
7365 /* end of 'src/items/item-curve.h' */
7366 
7367 /* including file 'src/items/item-rect.h', size 3688 */
7368 /* commit ce344b3f96a62e5f652585e55f1ae7c7883cd45b 2018-06-25 01:03:39 +0200 */
7369 
7371  Q_OBJECT
7373  Q_PROPERTY(QPen pen READ pen WRITE setPen)
7374  Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
7375  Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
7376  Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
7378 public:
7379  explicit QCPItemRect(QCustomPlot *parentPlot);
7380  virtual ~QCPItemRect();
7381 
7382  // getters:
7383  QPen pen() const { return mPen; }
7384  QPen selectedPen() const { return mSelectedPen; }
7385  QBrush brush() const { return mBrush; }
7386  QBrush selectedBrush() const { return mSelectedBrush; }
7387 
7388  // setters;
7389  void setPen(const QPen &pen);
7390  void setSelectedPen(const QPen &pen);
7391  void setBrush(const QBrush &brush);
7392  void setSelectedBrush(const QBrush &brush);
7393 
7394  // reimplemented virtual methods:
7395  virtual double selectTest(const QPointF &pos,
7396  bool onlySelectable,
7397  QVariant *details = 0) const Q_DECL_OVERRIDE;
7398 
7399  QCPItemPosition *const topLeft;
7400  QCPItemPosition *const bottomRight;
7401  QCPItemAnchor *const top;
7402  QCPItemAnchor *const topRight;
7403  QCPItemAnchor *const right;
7404  QCPItemAnchor *const bottom;
7405  QCPItemAnchor *const bottomLeft;
7406  QCPItemAnchor *const left;
7407 
7408 protected:
7415  aiLeft
7416  };
7417 
7418  // property members:
7419  QPen mPen, mSelectedPen;
7420  QBrush mBrush, mSelectedBrush;
7421 
7422  // reimplemented virtual methods:
7423  virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
7424  virtual QPointF anchorPixelPosition(int anchorId) const Q_DECL_OVERRIDE;
7425 
7426  // non-virtual methods:
7427  QPen mainPen() const;
7428  QBrush mainBrush() const;
7429 };
7430 
7431 /* end of 'src/items/item-rect.h' */
7432 
7433 /* including file 'src/items/item-text.h', size 5554 */
7434 /* commit ce344b3f96a62e5f652585e55f1ae7c7883cd45b 2018-06-25 01:03:39 +0200 */
7435 
7437  Q_OBJECT
7439  Q_PROPERTY(QColor color READ color WRITE setColor)
7440  Q_PROPERTY(QColor selectedColor READ selectedColor WRITE setSelectedColor)
7441  Q_PROPERTY(QPen pen READ pen WRITE setPen)
7442  Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
7443  Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
7444  Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
7445  Q_PROPERTY(QFont font READ font WRITE setFont)
7446  Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont)
7447  Q_PROPERTY(QString text READ text WRITE setText)
7448  Q_PROPERTY(Qt::Alignment positionAlignment READ positionAlignment WRITE
7449  setPositionAlignment)
7450  Q_PROPERTY(Qt::Alignment textAlignment READ textAlignment WRITE
7451  setTextAlignment)
7452  Q_PROPERTY(double rotation READ rotation WRITE setRotation)
7453  Q_PROPERTY(QMargins padding READ padding WRITE setPadding)
7455 public:
7456  explicit QCPItemText(QCustomPlot *parentPlot);
7457  virtual ~QCPItemText();
7458 
7459  // getters:
7460  QColor color() const { return mColor; }
7461  QColor selectedColor() const { return mSelectedColor; }
7462  QPen pen() const { return mPen; }
7463  QPen selectedPen() const { return mSelectedPen; }
7464  QBrush brush() const { return mBrush; }
7465  QBrush selectedBrush() const { return mSelectedBrush; }
7466  QFont font() const { return mFont; }
7467  QFont selectedFont() const { return mSelectedFont; }
7468  QString text() const { return mText; }
7469  Qt::Alignment positionAlignment() const { return mPositionAlignment; }
7470  Qt::Alignment textAlignment() const { return mTextAlignment; }
7471  double rotation() const { return mRotation; }
7472  QMargins padding() const { return mPadding; }
7473 
7474  // setters;
7475  void setColor(const QColor &color);
7476  void setSelectedColor(const QColor &color);
7477  void setPen(const QPen &pen);
7478  void setSelectedPen(const QPen &pen);
7479  void setBrush(const QBrush &brush);
7480  void setSelectedBrush(const QBrush &brush);
7481  void setFont(const QFont &font);
7482  void setSelectedFont(const QFont &font);
7483  void setText(const QString &text);
7484  void setPositionAlignment(Qt::Alignment alignment);
7485  void setTextAlignment(Qt::Alignment alignment);
7486  void setRotation(double degrees);
7487  void setPadding(const QMargins &padding);
7488 
7489  // reimplemented virtual methods:
7490  virtual double selectTest(const QPointF &pos,
7491  bool onlySelectable,
7492  QVariant *details = 0) const Q_DECL_OVERRIDE;
7493 
7495  QCPItemAnchor *const topLeft;
7496  QCPItemAnchor *const top;
7497  QCPItemAnchor *const topRight;
7498  QCPItemAnchor *const right;
7499  QCPItemAnchor *const bottomRight;
7500  QCPItemAnchor *const bottom;
7501  QCPItemAnchor *const bottomLeft;
7502  QCPItemAnchor *const left;
7503 
7504 protected:
7513  aiLeft
7514  };
7515 
7516  // property members:
7517  QColor mColor, mSelectedColor;
7518  QPen mPen, mSelectedPen;
7519  QBrush mBrush, mSelectedBrush;
7520  QFont mFont, mSelectedFont;
7521  QString mText;
7524  double mRotation;
7525  QMargins mPadding;
7526 
7527  // reimplemented virtual methods:
7528  virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
7529  virtual QPointF anchorPixelPosition(int anchorId) const Q_DECL_OVERRIDE;
7530 
7531  // non-virtual methods:
7532  QPointF getTextDrawPoint(const QPointF &pos,
7533  const QRectF &rect,
7534  Qt::Alignment positionAlignment) const;
7535  QFont mainFont() const;
7536  QColor mainColor() const;
7537  QPen mainPen() const;
7538  QBrush mainBrush() const;
7539 };
7540 
7541 /* end of 'src/items/item-text.h' */
7542 
7543 /* including file 'src/items/item-ellipse.h', size 3868 */
7544 /* commit ce344b3f96a62e5f652585e55f1ae7c7883cd45b 2018-06-25 01:03:39 +0200 */
7545 
7547  Q_OBJECT
7549  Q_PROPERTY(QPen pen READ pen WRITE setPen)
7550  Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
7551  Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
7552  Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
7554 public:
7555  explicit QCPItemEllipse(QCustomPlot *parentPlot);
7556  virtual ~QCPItemEllipse();
7557 
7558  // getters:
7559  QPen pen() const { return mPen; }
7560  QPen selectedPen() const { return mSelectedPen; }
7561  QBrush brush() const { return mBrush; }
7562  QBrush selectedBrush() const { return mSelectedBrush; }
7563 
7564  // setters;
7565  void setPen(const QPen &pen);
7566  void setSelectedPen(const QPen &pen);
7567  void setBrush(const QBrush &brush);
7568  void setSelectedBrush(const QBrush &brush);
7569 
7570  // reimplemented virtual methods:
7571  virtual double selectTest(const QPointF &pos,
7572  bool onlySelectable,
7573  QVariant *details = 0) const Q_DECL_OVERRIDE;
7574 
7575  QCPItemPosition *const topLeft;
7576  QCPItemPosition *const bottomRight;
7577  QCPItemAnchor *const topLeftRim;
7578  QCPItemAnchor *const top;
7579  QCPItemAnchor *const topRightRim;
7580  QCPItemAnchor *const right;
7581  QCPItemAnchor *const bottomRightRim;
7582  QCPItemAnchor *const bottom;
7583  QCPItemAnchor *const bottomLeftRim;
7584  QCPItemAnchor *const left;
7585  QCPItemAnchor *const center;
7586 
7587 protected:
7597  aiCenter
7598  };
7599 
7600  // property members:
7601  QPen mPen, mSelectedPen;
7602  QBrush mBrush, mSelectedBrush;
7603 
7604  // reimplemented virtual methods:
7605  virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
7606  virtual QPointF anchorPixelPosition(int anchorId) const Q_DECL_OVERRIDE;
7607 
7608  // non-virtual methods:
7609  QPen mainPen() const;
7610  QBrush mainBrush() const;
7611 };
7612 
7613 /* end of 'src/items/item-ellipse.h' */
7614 
7615 /* including file 'src/items/item-pixmap.h', size 4373 */
7616 /* commit ce344b3f96a62e5f652585e55f1ae7c7883cd45b 2018-06-25 01:03:39 +0200 */
7617 
7619  Q_OBJECT
7621  Q_PROPERTY(QPixmap pixmap READ pixmap WRITE setPixmap)
7622  Q_PROPERTY(bool scaled READ scaled WRITE setScaled)
7623  Q_PROPERTY(Qt::AspectRatioMode aspectRatioMode READ aspectRatioMode)
7624  Q_PROPERTY(
7625  Qt::TransformationMode transformationMode READ transformationMode)
7626  Q_PROPERTY(QPen pen READ pen WRITE setPen)
7627  Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
7629 public:
7630  explicit QCPItemPixmap(QCustomPlot *parentPlot);
7631  virtual ~QCPItemPixmap();
7632 
7633  // getters:
7634  QPixmap pixmap() const { return mPixmap; }
7635  bool scaled() const { return mScaled; }
7636  Qt::AspectRatioMode aspectRatioMode() const { return mAspectRatioMode; }
7637  Qt::TransformationMode transformationMode() const {
7638  return mTransformationMode;
7639  }
7640  QPen pen() const { return mPen; }
7641  QPen selectedPen() const { return mSelectedPen; }
7642 
7643  // setters;
7644  void setPixmap(const QPixmap &pixmap);
7645  void setScaled(bool scaled,
7646  Qt::AspectRatioMode aspectRatioMode = Qt::KeepAspectRatio,
7647  Qt::TransformationMode transformationMode =
7648  Qt::SmoothTransformation);
7649  void setPen(const QPen &pen);
7650  void setSelectedPen(const QPen &pen);
7651 
7652  // reimplemented virtual methods:
7653  virtual double selectTest(const QPointF &pos,
7654  bool onlySelectable,
7655  QVariant *details = 0) const Q_DECL_OVERRIDE;
7656 
7657  QCPItemPosition *const topLeft;
7658  QCPItemPosition *const bottomRight;
7659  QCPItemAnchor *const top;
7660  QCPItemAnchor *const topRight;
7661  QCPItemAnchor *const right;
7662  QCPItemAnchor *const bottom;
7663  QCPItemAnchor *const bottomLeft;
7664  QCPItemAnchor *const left;
7665 
7666 protected:
7673  aiLeft
7674  };
7675 
7676  // property members:
7677  QPixmap mPixmap;
7678  QPixmap mScaledPixmap;
7679  bool mScaled;
7681  Qt::AspectRatioMode mAspectRatioMode;
7682  Qt::TransformationMode mTransformationMode;
7683  QPen mPen, mSelectedPen;
7684 
7685  // reimplemented virtual methods:
7686  virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
7687  virtual QPointF anchorPixelPosition(int anchorId) const Q_DECL_OVERRIDE;
7688 
7689  // non-virtual methods:
7690  void updateScaledPixmap(QRect finalRect = QRect(),
7691  bool flipHorz = false,
7692  bool flipVert = false);
7693  QRect getFinalRect(bool *flippedHorz = 0, bool *flippedVert = 0) const;
7694  QPen mainPen() const;
7695 };
7696 
7697 /* end of 'src/items/item-pixmap.h' */
7698 
7699 /* including file 'src/items/item-tracer.h', size 4762 */
7700 /* commit ce344b3f96a62e5f652585e55f1ae7c7883cd45b 2018-06-25 01:03:39 +0200 */
7701 
7703  Q_OBJECT
7705  Q_PROPERTY(QPen pen READ pen WRITE setPen)
7706  Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
7707  Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
7708  Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
7709  Q_PROPERTY(double size READ size WRITE setSize)
7710  Q_PROPERTY(TracerStyle style READ style WRITE setStyle)
7711  Q_PROPERTY(QCPGraph *graph READ graph WRITE setGraph)
7712  Q_PROPERTY(double graphKey READ graphKey WRITE setGraphKey)
7713  Q_PROPERTY(bool interpolating READ interpolating WRITE setInterpolating)
7715 public:
7723  tsNone
7724  ,
7725  tsPlus
7726  ,
7727  tsCrosshair
7729  ,
7730  tsCircle
7731  ,
7732  tsSquare
7733  };
7734  Q_ENUMS(TracerStyle)
7735 
7736  explicit QCPItemTracer(QCustomPlot *parentPlot);
7737  virtual ~QCPItemTracer();
7738 
7739  // getters:
7740  QPen pen() const { return mPen; }
7741  QPen selectedPen() const { return mSelectedPen; }
7742  QBrush brush() const { return mBrush; }
7743  QBrush selectedBrush() const { return mSelectedBrush; }
7744  double size() const { return mSize; }
7745  TracerStyle style() const { return mStyle; }
7746  QCPGraph *graph() const { return mGraph; }
7747  double graphKey() const { return mGraphKey; }
7748  bool interpolating() const { return mInterpolating; }
7749 
7750  // setters;
7751  void setPen(const QPen &pen);
7752  void setSelectedPen(const QPen &pen);
7753  void setBrush(const QBrush &brush);
7754  void setSelectedBrush(const QBrush &brush);
7755  void setSize(double size);
7756  void setStyle(TracerStyle style);
7757  void setGraph(QCPGraph *graph);
7758  void setGraphKey(double key);
7759  void setInterpolating(bool enabled);
7760 
7761  // reimplemented virtual methods:
7762  virtual double selectTest(const QPointF &pos,
7763  bool onlySelectable,
7764  QVariant *details = 0) const Q_DECL_OVERRIDE;
7765 
7766  // non-virtual methods:
7767  void updatePosition();
7768 
7770 
7771 protected:
7772  // property members:
7773  QPen mPen, mSelectedPen;
7774  QBrush mBrush, mSelectedBrush;
7775  double mSize;
7776  TracerStyle mStyle;
7777  QCPGraph *mGraph;
7778  double mGraphKey;
7779  bool mInterpolating;
7780 
7781  // reimplemented virtual methods:
7782  virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
7783 
7784  // non-virtual methods:
7785  QPen mainPen() const;
7786  QBrush mainBrush() const;
7787 };
7789 
7790 /* end of 'src/items/item-tracer.h' */
7791 
7792 /* including file 'src/items/item-bracket.h', size 3969 */
7793 /* commit ce344b3f96a62e5f652585e55f1ae7c7883cd45b 2018-06-25 01:03:39 +0200 */
7794 
7796  Q_OBJECT
7798  Q_PROPERTY(QPen pen READ pen WRITE setPen)
7799  Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
7800  Q_PROPERTY(double length READ length WRITE setLength)
7801  Q_PROPERTY(BracketStyle style READ style WRITE setStyle)
7803 public:
7811  bsSquare
7812  ,
7813  bsRound
7814  ,
7815  bsCurly
7816  ,
7817  bsCalligraphic
7819  };
7820  Q_ENUMS(BracketStyle)
7821 
7822  explicit QCPItemBracket(QCustomPlot *parentPlot);
7823  virtual ~QCPItemBracket();
7824 
7825  // getters:
7826  QPen pen() const { return mPen; }
7827  QPen selectedPen() const { return mSelectedPen; }
7828  double length() const { return mLength; }
7829  BracketStyle style() const { return mStyle; }
7830 
7831  // setters;
7832  void setPen(const QPen &pen);
7833  void setSelectedPen(const QPen &pen);
7834  void setLength(double length);
7835  void setStyle(BracketStyle style);
7836 
7837  // reimplemented virtual methods:
7838  virtual double selectTest(const QPointF &pos,
7839  bool onlySelectable,
7840  QVariant *details = 0) const Q_DECL_OVERRIDE;
7841 
7842  QCPItemPosition *const left;
7843  QCPItemPosition *const right;
7844  QCPItemAnchor *const center;
7845 
7846 protected:
7847  // property members:
7848  enum AnchorIndex { aiCenter };
7849  QPen mPen, mSelectedPen;
7850  double mLength;
7852 
7853  // reimplemented virtual methods:
7854  virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
7855  virtual QPointF anchorPixelPosition(int anchorId) const Q_DECL_OVERRIDE;
7856 
7857  // non-virtual methods:
7858  QPen mainPen() const;
7859 };
7861 
7862 /* end of 'src/items/item-bracket.h' */
7863 
7864 #endif // QCUSTOMPLOT_H
MouseEvent event
filament::Texture::InternalFormat format
int width
int size
std::string name
int height
int count
int offset
int points
char type
math::float4 color
math::float3 position
#define signals
static int columnCount(int count)
Eigen::Matrix3d rotation
Definition: VoxelGridIO.cpp:27
Eigen::Vector3d origin
Definition: VoxelGridIO.cpp:26
core::Tensor result
Definition: VtkUtils.cpp:76
bool copy
Definition: VtkUtils.cpp:74
const QCPVector2D operator+(const QCPVector2D &vec1, const QCPVector2D &vec2)
Definition: qcustomplot.h:611
QCPDataContainer< QCPGraphData > QCPGraphDataContainer
Definition: qcustomplot.h:5994
#define Q_DECL_OVERRIDE
Definition: qcustomplot.h:130
QCPDataContainer< QCPBarsData > QCPBarsDataContainer
Definition: qcustomplot.h:6447
#define QCP_LIB_DECL
Definition: qcustomplot.h:125
QCPDataContainer< QCPStatisticalBoxData > QCPStatisticalBoxDataContainer
Definition: qcustomplot.h:6602
QVector< QCPErrorBarsData > QCPErrorBarsDataContainer
Definition: qcustomplot.h:7093
const QCPVector2D operator-(const QCPVector2D &vec1, const QCPVector2D &vec2)
Definition: qcustomplot.h:615
const QCPVector2D operator/(const QCPVector2D &vec, double divisor)
Definition: qcustomplot.h:608
const QCPVector2D operator*(double factor, const QCPVector2D &vec)
Definition: qcustomplot.h:602
QCPDataContainer< QCPCurveData > QCPCurveDataContainer
Definition: qcustomplot.h:6196
Q_DECLARE_TYPEINFO(QCPVector2D, Q_MOVABLE_TYPE)
QCPDataContainer< QCPFinancialData > QCPFinancialDataContainer
Definition: qcustomplot.h:6909
The abstract base class for all items in a plot.
Definition: qcustomplot.h:4081
QList< QCPItemAnchor * > mAnchors
Definition: qcustomplot.h:4129
QPointer< QCPAxisRect > mClipAxisRect
Definition: qcustomplot.h:4127
QList< QCPItemPosition * > mPositions
Definition: qcustomplot.h:4128
bool clipToAxisRect() const
Definition: qcustomplot.h:4097
void selectableChanged(bool selectable)
QList< QCPItemAnchor * > anchors() const
Definition: qcustomplot.h:4115
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const =0
bool selected() const
Definition: qcustomplot.h:4100
void selectionChanged(bool selected)
bool selectable() const
Definition: qcustomplot.h:4099
The abstract base class for all entries in a QCPLegend.
Definition: qcustomplot.h:5512
QColor selectedTextColor() const
Definition: qcustomplot.h:5534
QCPLegend * parentLegend() const
Definition: qcustomplot.h:5530
QColor textColor() const
Definition: qcustomplot.h:5532
QFont font() const
Definition: qcustomplot.h:5531
QFont selectedFont() const
Definition: qcustomplot.h:5533
bool selected() const
Definition: qcustomplot.h:5536
bool selectable() const
Definition: qcustomplot.h:5535
The abstract base class for paint buffers, which define the rendering backend.
Definition: qcustomplot.h:710
QSize size() const
Definition: qcustomplot.h:716
virtual void donePainting()
Definition: qcustomplot.h:727
bool invalidated() const
Definition: qcustomplot.h:717
virtual void clear(const QColor &color)=0
virtual QCPPainter * startPainting()=0
double devicePixelRatio() const
Definition: qcustomplot.h:718
virtual void reallocateBuffer()=0
virtual void draw(QCPPainter *painter) const =0
A template base class for plottables with one-dimensional data.
Definition: qcustomplot.h:4551
virtual bool sortKeyIsMainKey() const
Definition: qcustomplot.h:4896
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
Definition: qcustomplot.h:4997
virtual double dataMainValue(int index) const
Definition: qcustomplot.h:4855
virtual QPointF dataPixelPosition(int index) const
Definition: qcustomplot.h:4881
QCPAbstractPlottable1D(QCPAxis *keyAxis, QCPAxis *valueAxis)
Definition: qcustomplot.h:4809
virtual int dataCount() const
Definition: qcustomplot.h:4821
virtual double dataSortKey(int index) const
Definition: qcustomplot.h:4842
void drawPolyline(QCPPainter *painter, const QVector< QPointF > &lineData) const
Definition: qcustomplot.h:5106
virtual double dataMainKey(int index) const
Definition: qcustomplot.h:4829
QSharedPointer< QCPDataContainer< DataType > > mDataContainer
Definition: qcustomplot.h:4583
virtual QCPDataSelection selectTestRect(const QRectF &rect, bool onlySelectable) const
Definition: qcustomplot.h:4909
virtual QCPRange dataValueRange(int index) const
Definition: qcustomplot.h:4868
virtual int findEnd(double sortKey, bool expandedRange=true) const
Definition: qcustomplot.h:4979
virtual int findBegin(double sortKey, bool expandedRange=true) const
Definition: qcustomplot.h:4969
void getDataSegments(QList< QCPDataRange > &selectedSegments, QList< QCPDataRange > &unselectedSegments) const
Definition: qcustomplot.h:5073
virtual ~QCPAbstractPlottable1D()
Definition: qcustomplot.h:4815
The abstract base class for all data representing objects in a plot.
Definition: qcustomplot.h:3816
QCP::SelectionType selectable() const
Definition: qcustomplot.h:3847
bool antialiasedFill() const
Definition: qcustomplot.h:3841
QCPDataSelection selection() const
Definition: qcustomplot.h:3849
bool selected() const
Definition: qcustomplot.h:3848
QCPSelectionDecorator * mSelectionDecorator
Definition: qcustomplot.h:3912
QCPDataSelection mSelection
Definition: qcustomplot.h:3911
QCPAxis * keyAxis() const
Definition: qcustomplot.h:3845
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const =0
QCP::SelectionType mSelectable
Definition: qcustomplot.h:3910
void selectionChanged(bool selected)
virtual QCPRange getKeyRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth) const =0
virtual QCPRange getValueRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth, const QCPRange &inKeyRange=QCPRange()) const =0
QString name() const
Definition: qcustomplot.h:3840
void selectableChanged(QCP::SelectionType selectable)
QCPSelectionDecorator * selectionDecorator() const
Definition: qcustomplot.h:3850
void selectionChanged(const QCPDataSelection &selection)
bool antialiasedScatters() const
Definition: qcustomplot.h:3842
QBrush brush() const
Definition: qcustomplot.h:3844
QPointer< QCPAxis > mKeyAxis
Definition: qcustomplot.h:3909
QCPAxis * valueAxis() const
Definition: qcustomplot.h:3846
Holds multiple axes and arranges them in a rectangular shape.
Definition: qcustomplot.h:5375
bool backgroundScaled() const
Definition: qcustomplot.h:5393
Qt::AspectRatioMode backgroundScaledMode() const
Definition: qcustomplot.h:5394
int width() const
Definition: qcustomplot.h:5449
virtual void update(UpdatePhase phase)
QList< QCPRange > mDragStartHorzRange
Definition: qcustomplot.h:5477
QPoint bottomRight() const
Definition: qcustomplot.h:5455
QPixmap mBackgroundPixmap
Definition: qcustomplot.h:5466
virtual void mouseMoveEvent(QMouseEvent *event, const QPointF &startPos)
int right() const
Definition: qcustomplot.h:5446
virtual void mousePressEvent(QMouseEvent *event, const QVariant &details)
int top() const
Definition: qcustomplot.h:5447
QPixmap background() const
Definition: qcustomplot.h:5391
QBrush mBackgroundBrush
Definition: qcustomplot.h:5465
QPoint topLeft() const
Definition: qcustomplot.h:5452
virtual void wheelEvent(QWheelEvent *event)
bool mBackgroundScaled
Definition: qcustomplot.h:5468
QSize size() const
Definition: qcustomplot.h:5451
QPoint topRight() const
Definition: qcustomplot.h:5453
QBrush backgroundBrush() const
Definition: qcustomplot.h:5392
Qt::AspectRatioMode mBackgroundScaledMode
Definition: qcustomplot.h:5469
QCPLayoutInset * insetLayout() const
Definition: qcustomplot.h:5435
virtual void mouseReleaseEvent(QMouseEvent *event, const QPointF &startPos)
Qt::Orientations rangeZoom() const
Definition: qcustomplot.h:5398
QList< QPointer< QCPAxis > > mRangeZoomHorzAxis
Definition: qcustomplot.h:5473
Qt::Orientations rangeDrag() const
Definition: qcustomplot.h:5397
QCP::AntialiasedElements mAADragBackup
Definition: qcustomplot.h:5478
QPixmap mScaledBackgroundPixmap
Definition: qcustomplot.h:5467
Qt::Orientations mRangeDrag
Definition: qcustomplot.h:5471
QPoint bottomLeft() const
Definition: qcustomplot.h:5454
QList< QPointer< QCPAxis > > mRangeDragHorzAxis
Definition: qcustomplot.h:5472
int height() const
Definition: qcustomplot.h:5450
int bottom() const
Definition: qcustomplot.h:5448
double mRangeZoomFactorHorz
Definition: qcustomplot.h:5474
QHash< QCPAxis::AxisType, QList< QCPAxis * > > mAxes
Definition: qcustomplot.h:5480
QPoint center() const
Definition: qcustomplot.h:5456
virtual int calculateAutoMargin(QCP::MarginSide side)
QCPLayoutInset * mInsetLayout
Definition: qcustomplot.h:5470
int left() const
Definition: qcustomplot.h:5445
Specialized axis ticker for calendar dates and times as axis ticks.
Definition: qcustomplot.h:1904
Qt::TimeSpec mDateTimeSpec
Definition: qcustomplot.h:1928
QString dateTimeFormat() const
Definition: qcustomplot.h:1909
Qt::TimeSpec dateTimeSpec() const
Definition: qcustomplot.h:1910
Specialized axis ticker with a fixed tick step.
Definition: qcustomplot.h:2013
ScaleStrategy scaleStrategy() const
Definition: qcustomplot.h:2040
double tickStep() const
Definition: qcustomplot.h:2039
ScaleStrategy mScaleStrategy
Definition: qcustomplot.h:2049
Specialized axis ticker suited for logarithmic axes.
Definition: qcustomplot.h:2170
double logBase() const
Definition: qcustomplot.h:2175
int subTickCount() const
Definition: qcustomplot.h:2176
Specialized axis ticker to display ticks in units of an arbitrary constant, for example pi.
Definition: qcustomplot.h:2103
QString piSymbol() const
Definition: qcustomplot.h:2127
FractionStyle mFractionStyle
Definition: qcustomplot.h:2143
bool periodicity() const
Definition: qcustomplot.h:2129
FractionStyle fractionStyle() const
Definition: qcustomplot.h:2130
double piValue() const
Definition: qcustomplot.h:2128
Specialized axis ticker which allows arbitrary labels at specified coordinates.
Definition: qcustomplot.h:2061
QMap< double, QString > mTicks
Definition: qcustomplot.h:2084
int subTickCount() const
Definition: qcustomplot.h:2067
QMap< double, QString > & ticks()
Definition: qcustomplot.h:2066
Specialized axis ticker for time spans in units of milliseconds to days.
Definition: qcustomplot.h:1953
TimeUnit mBiggestUnit
Definition: qcustomplot.h:1992
QHash< TimeUnit, int > mFieldWidth
Definition: qcustomplot.h:1989
int fieldWidth(TimeUnit unit) const
Definition: qcustomplot.h:1980
QString timeFormat() const
Definition: qcustomplot.h:1979
QHash< TimeUnit, QString > mFormatPattern
Definition: qcustomplot.h:1993
The base class tick generator used by QCPAxis to create tick positions and tick labels.
Definition: qcustomplot.h:1821
double mTickOrigin
Definition: qcustomplot.h:1867
TickStepStrategy tickStepStrategy() const
Definition: qcustomplot.h:1845
int tickCount() const
Definition: qcustomplot.h:1846
TickStepStrategy mTickStepStrategy
Definition: qcustomplot.h:1865
double tickOrigin() const
Definition: qcustomplot.h:1847
Manages a single axis inside a QCustomPlot.
Definition: qcustomplot.h:2254
Qt::Orientation mOrientation
Definition: qcustomplot.h:2520
QColor labelColor() const
Definition: qcustomplot.h:2412
int padding() const
Definition: qcustomplot.h:2415
void rangeChanged(const QCPRange &newRange)
QFont selectedTickLabelFont() const
Definition: qcustomplot.h:2419
QFont tickLabelFont() const
Definition: qcustomplot.h:2395
QPen selectedBasePen() const
Definition: qcustomplot.h:2423
QCPGrid * mGrid
Definition: qcustomplot.h:2552
QFont selectedLabelFont() const
Definition: qcustomplot.h:2420
QVector< double > mSubTickVector
Definition: qcustomplot.h:2557
QVector< QString > tickVectorLabels() const
Definition: qcustomplot.h:2402
SelectableParts selectableParts() const
Definition: qcustomplot.h:2418
QCPRange mRange
Definition: qcustomplot.h:2547
QPen basePen() const
Definition: qcustomplot.h:2408
int numberPrecision() const
Definition: qcustomplot.h:2400
bool mCachedMarginValid
Definition: qcustomplot.h:2558
QString label() const
Definition: qcustomplot.h:2413
void scaleTypeChanged(QCPAxis::ScaleType scaleType)
QFont mLabelFont
Definition: qcustomplot.h:2527
QLatin1Char mNumberFormatChar
Definition: qcustomplot.h:2536
QColor mSelectedTickLabelColor
Definition: qcustomplot.h:2534
bool mTickLabels
Definition: qcustomplot.h:2531
QColor mLabelColor
Definition: qcustomplot.h:2528
int pixelOrientation() const
Definition: qcustomplot.h:2484
int mCachedMargin
Definition: qcustomplot.h:2559
QCPRange mDragStartRange
Definition: qcustomplot.h:2561
QFont mSelectedTickLabelFont
Definition: qcustomplot.h:2533
int mPadding
Definition: qcustomplot.h:2519
QVector< double > tickVector() const
Definition: qcustomplot.h:2401
bool ticks() const
Definition: qcustomplot.h:2392
bool mRangeReversed
Definition: qcustomplot.h:2548
void selectionChanged(const QCPAxis::SelectableParts &parts)
QCPGrid * grid() const
Definition: qcustomplot.h:2428
QVector< double > mTickVector
Definition: qcustomplot.h:2555
QCPAxisPainterPrivate * mAxisPainter
Definition: qcustomplot.h:2553
QPen selectedSubTickPen() const
Definition: qcustomplot.h:2425
QColor selectedTickLabelColor() const
Definition: qcustomplot.h:2421
QPen selectedTickPen() const
Definition: qcustomplot.h:2424
QCPAxisRect * mAxisRect
Definition: qcustomplot.h:2517
QPen subTickPen() const
Definition: qcustomplot.h:2410
QColor selectedLabelColor() const
Definition: qcustomplot.h:2422
QSharedPointer< QCPAxisTicker > ticker() const
Definition: qcustomplot.h:2391
Q_SLOT void setSelectedParts(const QCPAxis::SelectableParts &selectedParts)
SelectableParts selectedParts() const
Definition: qcustomplot.h:2417
QPen mSelectedTickPen
Definition: qcustomplot.h:2544
static Qt::Orientation orientation(AxisType type)
Definition: qcustomplot.h:2500
QCP::AntialiasedElements mAADragBackup
Definition: qcustomplot.h:2562
QColor tickLabelColor() const
Definition: qcustomplot.h:2396
AxisType axisType() const
Definition: qcustomplot.h:2386
QPen mSelectedSubTickPen
Definition: qcustomplot.h:2545
void selectableChanged(const QCPAxis::SelectableParts &parts)
QFont labelFont() const
Definition: qcustomplot.h:2411
void rangeChanged(const QCPRange &newRange, const QCPRange &oldRange)
bool mTicks
Definition: qcustomplot.h:2540
Q_SLOT void setSelectableParts(const QCPAxis::SelectableParts &selectableParts)
SelectableParts mSelectableParts
Definition: qcustomplot.h:2521
bool rangeReversed() const
Definition: qcustomplot.h:2390
const QCPRange range() const
Definition: qcustomplot.h:2389
QVector< QString > mTickVectorLabels
Definition: qcustomplot.h:2556
int mNumberPrecision
Definition: qcustomplot.h:2535
ScaleType scaleType() const
Definition: qcustomplot.h:2388
bool mDragging
Definition: qcustomplot.h:2560
QPen mBasePen
Definition: qcustomplot.h:2522
ScaleType mScaleType
Definition: qcustomplot.h:2549
bool subTicks() const
Definition: qcustomplot.h:2405
QSharedPointer< QCPAxisTicker > mTicker
Definition: qcustomplot.h:2554
bool tickLabels() const
Definition: qcustomplot.h:2393
AxisType mAxisType
Definition: qcustomplot.h:2516
QString mLabel
Definition: qcustomplot.h:2526
bool mNumberBeautifulPowers
Definition: qcustomplot.h:2537
bool mSubTicks
Definition: qcustomplot.h:2541
QCPAxisRect * axisRect() const
Definition: qcustomplot.h:2387
QPen tickPen() const
Definition: qcustomplot.h:2409
Holds the data of one single data point (one bar) for QCPBars.
Definition: qcustomplot.h:6413
double sortKey() const
Definition: qcustomplot.h:6418
double mainValue() const
Definition: qcustomplot.h:6425
double mainKey() const
Definition: qcustomplot.h:6424
QCPRange valueRange() const
Definition: qcustomplot.h:6427
static QCPBarsData fromSortKey(double sortKey)
Definition: qcustomplot.h:6419
static bool sortKeyIsMainKey()
Definition: qcustomplot.h:6422
Groups multiple QCPBars together so they appear side by side.
Definition: qcustomplot.h:6345
double spacing() const
Definition: qcustomplot.h:6374
QCustomPlot * mParentPlot
Definition: qcustomplot.h:6393
int size() const
Definition: qcustomplot.h:6383
double mSpacing
Definition: qcustomplot.h:6395
SpacingType mSpacingType
Definition: qcustomplot.h:6394
QList< QCPBars * > bars() const
Definition: qcustomplot.h:6381
SpacingType spacingType() const
Definition: qcustomplot.h:6373
bool isEmpty() const
Definition: qcustomplot.h:6384
bool contains(QCPBars *bars) const
Definition: qcustomplot.h:6386
QList< QCPBars * > mBars
Definition: qcustomplot.h:6396
A plottable representing a bar chart in a plot.
Definition: qcustomplot.h:6449
QCPBars * barBelow() const
Definition: qcustomplot.h:6487
double baseValue() const
Definition: qcustomplot.h:6485
double stackingGap() const
Definition: qcustomplot.h:6486
WidthType widthType() const
Definition: qcustomplot.h:6483
QCPBarsGroup * barsGroup() const
Definition: qcustomplot.h:6484
QSharedPointer< QCPBarsDataContainer > data() const
Definition: qcustomplot.h:6489
QCPBars * barAbove() const
Definition: qcustomplot.h:6488
double width() const
Definition: qcustomplot.h:6482
Defines a color gradient for use with e.g. QCPColorMap.
Definition: qcustomplot.h:5165
ColorInterpolation mColorInterpolation
Definition: qcustomplot.h:5277
bool periodic() const
Definition: qcustomplot.h:5243
QMap< double, QColor > mColorStops
Definition: qcustomplot.h:5276
QMap< double, QColor > colorStops() const
Definition: qcustomplot.h:5239
bool mColorBufferInvalidated
Definition: qcustomplot.h:5284
ColorInterpolation colorInterpolation() const
Definition: qcustomplot.h:5240
int levelCount() const
Definition: qcustomplot.h:5238
bool operator!=(const QCPColorGradient &other) const
Definition: qcustomplot.h:5233
QVector< QRgb > mColorBuffer
Definition: qcustomplot.h:5282
Holds the two-dimensional data of a QCPColorMap plottable.
Definition: qcustomplot.h:6720
QCPRange mDataBounds
Definition: qcustomplot.h:6776
QCPRange keyRange() const
Definition: qcustomplot.h:6733
unsigned char * mAlpha
Definition: qcustomplot.h:6775
QCPRange valueRange() const
Definition: qcustomplot.h:6734
int valueSize() const
Definition: qcustomplot.h:6732
QCPRange mKeyRange
Definition: qcustomplot.h:6770
QCPRange dataBounds() const
Definition: qcustomplot.h:6735
int keySize() const
Definition: qcustomplot.h:6731
bool isEmpty() const
Definition: qcustomplot.h:6757
A plottable representing a two-dimensional color map in a plot.
Definition: qcustomplot.h:6784
QCPColorMapData * data() const
Definition: qcustomplot.h:6802
bool interpolate() const
Definition: qcustomplot.h:6805
bool tightBoundary() const
Definition: qcustomplot.h:6806
QCPColorScale * colorScale() const
Definition: qcustomplot.h:6808
QCPAxis::ScaleType dataScaleType() const
Definition: qcustomplot.h:6804
QCPColorGradient gradient() const
Definition: qcustomplot.h:6807
QCPRange dataRange() const
Definition: qcustomplot.h:6803
A color scale for use with color coding data such as QCPColorMap.
Definition: qcustomplot.h:5876
QCPAxis::ScaleType mDataScaleType
Definition: qcustomplot.h:5932
QCPColorGradient gradient() const
Definition: qcustomplot.h:5900
QCPAxis * axis() const
Definition: qcustomplot.h:5896
QCPRange dataRange() const
Definition: qcustomplot.h:5898
QPointer< QCPColorScaleAxisRectPrivate > mAxisRect
Definition: qcustomplot.h:5937
QCPRange mDataRange
Definition: qcustomplot.h:5931
void gradientChanged(const QCPColorGradient &newGradient)
void dataScaleTypeChanged(QCPAxis::ScaleType scaleType)
void dataRangeChanged(const QCPRange &newRange)
QCPAxis::AxisType mType
Definition: qcustomplot.h:5930
QCPAxis::AxisType type() const
Definition: qcustomplot.h:5897
QPointer< QCPAxis > mColorAxis
Definition: qcustomplot.h:5938
QCPAxis::ScaleType dataScaleType() const
Definition: qcustomplot.h:5899
int barWidth() const
Definition: qcustomplot.h:5902
QCPColorGradient mGradient
Definition: qcustomplot.h:5933
Holds the data of one single data point for QCPCurve.
Definition: qcustomplot.h:6164
static bool sortKeyIsMainKey()
Definition: qcustomplot.h:6173
double mainValue() const
Definition: qcustomplot.h:6176
static QCPCurveData fromSortKey(double sortKey)
Definition: qcustomplot.h:6170
double sortKey() const
Definition: qcustomplot.h:6169
double mainKey() const
Definition: qcustomplot.h:6175
QCPRange valueRange() const
Definition: qcustomplot.h:6178
A plottable representing a parametric curve in a plot.
Definition: qcustomplot.h:6198
LineStyle lineStyle() const
Definition: qcustomplot.h:6228
int scatterSkip() const
Definition: qcustomplot.h:6227
QSharedPointer< QCPCurveDataContainer > data() const
Definition: qcustomplot.h:6223
QCPScatterStyle scatterStyle() const
Definition: qcustomplot.h:6226
The generic data container for one-dimensional plottables.
Definition: qcustomplot.h:2863
QVector< DataType >::iterator iterator
Definition: qcustomplot.h:2866
QVector< DataType >::const_iterator const_iterator
Definition: qcustomplot.h:2865
void setAutoSqueeze(bool enabled)
Definition: qcustomplot.h:3097
const_iterator findBegin(double sortKey, bool expandedRange=true) const
Definition: qcustomplot.h:3404
QCPRange valueRange(bool &foundRange, QCP::SignDomain signDomain=QCP::sdBoth, const QCPRange &inKeyRange=QCPRange())
Definition: qcustomplot.h:3582
void add(const QCPDataContainer< DataType > &data)
Definition: qcustomplot.h:3142
bool autoSqueeze() const
Definition: qcustomplot.h:2873
QVector< DataType > mData
Definition: qcustomplot.h:2918
bool qcpLessThanSortKey(const DataType &a, const DataType &b)
Definition: qcustomplot.h:2856
bool isEmpty() const
Definition: qcustomplot.h:2872
iterator begin()
Definition: qcustomplot.h:2896
void squeeze(bool preAllocation=true, bool postAllocation=true)
Definition: qcustomplot.h:3373
void performAutoSqueeze()
Definition: qcustomplot.h:3729
int size() const
Definition: qcustomplot.h:2871
void limitIteratorsToDataRange(const_iterator &begin, const_iterator &end, const QCPDataRange &dataRange) const
Definition: qcustomplot.h:3675
void removeBefore(double sortKey)
Definition: qcustomplot.h:3258
const_iterator constEnd() const
Definition: qcustomplot.h:2895
void preallocateGrow(int minimumPreallocSize)
Definition: qcustomplot.h:3696
QCPRange keyRange(bool &foundRange, QCP::SignDomain signDomain=QCP::sdBoth)
Definition: qcustomplot.h:3464
void removeAfter(double sortKey)
Definition: qcustomplot.h:3276
iterator end()
Definition: qcustomplot.h:2897
void remove(double sortKeyFrom, double sortKeyTo)
Definition: qcustomplot.h:3294
void set(const QCPDataContainer< DataType > &data)
Definition: qcustomplot.h:3111
const_iterator at(int index) const
Definition: qcustomplot.h:2900
QCPDataRange dataRange() const
Definition: qcustomplot.h:2908
const_iterator findEnd(double sortKey, bool expandedRange=true) const
Definition: qcustomplot.h:3437
const_iterator constBegin() const
Definition: qcustomplot.h:2892
Describes a data range given by begin and end index.
Definition: qcustomplot.h:1105
int length() const
Definition: qcustomplot.h:1121
void setEnd(int end)
Definition: qcustomplot.h:1125
QCPDataRange adjusted(int changeBegin, int changeEnd) const
Definition: qcustomplot.h:1133
QDebug operator<<(QDebug d, const QCPDataRange &dataRange)
Definition: qcustomplot.h:1300
void setBegin(int begin)
Definition: qcustomplot.h:1124
bool operator!=(const QCPDataRange &other) const
Definition: qcustomplot.h:1113
bool operator==(const QCPDataRange &other) const
Definition: qcustomplot.h:1110
QCPDataRange bounded(const QCPDataRange &other) const
bool isValid() const
Definition: qcustomplot.h:1128
bool isEmpty() const
Definition: qcustomplot.h:1129
int size() const
Definition: qcustomplot.h:1120
int begin() const
Definition: qcustomplot.h:1118
int end() const
Definition: qcustomplot.h:1119
Describes a data set by holding multiple QCPDataRange instances.
Definition: qcustomplot.h:1145
void addDataRange(const QCPDataRange &dataRange, bool simplify=true)
QCPDataRange dataRange(int index=0) const
bool isEmpty() const
Definition: qcustomplot.h:1185
bool operator!=(const QCPDataSelection &other) const
Definition: qcustomplot.h:1151
int dataRangeCount() const
Definition: qcustomplot.h:1176
QList< QCPDataRange > dataRanges() const
Definition: qcustomplot.h:1179
QCPDataSelection inverse(const QCPDataRange &outerRange) const
QDebug operator<<(QDebug d, const QCPDataSelection &selection)
Definition: qcustomplot.h:1310
Holds the data of one single error bar for QCPErrorBars.
Definition: qcustomplot.h:7067
A plottable that adds a set of error bars to other plottables.
Definition: qcustomplot.h:7096
QPointer< QCPAbstractPlottable > mDataPlottable
Definition: qcustomplot.h:7180
double symbolGap() const
Definition: qcustomplot.h:7135
double mWhiskerWidth
Definition: qcustomplot.h:7182
ErrorType errorType() const
Definition: qcustomplot.h:7133
double mSymbolGap
Definition: qcustomplot.h:7183
QSharedPointer< QCPErrorBarsDataContainer > mDataContainer
Definition: qcustomplot.h:7179
QCPAbstractPlottable * dataPlottable() const
Definition: qcustomplot.h:7130
double whiskerWidth() const
Definition: qcustomplot.h:7134
QSharedPointer< QCPErrorBarsDataContainer > data() const
Definition: qcustomplot.h:7127
ErrorType mErrorType
Definition: qcustomplot.h:7181
Holds the data of one single data point for QCPFinancial.
Definition: qcustomplot.h:6874
static bool sortKeyIsMainKey()
Definition: qcustomplot.h:6884
QCPRange valueRange() const
Definition: qcustomplot.h:6889
static QCPFinancialData fromSortKey(double sortKey)
Definition: qcustomplot.h:6881
double mainValue() const
Definition: qcustomplot.h:6887
double sortKey() const
Definition: qcustomplot.h:6880
double mainKey() const
Definition: qcustomplot.h:6886
A plottable representing a financial stock chart.
Definition: qcustomplot.h:6912
double width() const
Definition: qcustomplot.h:6961
QPen penNegative() const
Definition: qcustomplot.h:6967
ChartStyle chartStyle() const
Definition: qcustomplot.h:6960
QSharedPointer< QCPFinancialDataContainer > data() const
Definition: qcustomplot.h:6957
WidthType widthType() const
Definition: qcustomplot.h:6962
QBrush brushNegative() const
Definition: qcustomplot.h:6965
QPen penPositive() const
Definition: qcustomplot.h:6966
QBrush brushPositive() const
Definition: qcustomplot.h:6964
bool twoColored() const
Definition: qcustomplot.h:6963
Holds the data of one single data point for QCPGraph.
Definition: qcustomplot.h:5963
double mainValue() const
Definition: qcustomplot.h:5975
static bool sortKeyIsMainKey()
Definition: qcustomplot.h:5972
QCPRange valueRange() const
Definition: qcustomplot.h:5977
static QCPGraphData fromSortKey(double sortKey)
Definition: qcustomplot.h:5969
double sortKey() const
Definition: qcustomplot.h:5968
double mainKey() const
Definition: qcustomplot.h:5974
A plottable representing a graph in a plot.
Definition: qcustomplot.h:5996
bool adaptiveSampling() const
Definition: qcustomplot.h:6047
QCPScatterStyle scatterStyle() const
Definition: qcustomplot.h:6044
int scatterSkip() const
Definition: qcustomplot.h:6045
QCPGraph * channelFillGraph() const
Definition: qcustomplot.h:6046
LineStyle lineStyle() const
Definition: qcustomplot.h:6043
QSharedPointer< QCPGraphDataContainer > data() const
Definition: qcustomplot.h:6040
Responsible for drawing the grid of a QCPAxis.
Definition: qcustomplot.h:2202
QPen mPen
Definition: qcustomplot.h:2237
QPen pen() const
Definition: qcustomplot.h:2221
QCPAxis * mParentAxis
Definition: qcustomplot.h:2240
bool mSubGridVisible
Definition: qcustomplot.h:2235
bool antialiasedZeroLine() const
Definition: qcustomplot.h:2220
bool mAntialiasedSubGrid
Definition: qcustomplot.h:2236
QPen zeroLinePen() const
Definition: qcustomplot.h:2223
QPen subGridPen() const
Definition: qcustomplot.h:2222
bool antialiasedSubGrid() const
Definition: qcustomplot.h:2219
bool subGridVisible() const
Definition: qcustomplot.h:2218
An anchor of an item to which positions can be attached to.
Definition: qcustomplot.h:3948
QCPAbstractItem * mParentItem
Definition: qcustomplot.h:3967
QCustomPlot * mParentPlot
Definition: qcustomplot.h:3966
QString name() const
Definition: qcustomplot.h:3958
virtual QCPItemPosition * toQCPItemPosition()
Definition: qcustomplot.h:3972
QSet< QCPItemPosition * > mChildrenX
Definition: qcustomplot.h:3969
A bracket for referencing/highlighting certain parts in the plot.
Definition: qcustomplot.h:7795
BracketStyle style() const
Definition: qcustomplot.h:7829
QPen pen() const
Definition: qcustomplot.h:7826
BracketStyle mStyle
Definition: qcustomplot.h:7851
double length() const
Definition: qcustomplot.h:7828
QPen selectedPen() const
Definition: qcustomplot.h:7827
A curved line from one point to another.
Definition: qcustomplot.h:7319
QPen selectedPen() const
Definition: qcustomplot.h:7333
QCPLineEnding head() const
Definition: qcustomplot.h:7334
QCPLineEnding tail() const
Definition: qcustomplot.h:7335
QPen pen() const
Definition: qcustomplot.h:7332
An ellipse.
Definition: qcustomplot.h:7546
QPen pen() const
Definition: qcustomplot.h:7559
QPen selectedPen() const
Definition: qcustomplot.h:7560
QBrush brush() const
Definition: qcustomplot.h:7561
QBrush selectedBrush() const
Definition: qcustomplot.h:7562
A line from one point to another.
Definition: qcustomplot.h:7267
QCPLineEnding head() const
Definition: qcustomplot.h:7282
QPen pen() const
Definition: qcustomplot.h:7280
QCPLineEnding tail() const
Definition: qcustomplot.h:7283
QPen selectedPen() const
Definition: qcustomplot.h:7281
An arbitrary pixmap.
Definition: qcustomplot.h:7618
QPixmap mPixmap
Definition: qcustomplot.h:7677
bool mScaledPixmapInvalidated
Definition: qcustomplot.h:7680
QPen selectedPen() const
Definition: qcustomplot.h:7641
QPixmap mScaledPixmap
Definition: qcustomplot.h:7678
Qt::AspectRatioMode aspectRatioMode() const
Definition: qcustomplot.h:7636
QPen pen() const
Definition: qcustomplot.h:7640
QPixmap pixmap() const
Definition: qcustomplot.h:7634
bool scaled() const
Definition: qcustomplot.h:7635
Qt::AspectRatioMode mAspectRatioMode
Definition: qcustomplot.h:7681
Qt::TransformationMode transformationMode() const
Definition: qcustomplot.h:7637
Qt::TransformationMode mTransformationMode
Definition: qcustomplot.h:7682
Manages the position of an item.
Definition: qcustomplot.h:3990
QCPItemAnchor * parentAnchor() const
Definition: qcustomplot.h:4036
PositionType typeX() const
Definition: qcustomplot.h:4034
QCPAxis * valueAxis() const
Definition: qcustomplot.h:4043
QCPItemAnchor * parentAnchorX() const
Definition: qcustomplot.h:4037
double key() const
Definition: qcustomplot.h:4039
QCPAxis * keyAxis() const
Definition: qcustomplot.h:4042
QCPItemAnchor * parentAnchorY() const
Definition: qcustomplot.h:4038
QPointF coords() const
Definition: qcustomplot.h:4041
PositionType type() const
Definition: qcustomplot.h:4033
double value() const
Definition: qcustomplot.h:4040
PositionType typeY() const
Definition: qcustomplot.h:4035
A rectangle.
Definition: qcustomplot.h:7370
QBrush selectedBrush() const
Definition: qcustomplot.h:7386
QBrush mBrush
Definition: qcustomplot.h:7420
QPen pen() const
Definition: qcustomplot.h:7383
QBrush brush() const
Definition: qcustomplot.h:7385
QPen selectedPen() const
Definition: qcustomplot.h:7384
A straight line that spans infinitely in both directions.
Definition: qcustomplot.h:7222
QPen pen() const
Definition: qcustomplot.h:7233
QPen selectedPen() const
Definition: qcustomplot.h:7234
A text label.
Definition: qcustomplot.h:7436
double rotation() const
Definition: qcustomplot.h:7471
QColor color() const
Definition: qcustomplot.h:7460
Qt::Alignment positionAlignment() const
Definition: qcustomplot.h:7469
QBrush mBrush
Definition: qcustomplot.h:7519
QBrush brush() const
Definition: qcustomplot.h:7464
QString mText
Definition: qcustomplot.h:7521
QBrush selectedBrush() const
Definition: qcustomplot.h:7465
QFont font() const
Definition: qcustomplot.h:7466
QMargins padding() const
Definition: qcustomplot.h:7472
Qt::Alignment mPositionAlignment
Definition: qcustomplot.h:7522
QColor selectedColor() const
Definition: qcustomplot.h:7461
QPen pen() const
Definition: qcustomplot.h:7462
QFont selectedFont() const
Definition: qcustomplot.h:7467
QColor mColor
Definition: qcustomplot.h:7517
QPen selectedPen() const
Definition: qcustomplot.h:7463
Qt::Alignment textAlignment() const
Definition: qcustomplot.h:7470
double mRotation
Definition: qcustomplot.h:7524
Qt::Alignment mTextAlignment
Definition: qcustomplot.h:7523
QString text() const
Definition: qcustomplot.h:7468
QMargins mPadding
Definition: qcustomplot.h:7525
Item that sticks to QCPGraph data points.
Definition: qcustomplot.h:7702
double size() const
Definition: qcustomplot.h:7744
QBrush brush() const
Definition: qcustomplot.h:7742
QPen pen() const
Definition: qcustomplot.h:7740
double graphKey() const
Definition: qcustomplot.h:7747
QCPGraph * graph() const
Definition: qcustomplot.h:7746
QPen selectedPen() const
Definition: qcustomplot.h:7741
QBrush selectedBrush() const
Definition: qcustomplot.h:7743
bool interpolating() const
Definition: qcustomplot.h:7748
TracerStyle style() const
Definition: qcustomplot.h:7745
A layer that may contain objects, to control the rendering order.
Definition: qcustomplot.h:816
QList< QCPLayerable * > mChildren
Definition: qcustomplot.h:866
LayerMode mMode
Definition: qcustomplot.h:868
int mIndex
Definition: qcustomplot.h:865
QList< QCPLayerable * > children() const
Definition: qcustomplot.h:850
bool mVisible
Definition: qcustomplot.h:867
QString name() const
Definition: qcustomplot.h:848
LayerMode mode() const
Definition: qcustomplot.h:852
QCustomPlot * parentPlot() const
Definition: qcustomplot.h:847
QCustomPlot * mParentPlot
Definition: qcustomplot.h:863
QString mName
Definition: qcustomplot.h:864
QWeakPointer< QCPAbstractPaintBuffer > mPaintBuffer
Definition: qcustomplot.h:871
bool visible() const
Definition: qcustomplot.h:851
int index() const
Definition: qcustomplot.h:849
Base class for all drawable objects.
Definition: qcustomplot.h:887
virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const =0
QCustomPlot * mParentPlot
Definition: qcustomplot.h:929
bool mAntialiased
Definition: qcustomplot.h:932
QCustomPlot * parentPlot() const
Definition: qcustomplot.h:904
QCPLayer * layer() const
Definition: qcustomplot.h:906
bool antialiased() const
Definition: qcustomplot.h:907
QCPLayerable * parentLayerable() const
Definition: qcustomplot.h:905
QCPLayer * mLayer
Definition: qcustomplot.h:931
void layerChanged(QCPLayer *newLayer)
virtual void draw(QCPPainter *painter)=0
QPointer< QCPLayerable > mParentLayerable
Definition: qcustomplot.h:930
bool visible() const
Definition: qcustomplot.h:903
The abstract base class for all objects that form the layout system.
Definition: qcustomplot.h:1409
QRect rect() const
Definition: qcustomplot.h:1461
QCP::MarginSides autoMargins() const
Definition: qcustomplot.h:1465
QRect outerRect() const
Definition: qcustomplot.h:1462
QCPLayout * layout() const
Definition: qcustomplot.h:1460
virtual void draw(QCPPainter *painter)
Definition: qcustomplot.h:1520
QMargins minimumMargins() const
Definition: qcustomplot.h:1464
QSize minimumSize() const
Definition: qcustomplot.h:1466
SizeConstraintRect sizeConstraintRect() const
Definition: qcustomplot.h:1468
QHash< QCP::MarginSide, QCPMarginGroup * > marginGroups() const
Definition: qcustomplot.h:1474
QCPMarginGroup * marginGroup(QCP::MarginSide side) const
Definition: qcustomplot.h:1471
QMargins margins() const
Definition: qcustomplot.h:1463
QSize maximumSize() const
Definition: qcustomplot.h:1467
A layout that arranges child elements in a grid.
Definition: qcustomplot.h:1574
int rowCount() const
Definition: qcustomplot.h:1611
int columnCount() const
Definition: qcustomplot.h:1612
int rowSpacing() const
Definition: qcustomplot.h:1618
FillOrder fillOrder() const
Definition: qcustomplot.h:1620
int wrap() const
Definition: qcustomplot.h:1619
QList< double > columnStretchFactors() const
Definition: qcustomplot.h:1615
QList< double > rowStretchFactors() const
Definition: qcustomplot.h:1616
int columnSpacing() const
Definition: qcustomplot.h:1617
A layout that places child elements aligned to the border or arbitrarily positioned.
Definition: qcustomplot.h:1677
The abstract base class for layouts.
Definition: qcustomplot.h:1532
virtual int elementCount() const =0
virtual QCPLayoutElement * takeAt(int index)=0
virtual bool take(QCPLayoutElement *element)=0
virtual QCPLayoutElement * elementAt(int index) const =0
Manages a legend inside a QCustomPlot.
Definition: qcustomplot.h:5605
int iconTextPadding() const
Definition: qcustomplot.h:5656
QFont selectedFont() const
Definition: qcustomplot.h:5663
QPen iconBorderPen() const
Definition: qcustomplot.h:5657
QBrush selectedBrush() const
Definition: qcustomplot.h:5662
QPen borderPen() const
Definition: qcustomplot.h:5651
QColor textColor() const
Definition: qcustomplot.h:5654
QBrush brush() const
Definition: qcustomplot.h:5652
QColor selectedTextColor() const
Definition: qcustomplot.h:5664
SelectableParts selectableParts() const
Definition: qcustomplot.h:5658
QPen selectedIconBorderPen() const
Definition: qcustomplot.h:5661
QPen selectedBorderPen() const
Definition: qcustomplot.h:5660
QFont font() const
Definition: qcustomplot.h:5653
QSize iconSize() const
Definition: qcustomplot.h:5655
Handles the different ending decorations for line-like items.
Definition: qcustomplot.h:1738
EndingStyle style() const
Definition: qcustomplot.h:1788
bool inverted() const
Definition: qcustomplot.h:1791
EndingStyle mStyle
Definition: qcustomplot.h:1809
double width() const
Definition: qcustomplot.h:1789
double length() const
Definition: qcustomplot.h:1790
A margin group allows synchronization of margin sides if working with multiple layout elements.
Definition: qcustomplot.h:1378
QList< QCPLayoutElement * > elements(QCP::MarginSide side) const
Definition: qcustomplot.h:1385
QCustomPlot * mParentPlot
Definition: qcustomplot.h:1393
QHash< QCP::MarginSide, QList< QCPLayoutElement * > > mChildren
Definition: qcustomplot.h:1394
A paint buffer based on QPixmap, using software raster rendering.
Definition: qcustomplot.h:743
QPainter subclass used internally.
Definition: qcustomplot.h:637
void drawLine(const QLineF &line)
QStack< bool > mAntialiasingStack
Definition: qcustomplot.h:700
bool antialiasing() const
Definition: qcustomplot.h:670
void setModes(PainterModes modes)
bool mIsAntialiasing
Definition: qcustomplot.h:697
void drawLine(const QPointF &p1, const QPointF &p2)
Definition: qcustomplot.h:685
PainterModes modes() const
Definition: qcustomplot.h:671
PainterModes mModes
Definition: qcustomplot.h:696
Defines an abstract interface for one-dimensional plottables.
Definition: qcustomplot.h:4529
virtual int dataCount() const =0
virtual bool sortKeyIsMainKey() const =0
virtual double dataMainKey(int index) const =0
virtual int findBegin(double sortKey, bool expandedRange=true) const =0
virtual int findEnd(double sortKey, bool expandedRange=true) const =0
virtual QCPDataSelection selectTestRect(const QRectF &rect, bool onlySelectable) const =0
virtual QPointF dataPixelPosition(int index) const =0
virtual ~QCPPlottableInterface1D()
Definition: qcustomplot.h:4531
virtual QCPRange dataValueRange(int index) const =0
virtual double dataMainValue(int index) const =0
virtual double dataSortKey(int index) const =0
A legend item representing a plottable with an icon and the plottable name.
Definition: qcustomplot.h:5583
QCPAbstractPlottable * mPlottable
Definition: qcustomplot.h:5593
QCPAbstractPlottable * plottable()
Definition: qcustomplot.h:5589
Represents the range an axis is encompassing.
Definition: qcustomplot.h:975
static const double maxRange
Definition: qcustomplot.h:1033
bool operator!=(const QCPRange &other) const
Definition: qcustomplot.h:985
QCPRange & operator/=(const double &value)
Definition: qcustomplot.h:1002
double size() const
Definition: qcustomplot.h:1014
QCPRange & operator*=(const double &value)
Definition: qcustomplot.h:997
QCPRange & operator-=(const double &value)
Definition: qcustomplot.h:992
static const double minRange
Definition: qcustomplot.h:1032
bool operator==(const QCPRange &other) const
Definition: qcustomplot.h:982
double lower
Definition: qcustomplot.h:977
QDebug operator<<(QDebug d, const QCPRange &range)
Definition: qcustomplot.h:1041
double upper
Definition: qcustomplot.h:977
bool contains(double value) const
Definition: qcustomplot.h:1026
double center() const
Definition: qcustomplot.h:1015
void normalize()
Definition: qcustomplot.h:1016
QCPRange & operator+=(const double &value)
Definition: qcustomplot.h:987
Represents the visual appearance of scatter points.
Definition: qcustomplot.h:2695
double size() const
Definition: qcustomplot.h:2803
bool isPenDefined() const
Definition: qcustomplot.h:2822
bool isNone() const
Definition: qcustomplot.h:2821
QPainterPath mCustomPath
Definition: qcustomplot.h:2835
@ spPen
0x01 The pen property, see setPen
Definition: qcustomplot.h:2710
QPixmap pixmap() const
Definition: qcustomplot.h:2807
QPen pen() const
Definition: qcustomplot.h:2805
QBrush brush() const
Definition: qcustomplot.h:2806
QPainterPath customPath() const
Definition: qcustomplot.h:2808
ScatterShape shape() const
Definition: qcustomplot.h:2804
ScatterShape mShape
Definition: qcustomplot.h:2831
A selection decorator which draws brackets around each selected data segment.
Definition: qcustomplot.h:5298
BracketStyle bracketStyle() const
Definition: qcustomplot.h:5331
Controls how a plottable's data selection is drawn.
Definition: qcustomplot.h:3764
QCPAbstractPlottable * mPlottable
Definition: qcustomplot.h:3805
QCPScatterStyle mScatterStyle
Definition: qcustomplot.h:3802
QBrush brush() const
Definition: qcustomplot.h:3772
QCPScatterStyle scatterStyle() const
Definition: qcustomplot.h:3773
QCPScatterStyle::ScatterProperties usedScatterProperties() const
Definition: qcustomplot.h:3774
QCPScatterStyle::ScatterProperties mUsedScatterProperties
Definition: qcustomplot.h:3803
Provides rect/rubber-band data selection and range zoom interaction.
Definition: qcustomplot.h:1325
void accepted(const QRect &rect, QMouseEvent *event)
void changed(const QRect &rect, QMouseEvent *event)
QRect rect() const
Definition: qcustomplot.h:1332
void started(QMouseEvent *event)
QBrush brush() const
Definition: qcustomplot.h:1335
QPen pen() const
Definition: qcustomplot.h:1334
bool isActive() const
Definition: qcustomplot.h:1336
void canceled(const QRect &rect, QInputEvent *event)
Holds the data of one single data point for QCPStatisticalBox.
Definition: qcustomplot.h:6558
double mainValue() const
Definition: qcustomplot.h:6576
double sortKey() const
Definition: qcustomplot.h:6569
QCPRange valueRange() const
Definition: qcustomplot.h:6578
static bool sortKeyIsMainKey()
Definition: qcustomplot.h:6573
double mainKey() const
Definition: qcustomplot.h:6575
static QCPStatisticalBoxData fromSortKey(double sortKey)
Definition: qcustomplot.h:6570
QVector< double > outliers
Definition: qcustomplot.h:6587
A plottable representing a single statistical box in a plot.
Definition: qcustomplot.h:6605
bool whiskerAntialiased() const
Definition: qcustomplot.h:6629
QPen whiskerBarPen() const
Definition: qcustomplot.h:6628
QPen whiskerPen() const
Definition: qcustomplot.h:6627
QSharedPointer< QCPStatisticalBoxDataContainer > data() const
Definition: qcustomplot.h:6622
double whiskerWidth() const
Definition: qcustomplot.h:6626
double width() const
Definition: qcustomplot.h:6625
QCPScatterStyle outlierStyle() const
Definition: qcustomplot.h:6631
QPen medianPen() const
Definition: qcustomplot.h:6630
A layout element displaying a text.
Definition: qcustomplot.h:5750
bool selected() const
Definition: qcustomplot.h:5786
int textFlags() const
Definition: qcustomplot.h:5780
QString text() const
Definition: qcustomplot.h:5779
QColor textColor() const
Definition: qcustomplot.h:5782
QFont selectedFont() const
Definition: qcustomplot.h:5783
QFont font() const
Definition: qcustomplot.h:5781
bool selectable() const
Definition: qcustomplot.h:5785
QColor selectedTextColor() const
Definition: qcustomplot.h:5784
Represents two doubles as a mathematical 2D vector.
Definition: qcustomplot.h:543
QCPVector2D perpendicular() const
Definition: qcustomplot.h:569
double length() const
Definition: qcustomplot.h:561
double & rx()
Definition: qcustomplot.h:553
double dot(const QCPVector2D &vec) const
Definition: qcustomplot.h:570
double x() const
Definition: qcustomplot.h:551
double y() const
Definition: qcustomplot.h:552
QDebug operator<<(QDebug d, const QCPVector2D &vec)
Definition: qcustomplot.h:627
double lengthSquared() const
Definition: qcustomplot.h:562
double & ry()
Definition: qcustomplot.h:554
void setX(double x)
Definition: qcustomplot.h:557
QPointF toPointF() const
Definition: qcustomplot.h:564
bool isNull() const
Definition: qcustomplot.h:566
void setY(double y)
Definition: qcustomplot.h:558
QPoint toPoint() const
Definition: qcustomplot.h:563
The central class of the library. This is the QWidget which displays the plot and interacts with the ...
Definition: qcustomplot.h:4167
void legendDoubleClick(QCPLegend *legend, QCPAbstractLegendItem *item, QMouseEvent *event)
QPixmap mScaledBackgroundPixmap
Definition: qcustomplot.h:4445
void beforeReplot()
Qt::KeyboardModifier mMultiSelectModifier
Definition: qcustomplot.h:4450
QList< QCPGraph * > mGraphs
Definition: qcustomplot.h:4435
QRect viewport() const
Definition: qcustomplot.h:4232
QPointer< QCPLayerable > mMouseEventLayerable
Definition: qcustomplot.h:4459
Qt::KeyboardModifier multiSelectModifier() const
Definition: qcustomplot.h:4251
const QCP::Interactions interactions() const
Definition: qcustomplot.h:4247
QVariant mMouseSignalLayerableDetails
Definition: qcustomplot.h:4462
QBrush mBackgroundBrush
Definition: qcustomplot.h:4443
QCPLayer * mCurrentLayer
Definition: qcustomplot.h:4448
QCPSelectionRect * mSelectionRect
Definition: qcustomplot.h:4452
QCPLegend * legend
Definition: qcustomplot.h:4394
void selectionChangedByUser()
double bufferDevicePixelRatio() const
Definition: qcustomplot.h:4233
int selectionTolerance() const
Definition: qcustomplot.h:4248
QList< QSharedPointer< QCPAbstractPaintBuffer > > mPaintBuffers
Definition: qcustomplot.h:4456
QPixmap background() const
Definition: qcustomplot.h:4234
bool mBackgroundScaled
Definition: qcustomplot.h:4446
QCP::AntialiasedElements antialiasedElements() const
Definition: qcustomplot.h:4240
double mBufferDevicePixelRatio
Definition: qcustomplot.h:4431
void axisDoubleClick(QCPAxis *axis, QCPAxis::SelectablePart part, QMouseEvent *event)
QCP::SelectionRectMode selectionRectMode() const
Definition: qcustomplot.h:4254
void afterReplot()
void mouseMove(QMouseEvent *event)
QCP::AntialiasedElements notAntialiasedElements() const
Definition: qcustomplot.h:4243
QList< QCPAbstractItem * > mItems
Definition: qcustomplot.h:4437
void legendClick(QCPLegend *legend, QCPAbstractLegendItem *item, QMouseEvent *event)
void plottableDoubleClick(QCPAbstractPlottable *plottable, int dataIndex, QMouseEvent *event)
QCPAxis * xAxis
Definition: qcustomplot.h:4393
void mouseDoubleClick(QMouseEvent *event)
QCP::PlottingHints mPlottingHints
Definition: qcustomplot.h:4449
QCP::AntialiasedElements mAntialiasedElements
Definition: qcustomplot.h:4439
bool backgroundScaled() const
Definition: qcustomplot.h:4235
QList< QCPAbstractPlottable * > mPlottables
Definition: qcustomplot.h:4434
int mOpenGlMultisamples
Definition: qcustomplot.h:4465
bool mAutoAddPlottableToLegend
Definition: qcustomplot.h:4433
bool mOpenGlCacheLabelsBackup
Definition: qcustomplot.h:4467
bool mReplotting
Definition: qcustomplot.h:4463
Qt::AspectRatioMode mBackgroundScaledMode
Definition: qcustomplot.h:4447
QCPLayoutGrid * mPlotLayout
Definition: qcustomplot.h:4432
int mSelectionTolerance
Definition: qcustomplot.h:4441
QCP::SelectionRectMode mSelectionRectMode
Definition: qcustomplot.h:4451
bool openGl() const
Definition: qcustomplot.h:4258
void axisClick(QCPAxis *axis, QCPAxis::SelectablePart part, QMouseEvent *event)
QRect mViewport
Definition: qcustomplot.h:4430
bool autoAddPlottableToLegend() const
Definition: qcustomplot.h:4246
QPoint mMousePressPos
Definition: qcustomplot.h:4457
QCP::PlottingHints plottingHints() const
Definition: qcustomplot.h:4250
void mouseWheel(QWheelEvent *event)
void itemDoubleClick(QCPAbstractItem *item, QMouseEvent *event)
bool mNoAntialiasingOnDrag
Definition: qcustomplot.h:4442
void mouseRelease(QMouseEvent *event)
bool noAntialiasingOnDrag() const
Definition: qcustomplot.h:4249
void mousePress(QMouseEvent *event)
bool mReplotQueued
Definition: qcustomplot.h:4464
QList< QCPLayer * > mLayers
Definition: qcustomplot.h:4438
bool mMouseHasMoved
Definition: qcustomplot.h:4458
QVariant mMouseEventLayerableDetails
Definition: qcustomplot.h:4461
QCP::Interactions mInteractions
Definition: qcustomplot.h:4440
QCPSelectionRect * selectionRect() const
Definition: qcustomplot.h:4257
QCP::AntialiasedElements mOpenGlAntialiasedElementsBackup
Definition: qcustomplot.h:4466
QPointer< QCPLayerable > mMouseSignalLayerable
Definition: qcustomplot.h:4460
void itemClick(QCPAbstractItem *item, QMouseEvent *event)
QPixmap mBackgroundPixmap
Definition: qcustomplot.h:4444
QCPLayoutGrid * plotLayout() const
Definition: qcustomplot.h:4239
void plottableClick(QCPAbstractPlottable *plottable, int dataIndex, QMouseEvent *event)
Qt::AspectRatioMode backgroundScaledMode() const
Definition: qcustomplot.h:4236
Q_DECLARE_OPERATORS_FOR_FLAGS(ecvDisplayTools::INTERACTION_FLAGS)
Q_DECLARE_METATYPE(ccPclPluginInterface *)
a[190]
GraphType data
Definition: graph_cut.cc:138
normal_z y
normal_z x
normal_z z
bool isInvalidData(double value)
Definition: qcustomplot.h:425
const QMetaObject staticMetaObject
ExportPen
Definition: qcustomplot.h:193
@ epAllowCosmetic
Definition: qcustomplot.h:197
@ epNoCosmetic
Definition: qcustomplot.h:194
int getMarginValue(const QMargins &margins, QCP::MarginSide side)
Definition: qcustomplot.h:473
Interaction
Definition: qcustomplot.h:320
@ iRangeDrag
Definition: qcustomplot.h:321
@ iSelectItems
Definition: qcustomplot.h:344
@ iSelectLegend
Definition: qcustomplot.h:341
@ iSelectOther
Definition: qcustomplot.h:347
@ iSelectAxes
Definition: qcustomplot.h:338
@ iSelectPlottables
Definition: qcustomplot.h:334
@ iMultiSelect
Definition: qcustomplot.h:329
@ iRangeZoom
Definition: qcustomplot.h:325
PlottingHint
Definition: qcustomplot.h:288
@ phFastPolylines
Definition: qcustomplot.h:291
@ phImmediateRefresh
Definition: qcustomplot.h:299
@ phCacheLabels
Definition: qcustomplot.h:308
@ phNone
0x000 No hints are set
Definition: qcustomplot.h:289
ResolutionUnit
Definition: qcustomplot.h:178
@ ruDotsPerCentimeter
Definition: qcustomplot.h:181
@ ruDotsPerMeter
Resolution is given in dots per meter (dpm)
Definition: qcustomplot.h:179
@ ruDotsPerInch
Resolution is given in dots per inch (DPI/PPI)
Definition: qcustomplot.h:184
MarginSide
Definition: qcustomplot.h:223
@ msTop
0x04 top margin
Definition: qcustomplot.h:228
@ msNone
0x00 no margin
Definition: qcustomplot.h:234
@ msRight
0x02 right margin
Definition: qcustomplot.h:226
@ msAll
0xFF all margins
Definition: qcustomplot.h:232
@ msLeft
0x01 left margin
Definition: qcustomplot.h:224
@ msBottom
0x08 bottom margin
Definition: qcustomplot.h:230
SelectionType
Definition: qcustomplot.h:402
@ stMultipleDataRanges
Definition: qcustomplot.h:414
@ stDataRange
Definition: qcustomplot.h:411
@ stNone
The plottable is not selectable.
Definition: qcustomplot.h:403
@ stSingleData
One individual data point can be selected at a time.
Definition: qcustomplot.h:409
@ stWhole
Definition: qcustomplot.h:405
SelectionRectMode
Definition: qcustomplot.h:359
@ srmCustom
Definition: qcustomplot.h:375
@ srmSelect
Definition: qcustomplot.h:369
@ srmZoom
Definition: qcustomplot.h:364
@ srmNone
Definition: qcustomplot.h:360
AntialiasedElement
Definition: qcustomplot.h:249
@ aeAxes
0x0001 Axis base line and tick marks
Definition: qcustomplot.h:250
@ aeOther
Definition: qcustomplot.h:273
@ aeItems
0x0040 Main lines of items
Definition: qcustomplot.h:262
@ aeScatters
Definition: qcustomplot.h:264
@ aeLegendItems
0x0010 Legend items
Definition: qcustomplot.h:258
@ aePlottables
0x0020 Main lines of plottables
Definition: qcustomplot.h:260
@ aeNone
0x0000 No elements
Definition: qcustomplot.h:278
@ aeSubGrid
0x0004 Sub grid lines
Definition: qcustomplot.h:254
@ aeFills
Definition: qcustomplot.h:267
@ aeAll
0xFFFF All elements
Definition: qcustomplot.h:276
@ aeGrid
0x0002 Grid lines
Definition: qcustomplot.h:252
@ aeZeroLine
Definition: qcustomplot.h:270
@ aeLegend
0x0008 Legend box
Definition: qcustomplot.h:256
void setMarginValue(QMargins &margins, QCP::MarginSide side, int value)
Definition: qcustomplot.h:444
SignDomain
Definition: qcustomplot.h:210
@ sdNegative
The negative sign domain, i.e. numbers smaller than zero.
Definition: qcustomplot.h:211
@ sdPositive
The positive sign domain, i.e. numbers greater than zero.
Definition: qcustomplot.h:215
@ sdBoth
Both sign domains, including zero, i.e. all numbers.
Definition: qcustomplot.h:213
bool setColor(ccHObject::Container selectedEntities, bool colorize, QWidget *parent)
void operator/=(MiniVec< T, N > &a, const MiniVec< T, N > &b)
Definition: MiniVec.h:153
void operator*=(MiniVec< T, N > &a, const MiniVec< T, N > &b)
Definition: MiniVec.h:152
void operator+=(MiniVec< T, N > &a, const MiniVec< T, N > &b)
Definition: MiniVec.h:150
void operator-=(MiniVec< T, N > &a, const MiniVec< T, N > &b)
Definition: MiniVec.h:151
constexpr bool operator==(const optional< T > &x, const optional< T > &y)
Definition: Optional.h:615