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 #pragma once
9 
10 #include <QtCore/qglobal.h>
11 
12 // Qt5/Qt6 Compatibility Layer
13 #include <QtCompat.h>
14 
15 // some Qt version/configuration dependent macros to include or exclude certain
16 // code paths:
17 #ifdef QCUSTOMPLOT_USE_OPENGL
18 #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
19 #define QCP_OPENGL_PBUFFER
20 #else
21 #define QCP_OPENGL_FBO
22 #endif
23 #if QT_VERSION >= QT_VERSION_CHECK(5, 3, 0)
24 #define QCP_OPENGL_OFFSCREENSURFACE
25 #endif
26 #endif
27 
28 #if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0)
29 #define QCP_DEVICEPIXELRATIO_SUPPORTED
30 #if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
31 #define QCP_DEVICEPIXELRATIO_FLOAT
32 #endif
33 #endif
34 
35 #include <qmath.h>
36 
37 #include <QtCore/QCache>
38 #include <QtCore/QDateTime>
39 #include <QtCore/QDebug>
40 #include <QtCore/QFlags>
41 #include <QtCore/QMargins>
42 #include <QtCore/QMultiMap>
43 #include <QtCore/QObject>
44 #include <QtCore/QPointer>
45 #include <QtCore/QStack>
46 #include <QtCore/QString>
47 #include <QtCore/QVector>
48 #include <QtGui/QMouseEvent>
49 #include <QtGui/QPaintEvent>
50 #include <QtGui/QPainter>
51 #include <QtGui/QPainterPath>
52 #include <QtGui/QPixmap>
53 #include <QtGui/QVector2D>
54 #include <QtGui/QWheelEvent>
55 #include <algorithm>
56 #include <limits>
57 #ifdef QCP_OPENGL_FBO
58 #include <QtGui/QOpenGLContext>
59 #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
60 #include <QtGui/QOpenGLFramebufferObject>
61 #else
62 #include <QOpenGLFramebufferObject>
63 #include <QOpenGLPaintDevice>
64 #endif
65 #ifdef QCP_OPENGL_OFFSCREENSURFACE
66 #include <QtGui/QOffscreenSurface>
67 #else
68 #include <QtGui/QWindow>
69 #endif
70 #endif
71 #ifdef QCP_OPENGL_PBUFFER
72 #include <QtOpenGL/QGLPixelBuffer>
73 #endif
74 #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
75 #include <qnumeric.h>
76 
77 #include <QtGui/QPrintEngine>
78 #include <QtGui/QPrinter>
79 #include <QtGui/QWidget>
80 #else
81 #include <QtNumeric>
82 #include <QtPrintSupport/QtPrintSupport>
83 #include <QtWidgets/QWidget>
84 #endif
85 #if QT_VERSION >= QT_VERSION_CHECK(4, 8, 0)
86 #include <QtCore/QElapsedTimer>
87 #endif
88 #if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0)
89 #include <QtCore/QTimeZone>
90 #endif
91 
92 class QCPPainter;
93 class QCustomPlot;
94 class QCPLayerable;
95 class QCPLayoutElement;
96 class QCPLayout;
97 class QCPAxis;
98 class QCPAxisRect;
99 class QCPAxisPainterPrivate;
101 class QCPGraph;
102 class QCPAbstractItem;
103 class QCPItemPosition;
104 class QCPLayer;
105 class QCPPlotTitle;
106 class QCPLegend;
108 class QCPColorMap;
109 class QCPColorScale;
110 class QCPBars;
111 
114 // decl definitions for shared library compilation/usage:
115 #if defined(QT_STATIC_BUILD)
116 #define QCP_LIB_DECL
117 #elif defined(QCUSTOMPLOT_COMPILE_LIBRARY)
118 #define QCP_LIB_DECL Q_DECL_EXPORT
119 #elif defined(QCUSTOMPLOT_USE_LIBRARY)
120 #define QCP_LIB_DECL Q_DECL_IMPORT
121 #else
122 #define QCP_LIB_DECL
123 #endif
124 
125 // define empty macro for Q_DECL_OVERRIDE if it doesn't exist (Qt < 5)
126 #ifndef Q_DECL_OVERRIDE
127 #define Q_DECL_OVERRIDE
128 #endif
129 
134 namespace QCP {
141  msLeft = 0x01
142  ,
143  msRight = 0x02
144  ,
145  msTop = 0x04
146  ,
147  msBottom = 0x08
148  ,
149  msAll = 0xFF
150  ,
151  msNone = 0x00
152 };
153 Q_DECLARE_FLAGS(MarginSides, MarginSide)
154 
155 
167  aeAxes = 0x0001
168  ,
169  aeGrid = 0x0002
170  ,
171  aeSubGrid = 0x0004
172  ,
173  aeLegend = 0x0008
174  ,
175  aeLegendItems = 0x0010
176  ,
177  aePlottables =
178  0x0020
180  ,
181  aeItems = 0x0040
182  ,
183  aeScatters = 0x0080
185  ,
186  aeErrorBars = 0x0100
187  ,
188  aeFills = 0x0200
190  ,
191  aeZeroLine = 0x0400
193  ,
194  aeAll = 0xFFFF
195  ,
196  aeNone = 0x0000
197 };
198 Q_DECLARE_FLAGS(AntialiasedElements, AntialiasedElement)
199 
200 
207  phNone = 0x000
208  ,
209  phFastPolylines = 0x001
213  ,
215  0x002
221  ,
222  phCacheLabels = 0x004
224 };
225 Q_DECLARE_FLAGS(PlottingHints, PlottingHint)
226 
227 
235  iRangeDrag = 0x001
238  ,
239  iRangeZoom = 0x002
242  ,
243  iMultiSelect =
244  0x004
247  ,
249  0x008
251  ,
252  iSelectAxes = 0x010
254  ,
255  iSelectLegend = 0x020
257  ,
258  iSelectItems = 0x040
260  ,
261  iSelectOther =
262  0x080
264 };
265 Q_DECLARE_FLAGS(Interactions, Interaction)
266 
267 
274 inline bool isInvalidData(double value) {
275  return qIsNaN(value) || qIsInf(value);
276 }
277 
283 inline bool isInvalidData(double value1, double value2) {
284  return isInvalidData(value1) || isInvalidData(value2);
285 }
286 
293 inline void setMarginValue(QMargins &margins, QCP::MarginSide side, int value) {
294  switch (side) {
295  case QCP::msLeft:
296  margins.setLeft(value);
297  break;
298  case QCP::msRight:
299  margins.setRight(value);
300  break;
301  case QCP::msTop:
302  margins.setTop(value);
303  break;
304  case QCP::msBottom:
305  margins.setBottom(value);
306  break;
307  case QCP::msAll:
308  margins = QMargins(value, value, value, value);
309  break;
310  default:
311  break;
312  }
313 }
314 
322 inline int getMarginValue(const QMargins &margins, QCP::MarginSide side) {
323  switch (side) {
324  case QCP::msLeft:
325  return margins.left();
326  case QCP::msRight:
327  return margins.right();
328  case QCP::msTop:
329  return margins.top();
330  case QCP::msBottom:
331  return margins.bottom();
332  default:
333  break;
334  }
335  return 0;
336 }
337 
338 } // end of namespace QCP
339 
340 Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::AntialiasedElements)
341 Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::PlottingHints)
342 Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::MarginSides)
343 Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::Interactions)
344 
346  Q_GADGET
347 public:
356  Q_ENUMS(ScatterShape)
358  ssNone
360  ,
361  ssDot
364  ,
365  ssCross
366  ,
367  ssPlus
368  ,
369  ssCircle
370  ,
371  ssDisc
373  ,
374  ssSquare
375  ,
376  ssDiamond
377  ,
378  ssStar
380  ,
381  ssTriangle
383  ,
384  ssTriangleInverted
386  ,
387  ssCrossSquare
389  ,
390  ssPlusSquare
392  ,
393  ssCrossCircle
395  ,
396  ssPlusCircle
398  ,
399  ssPeace
401  ,
402  ssPixmap
404  ,
405  ssCustom
407  };
408 
410  QCPScatterStyle(ScatterShape shape, double size = 6);
411  QCPScatterStyle(ScatterShape shape, const QColor &color, double size);
413  const QColor &color,
414  const QColor &fill,
415  double size);
417  const QPen &pen,
418  const QBrush &brush,
419  double size);
420  QCPScatterStyle(const QPixmap &pixmap);
421  QCPScatterStyle(const QPainterPath &customPath,
422  const QPen &pen,
423  const QBrush &brush = Qt::NoBrush,
424  double size = 6);
425 
426  // getters:
427  double size() const { return mSize; }
428  ScatterShape shape() const { return mShape; }
429  QPen pen() const { return mPen; }
430  QBrush brush() const { return mBrush; }
431  QPixmap pixmap() const { return mPixmap; }
432  QPainterPath customPath() const { return mCustomPath; }
433 
434  // setters:
435  void setSize(double size);
436  void setShape(ScatterShape shape);
437  void setPen(const QPen &pen);
438  void setBrush(const QBrush &brush);
439  void setPixmap(const QPixmap &pixmap);
440  void setCustomPath(const QPainterPath &customPath);
441 
442  // non-property methods:
443  bool isNone() const { return mShape == ssNone; }
444  bool isPenDefined() const { return mPenDefined; }
445  void applyTo(QCPPainter *painter, const QPen &defaultPen) const;
446  void drawShape(QCPPainter *painter, QPointF pos) const;
447  void drawShape(QCPPainter *painter, double x, double y) const;
448 
449 protected:
450  // property members:
451  double mSize;
452  ScatterShape mShape;
453  QPen mPen;
454  QBrush mBrush;
455  QPixmap mPixmap;
456  QPainterPath mCustomPath;
457 
458  // non-property members:
459  bool mPenDefined;
460 };
462 
463 class QCP_LIB_DECL QCPPainter : public QPainter {
464  Q_GADGET
465 public:
471  enum PainterMode {
472  pmDefault = 0x00
474  ,
475  pmVectorized = 0x01
478  ,
479  pmNoCaching = 0x02
482  ,
483  pmNonCosmetic = 0x04
487  };
488  Q_FLAGS(PainterMode PainterModes)
489  Q_DECLARE_FLAGS(PainterModes, PainterMode)
490 
492  QCPPainter(QPaintDevice *device);
493  ~QCPPainter();
494 
495  // getters:
496  bool antialiasing() const { return testRenderHint(QPainter::Antialiasing); }
497  PainterModes modes() const { return mModes; }
498 
499  // setters:
500  void setAntialiasing(bool enabled);
501  void setMode(PainterMode mode, bool enabled = true);
502  void setModes(PainterModes modes);
503 
504  // methods hiding non-virtual base class functions (QPainter bug
505  // workarounds):
506  bool begin(QPaintDevice *device);
507  void setPen(const QPen &pen);
508  void setPen(const QColor &color);
509  void setPen(Qt::PenStyle penStyle);
510  void drawLine(const QLineF &line);
511  void drawLine(const QPointF &p1, const QPointF &p2) {
512  drawLine(QLineF(p1, p2));
513  }
514  void save();
515  void restore();
516 
517  // non-virtual methods:
519 
520 protected:
521  // property members:
522  PainterModes mModes;
523  bool mIsAntialiasing;
524 
525  // non-property members:
526  QStack<bool> mAntialiasingStack;
527 };
528 Q_DECLARE_OPERATORS_FOR_FLAGS(QCPPainter::PainterModes)
529 
530 class QCP_LIB_DECL QCPLayer : public QObject {
531  Q_OBJECT
533  Q_PROPERTY(QCustomPlot *parentPlot READ parentPlot)
534  Q_PROPERTY(QString name READ name)
535  Q_PROPERTY(int index READ index)
536  Q_PROPERTY(QList<QCPLayerable *> children READ children)
537  Q_PROPERTY(bool visible READ visible WRITE setVisible)
539 public:
540  QCPLayer(QCustomPlot *parentPlot, const QString &layerName);
542 
543  // getters:
544  QCustomPlot *parentPlot() const { return mParentPlot; }
545  QString name() const { return mName; }
546  int index() const { return mIndex; }
547  QList<QCPLayerable *> children() const { return mChildren; }
548  bool visible() const { return mVisible; }
549 
550  // setters:
551  void setVisible(bool visible);
552 
553 protected:
554  // property members:
555  QCustomPlot *mParentPlot;
556  QString mName;
557  int mIndex;
558  QList<QCPLayerable *> mChildren;
559  bool mVisible;
560 
561  // non-virtual methods:
562  void addChild(QCPLayerable *layerable, bool prepend);
563  void removeChild(QCPLayerable *layerable);
564 
565 private:
566  Q_DISABLE_COPY(QCPLayer)
567 
568  friend class QCustomPlot;
569  friend class QCPLayerable;
570 };
571 
572 class QCP_LIB_DECL QCPLayerable : public QObject {
573  Q_OBJECT
575  Q_PROPERTY(bool visible READ visible WRITE setVisible)
576  Q_PROPERTY(QCustomPlot *parentPlot READ parentPlot)
577  Q_PROPERTY(QCPLayerable *parentLayerable READ parentLayerable)
578  Q_PROPERTY(QCPLayer *layer READ layer WRITE setLayer NOTIFY layerChanged)
579  Q_PROPERTY(bool antialiased READ antialiased WRITE setAntialiased)
581 public:
583  QString targetLayer = QString(),
584  QCPLayerable *parentLayerable = 0);
586 
587  // getters:
588  bool visible() const { return mVisible; }
589  QCustomPlot *parentPlot() const { return mParentPlot; }
590  QCPLayerable *parentLayerable() const { return mParentLayerable.data(); }
591  QCPLayer *layer() const { return mLayer; }
592  bool antialiased() const { return mAntialiased; }
593 
594  // setters:
595  void setVisible(bool on);
596  Q_SLOT bool setLayer(QCPLayer *layer);
597  bool setLayer(const QString &layerName);
598  void setAntialiased(bool enabled);
599 
600  // introduced virtual methods:
601  virtual double selectTest(const QPointF &pos,
602  bool onlySelectable,
603  QVariant *details = 0) const;
604 
605  // non-property methods:
606  bool realVisibility() const;
607 
608 signals:
609  void layerChanged(QCPLayer *newLayer);
610 
611 protected:
612  // property members:
613  bool mVisible;
614  QCustomPlot *mParentPlot;
615  QPointer<QCPLayerable> mParentLayerable;
616  QCPLayer *mLayer;
617  bool mAntialiased;
618 
619  // introduced virtual methods:
620  virtual void parentPlotInitialized(QCustomPlot *parentPlot);
622  virtual QRect clipRect() const;
623  virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const = 0;
624  virtual void draw(QCPPainter *painter) = 0;
625  // events:
626  virtual void selectEvent(QMouseEvent *event,
627  bool additive,
628  const QVariant &details,
629  bool *selectionStateChanged);
630  virtual void deselectEvent(bool *selectionStateChanged);
631 
632  // non-property methods:
634  void setParentLayerable(QCPLayerable *parentLayerable);
635  bool moveToLayer(QCPLayer *layer, bool prepend);
637  bool localAntialiased,
638  QCP::AntialiasedElement overrideElement) const;
639 
640 private:
641  Q_DISABLE_COPY(QCPLayerable)
642 
643  friend class QCustomPlot;
644  friend class QCPAxisRect;
645 };
646 
647 class QCP_LIB_DECL QCPRange {
648 public:
649  double lower, upper;
650 
652  QCPRange(double lower, double upper);
653 
654  bool operator==(const QCPRange &other) const {
655  return lower == other.lower && upper == other.upper;
656  }
657  bool operator!=(const QCPRange &other) const { return !(*this == other); }
658 
659  QCPRange &operator+=(const double &value) {
660  lower += value;
661  upper += value;
662  return *this;
663  }
664  QCPRange &operator-=(const double &value) {
665  lower -= value;
666  upper -= value;
667  return *this;
668  }
669  QCPRange &operator*=(const double &value) {
670  lower *= value;
671  upper *= value;
672  return *this;
673  }
674  QCPRange &operator/=(const double &value) {
675  lower /= value;
676  upper /= value;
677  return *this;
678  }
679  friend inline const QCPRange operator+(const QCPRange &, double);
680  friend inline const QCPRange operator+(double, const QCPRange &);
681  friend inline const QCPRange operator-(const QCPRange &range, double value);
682  friend inline const QCPRange operator*(const QCPRange &range, double value);
683  friend inline const QCPRange operator*(double value, const QCPRange &range);
684  friend inline const QCPRange operator/(const QCPRange &range, double value);
685 
686  double size() const;
687  double center() const;
688  void normalize();
689  void expand(const QCPRange &otherRange);
690  QCPRange expanded(const QCPRange &otherRange) const;
693  bool contains(double value) const;
694 
695  static bool validRange(double lower, double upper);
696  static bool validRange(const QCPRange &range);
697  static const double minRange; // 1e-280;
698  static const double maxRange; // 1e280;
699 };
700 Q_DECLARE_TYPEINFO(QCPRange, Q_MOVABLE_TYPE);
701 
702 /* documentation of inline functions */
703 
724 /* end documentation of inline functions */
725 
729 inline const QCPRange operator+(const QCPRange &range, double value) {
730  QCPRange result(range);
731  result += value;
732  return result;
733 }
734 
738 inline const QCPRange operator+(double value, const QCPRange &range) {
739  QCPRange result(range);
740  result += value;
741  return result;
742 }
743 
747 inline const QCPRange operator-(const QCPRange &range, double value) {
748  QCPRange result(range);
749  result -= value;
750  return result;
751 }
752 
756 inline const QCPRange operator*(const QCPRange &range, double value) {
757  QCPRange result(range);
758  result *= value;
759  return result;
760 }
761 
765 inline const QCPRange operator*(double value, const QCPRange &range) {
766  QCPRange result(range);
767  result *= value;
768  return result;
769 }
770 
774 inline const QCPRange operator/(const QCPRange &range, double value) {
775  QCPRange result(range);
776  result /= value;
777  return result;
778 }
779 
780 class QCP_LIB_DECL QCPMarginGroup : public QObject {
781  Q_OBJECT
782 public:
785 
786  // non-virtual methods:
787  QList<QCPLayoutElement *> elements(QCP::MarginSide side) const {
788  return mChildren.value(side);
789  }
790  bool isEmpty() const;
791  void clear();
792 
793 protected:
794  // non-property members:
795  QCustomPlot *mParentPlot;
796  QHash<QCP::MarginSide, QList<QCPLayoutElement *>> mChildren;
797 
798  // non-virtual methods:
799  int commonMargin(QCP::MarginSide side) const;
802 
803 private:
804  Q_DISABLE_COPY(QCPMarginGroup)
805 
806  friend class QCPLayoutElement;
807 };
808 
810  Q_OBJECT
812  Q_PROPERTY(QCPLayout *layout READ layout)
813  Q_PROPERTY(QRect rect READ rect)
814  Q_PROPERTY(QRect outerRect READ outerRect WRITE setOuterRect)
815  Q_PROPERTY(QMargins margins READ margins WRITE setMargins)
816  Q_PROPERTY(
817  QMargins minimumMargins READ minimumMargins WRITE setMinimumMargins)
818  Q_PROPERTY(QSize minimumSize READ minimumSize WRITE setMinimumSize)
819  Q_PROPERTY(QSize maximumSize READ maximumSize WRITE setMaximumSize)
821 public:
826  enum UpdatePhase {
827  upPreparation
829  ,
830  upMargins
831  ,
832  upLayout
834  };
835  Q_ENUMS(UpdatePhase)
836 
837  explicit QCPLayoutElement(QCustomPlot *parentPlot = 0);
838  virtual ~QCPLayoutElement();
839 
840  // getters:
841  QCPLayout *layout() const { return mParentLayout; }
842  QRect rect() const { return mRect; }
843  QRect outerRect() const { return mOuterRect; }
844  QMargins margins() const { return mMargins; }
845  QMargins minimumMargins() const { return mMinimumMargins; }
846  QCP::MarginSides autoMargins() const { return mAutoMargins; }
847  QSize minimumSize() const { return mMinimumSize; }
848  QSize maximumSize() const { return mMaximumSize; }
850  return mMarginGroups.value(side, (QCPMarginGroup *)0);
851  }
852  QHash<QCP::MarginSide, QCPMarginGroup *> marginGroups() const {
853  return mMarginGroups;
854  }
855 
856  // setters:
857  void setOuterRect(const QRect &rect);
858  void setMargins(const QMargins &margins);
859  void setMinimumMargins(const QMargins &margins);
860  void setAutoMargins(QCP::MarginSides sides);
861  void setMinimumSize(const QSize &size);
862  void setMinimumSize(int width, int height);
863  void setMaximumSize(const QSize &size);
864  void setMaximumSize(int width, int height);
865  void setMarginGroup(QCP::MarginSides sides, QCPMarginGroup *group);
866 
867  // introduced virtual methods:
868  virtual void update(UpdatePhase phase);
869  virtual QSize minimumSizeHint() const;
870  virtual QSize maximumSizeHint() const;
871  virtual QList<QCPLayoutElement *> elements(bool recursive) const;
872 
873  // reimplemented virtual methods:
874  virtual double selectTest(const QPointF &pos,
875  bool onlySelectable,
876  QVariant *details = 0) const;
877 
878 protected:
879  // property members:
880  QCPLayout *mParentLayout;
881  QSize mMinimumSize, mMaximumSize;
882  QRect mRect, mOuterRect;
883  QMargins mMargins, mMinimumMargins;
884  QCP::MarginSides mAutoMargins;
885  QHash<QCP::MarginSide, QCPMarginGroup *> mMarginGroups;
886 
887  // introduced virtual methods:
889  // events:
890  virtual void mousePressEvent(QMouseEvent *event) { Q_UNUSED(event) }
891  virtual void mouseMoveEvent(QMouseEvent *event) { Q_UNUSED(event) }
892  virtual void mouseReleaseEvent(QMouseEvent *event) { Q_UNUSED(event) }
893  virtual void mouseDoubleClickEvent(QMouseEvent *event) { Q_UNUSED(event) }
894  virtual void wheelEvent(QWheelEvent *event) { Q_UNUSED(event) }
895 
896  // reimplemented virtual methods:
897  virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const {
898  Q_UNUSED(painter)
899  }
900  virtual void draw(QCPPainter *painter) { Q_UNUSED(painter) }
901  virtual void parentPlotInitialized(QCustomPlot *parentPlot);
902 
903 private:
904  Q_DISABLE_COPY(QCPLayoutElement)
905 
906  friend class QCustomPlot;
907  friend class QCPLayout;
908  friend class QCPMarginGroup;
909 };
910 
911 class QCP_LIB_DECL QCPLayout : public QCPLayoutElement {
912  Q_OBJECT
913 public:
914  explicit QCPLayout();
915 
916  // reimplemented virtual methods:
917  virtual void update(UpdatePhase phase);
918  virtual QList<QCPLayoutElement *> elements(bool recursive) const;
919 
920  // introduced virtual methods:
921  virtual int elementCount() const = 0;
922  virtual QCPLayoutElement *elementAt(int index) const = 0;
923  virtual QCPLayoutElement *takeAt(int index) = 0;
924  virtual bool take(QCPLayoutElement *element) = 0;
925  virtual void simplify();
926 
927  // non-virtual methods:
928  bool removeAt(int index);
929  bool remove(QCPLayoutElement *element);
930  void clear();
931 
932 protected:
933  // introduced virtual methods:
934  virtual void updateLayout();
935 
936  // non-virtual methods:
940  QVector<int> getSectionSizes(QVector<int> maxSizes,
941  QVector<int> minSizes,
942  QVector<double> stretchFactors,
943  int totalSize) const;
944 
945 private:
946  Q_DISABLE_COPY(QCPLayout)
947  friend class QCPLayoutElement;
948 };
949 
950 class QCP_LIB_DECL QCPLayoutGrid : public QCPLayout {
951  Q_OBJECT
953  Q_PROPERTY(int rowCount READ rowCount)
954  Q_PROPERTY(int columnCount READ columnCount)
955  Q_PROPERTY(QList<double> columnStretchFactors READ columnStretchFactors
956  WRITE setColumnStretchFactors)
957  Q_PROPERTY(QList<double> rowStretchFactors READ rowStretchFactors WRITE
958  setRowStretchFactors)
959  Q_PROPERTY(int columnSpacing READ columnSpacing WRITE setColumnSpacing)
960  Q_PROPERTY(int rowSpacing READ rowSpacing WRITE setRowSpacing)
962 public:
963  explicit QCPLayoutGrid();
964  virtual ~QCPLayoutGrid();
965 
966  // getters:
967  int rowCount() const;
968  int columnCount() const;
969  QList<double> columnStretchFactors() const { return mColumnStretchFactors; }
970  QList<double> rowStretchFactors() const { return mRowStretchFactors; }
971  int columnSpacing() const { return mColumnSpacing; }
972  int rowSpacing() const { return mRowSpacing; }
973 
974  // setters:
975  void setColumnStretchFactor(int column, double factor);
976  void setColumnStretchFactors(const QList<double> &factors);
977  void setRowStretchFactor(int row, double factor);
978  void setRowStretchFactors(const QList<double> &factors);
979  void setColumnSpacing(int pixels);
980  void setRowSpacing(int pixels);
981 
982  // reimplemented virtual methods:
983  virtual void updateLayout();
984  virtual int elementCount() const;
985  virtual QCPLayoutElement *elementAt(int index) const;
986  virtual QCPLayoutElement *takeAt(int index);
987  virtual bool take(QCPLayoutElement *element);
988  virtual QList<QCPLayoutElement *> elements(bool recursive) const;
989  virtual void simplify();
990  virtual QSize minimumSizeHint() const;
991  virtual QSize maximumSizeHint() const;
992 
993  // non-virtual methods:
994  QCPLayoutElement *element(int row, int column) const;
995  bool addElement(int row, int column, QCPLayoutElement *element);
996  bool hasElement(int row, int column);
997  void expandTo(int newRowCount, int newColumnCount);
998  void insertRow(int newIndex);
999  void insertColumn(int newIndex);
1000 
1001 protected:
1002  // property members:
1003  QList<QList<QCPLayoutElement *>> mElements;
1004  QList<double> mColumnStretchFactors;
1005  QList<double> mRowStretchFactors;
1006  int mColumnSpacing, mRowSpacing;
1007 
1008  // non-virtual methods:
1009  void getMinimumRowColSizes(QVector<int> *minColWidths,
1010  QVector<int> *minRowHeights) const;
1011  void getMaximumRowColSizes(QVector<int> *maxColWidths,
1012  QVector<int> *maxRowHeights) const;
1013 
1014 private:
1015  Q_DISABLE_COPY(QCPLayoutGrid)
1016 };
1017 
1018 class QCP_LIB_DECL QCPLayoutInset : public QCPLayout {
1019  Q_OBJECT
1020 public:
1026  ipFree
1028  ,
1029  ipBorderAligned
1031  };
1032 
1033  explicit QCPLayoutInset();
1034  virtual ~QCPLayoutInset();
1035 
1036  // getters:
1037  InsetPlacement insetPlacement(int index) const;
1038  Qt::Alignment insetAlignment(int index) const;
1039  QRectF insetRect(int index) const;
1040 
1041  // setters:
1042  void setInsetPlacement(int index, InsetPlacement placement);
1043  void setInsetAlignment(int index, Qt::Alignment alignment);
1044  void setInsetRect(int index, const QRectF &rect);
1045 
1046  // reimplemented virtual methods:
1047  virtual void updateLayout();
1048  virtual int elementCount() const;
1049  virtual QCPLayoutElement *elementAt(int index) const;
1050  virtual QCPLayoutElement *takeAt(int index);
1051  virtual bool take(QCPLayoutElement *element);
1052  virtual void simplify() {}
1053  virtual double selectTest(const QPointF &pos,
1054  bool onlySelectable,
1055  QVariant *details = 0) const;
1056 
1057  // non-virtual methods:
1058  void addElement(QCPLayoutElement *element, Qt::Alignment alignment);
1059  void addElement(QCPLayoutElement *element, const QRectF &rect);
1060 
1061 protected:
1062  // property members:
1063  QList<QCPLayoutElement *> mElements;
1064  QList<InsetPlacement> mInsetPlacement;
1065  QList<Qt::Alignment> mInsetAlignment;
1066  QList<QRectF> mInsetRect;
1067 
1068 private:
1069  Q_DISABLE_COPY(QCPLayoutInset)
1070 };
1071 
1073  Q_GADGET
1074 public:
1088  Q_ENUMS(EndingStyle)
1090  esNone
1091  ,
1092  esFlatArrow
1094  ,
1095  esSpikeArrow
1096  ,
1097  esLineArrow
1098  ,
1099  esDisc
1100  ,
1101  esSquare
1102  ,
1103  esDiamond
1104  ,
1105  esBar
1106  ,
1107  esHalfBar
1110  ,
1111  esSkewedBar
1113  };
1114 
1117  double width = 8,
1118  double length = 10,
1119  bool inverted = false);
1120 
1121  // getters:
1122  EndingStyle style() const { return mStyle; }
1123  double width() const { return mWidth; }
1124  double length() const { return mLength; }
1125  bool inverted() const { return mInverted; }
1126 
1127  // setters:
1128  void setStyle(EndingStyle style);
1129  void setWidth(double width);
1130  void setLength(double length);
1131  void setInverted(bool inverted);
1132 
1133  // non-property methods:
1134  double boundingDistance() const;
1135  double realLength() const;
1136  void draw(QCPPainter *painter,
1137  const QVector2D &pos,
1138  const QVector2D &dir) const;
1139  void draw(QCPPainter *painter, const QVector2D &pos, double angle) const;
1140 
1141 protected:
1142  // property members:
1143  EndingStyle mStyle;
1144  double mWidth, mLength;
1145  bool mInverted;
1146 };
1148 
1149 class QCP_LIB_DECL QCPGrid : public QCPLayerable {
1150  Q_OBJECT
1152  Q_PROPERTY(bool subGridVisible READ subGridVisible WRITE setSubGridVisible)
1153  Q_PROPERTY(bool antialiasedSubGrid READ antialiasedSubGrid WRITE
1154  setAntialiasedSubGrid)
1155  Q_PROPERTY(bool antialiasedZeroLine READ antialiasedZeroLine WRITE
1156  setAntialiasedZeroLine)
1157  Q_PROPERTY(QPen pen READ pen WRITE setPen)
1158  Q_PROPERTY(QPen subGridPen READ subGridPen WRITE setSubGridPen)
1159  Q_PROPERTY(QPen zeroLinePen READ zeroLinePen WRITE setZeroLinePen)
1161 public:
1162  QCPGrid(QCPAxis *parentAxis);
1163 
1164  // getters:
1165  bool subGridVisible() const { return mSubGridVisible; }
1166  bool antialiasedSubGrid() const { return mAntialiasedSubGrid; }
1167  bool antialiasedZeroLine() const { return mAntialiasedZeroLine; }
1168  QPen pen() const { return mPen; }
1169  QPen subGridPen() const { return mSubGridPen; }
1170  QPen zeroLinePen() const { return mZeroLinePen; }
1171 
1172  // setters:
1173  void setSubGridVisible(bool visible);
1174  void setAntialiasedSubGrid(bool enabled);
1175  void setAntialiasedZeroLine(bool enabled);
1176  void setPen(const QPen &pen);
1177  void setSubGridPen(const QPen &pen);
1178  void setZeroLinePen(const QPen &pen);
1179 
1180 protected:
1181  // property members:
1182  bool mSubGridVisible;
1183  bool mAntialiasedSubGrid, mAntialiasedZeroLine;
1184  QPen mPen, mSubGridPen, mZeroLinePen;
1185  // non-property members:
1186  QCPAxis *mParentAxis;
1187 
1188  // reimplemented virtual methods:
1189  virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const;
1190  virtual void draw(QCPPainter *painter);
1191 
1192  // non-virtual methods:
1193  void drawGridLines(QCPPainter *painter) const;
1194  void drawSubGridLines(QCPPainter *painter) const;
1195 
1196  friend class QCPAxis;
1197 };
1198 
1199 class QCP_LIB_DECL QCPAxis : public QCPLayerable {
1200  Q_OBJECT
1202  Q_PROPERTY(AxisType axisType READ axisType)
1203  Q_PROPERTY(QCPAxisRect *axisRect READ axisRect)
1204  Q_PROPERTY(ScaleType scaleType READ scaleType WRITE setScaleType NOTIFY
1205  scaleTypeChanged)
1206  Q_PROPERTY(double scaleLogBase READ scaleLogBase WRITE setScaleLogBase)
1207  Q_PROPERTY(QCPRange range READ range WRITE setRange NOTIFY rangeChanged)
1208  Q_PROPERTY(bool rangeReversed READ rangeReversed WRITE setRangeReversed)
1209  Q_PROPERTY(bool autoTicks READ autoTicks WRITE setAutoTicks)
1210  Q_PROPERTY(int autoTickCount READ autoTickCount WRITE setAutoTickCount)
1211  Q_PROPERTY(bool autoTickLabels READ autoTickLabels WRITE setAutoTickLabels)
1212  Q_PROPERTY(bool autoTickStep READ autoTickStep WRITE setAutoTickStep)
1213  Q_PROPERTY(bool autoSubTicks READ autoSubTicks WRITE setAutoSubTicks)
1214  Q_PROPERTY(bool ticks READ ticks WRITE setTicks)
1215  Q_PROPERTY(bool tickLabels READ tickLabels WRITE setTickLabels)
1216  Q_PROPERTY(int tickLabelPadding READ tickLabelPadding WRITE
1217  setTickLabelPadding)
1218  Q_PROPERTY(
1219  LabelType tickLabelType READ tickLabelType WRITE setTickLabelType)
1220  Q_PROPERTY(QFont tickLabelFont READ tickLabelFont WRITE setTickLabelFont)
1221  Q_PROPERTY(
1222  QColor tickLabelColor READ tickLabelColor WRITE setTickLabelColor)
1223  Q_PROPERTY(double tickLabelRotation READ tickLabelRotation WRITE
1224  setTickLabelRotation)
1225  Q_PROPERTY(
1226  LabelSide tickLabelSide READ tickLabelSide WRITE setTickLabelSide)
1227  Q_PROPERTY(
1228  QString dateTimeFormat READ dateTimeFormat WRITE setDateTimeFormat)
1229  Q_PROPERTY(
1230  Qt::TimeSpec dateTimeSpec READ dateTimeSpec WRITE setDateTimeSpec)
1231  Q_PROPERTY(QString numberFormat READ numberFormat WRITE setNumberFormat)
1232  Q_PROPERTY(
1233  int numberPrecision READ numberPrecision WRITE setNumberPrecision)
1234  Q_PROPERTY(double tickStep READ tickStep WRITE setTickStep)
1235  Q_PROPERTY(QVector<double> tickVector READ tickVector WRITE setTickVector)
1236  Q_PROPERTY(QVector<QString> tickVectorLabels READ tickVectorLabels WRITE
1237  setTickVectorLabels)
1238  Q_PROPERTY(int tickLengthIn READ tickLengthIn WRITE setTickLengthIn)
1239  Q_PROPERTY(int tickLengthOut READ tickLengthOut WRITE setTickLengthOut)
1240  Q_PROPERTY(int subTickCount READ subTickCount WRITE setSubTickCount)
1241  Q_PROPERTY(
1242  int subTickLengthIn READ subTickLengthIn WRITE setSubTickLengthIn)
1243  Q_PROPERTY(int subTickLengthOut READ subTickLengthOut WRITE
1244  setSubTickLengthOut)
1245  Q_PROPERTY(QPen basePen READ basePen WRITE setBasePen)
1246  Q_PROPERTY(QPen tickPen READ tickPen WRITE setTickPen)
1247  Q_PROPERTY(QPen subTickPen READ subTickPen WRITE setSubTickPen)
1248  Q_PROPERTY(QFont labelFont READ labelFont WRITE setLabelFont)
1249  Q_PROPERTY(QColor labelColor READ labelColor WRITE setLabelColor)
1250  Q_PROPERTY(QString label READ label WRITE setLabel)
1251  Q_PROPERTY(int labelPadding READ labelPadding WRITE setLabelPadding)
1252  Q_PROPERTY(int padding READ padding WRITE setPadding)
1253  Q_PROPERTY(int offset READ offset WRITE setOffset)
1254  Q_PROPERTY(SelectableParts selectedParts READ selectedParts WRITE
1255  setSelectedParts NOTIFY selectionChanged)
1256  Q_PROPERTY(SelectableParts selectableParts READ selectableParts WRITE
1257  setSelectableParts NOTIFY selectableChanged)
1258  Q_PROPERTY(QFont selectedTickLabelFont READ selectedTickLabelFont WRITE
1259  setSelectedTickLabelFont)
1260  Q_PROPERTY(QFont selectedLabelFont READ selectedLabelFont WRITE
1261  setSelectedLabelFont)
1262  Q_PROPERTY(QColor selectedTickLabelColor READ selectedTickLabelColor WRITE
1263  setSelectedTickLabelColor)
1264  Q_PROPERTY(QColor selectedLabelColor READ selectedLabelColor WRITE
1265  setSelectedLabelColor)
1266  Q_PROPERTY(
1267  QPen selectedBasePen READ selectedBasePen WRITE setSelectedBasePen)
1268  Q_PROPERTY(
1269  QPen selectedTickPen READ selectedTickPen WRITE setSelectedTickPen)
1270  Q_PROPERTY(QPen selectedSubTickPen READ selectedSubTickPen WRITE
1271  setSelectedSubTickPen)
1272  Q_PROPERTY(QCPLineEnding lowerEnding READ lowerEnding WRITE setLowerEnding)
1273  Q_PROPERTY(QCPLineEnding upperEnding READ upperEnding WRITE setUpperEnding)
1274  Q_PROPERTY(QCPGrid *grid READ grid)
1276 public:
1282  enum AxisType {
1283  atLeft = 0x01
1285  ,
1286  atRight = 0x02
1288  ,
1289  atTop = 0x04
1291  ,
1292  atBottom = 0x08
1294  };
1295  Q_FLAGS(AxisType AxisTypes)
1296  Q_DECLARE_FLAGS(AxisTypes, AxisType)
1304  enum LabelType {
1305  ltNumber
1307  ,
1308  ltDateTime
1312  };
1313  Q_ENUMS(LabelType)
1319  enum LabelSide {
1320  lsInside
1322  ,
1323  lsOutside
1324  };
1325  Q_ENUMS(LabelSide)
1330  enum ScaleType {
1331  stLinear
1332  ,
1333  stLogarithmic
1336  };
1337  Q_ENUMS(ScaleType)
1343  spNone = 0
1344  ,
1345  spAxis = 0x001
1346  ,
1347  spTickLabels = 0x002
1349  ,
1350  spAxisLabel = 0x004
1351  };
1352  Q_FLAGS(SelectablePart SelectableParts)
1353  Q_DECLARE_FLAGS(SelectableParts, SelectablePart)
1354 
1355  explicit QCPAxis(QCPAxisRect *parent, AxisType type);
1356  virtual ~QCPAxis();
1357 
1358  // getters:
1359  AxisType axisType() const { return mAxisType; }
1360  QCPAxisRect *axisRect() const { return mAxisRect; }
1361  ScaleType scaleType() const { return mScaleType; }
1362  double scaleLogBase() const { return mScaleLogBase; }
1363  const QCPRange range() const { return mRange; }
1364  bool rangeReversed() const { return mRangeReversed; }
1365  bool autoTicks() const { return mAutoTicks; }
1366  int autoTickCount() const { return mAutoTickCount; }
1367  bool autoTickLabels() const { return mAutoTickLabels; }
1368  bool autoTickStep() const { return mAutoTickStep; }
1369  bool autoSubTicks() const { return mAutoSubTicks; }
1370  bool ticks() const { return mTicks; }
1371  bool tickLabels() const { return mTickLabels; }
1372  int tickLabelPadding() const;
1373  LabelType tickLabelType() const { return mTickLabelType; }
1374  QFont tickLabelFont() const { return mTickLabelFont; }
1375  QColor tickLabelColor() const { return mTickLabelColor; }
1376  double tickLabelRotation() const;
1378  QString dateTimeFormat() const { return mDateTimeFormat; }
1379  Qt::TimeSpec dateTimeSpec() const { return mDateTimeSpec; }
1380  QString numberFormat() const;
1381  int numberPrecision() const { return mNumberPrecision; }
1382  double tickStep() const { return mTickStep; }
1383  QVector<double> tickVector() const { return mTickVector; }
1384  QVector<QString> tickVectorLabels() const { return mTickVectorLabels; }
1385  int tickLengthIn() const;
1386  int tickLengthOut() const;
1387  int subTickCount() const { return mSubTickCount; }
1388  int subTickLengthIn() const;
1389  int subTickLengthOut() const;
1390  QPen basePen() const { return mBasePen; }
1391  QPen tickPen() const { return mTickPen; }
1392  QPen subTickPen() const { return mSubTickPen; }
1393  QFont labelFont() const { return mLabelFont; }
1394  QColor labelColor() const { return mLabelColor; }
1395  QString label() const { return mLabel; }
1396  int labelPadding() const;
1397  int padding() const { return mPadding; }
1398  int offset() const;
1399  SelectableParts selectedParts() const { return mSelectedParts; }
1400  SelectableParts selectableParts() const { return mSelectableParts; }
1401  QFont selectedTickLabelFont() const { return mSelectedTickLabelFont; }
1402  QFont selectedLabelFont() const { return mSelectedLabelFont; }
1403  QColor selectedTickLabelColor() const { return mSelectedTickLabelColor; }
1404  QColor selectedLabelColor() const { return mSelectedLabelColor; }
1405  QPen selectedBasePen() const { return mSelectedBasePen; }
1406  QPen selectedTickPen() const { return mSelectedTickPen; }
1407  QPen selectedSubTickPen() const { return mSelectedSubTickPen; }
1410  QCPGrid *grid() const { return mGrid; }
1411 
1412  // setters:
1414  void setScaleLogBase(double base);
1415  Q_SLOT void setRange(const QCPRange &range);
1416  void setRange(double lower, double upper);
1417  void setRange(double position, double size, Qt::AlignmentFlag alignment);
1418  void setRangeLower(double lower);
1419  void setRangeUpper(double upper);
1420  void setRangeReversed(bool reversed);
1421  void setAutoTicks(bool on);
1422  void setAutoTickCount(int approximateCount);
1423  void setAutoTickLabels(bool on);
1424  void setAutoTickStep(bool on);
1425  void setAutoSubTicks(bool on);
1426  void setTicks(bool show);
1427  void setTickLabels(bool show);
1428  void setTickLabelPadding(int padding);
1429  void setTickLabelType(LabelType type);
1430  void setTickLabelFont(const QFont &font);
1431  void setTickLabelColor(const QColor &color);
1432  void setTickLabelRotation(double degrees);
1434  void setDateTimeFormat(const QString &format);
1435  void setDateTimeSpec(const Qt::TimeSpec &timeSpec);
1436  void setNumberFormat(const QString &formatCode);
1437  void setNumberPrecision(int precision);
1438  void setTickStep(double step);
1439  void setTickVector(const QVector<double> &vec);
1440  void setTickVectorLabels(const QVector<QString> &vec);
1441  void setTickLength(int inside, int outside = 0);
1442  void setTickLengthIn(int inside);
1443  void setTickLengthOut(int outside);
1444  void setSubTickCount(int count);
1445  void setSubTickLength(int inside, int outside = 0);
1446  void setSubTickLengthIn(int inside);
1447  void setSubTickLengthOut(int outside);
1448  void setBasePen(const QPen &pen);
1449  void setTickPen(const QPen &pen);
1450  void setSubTickPen(const QPen &pen);
1451  void setLabelFont(const QFont &font);
1452  void setLabelColor(const QColor &color);
1453  void setLabel(const QString &str);
1454  void setLabelPadding(int padding);
1455  void setPadding(int padding);
1456  void setOffset(int offset);
1457  void setSelectedTickLabelFont(const QFont &font);
1458  void setSelectedLabelFont(const QFont &font);
1459  void setSelectedTickLabelColor(const QColor &color);
1460  void setSelectedLabelColor(const QColor &color);
1461  void setSelectedBasePen(const QPen &pen);
1462  void setSelectedTickPen(const QPen &pen);
1463  void setSelectedSubTickPen(const QPen &pen);
1464  Q_SLOT void setSelectableParts(
1465  const QCPAxis::SelectableParts &selectableParts);
1466  Q_SLOT void setSelectedParts(const QCPAxis::SelectableParts &selectedParts);
1467  void setLowerEnding(const QCPLineEnding &ending);
1468  void setUpperEnding(const QCPLineEnding &ending);
1469 
1470  // reimplemented virtual methods:
1471  virtual double selectTest(const QPointF &pos,
1472  bool onlySelectable,
1473  QVariant *details = 0) const;
1474 
1475  // non-property methods:
1476  Qt::Orientation orientation() const { return mOrientation; }
1477  void moveRange(double diff);
1478  void scaleRange(double factor, double center);
1479  void setScaleRatio(const QCPAxis *otherAxis, double ratio = 1.0);
1480  void rescale(bool onlyVisiblePlottables = false);
1481  double pixelToCoord(double value) const;
1482  double coordToPixel(double value) const;
1483  SelectablePart getPartAt(const QPointF &pos) const;
1484  QList<QCPAbstractPlottable *> plottables() const;
1485  QList<QCPGraph *> graphs() const;
1486  QList<QCPAbstractItem *> items() const;
1487 
1489  static Qt::Orientation orientation(AxisType type) {
1490  return type == atBottom || type == atTop ? Qt::Horizontal
1491  : Qt::Vertical;
1492  }
1494 
1495 signals:
1497  void rangeChanged(const QCPRange &newRange);
1498  void rangeChanged(const QCPRange &newRange, const QCPRange &oldRange);
1500  void selectionChanged(const QCPAxis::SelectableParts &parts);
1501  void selectableChanged(const QCPAxis::SelectableParts &parts);
1502 
1503 protected:
1504  // property members:
1505  // axis base:
1506  AxisType mAxisType;
1507  QCPAxisRect *mAxisRect;
1508  // int mOffset; // in QCPAxisPainter
1509  int mPadding;
1510  Qt::Orientation mOrientation;
1511  SelectableParts mSelectableParts, mSelectedParts;
1512  QPen mBasePen, mSelectedBasePen;
1513  // QCPLineEnding mLowerEnding, mUpperEnding; // in QCPAxisPainter
1514  // axis label:
1515  // int mLabelPadding; // in QCPAxisPainter
1516  QString mLabel;
1517  QFont mLabelFont, mSelectedLabelFont;
1518  QColor mLabelColor, mSelectedLabelColor;
1519  // tick labels:
1520  // int mTickLabelPadding; // in QCPAxisPainter
1521  bool mTickLabels, mAutoTickLabels;
1522  // double mTickLabelRotation; // in QCPAxisPainter
1524  QFont mTickLabelFont, mSelectedTickLabelFont;
1525  QColor mTickLabelColor, mSelectedTickLabelColor;
1527  Qt::TimeSpec mDateTimeSpec;
1528  int mNumberPrecision;
1529  QLatin1Char mNumberFormatChar;
1530  bool mNumberBeautifulPowers;
1531  // bool mNumberMultiplyCross; // QCPAxisPainter
1532  // ticks and subticks:
1533  bool mTicks;
1534  double mTickStep;
1535  int mSubTickCount, mAutoTickCount;
1536  bool mAutoTicks, mAutoTickStep, mAutoSubTicks;
1537  // int mTickLengthIn, mTickLengthOut, mSubTickLengthIn, mSubTickLengthOut;
1538  // // QCPAxisPainter
1539  QPen mTickPen, mSelectedTickPen;
1540  QPen mSubTickPen, mSelectedSubTickPen;
1541  // scale and range:
1542  QCPRange mRange;
1543  bool mRangeReversed;
1544  ScaleType mScaleType;
1545  double mScaleLogBase, mScaleLogBaseLogInv;
1546 
1547  // non-property members:
1548  QCPGrid *mGrid;
1549  QCPAxisPainterPrivate *mAxisPainter;
1550  int mLowestVisibleTick, mHighestVisibleTick;
1551  QVector<double> mTickVector;
1552  QVector<QString> mTickVectorLabels;
1553  QVector<double> mSubTickVector;
1554  bool mCachedMarginValid;
1555  int mCachedMargin;
1556 
1557  // introduced virtual methods:
1558  virtual void setupTickVectors();
1559  virtual void generateAutoTicks();
1560  virtual int calculateAutoSubTickCount(double tickStep) const;
1561  virtual int calculateMargin();
1562 
1563  // reimplemented virtual methods:
1564  virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const;
1565  virtual void draw(QCPPainter *painter);
1567  // events:
1568  virtual void selectEvent(QMouseEvent *event,
1569  bool additive,
1570  const QVariant &details,
1571  bool *selectionStateChanged);
1572  virtual void deselectEvent(bool *selectionStateChanged);
1573 
1574  // non-virtual methods:
1575  void visibleTickBounds(int &lowIndex, int &highIndex) const;
1576  double baseLog(double value) const;
1577  double basePow(double value) const;
1578  QPen getBasePen() const;
1579  QPen getTickPen() const;
1580  QPen getSubTickPen() const;
1581  QFont getTickLabelFont() const;
1582  QFont getLabelFont() const;
1583  QColor getTickLabelColor() const;
1584  QColor getLabelColor() const;
1585 
1586 private:
1587  Q_DISABLE_COPY(QCPAxis)
1588 
1589  friend class QCustomPlot;
1590  friend class QCPGrid;
1591  friend class QCPAxisRect;
1592 };
1593 Q_DECLARE_OPERATORS_FOR_FLAGS(QCPAxis::SelectableParts)
1594 Q_DECLARE_OPERATORS_FOR_FLAGS(QCPAxis::AxisTypes)
1596 
1597 class QCPAxisPainterPrivate {
1598 public:
1599  explicit QCPAxisPainterPrivate(QCustomPlot *parentPlot);
1600  virtual ~QCPAxisPainterPrivate();
1601 
1602  virtual void draw(QCPPainter *painter);
1603  virtual int size() const;
1604  void clearCache();
1605 
1606  QRect axisSelectionBox() const { return mAxisSelectionBox; }
1607  QRect tickLabelsSelectionBox() const { return mTickLabelsSelectionBox; }
1608  QRect labelSelectionBox() const { return mLabelSelectionBox; }
1609 
1610  // public property members:
1612  QPen basePen;
1613  QCPLineEnding lowerEnding,
1614  upperEnding; // directly accessed by QCPAxis setters/getters
1615  int labelPadding; // directly accessed by QCPAxis setters/getters
1616  QFont labelFont;
1617  QColor labelColor;
1618  QString label;
1619  int tickLabelPadding; // directly accessed by QCPAxis setters/getters
1620  double tickLabelRotation; // directly accessed by QCPAxis setters/getters
1622  tickLabelSide; // directly accessed by QCPAxis setters/getters
1623  bool substituteExponent;
1624  bool numberMultiplyCross; // directly accessed by QCPAxis setters/getters
1625  int tickLengthIn, tickLengthOut, subTickLengthIn,
1626  subTickLengthOut; // directly accessed by QCPAxis setters/getters
1627  QPen tickPen, subTickPen;
1628  QFont tickLabelFont;
1629  QColor tickLabelColor;
1630  QRect axisRect, viewportRect;
1631  double offset; // directly accessed by QCPAxis setters/getters
1632  bool abbreviateDecimalPowers;
1633  bool reversedEndings;
1634 
1635  QVector<double> subTickPositions;
1636  QVector<double> tickPositions;
1637  QVector<QString> tickLabels;
1638 
1639 protected:
1640  struct CachedLabel {
1641  QPointF offset;
1642  QPixmap pixmap;
1643  };
1644  struct TickLabelData {
1645  QString basePart, expPart;
1646  QRect baseBounds, expBounds, totalBounds, rotatedTotalBounds;
1647  QFont baseFont, expFont;
1648  };
1649  QCustomPlot *mParentPlot;
1650  QByteArray mLabelParameterHash; // to determine whether mLabelCache needs
1651  // to be cleared due to changed parameters
1652  QCache<QString, CachedLabel> mLabelCache;
1653  QRect mAxisSelectionBox, mTickLabelsSelectionBox, mLabelSelectionBox;
1654 
1655  virtual QByteArray generateLabelParameterHash() const;
1656 
1657  virtual void placeTickLabel(QCPPainter *painter,
1658  double position,
1659  int distanceToAxis,
1660  const QString &text,
1661  QSize *tickLabelsSize);
1662  virtual void drawTickLabel(QCPPainter *painter,
1663  double x,
1664  double y,
1665  const TickLabelData &labelData) const;
1666  virtual TickLabelData getTickLabelData(const QFont &font,
1667  const QString &text) const;
1668  virtual QPointF getTickLabelDrawOffset(
1669  const TickLabelData &labelData) const;
1670  virtual void getMaxTickLabelSize(const QFont &font,
1671  const QString &text,
1672  QSize *tickLabelsSize) const;
1673 };
1674 
1676  Q_OBJECT
1678  Q_PROPERTY(QString name READ name WRITE setName)
1679  Q_PROPERTY(
1680  bool antialiasedFill READ antialiasedFill WRITE setAntialiasedFill)
1681  Q_PROPERTY(bool antialiasedScatters READ antialiasedScatters WRITE
1682  setAntialiasedScatters)
1683  Q_PROPERTY(bool antialiasedErrorBars READ antialiasedErrorBars WRITE
1684  setAntialiasedErrorBars)
1685  Q_PROPERTY(QPen pen READ pen WRITE setPen)
1686  Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
1687  Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
1688  Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
1689  Q_PROPERTY(QCPAxis *keyAxis READ keyAxis WRITE setKeyAxis)
1690  Q_PROPERTY(QCPAxis *valueAxis READ valueAxis WRITE setValueAxis)
1691  Q_PROPERTY(bool selectable READ selectable WRITE setSelectable NOTIFY
1692  selectableChanged)
1693  Q_PROPERTY(bool selected READ selected WRITE setSelected NOTIFY
1694  selectionChanged)
1696 public:
1697  QCPAbstractPlottable(QCPAxis *keyAxis, QCPAxis *valueAxis);
1698 
1699  // getters:
1700  QString name() const { return mName; }
1701  bool antialiasedFill() const { return mAntialiasedFill; }
1702  bool antialiasedScatters() const { return mAntialiasedScatters; }
1703  bool antialiasedErrorBars() const { return mAntialiasedErrorBars; }
1704  QPen pen() const { return mPen; }
1705  QPen selectedPen() const { return mSelectedPen; }
1706  QBrush brush() const { return mBrush; }
1707  QBrush selectedBrush() const { return mSelectedBrush; }
1708  QCPAxis *keyAxis() const { return mKeyAxis.data(); }
1709  QCPAxis *valueAxis() const { return mValueAxis.data(); }
1710  bool selectable() const { return mSelectable; }
1711  bool selected() const { return mSelected; }
1712 
1713  // setters:
1714  void setName(const QString &name);
1715  void setAntialiasedFill(bool enabled);
1716  void setAntialiasedScatters(bool enabled);
1717  void setAntialiasedErrorBars(bool enabled);
1718  void setPen(const QPen &pen);
1719  void setSelectedPen(const QPen &pen);
1720  void setBrush(const QBrush &brush);
1721  void setSelectedBrush(const QBrush &brush);
1722  void setKeyAxis(QCPAxis *axis);
1723  void setValueAxis(QCPAxis *axis);
1724  Q_SLOT void setSelectable(bool selectable);
1725  Q_SLOT void setSelected(bool selected);
1726 
1727  // introduced virtual methods:
1728  virtual void clearData() = 0;
1729  virtual double selectTest(const QPointF &pos,
1730  bool onlySelectable,
1731  QVariant *details = 0) const = 0;
1732  virtual bool addToLegend();
1733  virtual bool removeFromLegend() const;
1734 
1735  // non-property methods:
1736  void rescaleAxes(bool onlyEnlarge = false) const;
1737  void rescaleKeyAxis(bool onlyEnlarge = false) const;
1738  void rescaleValueAxis(bool onlyEnlarge = false) const;
1739 
1740 signals:
1741  void selectionChanged(bool selected);
1742  void selectableChanged(bool selectable);
1743 
1744 protected:
1749  enum SignDomain {
1750  sdNegative
1752  ,
1753  sdBoth
1755  ,
1756  sdPositive
1758  };
1759 
1760  // property members:
1761  QString mName;
1762  bool mAntialiasedFill, mAntialiasedScatters, mAntialiasedErrorBars;
1763  QPen mPen, mSelectedPen;
1764  QBrush mBrush, mSelectedBrush;
1765  QPointer<QCPAxis> mKeyAxis, mValueAxis;
1766  bool mSelectable, mSelected;
1767 
1768  // reimplemented virtual methods:
1769  virtual QRect clipRect() const;
1770  virtual void draw(QCPPainter *painter) = 0;
1773  // events:
1774  virtual void selectEvent(QMouseEvent *event,
1775  bool additive,
1776  const QVariant &details,
1777  bool *selectionStateChanged);
1778  virtual void deselectEvent(bool *selectionStateChanged);
1779 
1780  // introduced virtual methods:
1781  virtual void drawLegendIcon(QCPPainter *painter,
1782  const QRectF &rect) const = 0;
1783  virtual QCPRange getKeyRange(bool &foundRange,
1784  SignDomain inSignDomain = sdBoth) const = 0;
1785  virtual QCPRange getValueRange(bool &foundRange,
1786  SignDomain inSignDomain = sdBoth) const = 0;
1787 
1788  // non-virtual methods:
1789  void coordsToPixels(double key, double value, double &x, double &y) const;
1790  const QPointF coordsToPixels(double key, double value) const;
1791  void pixelsToCoords(double x, double y, double &key, double &value) const;
1792  void pixelsToCoords(const QPointF &pixelPos,
1793  double &key,
1794  double &value) const;
1795  QPen mainPen() const;
1796  QBrush mainBrush() const;
1799  void applyErrorBarsAntialiasingHint(QCPPainter *painter) const;
1800  double distSqrToLine(const QPointF &start,
1801  const QPointF &end,
1802  const QPointF &point) const;
1803 
1804 private:
1805  Q_DISABLE_COPY(QCPAbstractPlottable)
1806 
1807  friend class QCustomPlot;
1808  friend class QCPAxis;
1809  friend class QCPPlottableLegendItem;
1810 };
1811 
1813 public:
1814  QCPItemAnchor(QCustomPlot *parentPlot,
1815  QCPAbstractItem *parentItem,
1816  const QString name,
1817  int anchorId = -1);
1818  virtual ~QCPItemAnchor();
1819 
1820  // getters:
1821  QString name() const { return mName; }
1822  virtual QPointF pixelPoint() const;
1823 
1824 protected:
1825  // property members:
1826  QString mName;
1827 
1828  // non-property members:
1829  QCustomPlot *mParentPlot;
1830  QCPAbstractItem *mParentItem;
1831  int mAnchorId;
1832  QSet<QCPItemPosition *> mChildrenX, mChildrenY;
1833 
1834  // introduced virtual methods:
1835  virtual QCPItemPosition *toQCPItemPosition() { return 0; }
1836 
1837  // non-virtual methods:
1838  void addChildX(QCPItemPosition *pos); // called from pos when this anchor
1839  // is set as parent
1840  void removeChildX(QCPItemPosition *pos); // called from pos when its parent
1841  // anchor is reset or pos deleted
1842  void addChildY(QCPItemPosition *pos); // called from pos when this anchor
1843  // is set as parent
1844  void removeChildY(QCPItemPosition *pos); // called from pos when its parent
1845  // anchor is reset or pos deleted
1846 
1847 private:
1848  Q_DISABLE_COPY(QCPItemAnchor)
1849 
1850  friend class QCPItemPosition;
1851 };
1852 
1854 public:
1862  ptAbsolute
1864  ,
1865  ptViewportRatio
1871  ,
1872  ptAxisRectRatio
1881  ,
1882  ptPlotCoords
1884  };
1885 
1886  QCPItemPosition(QCustomPlot *parentPlot,
1887  QCPAbstractItem *parentItem,
1888  const QString name);
1889  virtual ~QCPItemPosition();
1890 
1891  // getters:
1892  PositionType type() const { return typeX(); }
1893  PositionType typeX() const { return mPositionTypeX; }
1894  PositionType typeY() const { return mPositionTypeY; }
1895  QCPItemAnchor *parentAnchor() const { return parentAnchorX(); }
1896  QCPItemAnchor *parentAnchorX() const { return mParentAnchorX; }
1897  QCPItemAnchor *parentAnchorY() const { return mParentAnchorY; }
1898  double key() const { return mKey; }
1899  double value() const { return mValue; }
1900  QPointF coords() const { return QPointF(mKey, mValue); }
1901  QCPAxis *keyAxis() const { return mKeyAxis.data(); }
1902  QCPAxis *valueAxis() const { return mValueAxis.data(); }
1904  virtual QPointF pixelPoint() const;
1905 
1906  // setters:
1910  bool setParentAnchor(QCPItemAnchor *parentAnchor,
1911  bool keepPixelPosition = false);
1912  bool setParentAnchorX(QCPItemAnchor *parentAnchor,
1913  bool keepPixelPosition = false);
1914  bool setParentAnchorY(QCPItemAnchor *parentAnchor,
1915  bool keepPixelPosition = false);
1916  void setCoords(double key, double value);
1917  void setCoords(const QPointF &coords);
1918  void setAxes(QCPAxis *keyAxis, QCPAxis *valueAxis);
1919  void setAxisRect(QCPAxisRect *axisRect);
1920  void setPixelPoint(const QPointF &pixelPoint);
1921 
1922 protected:
1923  // property members:
1924  PositionType mPositionTypeX, mPositionTypeY;
1925  QPointer<QCPAxis> mKeyAxis, mValueAxis;
1926  QPointer<QCPAxisRect> mAxisRect;
1927  double mKey, mValue;
1928  QCPItemAnchor *mParentAnchorX, *mParentAnchorY;
1929 
1930  // reimplemented virtual methods:
1931  virtual QCPItemPosition *toQCPItemPosition() { return this; }
1932 
1933 private:
1934  Q_DISABLE_COPY(QCPItemPosition)
1935 };
1936 
1937 class QCP_LIB_DECL QCPAbstractItem : public QCPLayerable {
1938  Q_OBJECT
1940  Q_PROPERTY(bool clipToAxisRect READ clipToAxisRect WRITE setClipToAxisRect)
1941  Q_PROPERTY(
1942  QCPAxisRect *clipAxisRect READ clipAxisRect WRITE setClipAxisRect)
1943  Q_PROPERTY(bool selectable READ selectable WRITE setSelectable NOTIFY
1944  selectableChanged)
1945  Q_PROPERTY(bool selected READ selected WRITE setSelected NOTIFY
1946  selectionChanged)
1948 public:
1950  virtual ~QCPAbstractItem();
1951 
1952  // getters:
1953  bool clipToAxisRect() const { return mClipToAxisRect; }
1955  bool selectable() const { return mSelectable; }
1956  bool selected() const { return mSelected; }
1957 
1958  // setters:
1959  void setClipToAxisRect(bool clip);
1961  Q_SLOT void setSelectable(bool selectable);
1962  Q_SLOT void setSelected(bool selected);
1963 
1964  // reimplemented virtual methods:
1965  virtual double selectTest(const QPointF &pos,
1966  bool onlySelectable,
1967  QVariant *details = 0) const = 0;
1968 
1969  // non-virtual methods:
1970  QList<QCPItemPosition *> positions() const { return mPositions; }
1971  QList<QCPItemAnchor *> anchors() const { return mAnchors; }
1972  QCPItemPosition *position(const QString &name) const;
1973  QCPItemAnchor *anchor(const QString &name) const;
1974  bool hasAnchor(const QString &name) const;
1975 
1976 signals:
1977  void selectionChanged(bool selected);
1978  void selectableChanged(bool selectable);
1979 
1980 protected:
1981  // property members:
1982  bool mClipToAxisRect;
1983  QPointer<QCPAxisRect> mClipAxisRect;
1984  QList<QCPItemPosition *> mPositions;
1985  QList<QCPItemAnchor *> mAnchors;
1986  bool mSelectable, mSelected;
1987 
1988  // reimplemented virtual methods:
1990  virtual QRect clipRect() const;
1991  virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const;
1992  virtual void draw(QCPPainter *painter) = 0;
1993  // events:
1994  virtual void selectEvent(QMouseEvent *event,
1995  bool additive,
1996  const QVariant &details,
1997  bool *selectionStateChanged);
1998  virtual void deselectEvent(bool *selectionStateChanged);
1999 
2000  // introduced virtual methods:
2001  virtual QPointF anchorPixelPoint(int anchorId) const;
2002 
2003  // non-virtual methods:
2004  double distSqrToLine(const QPointF &start,
2005  const QPointF &end,
2006  const QPointF &point) const;
2007  double rectSelectTest(const QRectF &rect,
2008  const QPointF &pos,
2009  bool filledRect) const;
2011  QCPItemAnchor *createAnchor(const QString &name, int anchorId);
2012 
2013 private:
2014  Q_DISABLE_COPY(QCPAbstractItem)
2015 
2016  friend class QCustomPlot;
2017  friend class QCPItemAnchor;
2018 };
2019 
2020 class QCP_LIB_DECL QCustomPlot : public QWidget {
2021  Q_OBJECT
2023  Q_PROPERTY(QRect viewport READ viewport WRITE setViewport)
2024  Q_PROPERTY(QPixmap background READ background WRITE setBackground)
2025  Q_PROPERTY(bool backgroundScaled READ backgroundScaled WRITE
2026  setBackgroundScaled)
2027  Q_PROPERTY(Qt::AspectRatioMode backgroundScaledMode READ
2028  backgroundScaledMode WRITE setBackgroundScaledMode)
2029  Q_PROPERTY(QCPLayoutGrid *plotLayout READ plotLayout)
2030  Q_PROPERTY(bool autoAddPlottableToLegend READ autoAddPlottableToLegend WRITE
2031  setAutoAddPlottableToLegend)
2032  Q_PROPERTY(int selectionTolerance READ selectionTolerance WRITE
2033  setSelectionTolerance)
2034  Q_PROPERTY(bool noAntialiasingOnDrag READ noAntialiasingOnDrag WRITE
2035  setNoAntialiasingOnDrag)
2036  Q_PROPERTY(Qt::KeyboardModifier multiSelectModifier READ multiSelectModifier
2037  WRITE setMultiSelectModifier)
2039 public:
2046  limBelow
2047  ,
2048  limAbove
2049  };
2050  Q_ENUMS(LayerInsertMode)
2051 
2052 
2059  rpImmediate
2061  ,
2062  rpQueued
2065  ,
2066  rpHint
2069  };
2070 
2071  explicit QCustomPlot(QWidget *parent = 0);
2072  virtual ~QCustomPlot();
2073 
2074  // getters:
2075  QRect viewport() const { return mViewport; }
2076  QPixmap background() const { return mBackgroundPixmap; }
2077  bool backgroundScaled() const { return mBackgroundScaled; }
2078  Qt::AspectRatioMode backgroundScaledMode() const {
2079  return mBackgroundScaledMode;
2080  }
2081  QCPLayoutGrid *plotLayout() const { return mPlotLayout; }
2082  QCP::AntialiasedElements antialiasedElements() const {
2083  return mAntialiasedElements;
2084  }
2085  QCP::AntialiasedElements notAntialiasedElements() const {
2086  return mNotAntialiasedElements;
2087  }
2088  bool autoAddPlottableToLegend() const { return mAutoAddPlottableToLegend; }
2089  const QCP::Interactions interactions() const { return mInteractions; }
2090  int selectionTolerance() const { return mSelectionTolerance; }
2091  bool noAntialiasingOnDrag() const { return mNoAntialiasingOnDrag; }
2092  QCP::PlottingHints plottingHints() const { return mPlottingHints; }
2093  Qt::KeyboardModifier multiSelectModifier() const {
2094  return mMultiSelectModifier;
2095  }
2096 
2097  // setters:
2098  void setViewport(const QRect &rect);
2099  void setBackground(const QPixmap &pm);
2101  const QPixmap &pm,
2102  bool scaled,
2103  Qt::AspectRatioMode mode = Qt::KeepAspectRatioByExpanding);
2104  void setBackground(const QBrush &brush);
2105  void setBackgroundScaled(bool scaled);
2106  void setBackgroundScaledMode(Qt::AspectRatioMode mode);
2108  const QCP::AntialiasedElements &antialiasedElements);
2110  bool enabled = true);
2112  const QCP::AntialiasedElements &notAntialiasedElements);
2114  bool enabled = true);
2116  void setInteractions(const QCP::Interactions &interactions);
2117  void setInteraction(const QCP::Interaction &interaction,
2118  bool enabled = true);
2119  void setSelectionTolerance(int pixels);
2120  void setNoAntialiasingOnDrag(bool enabled);
2121  void setPlottingHints(const QCP::PlottingHints &hints);
2122  void setPlottingHint(QCP::PlottingHint hint, bool enabled = true);
2123  void setMultiSelectModifier(Qt::KeyboardModifier modifier);
2124 
2125  // non-property methods:
2126  // plottable interface:
2129  bool addPlottable(QCPAbstractPlottable *plottable);
2131  bool removePlottable(int index);
2133  int plottableCount() const;
2134  QList<QCPAbstractPlottable *> selectedPlottables() const;
2135  QCPAbstractPlottable *plottableAt(const QPointF &pos,
2136  bool onlySelectable = false) const;
2137  bool hasPlottable(QCPAbstractPlottable *plottable) const;
2138 
2139  // specialized interface for QCPGraph:
2140  QCPGraph *graph(int index) const;
2141  QCPGraph *graph() const;
2142  QCPGraph *addGraph(QCPAxis *keyAxis = 0, QCPAxis *valueAxis = 0);
2143  bool removeGraph(QCPGraph *graph);
2144  bool removeGraph(int index);
2146  int graphCount() const;
2147  QList<QCPGraph *> selectedGraphs() const;
2148 
2149  // item interface:
2150  QCPAbstractItem *item(int index) const;
2152  bool addItem(QCPAbstractItem *item);
2154  bool removeItem(int index);
2155  int clearItems();
2156  int itemCount() const;
2157  QList<QCPAbstractItem *> selectedItems() const;
2158  QCPAbstractItem *itemAt(const QPointF &pos,
2159  bool onlySelectable = false) const;
2160  bool hasItem(QCPAbstractItem *item) const;
2161 
2162  // layer interface:
2163  QCPLayer *layer(const QString &name) const;
2164  QCPLayer *layer(int index) const;
2166  bool setCurrentLayer(const QString &name);
2168  int layerCount() const;
2169  bool addLayer(const QString &name,
2170  QCPLayer *otherLayer = 0,
2171  LayerInsertMode insertMode = limAbove);
2172  bool removeLayer(QCPLayer *layer);
2173  bool moveLayer(QCPLayer *layer,
2174  QCPLayer *otherLayer,
2175  LayerInsertMode insertMode = limAbove);
2176 
2177  // axis rect/layout interface:
2178  int axisRectCount() const;
2179  QCPAxisRect *axisRect(int index = 0) const;
2180  QList<QCPAxisRect *> axisRects() const;
2181  QCPLayoutElement *layoutElementAt(const QPointF &pos) const;
2182  Q_SLOT void rescaleAxes(bool onlyVisiblePlottables = false);
2183 
2184  QList<QCPAxis *> selectedAxes() const;
2185  QList<QCPLegend *> selectedLegends() const;
2186  Q_SLOT void deselectAll();
2187 
2188  bool savePdf(const QString &fileName,
2189  bool noCosmeticPen = false,
2190  int width = 0,
2191  int height = 0,
2192  const QString &pdfCreator = QString(),
2193  const QString &pdfTitle = QString());
2194  bool savePng(const QString &fileName,
2195  int width = 0,
2196  int height = 0,
2197  double scale = 1.0,
2198  int quality = -1);
2199  bool saveJpg(const QString &fileName,
2200  int width = 0,
2201  int height = 0,
2202  double scale = 1.0,
2203  int quality = -1);
2204  bool saveBmp(const QString &fileName,
2205  int width = 0,
2206  int height = 0,
2207  double scale = 1.0);
2208  bool saveRastered(const QString &fileName,
2209  int width,
2210  int height,
2211  double scale,
2212  const char *format,
2213  int quality = -1);
2214  QPixmap toPixmap(int width = 0, int height = 0, double scale = 1.0);
2215  void toPainter(QCPPainter *painter, int width = 0, int height = 0);
2216  Q_SLOT void replot(
2218 
2219  QCPAxis *xAxis, *yAxis, *xAxis2, *yAxis2;
2220  QCPLegend *legend;
2221 
2222 signals:
2223  void mouseDoubleClick(QMouseEvent *event);
2224  void mousePress(QMouseEvent *event);
2225  void mouseMove(QMouseEvent *event);
2226  void mouseRelease(QMouseEvent *event);
2227  void mouseWheel(QWheelEvent *event);
2228 
2229  void plottableClick(QCPAbstractPlottable *plottable, QMouseEvent *event);
2231  QMouseEvent *event);
2232  void itemClick(QCPAbstractItem *item, QMouseEvent *event);
2233  void itemDoubleClick(QCPAbstractItem *item, QMouseEvent *event);
2234  void axisClick(QCPAxis *axis,
2236  QMouseEvent *event);
2239  QMouseEvent *event);
2240  void legendClick(QCPLegend *legend,
2241  QCPAbstractLegendItem *item,
2242  QMouseEvent *event);
2244  QCPAbstractLegendItem *item,
2245  QMouseEvent *event);
2246  void titleClick(QMouseEvent *event, QCPPlotTitle *title);
2247  void titleDoubleClick(QMouseEvent *event, QCPPlotTitle *title);
2248 
2251  void afterReplot();
2252 
2253 private slots:
2254  void showPointToolTip(QMouseEvent *event);
2255 
2256 protected:
2257  // property members:
2258  QRect mViewport;
2259  QCPLayoutGrid *mPlotLayout;
2260  bool mAutoAddPlottableToLegend;
2261  QList<QCPAbstractPlottable *> mPlottables;
2262  QList<QCPGraph *> mGraphs; // extra list of plottables also in mPlottables
2263  // that are of type QCPGraph
2264  QList<QCPAbstractItem *> mItems;
2265  QList<QCPLayer *> mLayers;
2266  QCP::AntialiasedElements mAntialiasedElements, mNotAntialiasedElements;
2267  QCP::Interactions mInteractions;
2268  int mSelectionTolerance;
2269  bool mNoAntialiasingOnDrag;
2270  QBrush mBackgroundBrush;
2271  QPixmap mBackgroundPixmap;
2272  QPixmap mScaledBackgroundPixmap;
2273  bool mBackgroundScaled;
2274  Qt::AspectRatioMode mBackgroundScaledMode;
2275  QCPLayer *mCurrentLayer;
2276  QCP::PlottingHints mPlottingHints;
2277  Qt::KeyboardModifier mMultiSelectModifier;
2278 
2279  // non-property members:
2280  QPixmap mPaintBuffer;
2281  QPoint mMousePressPos;
2282  QPointer<QCPLayoutElement> mMouseEventElement;
2283  bool mReplotting;
2284 
2285  // reimplemented virtual methods:
2286  virtual QSize minimumSizeHint() const;
2287  virtual QSize sizeHint() const;
2288  virtual void paintEvent(QPaintEvent *event);
2289  virtual void resizeEvent(QResizeEvent *event);
2290  virtual void mouseDoubleClickEvent(QMouseEvent *event);
2291  virtual void mousePressEvent(QMouseEvent *event);
2292  virtual void mouseMoveEvent(QMouseEvent *event);
2293  virtual void mouseReleaseEvent(QMouseEvent *event);
2294  virtual void wheelEvent(QWheelEvent *event);
2295 
2296  // introduced virtual methods:
2297  virtual void draw(QCPPainter *painter);
2298  virtual void axisRemoved(QCPAxis *axis);
2299  virtual void legendRemoved(QCPLegend *legend);
2300 
2301  // non-virtual methods:
2302  void updateLayerIndices() const;
2303  QCPLayerable *layerableAt(const QPointF &pos,
2304  bool onlySelectable,
2305  QVariant *selectionDetails = 0) const;
2306  void drawBackground(QCPPainter *painter);
2307 
2308  friend class QCPLegend;
2309  friend class QCPAxis;
2310  friend class QCPLayer;
2311  friend class QCPAxisRect;
2312 };
2313 
2315  Q_GADGET
2316 public:
2324  ciRGB
2325  ,
2326  ciHSV
2329  };
2330  Q_ENUMS(ColorInterpolation)
2331 
2332 
2337  gpGrayscale
2339  ,
2340  gpHot
2342  ,
2343  gpCold
2345  ,
2346  gpNight
2348  ,
2349  gpCandy
2350  ,
2351  gpGeography
2353  ,
2354  gpIon
2357  ,
2358  gpThermal
2360  ,
2361  gpPolar
2364  ,
2365  gpSpectrum
2368  ,
2369  gpJet
2372  ,
2373  gpHues
2376  };
2377  Q_ENUMS(GradientPreset)
2378 
2380  bool operator==(const QCPColorGradient &other) const;
2381  bool operator!=(const QCPColorGradient &other) const {
2382  return !(*this == other);
2383  }
2384 
2385  // getters:
2386  int levelCount() const { return mLevelCount; }
2387  QMap<double, QColor> colorStops() const { return mColorStops; }
2389  return mColorInterpolation;
2390  }
2391  bool periodic() const { return mPeriodic; }
2392 
2393  // setters:
2394  void setLevelCount(int n);
2395  void setColorStops(const QMap<double, QColor> &colorStops);
2396  void setColorStopAt(double position, const QColor &color);
2398  void setPeriodic(bool enabled);
2399 
2400  // non-property methods:
2401  void colorize(const double *data,
2402  const QCPRange &range,
2403  QRgb *scanLine,
2404  int n,
2405  int dataIndexFactor = 1,
2406  bool logarithmic = false);
2407  QRgb color(double position,
2408  const QCPRange &range,
2409  bool logarithmic = false);
2413 
2414 protected:
2416 
2417  // property members:
2418  int mLevelCount;
2419  QMap<double, QColor> mColorStops;
2420  ColorInterpolation mColorInterpolation;
2421  bool mPeriodic;
2422 
2423  // non-property members:
2424  QVector<QRgb> mColorBuffer;
2425  bool mColorBufferInvalidated;
2426 };
2427 
2428 class QCP_LIB_DECL QCPAxisRect : public QCPLayoutElement {
2429  Q_OBJECT
2431  Q_PROPERTY(QPixmap background READ background WRITE setBackground)
2432  Q_PROPERTY(bool backgroundScaled READ backgroundScaled WRITE
2433  setBackgroundScaled)
2434  Q_PROPERTY(Qt::AspectRatioMode backgroundScaledMode READ
2435  backgroundScaledMode WRITE setBackgroundScaledMode)
2436  Q_PROPERTY(Qt::Orientations rangeDrag READ rangeDrag WRITE setRangeDrag)
2437  Q_PROPERTY(Qt::Orientations rangeZoom READ rangeZoom WRITE setRangeZoom)
2439 public:
2440  explicit QCPAxisRect(QCustomPlot *parentPlot, bool setupDefaultAxes = true);
2441  virtual ~QCPAxisRect();
2442 
2443  // getters:
2444  QPixmap background() const { return mBackgroundPixmap; }
2445  bool backgroundScaled() const { return mBackgroundScaled; }
2446  Qt::AspectRatioMode backgroundScaledMode() const {
2447  return mBackgroundScaledMode;
2448  }
2449  Qt::Orientations rangeDrag() const { return mRangeDrag; }
2450  Qt::Orientations rangeZoom() const { return mRangeZoom; }
2451  QCPAxis *rangeDragAxis(Qt::Orientation orientation);
2452  QCPAxis *rangeZoomAxis(Qt::Orientation orientation);
2453  double rangeZoomFactor(Qt::Orientation orientation);
2454 
2455  // setters:
2456  void setBackground(const QPixmap &pm);
2458  const QPixmap &pm,
2459  bool scaled,
2460  Qt::AspectRatioMode mode = Qt::KeepAspectRatioByExpanding);
2461  void setBackground(const QBrush &brush);
2462  void setBackgroundScaled(bool scaled);
2463  void setBackgroundScaledMode(Qt::AspectRatioMode mode);
2464  void setRangeDrag(Qt::Orientations orientations);
2465  void setRangeZoom(Qt::Orientations orientations);
2466  void setRangeDragAxes(QCPAxis *horizontal, QCPAxis *vertical);
2467  void setRangeZoomAxes(QCPAxis *horizontal, QCPAxis *vertical);
2468  void setRangeZoomFactor(double horizontalFactor, double verticalFactor);
2469  void setRangeZoomFactor(double factor);
2470 
2471  // non-property methods:
2473  QCPAxis *axis(QCPAxis::AxisType type, int index = 0) const;
2474  QList<QCPAxis *> axes(QCPAxis::AxisTypes types) const;
2475  QList<QCPAxis *> axes() const;
2477  QList<QCPAxis *> addAxes(QCPAxis::AxisTypes types);
2478  bool removeAxis(QCPAxis *axis);
2479  QCPLayoutInset *insetLayout() const { return mInsetLayout; }
2480 
2481  void setupFullAxesBox(bool connectRanges = false);
2482  QList<QCPAbstractPlottable *> plottables() const;
2483  QList<QCPGraph *> graphs() const;
2484  QList<QCPAbstractItem *> items() const;
2485 
2486  // read-only interface imitating a QRect:
2487  int left() const { return mRect.left(); }
2488  int right() const { return mRect.right(); }
2489  int top() const { return mRect.top(); }
2490  int bottom() const { return mRect.bottom(); }
2491  int width() const { return mRect.width(); }
2492  int height() const { return mRect.height(); }
2493  QSize size() const { return mRect.size(); }
2494  QPoint topLeft() const { return mRect.topLeft(); }
2495  QPoint topRight() const { return mRect.topRight(); }
2496  QPoint bottomLeft() const { return mRect.bottomLeft(); }
2497  QPoint bottomRight() const { return mRect.bottomRight(); }
2498  QPoint center() const { return mRect.center(); }
2499 
2500  // reimplemented virtual methods:
2501  virtual void update(UpdatePhase phase);
2502  virtual QList<QCPLayoutElement *> elements(bool recursive) const;
2503 
2504 protected:
2505  // property members:
2506  QBrush mBackgroundBrush;
2507  QPixmap mBackgroundPixmap;
2508  QPixmap mScaledBackgroundPixmap;
2509  bool mBackgroundScaled;
2510  Qt::AspectRatioMode mBackgroundScaledMode;
2511  QCPLayoutInset *mInsetLayout;
2512  Qt::Orientations mRangeDrag, mRangeZoom;
2513  QPointer<QCPAxis> mRangeDragHorzAxis, mRangeDragVertAxis,
2514  mRangeZoomHorzAxis, mRangeZoomVertAxis;
2515  double mRangeZoomFactorHorz, mRangeZoomFactorVert;
2516  // non-property members:
2517  QCPRange mDragStartHorzRange, mDragStartVertRange;
2518  QCP::AntialiasedElements mAADragBackup, mNotAADragBackup;
2519  QPoint mDragStart;
2520  bool mDragging;
2521  QHash<QCPAxis::AxisType, QList<QCPAxis *>> mAxes;
2522 
2523  // reimplemented virtual methods:
2524  virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const;
2525  virtual void draw(QCPPainter *painter);
2527  // events:
2528  virtual void mousePressEvent(QMouseEvent *event);
2529  virtual void mouseMoveEvent(QMouseEvent *event);
2530  virtual void mouseReleaseEvent(QMouseEvent *event);
2531  virtual void wheelEvent(QWheelEvent *event);
2532 
2533  // non-property methods:
2534  void drawBackground(QCPPainter *painter);
2536 
2537 private:
2538  Q_DISABLE_COPY(QCPAxisRect)
2539 
2540  friend class QCustomPlot;
2541 };
2542 
2544  Q_OBJECT
2546  Q_PROPERTY(QCPLegend *parentLegend READ parentLegend)
2547  Q_PROPERTY(QFont font READ font WRITE setFont)
2548  Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor)
2549  Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont)
2550  Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE
2551  setSelectedTextColor)
2552  Q_PROPERTY(bool selectable READ selectable WRITE setSelectable NOTIFY
2553  selectionChanged)
2554  Q_PROPERTY(bool selected READ selected WRITE setSelected NOTIFY
2555  selectableChanged)
2557 public:
2559 
2560  // getters:
2561  QCPLegend *parentLegend() const { return mParentLegend; }
2562  QFont font() const { return mFont; }
2563  QColor textColor() const { return mTextColor; }
2564  QFont selectedFont() const { return mSelectedFont; }
2565  QColor selectedTextColor() const { return mSelectedTextColor; }
2566  bool selectable() const { return mSelectable; }
2567  bool selected() const { return mSelected; }
2568 
2569  // setters:
2570  void setFont(const QFont &font);
2571  void setTextColor(const QColor &color);
2572  void setSelectedFont(const QFont &font);
2573  void setSelectedTextColor(const QColor &color);
2574  Q_SLOT void setSelectable(bool selectable);
2575  Q_SLOT void setSelected(bool selected);
2576 
2577  // reimplemented virtual methods:
2578  virtual double selectTest(const QPointF &pos,
2579  bool onlySelectable,
2580  QVariant *details = 0) const;
2581 
2582 signals:
2583  void selectionChanged(bool selected);
2584  void selectableChanged(bool selectable);
2585 
2586 protected:
2587  // property members:
2588  QCPLegend *mParentLegend;
2589  QFont mFont;
2590  QColor mTextColor;
2591  QFont mSelectedFont;
2592  QColor mSelectedTextColor;
2593  bool mSelectable, mSelected;
2594 
2595  // reimplemented virtual methods:
2597  virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const;
2598  virtual QRect clipRect() const;
2599  virtual void draw(QCPPainter *painter) = 0;
2600  // events:
2601  virtual void selectEvent(QMouseEvent *event,
2602  bool additive,
2603  const QVariant &details,
2604  bool *selectionStateChanged);
2605  virtual void deselectEvent(bool *selectionStateChanged);
2606 
2607 private:
2608  Q_DISABLE_COPY(QCPAbstractLegendItem)
2609 
2610  friend class QCPLegend;
2611 };
2612 
2614  Q_OBJECT
2615 public:
2617 
2618  // getters:
2619  QCPAbstractPlottable *plottable() { return mPlottable; }
2620 
2621 protected:
2622  // property members:
2623  QCPAbstractPlottable *mPlottable;
2624 
2625  // reimplemented virtual methods:
2626  virtual void draw(QCPPainter *painter);
2627  virtual QSize minimumSizeHint() const;
2628 
2629  // non-virtual methods:
2630  QPen getIconBorderPen() const;
2631  QColor getTextColor() const;
2632  QFont getFont() const;
2633 };
2634 
2635 class QCP_LIB_DECL QCPLegend : public QCPLayoutGrid {
2636  Q_OBJECT
2638  Q_PROPERTY(QPen borderPen READ borderPen WRITE setBorderPen)
2639  Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
2640  Q_PROPERTY(QFont font READ font WRITE setFont)
2641  Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor)
2642  Q_PROPERTY(QSize iconSize READ iconSize WRITE setIconSize)
2643  Q_PROPERTY(
2644  int iconTextPadding READ iconTextPadding WRITE setIconTextPadding)
2645  Q_PROPERTY(QPen iconBorderPen READ iconBorderPen WRITE setIconBorderPen)
2646  Q_PROPERTY(SelectableParts selectableParts READ selectableParts WRITE
2647  setSelectableParts NOTIFY selectionChanged)
2648  Q_PROPERTY(SelectableParts selectedParts READ selectedParts WRITE
2649  setSelectedParts NOTIFY selectableChanged)
2650  Q_PROPERTY(QPen selectedBorderPen READ selectedBorderPen WRITE
2651  setSelectedBorderPen)
2652  Q_PROPERTY(QPen selectedIconBorderPen READ selectedIconBorderPen WRITE
2653  setSelectedIconBorderPen)
2654  Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
2655  Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont)
2656  Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE
2657  setSelectedTextColor)
2659 public:
2666  spNone = 0x000
2667  ,
2668  spLegendBox = 0x001
2669  ,
2670  spItems = 0x002
2672  };
2673  Q_FLAGS(SelectablePart SelectableParts)
2674  Q_DECLARE_FLAGS(SelectableParts, SelectablePart)
2675 
2676  explicit QCPLegend();
2677  virtual ~QCPLegend();
2678 
2679  // getters:
2680  QPen borderPen() const { return mBorderPen; }
2681  QBrush brush() const { return mBrush; }
2682  QFont font() const { return mFont; }
2683  QColor textColor() const { return mTextColor; }
2684  QSize iconSize() const { return mIconSize; }
2685  int iconTextPadding() const { return mIconTextPadding; }
2686  QPen iconBorderPen() const { return mIconBorderPen; }
2687  SelectableParts selectableParts() const { return mSelectableParts; }
2688  SelectableParts selectedParts() const;
2689  QPen selectedBorderPen() const { return mSelectedBorderPen; }
2690  QPen selectedIconBorderPen() const { return mSelectedIconBorderPen; }
2691  QBrush selectedBrush() const { return mSelectedBrush; }
2692  QFont selectedFont() const { return mSelectedFont; }
2693  QColor selectedTextColor() const { return mSelectedTextColor; }
2694 
2695  // setters:
2696  void setBorderPen(const QPen &pen);
2697  void setBrush(const QBrush &brush);
2698  void setFont(const QFont &font);
2699  void setTextColor(const QColor &color);
2700  void setIconSize(const QSize &size);
2701  void setIconSize(int width, int height);
2702  void setIconTextPadding(int padding);
2703  void setIconBorderPen(const QPen &pen);
2704  Q_SLOT void setSelectableParts(const SelectableParts &selectableParts);
2705  Q_SLOT void setSelectedParts(const SelectableParts &selectedParts);
2706  void setSelectedBorderPen(const QPen &pen);
2707  void setSelectedIconBorderPen(const QPen &pen);
2708  void setSelectedBrush(const QBrush &brush);
2709  void setSelectedFont(const QFont &font);
2710  void setSelectedTextColor(const QColor &color);
2711 
2712  // reimplemented virtual methods:
2713  virtual double selectTest(const QPointF &pos,
2714  bool onlySelectable,
2715  QVariant *details = 0) const;
2716 
2717  // non-virtual methods:
2718  QCPAbstractLegendItem *item(int index) const;
2720  const QCPAbstractPlottable *plottable) const;
2721  int itemCount() const;
2722  bool hasItem(QCPAbstractLegendItem *item) const;
2723  bool hasItemWithPlottable(const QCPAbstractPlottable *plottable) const;
2725  bool removeItem(int index);
2727  void clearItems();
2728  QList<QCPAbstractLegendItem *> selectedItems() const;
2729 
2730 signals:
2731  void selectionChanged(QCPLegend::SelectableParts parts);
2732  void selectableChanged(QCPLegend::SelectableParts parts);
2733 
2734 protected:
2735  // property members:
2736  QPen mBorderPen, mIconBorderPen;
2737  QBrush mBrush;
2738  QFont mFont;
2739  QColor mTextColor;
2740  QSize mIconSize;
2741  int mIconTextPadding;
2742  SelectableParts mSelectedParts, mSelectableParts;
2743  QPen mSelectedBorderPen, mSelectedIconBorderPen;
2744  QBrush mSelectedBrush;
2745  QFont mSelectedFont;
2746  QColor mSelectedTextColor;
2747 
2748  // reimplemented virtual methods:
2749  virtual void parentPlotInitialized(QCustomPlot *parentPlot);
2751  virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const;
2752  virtual void draw(QCPPainter *painter);
2753  // events:
2754  virtual void selectEvent(QMouseEvent *event,
2755  bool additive,
2756  const QVariant &details,
2757  bool *selectionStateChanged);
2758  virtual void deselectEvent(bool *selectionStateChanged);
2759 
2760  // non-virtual methods:
2761  QPen getBorderPen() const;
2762  QBrush getBrush() const;
2763 
2764 private:
2765  Q_DISABLE_COPY(QCPLegend)
2766 
2767  friend class QCustomPlot;
2768  friend class QCPAbstractLegendItem;
2769 };
2770 Q_DECLARE_OPERATORS_FOR_FLAGS(QCPLegend::SelectableParts)
2772 
2774  Q_OBJECT
2776  Q_PROPERTY(QString text READ text WRITE setText)
2777  Q_PROPERTY(QFont font READ font WRITE setFont)
2778  Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor)
2779  Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont)
2780  Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE
2782  Q_PROPERTY(bool selectable READ selectable WRITE setSelectable NOTIFY
2784  Q_PROPERTY(bool selected READ selected WRITE setSelected NOTIFY
2787 public:
2788  explicit QCPPlotTitle(QCustomPlot *parentPlot);
2789  explicit QCPPlotTitle(QCustomPlot *parentPlot, const QString &text);
2790 
2791  // getters:
2792  QString text() const { return mText; }
2793  QFont font() const { return mFont; }
2794  QColor textColor() const { return mTextColor; }
2795  QFont selectedFont() const { return mSelectedFont; }
2796  QColor selectedTextColor() const { return mSelectedTextColor; }
2797  bool selectable() const { return mSelectable; }
2798  bool selected() const { return mSelected; }
2799 
2800  // setters:
2801  void setText(const QString &text);
2802  void setFont(const QFont &font);
2803  void setTextColor(const QColor &color);
2804  void setSelectedFont(const QFont &font);
2805  void setSelectedTextColor(const QColor &color);
2806  Q_SLOT void setSelectable(bool selectable);
2807  Q_SLOT void setSelected(bool selected);
2808 
2809  // reimplemented virtual methods:
2810  virtual double selectTest(const QPointF &pos,
2811  bool onlySelectable,
2812  QVariant *details = 0) const;
2813 
2814 signals:
2817 
2818 protected:
2819  // property members:
2820  QString mText;
2821  QFont mFont;
2822  QColor mTextColor;
2827 
2828  // reimplemented virtual methods:
2829  virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const;
2830  virtual void draw(QCPPainter *painter);
2831  virtual QSize minimumSizeHint() const;
2832  virtual QSize maximumSizeHint() const;
2833  // events:
2834  virtual void selectEvent(QMouseEvent *event,
2835  bool additive,
2836  const QVariant &details,
2837  bool *selectionStateChanged);
2838  virtual void deselectEvent(bool *selectionStateChanged);
2839 
2840  // non-virtual methods:
2841  QFont mainFont() const;
2842  QColor mainTextColor() const;
2843 
2844 private:
2845  Q_DISABLE_COPY(QCPPlotTitle)
2846 };
2847 
2848 class QCPColorScaleAxisRectPrivate : public QCPAxisRect {
2849  Q_OBJECT
2850 public:
2851  explicit QCPColorScaleAxisRectPrivate(QCPColorScale *parentColorScale);
2852 
2853 protected:
2854  QCPColorScale *mParentColorScale;
2855  QImage mGradientImage;
2856  bool mGradientImageInvalidated;
2857  // re-using some methods of QCPAxisRect to make them available to friend
2858  // class QCPColorScale
2863  using QCPAxisRect::update;
2865  virtual void draw(QCPPainter *painter);
2866  void updateGradientImage();
2867  Q_SLOT void axisSelectionChanged(QCPAxis::SelectableParts selectedParts);
2868  Q_SLOT void axisSelectableChanged(QCPAxis::SelectableParts selectableParts);
2869  friend class QCPColorScale;
2870 };
2871 
2873  Q_OBJECT
2875  Q_PROPERTY(QCPAxis::AxisType type READ type WRITE setType)
2876  Q_PROPERTY(QCPRange dataRange READ dataRange WRITE setDataRange NOTIFY
2877  dataRangeChanged)
2878  Q_PROPERTY(QCPAxis::ScaleType dataScaleType READ dataScaleType WRITE
2879  setDataScaleType NOTIFY dataScaleTypeChanged)
2880  Q_PROPERTY(QCPColorGradient gradient READ gradient WRITE setGradient NOTIFY
2881  gradientChanged)
2882  Q_PROPERTY(QString label READ label WRITE setLabel)
2883  Q_PROPERTY(int barWidth READ barWidth WRITE setBarWidth)
2884  Q_PROPERTY(bool rangeDrag READ rangeDrag WRITE setRangeDrag)
2885  Q_PROPERTY(bool rangeZoom READ rangeZoom WRITE setRangeZoom)
2887 public:
2888  explicit QCPColorScale(QCustomPlot *parentPlot);
2889  virtual ~QCPColorScale();
2890 
2891  // getters:
2892  QCPAxis *axis() const { return mColorAxis.data(); }
2893  QCPAxis::AxisType type() const { return mType; }
2894  QCPRange dataRange() const { return mDataRange; }
2895  QCPAxis::ScaleType dataScaleType() const { return mDataScaleType; }
2896  QCPColorGradient gradient() const { return mGradient; }
2897  QString label() const;
2898  int barWidth() const { return mBarWidth; }
2899  bool rangeDrag() const;
2900  bool rangeZoom() const;
2901 
2902  // setters:
2904  Q_SLOT void setDataRange(const QCPRange &dataRange);
2905  Q_SLOT void setDataScaleType(QCPAxis::ScaleType scaleType);
2906  Q_SLOT void setGradient(const QCPColorGradient &gradient);
2907  void setLabel(const QString &str);
2908  void setBarWidth(int width);
2909  void setRangeDrag(bool enabled);
2910  void setRangeZoom(bool enabled);
2911 
2912  // non-property methods:
2913  QList<QCPColorMap *> colorMaps() const;
2914  void rescaleDataRange(bool onlyVisibleMaps);
2915 
2916  // reimplemented virtual methods:
2917  virtual void update(UpdatePhase phase);
2918 
2919 signals:
2920  void dataRangeChanged(QCPRange newRange);
2923 
2924 protected:
2925  // property members:
2926  QCPAxis::AxisType mType;
2927  QCPRange mDataRange;
2928  QCPAxis::ScaleType mDataScaleType;
2929  QCPColorGradient mGradient;
2930  int mBarWidth;
2931 
2932  // non-property members:
2933  QPointer<QCPColorScaleAxisRectPrivate> mAxisRect;
2934  QPointer<QCPAxis> mColorAxis;
2935 
2936  // reimplemented virtual methods:
2937  virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const;
2938  // events:
2939  virtual void mousePressEvent(QMouseEvent *event);
2940  virtual void mouseMoveEvent(QMouseEvent *event);
2941  virtual void mouseReleaseEvent(QMouseEvent *event);
2942  virtual void wheelEvent(QWheelEvent *event);
2943 
2944 private:
2945  Q_DISABLE_COPY(QCPColorScale)
2946 
2947  friend class QCPColorScaleAxisRectPrivate;
2948 };
2949 
2953 public:
2954  QCPData();
2955  QCPData(double key, double value);
2956  double key, value;
2957  double keyErrorPlus, keyErrorMinus;
2958  double valueErrorPlus, valueErrorMinus;
2959 };
2960 Q_DECLARE_TYPEINFO(QCPData, Q_MOVABLE_TYPE);
2961 
2969 typedef QMap<double, QCPData> QCPDataMap;
2970 typedef QMapIterator<double, QCPData> QCPDataMapIterator;
2971 typedef QMutableMapIterator<double, QCPData> QCPDataMutableMapIterator;
2972 
2974  Q_OBJECT
2976  Q_PROPERTY(LineStyle lineStyle READ lineStyle WRITE setLineStyle)
2977  Q_PROPERTY(QCPScatterStyle scatterStyle READ scatterStyle WRITE
2978  setScatterStyle)
2979  Q_PROPERTY(ErrorType errorType READ errorType WRITE setErrorType)
2980  Q_PROPERTY(QPen errorPen READ errorPen WRITE setErrorPen)
2981  Q_PROPERTY(double errorBarSize READ errorBarSize WRITE setErrorBarSize)
2982  Q_PROPERTY(bool errorBarSkipSymbol READ errorBarSkipSymbol WRITE
2983  setErrorBarSkipSymbol)
2984  Q_PROPERTY(QCPGraph *channelFillGraph READ channelFillGraph WRITE
2985  setChannelFillGraph)
2986  Q_PROPERTY(bool adaptiveSampling READ adaptiveSampling WRITE
2987  setAdaptiveSampling)
2989 public:
2994  enum LineStyle {
2995  lsNone
2998  ,
2999  lsLine
3000  ,
3001  lsStepLeft
3003  ,
3004  lsStepRight
3006  ,
3007  lsStepCenter
3009  ,
3010  lsImpulse
3013  };
3014  Q_ENUMS(LineStyle)
3018  enum ErrorType {
3019  etNone
3020  ,
3021  etKey
3022  ,
3023  etValue
3025  ,
3026  etBoth
3028  };
3029  Q_ENUMS(ErrorType)
3030 
3031  explicit QCPGraph(QCPAxis *keyAxis, QCPAxis *valueAxis);
3032  virtual ~QCPGraph();
3033 
3034  // getters:
3035  QCPDataMap *data() const { return mData; }
3036  LineStyle lineStyle() const { return mLineStyle; }
3037  QCPScatterStyle scatterStyle() const { return mScatterStyle; }
3038  ErrorType errorType() const { return mErrorType; }
3039  QPen errorPen() const { return mErrorPen; }
3040  double errorBarSize() const { return mErrorBarSize; }
3041  bool errorBarSkipSymbol() const { return mErrorBarSkipSymbol; }
3042  QCPGraph *channelFillGraph() const { return mChannelFillGraph.data(); }
3043  bool adaptiveSampling() const { return mAdaptiveSampling; }
3044 
3045  // setters:
3046  void setData(QCPDataMap *data, bool copy = false);
3047  void setData(const QVector<double> &key, const QVector<double> &value);
3048  void setDataKeyError(const QVector<double> &key,
3049  const QVector<double> &value,
3050  const QVector<double> &keyError);
3051  void setDataKeyError(const QVector<double> &key,
3052  const QVector<double> &value,
3053  const QVector<double> &keyErrorMinus,
3054  const QVector<double> &keyErrorPlus);
3055  void setDataValueError(const QVector<double> &key,
3056  const QVector<double> &value,
3057  const QVector<double> &valueError);
3058  void setDataValueError(const QVector<double> &key,
3059  const QVector<double> &value,
3060  const QVector<double> &valueErrorMinus,
3061  const QVector<double> &valueErrorPlus);
3062  void setDataBothError(const QVector<double> &key,
3063  const QVector<double> &value,
3064  const QVector<double> &keyError,
3065  const QVector<double> &valueError);
3066  void setDataBothError(const QVector<double> &key,
3067  const QVector<double> &value,
3068  const QVector<double> &keyErrorMinus,
3069  const QVector<double> &keyErrorPlus,
3070  const QVector<double> &valueErrorMinus,
3071  const QVector<double> &valueErrorPlus);
3073  void setScatterStyle(const QCPScatterStyle &style);
3074  void setErrorType(ErrorType errorType);
3075  void setErrorPen(const QPen &pen);
3076  void setErrorBarSize(double size);
3077  void setErrorBarSkipSymbol(bool enabled);
3078  void setChannelFillGraph(QCPGraph *targetGraph);
3079  void setAdaptiveSampling(bool enabled);
3080 
3081  // non-property methods:
3082  void addData(const QCPDataMap &dataMap);
3083  void addData(const QCPData &data);
3084  void addData(double key, double value);
3085  void addData(const QVector<double> &keys, const QVector<double> &values);
3086  void removeDataBefore(double key);
3087  void removeDataAfter(double key);
3088  void removeData(double fromKey, double toKey);
3089  void removeData(double key);
3090 
3091  // reimplemented virtual methods:
3092  virtual void clearData();
3093  virtual double selectTest(const QPointF &pos,
3094  bool onlySelectable,
3095  QVariant *details = 0) const;
3099  void rescaleAxes(bool onlyEnlarge, bool includeErrorBars)
3100  const; // overloads base class interface
3101  void rescaleKeyAxis(bool onlyEnlarge, bool includeErrorBars)
3102  const; // overloads base class interface
3103  void rescaleValueAxis(bool onlyEnlarge, bool includeErrorBars)
3104  const; // overloads base class interface
3105 
3106 protected:
3107  // property members:
3110  LineStyle mLineStyle;
3111  QCPScatterStyle mScatterStyle;
3115  QPointer<QCPGraph> mChannelFillGraph;
3116  bool mAdaptiveSampling;
3117 
3118  // reimplemented virtual methods:
3119  virtual void draw(QCPPainter *painter);
3120  virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const;
3121  virtual QCPRange getKeyRange(bool &foundRange,
3122  SignDomain inSignDomain = sdBoth) const;
3123  virtual QCPRange getValueRange(bool &foundRange,
3124  SignDomain inSignDomain = sdBoth) const;
3125  virtual QCPRange getKeyRange(
3126  bool &foundRange,
3127  SignDomain inSignDomain,
3128  bool includeErrors) const; // overloads base class interface
3129  virtual QCPRange getValueRange(
3130  bool &foundRange,
3131  SignDomain inSignDomain,
3132  bool includeErrors) const; // overloads base class interface
3133 
3134  // introduced virtual methods:
3135  virtual void drawFill(QCPPainter *painter,
3136  QVector<QPointF> *lineData) const;
3137  virtual void drawScatterPlot(QCPPainter *painter,
3138  QVector<QCPData> *scatterData) const;
3139  virtual void drawLinePlot(QCPPainter *painter,
3140  QVector<QPointF> *lineData) const;
3141  virtual void drawImpulsePlot(QCPPainter *painter,
3142  QVector<QPointF> *lineData) const;
3143 
3144  // non-virtual methods:
3145  void getPreparedData(QVector<QCPData> *lineData,
3146  QVector<QCPData> *scatterData) const;
3147  void getPlotData(QVector<QPointF> *lineData,
3148  QVector<QCPData> *scatterData) const;
3149  void getScatterPlotData(QVector<QCPData> *scatterData) const;
3150  void getLinePlotData(QVector<QPointF> *linePixelData,
3151  QVector<QCPData> *scatterData) const;
3152  void getStepLeftPlotData(QVector<QPointF> *linePixelData,
3153  QVector<QCPData> *scatterData) const;
3154  void getStepRightPlotData(QVector<QPointF> *linePixelData,
3155  QVector<QCPData> *scatterData) const;
3156  void getStepCenterPlotData(QVector<QPointF> *linePixelData,
3157  QVector<QCPData> *scatterData) const;
3158  void getImpulsePlotData(QVector<QPointF> *linePixelData,
3159  QVector<QCPData> *scatterData) const;
3160  void drawError(QCPPainter *painter,
3161  double x,
3162  double y,
3163  const QCPData &data) const;
3164  void getVisibleDataBounds(QCPDataMap::const_iterator &lower,
3165  QCPDataMap::const_iterator &upper) const;
3166  int countDataInBounds(const QCPDataMap::const_iterator &lower,
3167  const QCPDataMap::const_iterator &upper,
3168  int maxCount) const;
3169  void addFillBasePoints(QVector<QPointF> *lineData) const;
3170  void removeFillBasePoints(QVector<QPointF> *lineData) const;
3171  QPointF lowerFillBasePoint(double lowerKey) const;
3172  QPointF upperFillBasePoint(double upperKey) const;
3173  const QPolygonF getChannelFillPolygon(
3174  const QVector<QPointF> *lineData) const;
3175  int findIndexBelowX(const QVector<QPointF> *data, double x) const;
3176  int findIndexAboveX(const QVector<QPointF> *data, double x) const;
3177  int findIndexBelowY(const QVector<QPointF> *data, double y) const;
3178  int findIndexAboveY(const QVector<QPointF> *data, double y) const;
3179  double pointDistance(const QPointF &pixelPoint) const;
3180 
3181  friend class QCustomPlot;
3182  friend class QCPLegend;
3183 };
3184 
3187 class QCP_LIB_DECL QCPCurveData {
3188 public:
3190  QCPCurveData(double t, double key, double value);
3191  double t, key, value;
3192 };
3194 
3203 typedef QMap<double, QCPCurveData> QCPCurveDataMap;
3204 typedef QMapIterator<double, QCPCurveData> QCPCurveDataMapIterator;
3205 typedef QMutableMapIterator<double, QCPCurveData>
3207 
3209  Q_OBJECT
3211  Q_PROPERTY(QCPScatterStyle scatterStyle READ scatterStyle WRITE
3212  setScatterStyle)
3213  Q_PROPERTY(LineStyle lineStyle READ lineStyle WRITE setLineStyle)
3215 public:
3220  enum LineStyle {
3221  lsNone
3222  ,
3223  lsLine
3224  };
3225  explicit QCPCurve(QCPAxis *keyAxis, QCPAxis *valueAxis);
3226  virtual ~QCPCurve();
3227 
3228  // getters:
3229  QCPCurveDataMap *data() const { return mData; }
3230  QCPScatterStyle scatterStyle() const { return mScatterStyle; }
3231  LineStyle lineStyle() const { return mLineStyle; }
3232 
3233  // setters:
3234  void setData(QCPCurveDataMap *data, bool copy = false);
3235  void setData(const QVector<double> &t,
3236  const QVector<double> &key,
3237  const QVector<double> &value);
3238  void setData(const QVector<double> &key, const QVector<double> &value);
3239  void setScatterStyle(const QCPScatterStyle &style);
3241 
3242  // non-property methods:
3243  void addData(const QCPCurveDataMap &dataMap);
3244  void addData(const QCPCurveData &data);
3245  void addData(double t, double key, double value);
3246  void addData(double key, double value);
3247  void addData(const QVector<double> &ts,
3248  const QVector<double> &keys,
3249  const QVector<double> &values);
3250  void removeDataBefore(double t);
3251  void removeDataAfter(double t);
3252  void removeData(double fromt, double tot);
3253  void removeData(double t);
3254 
3255  // reimplemented virtual methods:
3256  virtual void clearData();
3257  virtual double selectTest(const QPointF &pos,
3258  bool onlySelectable,
3259  QVariant *details = 0) const;
3260 
3261 protected:
3262  // property members:
3264  QCPScatterStyle mScatterStyle;
3265  LineStyle mLineStyle;
3266 
3267  // reimplemented virtual methods:
3268  virtual void draw(QCPPainter *painter);
3269  virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const;
3270  virtual QCPRange getKeyRange(bool &foundRange,
3271  SignDomain inSignDomain = sdBoth) const;
3272  virtual QCPRange getValueRange(bool &foundRange,
3273  SignDomain inSignDomain = sdBoth) const;
3274 
3275  // introduced virtual methods:
3276  virtual void drawScatterPlot(QCPPainter *painter,
3277  const QVector<QPointF> *pointData) const;
3278 
3279  // non-virtual methods:
3280  void getCurveData(QVector<QPointF> *lineData) const;
3281  int getRegion(double x,
3282  double y,
3283  double rectLeft,
3284  double rectTop,
3285  double rectRight,
3286  double rectBottom) const;
3287  QPointF getOptimizedPoint(int prevRegion,
3288  double prevKey,
3289  double prevValue,
3290  double key,
3291  double value,
3292  double rectLeft,
3293  double rectTop,
3294  double rectRight,
3295  double rectBottom) const;
3296  QVector<QPointF> getOptimizedCornerPoints(int prevRegion,
3297  int currentRegion,
3298  double prevKey,
3299  double prevValue,
3300  double key,
3301  double value,
3302  double rectLeft,
3303  double rectTop,
3304  double rectRight,
3305  double rectBottom) const;
3306  bool mayTraverse(int prevRegion, int currentRegion) const;
3307  bool getTraverse(double prevKey,
3308  double prevValue,
3309  double key,
3310  double value,
3311  double rectLeft,
3312  double rectTop,
3313  double rectRight,
3314  double rectBottom,
3315  QPointF &crossA,
3316  QPointF &crossB) const;
3317  void getTraverseCornerPoints(int prevRegion,
3318  int currentRegion,
3319  double rectLeft,
3320  double rectTop,
3321  double rectRight,
3322  double rectBottom,
3323  QVector<QPointF> &beforeTraverse,
3324  QVector<QPointF> &afterTraverse) const;
3325  double pointDistance(const QPointF &pixelPoint) const;
3326 
3327  friend class QCustomPlot;
3328  friend class QCPLegend;
3329 };
3330 
3333 class QCP_LIB_DECL QCPBarsGroup : public QObject {
3334  Q_OBJECT
3336  Q_PROPERTY(SpacingType spacingType READ spacingType WRITE setSpacingType)
3337  Q_PROPERTY(double spacing READ spacing WRITE setSpacing)
3339 public:
3347  stAbsolute
3348  ,
3349  stAxisRectRatio
3351  ,
3352  stPlotCoords
3354  };
3357 
3358  // getters:
3359  SpacingType spacingType() const { return mSpacingType; }
3360  double spacing() const { return mSpacing; }
3361 
3362  // setters:
3363  void setSpacingType(SpacingType spacingType);
3364  void setSpacing(double spacing);
3365 
3366  // non-virtual methods:
3367  QList<QCPBars *> bars() const { return mBars; }
3368  QCPBars *bars(int index) const;
3369  int size() const { return mBars.size(); }
3370  bool isEmpty() const { return mBars.isEmpty(); }
3371  void clear();
3372  bool contains(QCPBars *bars) const { return mBars.contains(bars); }
3373  void append(QCPBars *bars);
3374  void insert(int i, QCPBars *bars);
3375  void remove(QCPBars *bars);
3376 
3377 protected:
3378  // non-property members:
3379  QCustomPlot *mParentPlot;
3380  SpacingType mSpacingType;
3381  double mSpacing;
3382  QList<QCPBars *> mBars;
3383 
3384  // non-virtual methods:
3385  void registerBars(QCPBars *bars);
3387 
3388  // virtual methods:
3389  double keyPixelOffset(const QCPBars *bars, double keyCoord);
3390  double getPixelSpacing(const QCPBars *bars, double keyCoord);
3391 
3392 private:
3393  Q_DISABLE_COPY(QCPBarsGroup)
3394 
3395  friend class QCPBars;
3396 };
3397 
3399 public:
3400  QCPBarData();
3401  QCPBarData(double key, double value);
3402  double key, value;
3403 };
3405 
3413 typedef QMap<double, QCPBarData> QCPBarDataMap;
3414 typedef QMapIterator<double, QCPBarData> QCPBarDataMapIterator;
3415 typedef QMutableMapIterator<double, QCPBarData> QCPBarDataMutableMapIterator;
3416 
3417 class QCP_LIB_DECL QCPBars : public QCPAbstractPlottable {
3418  Q_OBJECT
3420  Q_PROPERTY(double width READ width WRITE setWidth)
3421  Q_PROPERTY(WidthType widthType READ widthType WRITE setWidthType)
3422  Q_PROPERTY(QCPBarsGroup *barsGroup READ barsGroup WRITE setBarsGroup)
3423  Q_PROPERTY(double baseValue READ baseValue WRITE setBaseValue)
3424  Q_PROPERTY(QCPBars *barBelow READ barBelow)
3425  Q_PROPERTY(QCPBars *barAbove READ barAbove)
3427 public:
3434  enum WidthType {
3435  wtAbsolute
3436  ,
3437  wtAxisRectRatio
3439  ,
3440  wtPlotCoords
3442  };
3443  Q_ENUMS(WidthType)
3444 
3445  explicit QCPBars(QCPAxis *keyAxis, QCPAxis *valueAxis);
3446  virtual ~QCPBars();
3447 
3448  // getters:
3449  double width() const { return mWidth; }
3450  WidthType widthType() const { return mWidthType; }
3451  QCPBarsGroup *barsGroup() const { return mBarsGroup; }
3452  double baseValue() const { return mBaseValue; }
3453  QCPBars *barBelow() const { return mBarBelow.data(); }
3454  QCPBars *barAbove() const { return mBarAbove.data(); }
3455  QCPBarDataMap *data() const { return mData; }
3456 
3457  // setters:
3458  void setWidth(double width);
3459  void setWidthType(WidthType widthType);
3460  void setBarsGroup(QCPBarsGroup *barsGroup);
3461  void setBaseValue(double baseValue);
3462  void setData(QCPBarDataMap *data, bool copy = false);
3463  void setData(const QVector<double> &key, const QVector<double> &value);
3464 
3465  // non-property methods:
3466  void moveBelow(QCPBars *bars);
3467  void moveAbove(QCPBars *bars);
3468  void addData(const QCPBarDataMap &dataMap);
3469  void addData(const QCPBarData &data);
3470  void addData(double key, double value);
3471  void addData(const QVector<double> &keys, const QVector<double> &values);
3472  void removeDataBefore(double key);
3473  void removeDataAfter(double key);
3474  void removeData(double fromKey, double toKey);
3475  void removeData(double key);
3476 
3477  // reimplemented virtual methods:
3478  virtual void clearData();
3479  virtual double selectTest(const QPointF &pos,
3480  bool onlySelectable,
3481  QVariant *details = 0) const;
3482 
3483 protected:
3484  // property members:
3486  double mWidth;
3487  WidthType mWidthType;
3488  QCPBarsGroup *mBarsGroup;
3489  double mBaseValue;
3490  QPointer<QCPBars> mBarBelow, mBarAbove;
3491 
3492  // reimplemented virtual methods:
3493  virtual void draw(QCPPainter *painter);
3494  virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const;
3495  virtual QCPRange getKeyRange(bool &foundRange,
3496  SignDomain inSignDomain = sdBoth) const;
3497  virtual QCPRange getValueRange(bool &foundRange,
3498  SignDomain inSignDomain = sdBoth) const;
3499 
3500  // non-virtual methods:
3501  void getVisibleDataBounds(QCPBarDataMap::const_iterator &lower,
3502  QCPBarDataMap::const_iterator &upperEnd) const;
3503  QPolygonF getBarPolygon(double key, double value) const;
3504  void getPixelWidth(double key, double &lower, double &upper) const;
3505  double getStackedBaseValue(double key, bool positive) const;
3506  static void connectBars(QCPBars *lower, QCPBars *upper);
3507 
3508  friend class QCustomPlot;
3509  friend class QCPLegend;
3510  friend class QCPBarsGroup;
3511 };
3512 
3516  Q_OBJECT
3518  Q_PROPERTY(double key READ key WRITE setKey)
3519  Q_PROPERTY(double minimum READ minimum WRITE setMinimum)
3520  Q_PROPERTY(double lowerQuartile READ lowerQuartile WRITE setLowerQuartile)
3521  Q_PROPERTY(double median READ median WRITE setMedian)
3522  Q_PROPERTY(double upperQuartile READ upperQuartile WRITE setUpperQuartile)
3523  Q_PROPERTY(double maximum READ maximum WRITE setMaximum)
3524  Q_PROPERTY(QVector<double> outliers READ outliers WRITE setOutliers)
3525  Q_PROPERTY(double width READ width WRITE setWidth)
3526  Q_PROPERTY(double whiskerWidth READ whiskerWidth WRITE setWhiskerWidth)
3527  Q_PROPERTY(QPen whiskerPen READ whiskerPen WRITE setWhiskerPen)
3528  Q_PROPERTY(QPen whiskerBarPen READ whiskerBarPen WRITE setWhiskerBarPen)
3529  Q_PROPERTY(QPen medianPen READ medianPen WRITE setMedianPen)
3530  Q_PROPERTY(QCPScatterStyle outlierStyle READ outlierStyle WRITE
3531  setOutlierStyle)
3533 public:
3534  explicit QCPStatisticalBox(QCPAxis *keyAxis, QCPAxis *valueAxis);
3535 
3536  // getters:
3537  double key() const { return mKey; }
3538  double minimum() const { return mMinimum; }
3539  double lowerQuartile() const { return mLowerQuartile; }
3540  double median() const { return mMedian; }
3541  double upperQuartile() const { return mUpperQuartile; }
3542  double maximum() const { return mMaximum; }
3543  QVector<double> outliers() const { return mOutliers; }
3544  double width() const { return mWidth; }
3545  double whiskerWidth() const { return mWhiskerWidth; }
3546  QPen whiskerPen() const { return mWhiskerPen; }
3547  QPen whiskerBarPen() const { return mWhiskerBarPen; }
3548  QPen medianPen() const { return mMedianPen; }
3549  QCPScatterStyle outlierStyle() const { return mOutlierStyle; }
3550 
3551  // setters:
3552  void setKey(double key);
3553  void setMinimum(double value);
3554  void setLowerQuartile(double value);
3555  void setMedian(double value);
3556  void setUpperQuartile(double value);
3557  void setMaximum(double value);
3558  void setOutliers(const QVector<double> &values);
3559  void setData(double key,
3560  double minimum,
3561  double lowerQuartile,
3562  double median,
3563  double upperQuartile,
3564  double maximum);
3565  void setWidth(double width);
3566  void setWhiskerWidth(double width);
3567  void setWhiskerPen(const QPen &pen);
3568  void setWhiskerBarPen(const QPen &pen);
3569  void setMedianPen(const QPen &pen);
3570  void setOutlierStyle(const QCPScatterStyle &style);
3571 
3572  // non-property methods:
3573  virtual void clearData();
3574  virtual double selectTest(const QPointF &pos,
3575  bool onlySelectable,
3576  QVariant *details = 0) const;
3577 
3578 protected:
3579  // property members:
3580  QVector<double> mOutliers;
3581  double mKey, mMinimum, mLowerQuartile, mMedian, mUpperQuartile, mMaximum;
3582  double mWidth;
3583  double mWhiskerWidth;
3584  QPen mWhiskerPen, mWhiskerBarPen, mMedianPen;
3585  QCPScatterStyle mOutlierStyle;
3586 
3587  // reimplemented virtual methods:
3588  virtual void draw(QCPPainter *painter);
3589  virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const;
3590  virtual QCPRange getKeyRange(bool &foundRange,
3591  SignDomain inSignDomain = sdBoth) const;
3592  virtual QCPRange getValueRange(bool &foundRange,
3593  SignDomain inSignDomain = sdBoth) const;
3594 
3595  // introduced virtual methods:
3596  virtual void drawQuartileBox(QCPPainter *painter,
3597  QRectF *quartileBox = 0) const;
3598  virtual void drawMedian(QCPPainter *painter) const;
3599  virtual void drawWhiskers(QCPPainter *painter) const;
3600  virtual void drawOutliers(QCPPainter *painter) const;
3601 
3602  friend class QCustomPlot;
3603  friend class QCPLegend;
3604 };
3605 
3607 public:
3608  QCPColorMapData(int keySize,
3609  int valueSize,
3610  const QCPRange &keyRange,
3611  const QCPRange &valueRange);
3615 
3616  // getters:
3617  int keySize() const { return mKeySize; }
3618  int valueSize() const { return mValueSize; }
3619  QCPRange keyRange() const { return mKeyRange; }
3620  QCPRange valueRange() const { return mValueRange; }
3621  QCPRange dataBounds() const { return mDataBounds; }
3622  double data(double key, double value);
3623  double cell(int keyIndex, int valueIndex);
3624 
3625  // setters:
3626  void setSize(int keySize, int valueSize);
3627  void setKeySize(int keySize);
3628  void setValueSize(int valueSize);
3629  void setRange(const QCPRange &keyRange, const QCPRange &valueRange);
3630  void setKeyRange(const QCPRange &keyRange);
3631  void setValueRange(const QCPRange &valueRange);
3632  void setData(double key, double value, double z);
3633  void setCell(int keyIndex, int valueIndex, double z);
3634 
3635  // non-property methods:
3637  void clear();
3638  void fill(double z);
3639  bool isEmpty() const { return mIsEmpty; }
3640  void coordToCell(double key,
3641  double value,
3642  int *keyIndex,
3643  int *valueIndex) const;
3644  void cellToCoord(int keyIndex,
3645  int valueIndex,
3646  double *key,
3647  double *value) const;
3648 
3649 protected:
3650  // property members:
3651  int mKeySize, mValueSize;
3652  QCPRange mKeyRange, mValueRange;
3653  bool mIsEmpty;
3654  // non-property members:
3655  double *mData;
3656  QCPRange mDataBounds;
3657  bool mDataModified;
3658 
3659  friend class QCPColorMap;
3660 };
3661 
3663  Q_OBJECT
3665  Q_PROPERTY(QCPRange dataRange READ dataRange WRITE setDataRange NOTIFY
3666  dataRangeChanged)
3667  Q_PROPERTY(QCPAxis::ScaleType dataScaleType READ dataScaleType WRITE
3668  setDataScaleType NOTIFY dataScaleTypeChanged)
3669  Q_PROPERTY(QCPColorGradient gradient READ gradient WRITE setGradient NOTIFY
3670  gradientChanged)
3671  Q_PROPERTY(bool interpolate READ interpolate WRITE setInterpolate)
3672  Q_PROPERTY(bool tightBoundary READ tightBoundary WRITE setTightBoundary)
3673  Q_PROPERTY(QCPColorScale *colorScale READ colorScale WRITE setColorScale)
3675 public:
3676  explicit QCPColorMap(QCPAxis *keyAxis, QCPAxis *valueAxis);
3677  virtual ~QCPColorMap();
3678 
3679  // getters:
3680  QCPColorMapData *data() const { return mMapData; }
3681  QCPRange dataRange() const { return mDataRange; }
3682  QCPAxis::ScaleType dataScaleType() const { return mDataScaleType; }
3683  bool interpolate() const { return mInterpolate; }
3684  bool tightBoundary() const { return mTightBoundary; }
3685  QCPColorGradient gradient() const { return mGradient; }
3686  QCPColorScale *colorScale() const { return mColorScale.data(); }
3687 
3688  // setters:
3689  void setData(QCPColorMapData *data, bool copy = false);
3690  Q_SLOT void setDataRange(const QCPRange &dataRange);
3691  Q_SLOT void setDataScaleType(QCPAxis::ScaleType scaleType);
3692  Q_SLOT void setGradient(const QCPColorGradient &gradient);
3693  void setInterpolate(bool enabled);
3694  void setTightBoundary(bool enabled);
3695  void setColorScale(QCPColorScale *colorScale);
3696 
3697  // non-property methods:
3698  void rescaleDataRange(bool recalculateDataBounds = false);
3699  Q_SLOT void updateLegendIcon(
3700  Qt::TransformationMode transformMode = Qt::SmoothTransformation,
3701  const QSize &thumbSize = QSize(32, 18));
3702 
3703  // reimplemented virtual methods:
3704  virtual void clearData();
3705  virtual double selectTest(const QPointF &pos,
3706  bool onlySelectable,
3707  QVariant *details = 0) const;
3708 
3709 signals:
3710  void dataRangeChanged(QCPRange newRange);
3713 
3714 protected:
3715  // property members:
3716  QCPRange mDataRange;
3717  QCPAxis::ScaleType mDataScaleType;
3718  QCPColorMapData *mMapData;
3719  QCPColorGradient mGradient;
3720  bool mInterpolate;
3721  bool mTightBoundary;
3722  QPointer<QCPColorScale> mColorScale;
3723  // non-property members:
3724  QImage mMapImage, mUndersampledMapImage;
3725  QPixmap mLegendIcon;
3726  bool mMapImageInvalidated;
3727 
3728  // introduced virtual methods:
3729  virtual void updateMapImage();
3730 
3731  // reimplemented virtual methods:
3732  virtual void draw(QCPPainter *painter);
3733  virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const;
3734  virtual QCPRange getKeyRange(bool &foundRange,
3735  SignDomain inSignDomain = sdBoth) const;
3736  virtual QCPRange getValueRange(bool &foundRange,
3737  SignDomain inSignDomain = sdBoth) const;
3738 
3739  friend class QCustomPlot;
3740  friend class QCPLegend;
3741 };
3742 
3746 public:
3749  double key, double open, double high, double low, double close);
3750  double key, open, high, low, close;
3751 };
3753 
3761 typedef QMap<double, QCPFinancialData> QCPFinancialDataMap;
3762 typedef QMapIterator<double, QCPFinancialData> QCPFinancialDataMapIterator;
3763 typedef QMutableMapIterator<double, QCPFinancialData>
3765 
3767  Q_OBJECT
3769  Q_PROPERTY(ChartStyle chartStyle READ chartStyle WRITE setChartStyle)
3770  Q_PROPERTY(double width READ width WRITE setWidth)
3771  Q_PROPERTY(bool twoColored READ twoColored WRITE setTwoColored)
3772  Q_PROPERTY(QBrush brushPositive READ brushPositive WRITE setBrushPositive)
3773  Q_PROPERTY(QBrush brushNegative READ brushNegative WRITE setBrushNegative)
3774  Q_PROPERTY(QPen penPositive READ penPositive WRITE setPenPositive)
3775  Q_PROPERTY(QPen penNegative READ penNegative WRITE setPenNegative)
3777 public:
3783  enum ChartStyle {
3784  csOhlc
3785  ,
3786  csCandlestick
3787  };
3788  Q_ENUMS(ChartStyle)
3789 
3790  explicit QCPFinancial(QCPAxis *keyAxis, QCPAxis *valueAxis);
3791  virtual ~QCPFinancial();
3792 
3793  // getters:
3794  QCPFinancialDataMap *data() const { return mData; }
3795  ChartStyle chartStyle() const { return mChartStyle; }
3796  double width() const { return mWidth; }
3797  bool twoColored() const { return mTwoColored; }
3798  QBrush brushPositive() const { return mBrushPositive; }
3799  QBrush brushNegative() const { return mBrushNegative; }
3800  QPen penPositive() const { return mPenPositive; }
3801  QPen penNegative() const { return mPenNegative; }
3802 
3803  // setters:
3804  void setData(QCPFinancialDataMap *data, bool copy = false);
3805  void setData(const QVector<double> &key,
3806  const QVector<double> &open,
3807  const QVector<double> &high,
3808  const QVector<double> &low,
3809  const QVector<double> &close);
3811  void setWidth(double width);
3812  void setTwoColored(bool twoColored);
3813  void setBrushPositive(const QBrush &brush);
3814  void setBrushNegative(const QBrush &brush);
3815  void setPenPositive(const QPen &pen);
3816  void setPenNegative(const QPen &pen);
3817 
3818  // non-property methods:
3819  void addData(const QCPFinancialDataMap &dataMap);
3820  void addData(const QCPFinancialData &data);
3821  void addData(
3822  double key, double open, double high, double low, double close);
3823  void addData(const QVector<double> &key,
3824  const QVector<double> &open,
3825  const QVector<double> &high,
3826  const QVector<double> &low,
3827  const QVector<double> &close);
3828  void removeDataBefore(double key);
3829  void removeDataAfter(double key);
3830  void removeData(double fromKey, double toKey);
3831  void removeData(double key);
3832 
3833  // reimplemented virtual methods:
3834  virtual void clearData();
3835  virtual double selectTest(const QPointF &pos,
3836  bool onlySelectable,
3837  QVariant *details = 0) const;
3838 
3839  // static methods:
3840  static QCPFinancialDataMap timeSeriesToOhlc(const QVector<double> &time,
3841  const QVector<double> &value,
3842  double timeBinSize,
3843  double timeBinOffset = 0);
3844 
3845 protected:
3846  // property members:
3848  ChartStyle mChartStyle;
3849  double mWidth;
3850  bool mTwoColored;
3851  QBrush mBrushPositive, mBrushNegative;
3852  QPen mPenPositive, mPenNegative;
3853 
3854  // reimplemented virtual methods:
3855  virtual void draw(QCPPainter *painter);
3856  virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const;
3857  virtual QCPRange getKeyRange(bool &foundRange,
3858  SignDomain inSignDomain = sdBoth) const;
3859  virtual QCPRange getValueRange(bool &foundRange,
3860  SignDomain inSignDomain = sdBoth) const;
3861 
3862  // non-virtual methods:
3863  void drawOhlcPlot(QCPPainter *painter,
3864  const QCPFinancialDataMap::const_iterator &begin,
3865  const QCPFinancialDataMap::const_iterator &end);
3866  void drawCandlestickPlot(QCPPainter *painter,
3867  const QCPFinancialDataMap::const_iterator &begin,
3868  const QCPFinancialDataMap::const_iterator &end);
3869  double ohlcSelectTest(const QPointF &pos,
3870  const QCPFinancialDataMap::const_iterator &begin,
3871  const QCPFinancialDataMap::const_iterator &end) const;
3872  double candlestickSelectTest(
3873  const QPointF &pos,
3874  const QCPFinancialDataMap::const_iterator &begin,
3875  const QCPFinancialDataMap::const_iterator &end) const;
3876  void getVisibleDataBounds(QCPFinancialDataMap::const_iterator &lower,
3877  QCPFinancialDataMap::const_iterator &upper) const;
3878 
3879  friend class QCustomPlot;
3880  friend class QCPLegend;
3881 };
3882 
3884  Q_OBJECT
3886  Q_PROPERTY(QPen pen READ pen WRITE setPen)
3887  Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
3889 public:
3892 
3893  // getters:
3894  QPen pen() const { return mPen; }
3895  QPen selectedPen() const { return mSelectedPen; }
3896 
3897  // setters;
3898  void setPen(const QPen &pen);
3899  void setSelectedPen(const QPen &pen);
3900 
3901  // reimplemented virtual methods:
3902  virtual double selectTest(const QPointF &pos,
3903  bool onlySelectable,
3904  QVariant *details = 0) const;
3905 
3906  QCPItemPosition *const point1;
3907  QCPItemPosition *const point2;
3908 
3909 protected:
3910  // property members:
3911  QPen mPen, mSelectedPen;
3912 
3913  // reimplemented virtual methods:
3914  virtual void draw(QCPPainter *painter);
3915 
3916  // non-virtual methods:
3917  double distToStraightLine(const QVector2D &point1,
3918  const QVector2D &vec,
3919  const QVector2D &point) const;
3920  QLineF getRectClippedStraightLine(const QVector2D &point1,
3921  const QVector2D &vec,
3922  const QRect &rect) const;
3923  QPen mainPen() const;
3924 };
3925 
3926 class QCP_LIB_DECL QCPItemLine : public QCPAbstractItem {
3927  Q_OBJECT
3929  Q_PROPERTY(QPen pen READ pen WRITE setPen)
3930  Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
3931  Q_PROPERTY(QCPLineEnding head READ head WRITE setHead)
3932  Q_PROPERTY(QCPLineEnding tail READ tail WRITE setTail)
3934 public:
3935  QCPItemLine(QCustomPlot *parentPlot);
3936  virtual ~QCPItemLine();
3937 
3938  // getters:
3939  QPen pen() const { return mPen; }
3940  QPen selectedPen() const { return mSelectedPen; }
3941  QCPLineEnding head() const { return mHead; }
3942  QCPLineEnding tail() const { return mTail; }
3943 
3944  // setters;
3945  void setPen(const QPen &pen);
3946  void setSelectedPen(const QPen &pen);
3947  void setHead(const QCPLineEnding &head);
3948  void setTail(const QCPLineEnding &tail);
3949 
3950  // reimplemented virtual methods:
3951  virtual double selectTest(const QPointF &pos,
3952  bool onlySelectable,
3953  QVariant *details = 0) const;
3954 
3955  QCPItemPosition *const start;
3956  QCPItemPosition *const end;
3957 
3958 protected:
3959  // property members:
3960  QPen mPen, mSelectedPen;
3961  QCPLineEnding mHead, mTail;
3962 
3963  // reimplemented virtual methods:
3964  virtual void draw(QCPPainter *painter);
3965 
3966  // non-virtual methods:
3967  QLineF getRectClippedLine(const QVector2D &start,
3968  const QVector2D &end,
3969  const QRect &rect) const;
3970  QPen mainPen() const;
3971 };
3972 
3973 class QCP_LIB_DECL QCPItemCurve : public QCPAbstractItem {
3974  Q_OBJECT
3976  Q_PROPERTY(QPen pen READ pen WRITE setPen)
3977  Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
3978  Q_PROPERTY(QCPLineEnding head READ head WRITE setHead)
3979  Q_PROPERTY(QCPLineEnding tail READ tail WRITE setTail)
3981 public:
3983  virtual ~QCPItemCurve();
3984 
3985  // getters:
3986  QPen pen() const { return mPen; }
3987  QPen selectedPen() const { return mSelectedPen; }
3988  QCPLineEnding head() const { return mHead; }
3989  QCPLineEnding tail() const { return mTail; }
3990 
3991  // setters;
3992  void setPen(const QPen &pen);
3993  void setSelectedPen(const QPen &pen);
3994  void setHead(const QCPLineEnding &head);
3995  void setTail(const QCPLineEnding &tail);
3996 
3997  // reimplemented virtual methods:
3998  virtual double selectTest(const QPointF &pos,
3999  bool onlySelectable,
4000  QVariant *details = 0) const;
4001 
4002  QCPItemPosition *const start;
4003  QCPItemPosition *const startDir;
4004  QCPItemPosition *const endDir;
4005  QCPItemPosition *const end;
4006 
4007 protected:
4008  // property members:
4009  QPen mPen, mSelectedPen;
4010  QCPLineEnding mHead, mTail;
4011 
4012  // reimplemented virtual methods:
4013  virtual void draw(QCPPainter *painter);
4014 
4015  // non-virtual methods:
4016  QPen mainPen() const;
4017 };
4018 
4019 class QCP_LIB_DECL QCPItemRect : public QCPAbstractItem {
4020  Q_OBJECT
4022  Q_PROPERTY(QPen pen READ pen WRITE setPen)
4023  Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
4024  Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
4025  Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
4027 public:
4028  QCPItemRect(QCustomPlot *parentPlot);
4029  virtual ~QCPItemRect();
4030 
4031  // getters:
4032  QPen pen() const { return mPen; }
4033  QPen selectedPen() const { return mSelectedPen; }
4034  QBrush brush() const { return mBrush; }
4035  QBrush selectedBrush() const { return mSelectedBrush; }
4036 
4037  // setters;
4038  void setPen(const QPen &pen);
4039  void setSelectedPen(const QPen &pen);
4040  void setBrush(const QBrush &brush);
4041  void setSelectedBrush(const QBrush &brush);
4042 
4043  // reimplemented virtual methods:
4044  virtual double selectTest(const QPointF &pos,
4045  bool onlySelectable,
4046  QVariant *details = 0) const;
4047 
4048  QCPItemPosition *const topLeft;
4049  QCPItemPosition *const bottomRight;
4050  QCPItemAnchor *const top;
4051  QCPItemAnchor *const topRight;
4052  QCPItemAnchor *const right;
4053  QCPItemAnchor *const bottom;
4054  QCPItemAnchor *const bottomLeft;
4055  QCPItemAnchor *const left;
4056 
4057 protected:
4059  aiTop,
4060  aiTopRight,
4061  aiRight,
4062  aiBottom,
4063  aiBottomLeft,
4064  aiLeft
4065  };
4066 
4067  // property members:
4068  QPen mPen, mSelectedPen;
4069  QBrush mBrush, mSelectedBrush;
4070 
4071  // reimplemented virtual methods:
4072  virtual void draw(QCPPainter *painter);
4073  virtual QPointF anchorPixelPoint(int anchorId) const;
4074 
4075  // non-virtual methods:
4076  QPen mainPen() const;
4077  QBrush mainBrush() const;
4078 };
4079 
4080 class QCP_LIB_DECL QCPItemText : public QCPAbstractItem {
4081  Q_OBJECT
4083  Q_PROPERTY(QColor color READ color WRITE setColor)
4084  Q_PROPERTY(QColor selectedColor READ selectedColor WRITE setSelectedColor)
4085  Q_PROPERTY(QPen pen READ pen WRITE setPen)
4086  Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
4087  Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
4088  Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
4089  Q_PROPERTY(QFont font READ font WRITE setFont)
4090  Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont)
4091  Q_PROPERTY(QString text READ text WRITE setText)
4092  Q_PROPERTY(Qt::Alignment positionAlignment READ positionAlignment WRITE
4093  setPositionAlignment)
4094  Q_PROPERTY(Qt::Alignment textAlignment READ textAlignment WRITE
4095  setTextAlignment)
4096  Q_PROPERTY(double rotation READ rotation WRITE setRotation)
4097  Q_PROPERTY(QMargins padding READ padding WRITE setPadding)
4099 public:
4100  QCPItemText(QCustomPlot *parentPlot);
4101  virtual ~QCPItemText();
4102 
4103  // getters:
4104  QColor color() const { return mColor; }
4105  QColor selectedColor() const { return mSelectedColor; }
4106  QPen pen() const { return mPen; }
4107  QPen selectedPen() const { return mSelectedPen; }
4108  QBrush brush() const { return mBrush; }
4109  QBrush selectedBrush() const { return mSelectedBrush; }
4110  QFont font() const { return mFont; }
4111  QFont selectedFont() const { return mSelectedFont; }
4112  QString text() const { return mText; }
4113  Qt::Alignment positionAlignment() const { return mPositionAlignment; }
4114  Qt::Alignment textAlignment() const { return mTextAlignment; }
4115  double rotation() const { return mRotation; }
4116  QMargins padding() const { return mPadding; }
4117 
4118  // setters;
4119  void setColor(const QColor &color);
4120  void setSelectedColor(const QColor &color);
4121  void setPen(const QPen &pen);
4122  void setSelectedPen(const QPen &pen);
4123  void setBrush(const QBrush &brush);
4124  void setSelectedBrush(const QBrush &brush);
4125  void setFont(const QFont &font);
4126  void setSelectedFont(const QFont &font);
4127  void setText(const QString &text);
4130  void setRotation(double degrees);
4131  void setPadding(const QMargins &padding);
4132 
4133  // reimplemented virtual methods:
4134  virtual double selectTest(const QPointF &pos,
4135  bool onlySelectable,
4136  QVariant *details = 0) const;
4137 
4138  QCPItemPosition *const position;
4139  QCPItemAnchor *const topLeft;
4140  QCPItemAnchor *const top;
4141  QCPItemAnchor *const topRight;
4142  QCPItemAnchor *const right;
4143  QCPItemAnchor *const bottomRight;
4144  QCPItemAnchor *const bottom;
4145  QCPItemAnchor *const bottomLeft;
4146  QCPItemAnchor *const left;
4147 
4148 protected:
4150  aiTopLeft,
4151  aiTop,
4152  aiTopRight,
4153  aiRight,
4154  aiBottomRight,
4155  aiBottom,
4156  aiBottomLeft,
4157  aiLeft
4158  };
4159 
4160  // property members:
4161  QColor mColor, mSelectedColor;
4162  QPen mPen, mSelectedPen;
4163  QBrush mBrush, mSelectedBrush;
4164  QFont mFont, mSelectedFont;
4165  QString mText;
4166  Qt::Alignment mPositionAlignment;
4167  Qt::Alignment mTextAlignment;
4168  double mRotation;
4169  QMargins mPadding;
4170 
4171  // reimplemented virtual methods:
4172  virtual void draw(QCPPainter *painter);
4173  virtual QPointF anchorPixelPoint(int anchorId) const;
4174 
4175  // non-virtual methods:
4176  QPointF getTextDrawPoint(const QPointF &pos,
4177  const QRectF &rect,
4178  Qt::Alignment positionAlignment) const;
4179  QFont mainFont() const;
4180  QColor mainColor() const;
4181  QPen mainPen() const;
4182  QBrush mainBrush() const;
4183 };
4184 
4186  Q_OBJECT
4188  Q_PROPERTY(QPen pen READ pen WRITE setPen)
4189  Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
4190  Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
4191  Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
4193 public:
4195  virtual ~QCPItemEllipse();
4196 
4197  // getters:
4198  QPen pen() const { return mPen; }
4199  QPen selectedPen() const { return mSelectedPen; }
4200  QBrush brush() const { return mBrush; }
4201  QBrush selectedBrush() const { return mSelectedBrush; }
4202 
4203  // setters;
4204  void setPen(const QPen &pen);
4205  void setSelectedPen(const QPen &pen);
4206  void setBrush(const QBrush &brush);
4207  void setSelectedBrush(const QBrush &brush);
4208 
4209  // reimplemented virtual methods:
4210  virtual double selectTest(const QPointF &pos,
4211  bool onlySelectable,
4212  QVariant *details = 0) const;
4213 
4214  QCPItemPosition *const topLeft;
4215  QCPItemPosition *const bottomRight;
4216  QCPItemAnchor *const topLeftRim;
4217  QCPItemAnchor *const top;
4218  QCPItemAnchor *const topRightRim;
4219  QCPItemAnchor *const right;
4220  QCPItemAnchor *const bottomRightRim;
4221  QCPItemAnchor *const bottom;
4222  QCPItemAnchor *const bottomLeftRim;
4223  QCPItemAnchor *const left;
4224  QCPItemAnchor *const center;
4225 
4226 protected:
4228  aiTopLeftRim,
4229  aiTop,
4230  aiTopRightRim,
4231  aiRight,
4232  aiBottomRightRim,
4233  aiBottom,
4234  aiBottomLeftRim,
4235  aiLeft,
4236  aiCenter
4237  };
4238 
4239  // property members:
4240  QPen mPen, mSelectedPen;
4241  QBrush mBrush, mSelectedBrush;
4242 
4243  // reimplemented virtual methods:
4244  virtual void draw(QCPPainter *painter);
4245  virtual QPointF anchorPixelPoint(int anchorId) const;
4246 
4247  // non-virtual methods:
4248  QPen mainPen() const;
4249  QBrush mainBrush() const;
4250 };
4251 
4253  Q_OBJECT
4255  Q_PROPERTY(QPixmap pixmap READ pixmap WRITE setPixmap)
4256  Q_PROPERTY(bool scaled READ scaled WRITE setScaled)
4257  Q_PROPERTY(Qt::AspectRatioMode aspectRatioMode READ aspectRatioMode)
4258  Q_PROPERTY(
4259  Qt::TransformationMode transformationMode READ transformationMode)
4260  Q_PROPERTY(QPen pen READ pen WRITE setPen)
4261  Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
4263 public:
4265  virtual ~QCPItemPixmap();
4266 
4267  // getters:
4268  QPixmap pixmap() const { return mPixmap; }
4269  bool scaled() const { return mScaled; }
4270  Qt::AspectRatioMode aspectRatioMode() const { return mAspectRatioMode; }
4271  Qt::TransformationMode transformationMode() const {
4272  return mTransformationMode;
4273  }
4274  QPen pen() const { return mPen; }
4275  QPen selectedPen() const { return mSelectedPen; }
4276 
4277  // setters;
4278  void setPixmap(const QPixmap &pixmap);
4279  void setScaled(bool scaled,
4280  Qt::AspectRatioMode aspectRatioMode = Qt::KeepAspectRatio,
4281  Qt::TransformationMode transformationMode =
4282  Qt::SmoothTransformation);
4283  void setPen(const QPen &pen);
4284  void setSelectedPen(const QPen &pen);
4285 
4286  // reimplemented virtual methods:
4287  virtual double selectTest(const QPointF &pos,
4288  bool onlySelectable,
4289  QVariant *details = 0) const;
4290 
4291  QCPItemPosition *const topLeft;
4292  QCPItemPosition *const bottomRight;
4293  QCPItemAnchor *const top;
4294  QCPItemAnchor *const topRight;
4295  QCPItemAnchor *const right;
4296  QCPItemAnchor *const bottom;
4297  QCPItemAnchor *const bottomLeft;
4298  QCPItemAnchor *const left;
4299 
4300 protected:
4302  aiTop,
4303  aiTopRight,
4304  aiRight,
4305  aiBottom,
4306  aiBottomLeft,
4307  aiLeft
4308  };
4309 
4310  // property members:
4311  QPixmap mPixmap;
4312  QPixmap mScaledPixmap;
4313  bool mScaled;
4314  Qt::AspectRatioMode mAspectRatioMode;
4315  Qt::TransformationMode mTransformationMode;
4316  QPen mPen, mSelectedPen;
4317 
4318  // reimplemented virtual methods:
4319  virtual void draw(QCPPainter *painter);
4320  virtual QPointF anchorPixelPoint(int anchorId) const;
4321 
4322  // non-virtual methods:
4323  void updateScaledPixmap(QRect finalRect = QRect(),
4324  bool flipHorz = false,
4325  bool flipVert = false);
4326  QRect getFinalRect(bool *flippedHorz = 0, bool *flippedVert = 0) const;
4327  QPen mainPen() const;
4328 };
4329 
4331  Q_OBJECT
4333  Q_PROPERTY(QPen pen READ pen WRITE setPen)
4334  Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
4335  Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
4336  Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
4337  Q_PROPERTY(double size READ size WRITE setSize)
4338  Q_PROPERTY(TracerStyle style READ style WRITE setStyle)
4339  Q_PROPERTY(QCPGraph *graph READ graph WRITE setGraph)
4340  Q_PROPERTY(double graphKey READ graphKey WRITE setGraphKey)
4341  Q_PROPERTY(bool interpolating READ interpolating WRITE setInterpolating)
4343 public:
4351  tsNone
4352  ,
4353  tsPlus
4354  ,
4355  tsCrosshair
4357  ,
4358  tsCircle
4359  ,
4360  tsSquare
4361  };
4362  Q_ENUMS(TracerStyle)
4363 
4365  virtual ~QCPItemTracer();
4366 
4367  // getters:
4368  QPen pen() const { return mPen; }
4369  QPen selectedPen() const { return mSelectedPen; }
4370  QBrush brush() const { return mBrush; }
4371  QBrush selectedBrush() const { return mSelectedBrush; }
4372  double size() const { return mSize; }
4373  TracerStyle style() const { return mStyle; }
4374  QCPGraph *graph() const { return mGraph; }
4375  double graphKey() const { return mGraphKey; }
4376  bool interpolating() const { return mInterpolating; }
4377 
4378  // setters;
4379  void setPen(const QPen &pen);
4380  void setSelectedPen(const QPen &pen);
4381  void setBrush(const QBrush &brush);
4382  void setSelectedBrush(const QBrush &brush);
4383  void setSize(double size);
4384  void setStyle(TracerStyle style);
4385  void setGraph(QCPGraph *graph);
4386  void setGraphKey(double key);
4387  void setInterpolating(bool enabled);
4388 
4389  // reimplemented virtual methods:
4390  virtual double selectTest(const QPointF &pos,
4391  bool onlySelectable,
4392  QVariant *details = 0) const;
4393 
4394  // non-virtual methods:
4396 
4397  QCPItemPosition *const position;
4398 
4399 protected:
4400  // property members:
4401  QPen mPen, mSelectedPen;
4402  QBrush mBrush, mSelectedBrush;
4403  double mSize;
4404  TracerStyle mStyle;
4405  QCPGraph *mGraph;
4406  double mGraphKey;
4407  bool mInterpolating;
4408 
4409  // reimplemented virtual methods:
4410  virtual void draw(QCPPainter *painter);
4411 
4412  // non-virtual methods:
4413  QPen mainPen() const;
4414  QBrush mainBrush() const;
4415 };
4416 
4418  Q_OBJECT
4420  Q_PROPERTY(QPen pen READ pen WRITE setPen)
4421  Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
4422  Q_PROPERTY(double length READ length WRITE setLength)
4423  Q_PROPERTY(BracketStyle style READ style WRITE setStyle)
4425 public:
4427  bsSquare
4428  ,
4429  bsRound
4430  ,
4431  bsCurly
4432  ,
4433  bsCalligraphic
4435  };
4436 
4438  virtual ~QCPItemBracket();
4439 
4440  // getters:
4441  QPen pen() const { return mPen; }
4442  QPen selectedPen() const { return mSelectedPen; }
4443  double length() const { return mLength; }
4444  BracketStyle style() const { return mStyle; }
4445 
4446  // setters;
4447  void setPen(const QPen &pen);
4448  void setSelectedPen(const QPen &pen);
4449  void setLength(double length);
4450  void setStyle(BracketStyle style);
4451 
4452  // reimplemented virtual methods:
4453  virtual double selectTest(const QPointF &pos,
4454  bool onlySelectable,
4455  QVariant *details = 0) const;
4456 
4457  QCPItemPosition *const left;
4458  QCPItemPosition *const right;
4459  QCPItemAnchor *const center;
4460 
4461 protected:
4462  // property members:
4463  enum AnchorIndex { aiCenter };
4464  QPen mPen, mSelectedPen;
4465  double mLength;
4466  BracketStyle mStyle;
4467 
4468  // reimplemented virtual methods:
4469  virtual void draw(QCPPainter *painter);
4470  virtual QPointF anchorPixelPoint(int anchorId) const;
4471 
4472  // non-virtual methods:
4473  QPen mainPen() const;
4474 };
MouseEvent event
filament::Texture::InternalFormat format
int width
int size
std::string name
int height
int count
int offset
char type
math::float4 color
math::float3 position
#define slots
#define signals
static int columnCount(int count)
Eigen::Matrix3d rotation
Definition: VoxelGridIO.cpp:27
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
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
Q_DECLARE_TYPEINFO(QCPVector2D, Q_MOVABLE_TYPE)
The abstract base class for all items in a plot.
Definition: qcustomplot.h:4081
QList< QCPItemPosition * > positions() const
Definition: qcustomplot.h:1970
virtual void deselectEvent(bool *selectionStateChanged)
virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const
QList< QCPItemAnchor * > anchors() const
Definition: qcustomplot.h:1971
void setClipToAxisRect(bool clip)
bool clipToAxisRect() const
Definition: qcustomplot.h:1953
void selectableChanged(bool selectable)
virtual QCP::Interaction selectionCategory() const
void setClipAxisRect(QCPAxisRect *rect)
QCPAxisRect * clipAxisRect() const
bool hasAnchor(const QString &name) const
QCPItemPosition * position(const QString &name) const
QCPItemAnchor * createAnchor(const QString &name, int anchorId)
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const =0
QCPAbstractItem(QCustomPlot *parentPlot)
virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged)
bool selected() const
Definition: qcustomplot.h:1956
Q_SLOT void setSelected(bool selected)
void selectionChanged(bool selected)
QCPItemPosition * createPosition(const QString &name)
Q_SLOT void setSelectable(bool selectable)
QCPItemAnchor * anchor(const QString &name) const
bool selectable() const
Definition: qcustomplot.h:1955
virtual ~QCPAbstractItem()
virtual void draw(QCPPainter *painter)=0
virtual QRect clipRect() const
The abstract base class for all entries in a QCPLegend.
Definition: qcustomplot.h:5512
virtual QCP::Interaction selectionCategory() const
QColor selectedTextColor() const
Definition: qcustomplot.h:2565
QCPLegend * parentLegend() const
Definition: qcustomplot.h:2561
virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const
QColor textColor() const
Definition: qcustomplot.h:2563
void setFont(const QFont &font)
void setSelectedTextColor(const QColor &color)
QFont font() const
Definition: qcustomplot.h:2562
void setTextColor(const QColor &color)
Q_SLOT void setSelected(bool selected)
void selectionChanged(bool selected)
virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged)
Q_SLOT void setSelectable(bool selectable)
virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const
virtual QRect clipRect() const
void setSelectedFont(const QFont &font)
virtual void draw(QCPPainter *painter)=0
Q_SLOT void setSelectable(bool selectable)
void selectableChanged(bool selectable)
virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged)
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
QFont selectedFont() const
Definition: qcustomplot.h:2564
Q_SLOT void setSelected(bool selected)
bool selected() const
Definition: qcustomplot.h:2567
virtual void deselectEvent(bool *selectionStateChanged)
bool selectable() const
Definition: qcustomplot.h:2566
virtual void deselectEvent(bool *selectionStateChanged)
QCPAbstractLegendItem(QCPLegend *parent)
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
The abstract base class for all data representing objects in a plot.
Definition: qcustomplot.h:3816
void selectableChanged(bool selectable)
virtual QRect clipRect() const
bool antialiasedFill() const
Definition: qcustomplot.h:1701
void setAntialiasedFill(bool enabled)
bool selected() const
Definition: qcustomplot.h:1711
void rescaleAxes(bool onlyEnlarge=false) const
virtual bool removeFromLegend() const
void pixelsToCoords(const QPointF &pixelPos, double &key, double &value) const
QCPAxis * keyAxis() const
Definition: qcustomplot.h:1708
virtual bool addToLegend()
void setAntialiasedScatters(bool enabled)
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const =0
void pixelsToCoords(double x, double y, double &key, double &value) const
void selectionChanged(bool selected)
QString name() const
Definition: qcustomplot.h:1700
void applyDefaultAntialiasingHint(QCPPainter *painter) const
const QPointF coordsToPixels(double key, double value) const
void rescaleValueAxis(bool onlyEnlarge=false, bool inKeyRange=false) const
void setValueAxis(QCPAxis *axis)
virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const =0
virtual QCPRange getKeyRange(bool &foundRange, SignDomain inSignDomain=sdBoth) const =0
bool antialiasedScatters() const
Definition: qcustomplot.h:1702
void setBrush(const QBrush &brush)
void coordsToPixels(double key, double value, double &x, double &y) const
virtual void deselectEvent(bool *selectionStateChanged)
void setKeyAxis(QCPAxis *axis)
virtual void clearData()=0
QBrush brush() const
Definition: qcustomplot.h:1706
void applyFillAntialiasingHint(QCPPainter *painter) const
virtual QCPRange getValueRange(bool &foundRange, SignDomain inSignDomain=sdBoth) const =0
QPen selectedPen() const
Definition: qcustomplot.h:1705
virtual QCP::Interaction selectionCategory() const
void setPen(const QPen &pen)
void setName(const QString &name)
void applyScattersAntialiasingHint(QCPPainter *painter) const
virtual void draw(QCPPainter *painter)=0
bool antialiasedErrorBars() const
Definition: qcustomplot.h:1703
bool selectable() const
Definition: qcustomplot.h:1710
void rescaleKeyAxis(bool onlyEnlarge=false) const
virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged)
QCPAxis * valueAxis() const
Definition: qcustomplot.h:1709
QCPAbstractPlottable(QCPAxis *keyAxis, QCPAxis *valueAxis)
QBrush selectedBrush() const
Definition: qcustomplot.h:1707
Holds multiple axes and arranges them in a rectangular shape.
Definition: qcustomplot.h:5375
virtual ~QCPAxisRect()
QPoint mDragStart
Definition: qcustomplot.h:2519
bool removeAxis(QCPAxis *axis)
bool backgroundScaled() const
Definition: qcustomplot.h:2445
Qt::AspectRatioMode backgroundScaledMode() const
Definition: qcustomplot.h:2446
QCPAxis * rangeDragAxis(Qt::Orientation orientation)
virtual void wheelEvent(QWheelEvent *event)
QList< QCPAbstractItem * > items() const
virtual int calculateAutoMargin(QCP::MarginSide side)
virtual QList< QCPLayoutElement * > elements(bool recursive) const
int width() const
Definition: qcustomplot.h:2491
void setBackground(const QBrush &brush)
virtual void update(UpdatePhase phase)
QCPAxis * rangeZoomAxis(Qt::Orientation orientation)
QPoint bottomRight() const
Definition: qcustomplot.h:2497
virtual void mouseMoveEvent(QMouseEvent *event, const QPointF &startPos)
QList< QCPAxis * > axes(QCPAxis::AxisTypes types) const
int right() const
Definition: qcustomplot.h:2488
QCPRange mDragStartHorzRange
Definition: qcustomplot.h:2517
virtual void mousePressEvent(QMouseEvent *event, const QVariant &details)
int top() const
Definition: qcustomplot.h:2489
QPixmap background() const
Definition: qcustomplot.h:2444
QPoint topLeft() const
Definition: qcustomplot.h:2494
virtual void wheelEvent(QWheelEvent *event)
void setBackgroundScaledMode(Qt::AspectRatioMode mode)
void setupFullAxesBox(bool connectRanges=false)
void updateAxesOffset(QCPAxis::AxisType type)
QCPAxisRect(QCustomPlot *parentPlot, bool setupDefaultAxes=true)
void setRangeDragAxes(QCPAxis *horizontal, QCPAxis *vertical)
void setRangeZoom(Qt::Orientations orientations)
QSize size() const
Definition: qcustomplot.h:2493
QPoint topRight() const
Definition: qcustomplot.h:2495
virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const
int axisCount(QCPAxis::AxisType type) const
void setRangeZoomFactor(double horizontalFactor, double verticalFactor)
void setRangeZoomAxes(QCPAxis *horizontal, QCPAxis *vertical)
virtual void mouseReleaseEvent(QMouseEvent *event, const QPointF &startPos)
virtual void draw(QCPPainter *painter)
QCPAxis * axis(QCPAxis::AxisType type, int index=0) const
QList< QCPGraph * > graphs() const
Qt::Orientations rangeZoom() const
Definition: qcustomplot.h:2450
Qt::Orientations rangeDrag() const
Definition: qcustomplot.h:2449
virtual void update(UpdatePhase phase)
QPoint bottomLeft() const
Definition: qcustomplot.h:2496
void drawBackground(QCPPainter *painter)
QCPAxis * addAxis(QCPAxis::AxisType type, QCPAxis *axis=0)
void setBackground(const QPixmap &pm, bool scaled, Qt::AspectRatioMode mode=Qt::KeepAspectRatioByExpanding)
QList< QCPAxis * > axes() const
int height() const
Definition: qcustomplot.h:2492
int bottom() const
Definition: qcustomplot.h:2490
QList< QCPAxis * > addAxes(QCPAxis::AxisTypes types)
QPoint center() const
Definition: qcustomplot.h:2498
QPointer< QCPAxis > mRangeZoomHorzAxis
Definition: qcustomplot.h:2514
double rangeZoomFactor(Qt::Orientation orientation)
void setRangeDrag(Qt::Orientations orientations)
void setBackgroundScaled(bool scaled)
QList< QCPAbstractPlottable * > plottables() const
virtual int calculateAutoMargin(QCP::MarginSide side)
void setRangeZoomFactor(double factor)
QPointer< QCPAxis > mRangeDragHorzAxis
Definition: qcustomplot.h:2513
QCPLayoutInset * insetLayout() const
Definition: qcustomplot.h:2479
void setBackground(const QPixmap &pm)
virtual void draw(QCPPainter *painter)
int left() const
Definition: qcustomplot.h:2487
Manages a single axis inside a QCustomPlot.
Definition: qcustomplot.h:2254
void setSelectedLabelFont(const QFont &font)
void setOffset(int offset)
void setTickLabels(bool show)
QColor labelColor() const
Definition: qcustomplot.h:1394
int padding() const
Definition: qcustomplot.h:1397
void rangeChanged(const QCPRange &newRange)
void setLowerEnding(const QCPLineEnding &ending)
SelectablePart getPartAt(const QPointF &pos) const
QFont selectedTickLabelFont() const
Definition: qcustomplot.h:1401
QFont tickLabelFont() const
Definition: qcustomplot.h:1374
QString mDateTimeFormat
Definition: qcustomplot.h:1526
LabelType tickLabelType() const
Definition: qcustomplot.h:1373
QCPLineEnding lowerEnding() const
QPen selectedBasePen() const
Definition: qcustomplot.h:1405
virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged)
QFont selectedLabelFont() const
Definition: qcustomplot.h:1402
void setTickLabelSide(LabelSide side)
bool autoTickStep() const
Definition: qcustomplot.h:1368
void moveRange(double diff)
Q_SLOT void setRange(const QCPRange &range)
QVector< QString > tickVectorLabels() const
Definition: qcustomplot.h:1384
void setTickLabelRotation(double degrees)
SelectableParts selectableParts() const
Definition: qcustomplot.h:1400
QString numberFormat() const
QPen basePen() const
Definition: qcustomplot.h:1390
void setRangeReversed(bool reversed)
void setNumberPrecision(int precision)
int numberPrecision() const
Definition: qcustomplot.h:1381
virtual void draw(QCPPainter *painter)
void setSelectedSubTickPen(const QPen &pen)
void setTickLabelFont(const QFont &font)
QString dateTimeFormat() const
Definition: qcustomplot.h:1378
bool autoTicks() const
Definition: qcustomplot.h:1365
QList< QCPAbstractItem * > items() const
QString label() const
Definition: qcustomplot.h:1395
void setLabel(const QString &str)
void scaleTypeChanged(QCPAxis::ScaleType scaleType)
void setTickLabelColor(const QColor &color)
void setTickLengthOut(int outside)
int autoTickCount() const
Definition: qcustomplot.h:1366
void setLabelPadding(int padding)
void rescale(bool onlyVisiblePlottables=false)
int mAutoTickCount
Definition: qcustomplot.h:1535
void setSubTickLengthOut(int outside)
double mTickStep
Definition: qcustomplot.h:1534
double pixelToCoord(double value) const
void setPadding(int padding)
void setRange(double lower, double upper)
QVector< double > tickVector() const
Definition: qcustomplot.h:1383
bool ticks() const
Definition: qcustomplot.h:1370
double tickLabelRotation() const
void setSelectedLabelColor(const QColor &color)
void selectionChanged(const QCPAxis::SelectableParts &parts)
void setTickLength(int inside, int outside=0)
virtual void deselectEvent(bool *selectionStateChanged)
void setUpperEnding(const QCPLineEnding &ending)
QFont getTickLabelFont() const
virtual int calculateMargin()
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
void setLabelColor(const QColor &color)
int labelPadding() const
LabelType mTickLabelType
Definition: qcustomplot.h:1523
void scaleRange(double factor, double center)
void setLabelFont(const QFont &font)
bool mAutoTickLabels
Definition: qcustomplot.h:1521
QPen selectedSubTickPen() const
Definition: qcustomplot.h:1407
QColor selectedTickLabelColor() const
Definition: qcustomplot.h:1403
QPen selectedTickPen() const
Definition: qcustomplot.h:1406
void setBasePen(const QPen &pen)
QPen subTickPen() const
Definition: qcustomplot.h:1392
QColor selectedLabelColor() const
Definition: qcustomplot.h:1404
QCPGrid * grid() const
Definition: qcustomplot.h:1410
Q_SLOT void setSelectedParts(const QCPAxis::SelectableParts &selectedParts)
void setSelectedTickPen(const QPen &pen)
void setSelectedTickLabelFont(const QFont &font)
SelectableParts selectedParts() const
Definition: qcustomplot.h:1399
QPen getBasePen() const
QColor getTickLabelColor() const
double scaleLogBase() const
Definition: qcustomplot.h:1362
double tickStep() const
Definition: qcustomplot.h:1382
virtual QCP::Interaction selectionCategory() const
bool autoTickLabels() const
Definition: qcustomplot.h:1367
static Qt::Orientation orientation(AxisType type)
Definition: qcustomplot.h:1489
void setSelectedTickLabelColor(const QColor &color)
QColor tickLabelColor() const
Definition: qcustomplot.h:1375
QCPLineEnding upperEnding() const
static AxisType opposite(AxisType type)
void selectableChanged(const QCPAxis::SelectableParts &parts)
virtual void setupTickVectors()
QFont labelFont() const
Definition: qcustomplot.h:1393
bool mAutoSubTicks
Definition: qcustomplot.h:1536
void rangeChanged(const QCPRange &newRange, const QCPRange &oldRange)
static AxisType marginSideToAxisType(QCP::MarginSide side)
QPen getSubTickPen() const
Q_SLOT void setSelectableParts(const QCPAxis::SelectableParts &selectableParts)
virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const
void setSubTickLength(int inside, int outside=0)
bool rangeReversed() const
Definition: qcustomplot.h:1364
Qt::Orientation orientation() const
Definition: qcustomplot.h:1476
int subTickCount() const
Definition: qcustomplot.h:1387
int mHighestVisibleTick
Definition: qcustomplot.h:1550
double mScaleLogBase
Definition: qcustomplot.h:1545
const QCPRange range() const
Definition: qcustomplot.h:1363
void setSubTickLengthIn(int inside)
QList< QCPAbstractPlottable * > plottables() const
Q_SLOT void setScaleType(QCPAxis::ScaleType type)
void setTicks(bool show)
int subTickLengthOut() const
LabelSide tickLabelSide() const
void setRangeUpper(double upper)
int tickLengthIn() const
void setRange(double position, double size, Qt::AlignmentFlag alignment)
ScaleType scaleType() const
Definition: qcustomplot.h:1361
int tickLengthOut() const
void setTickPen(const QPen &pen)
bool autoSubTicks() const
Definition: qcustomplot.h:1369
bool tickLabels() const
Definition: qcustomplot.h:1371
void setNumberFormat(const QString &formatCode)
QColor getLabelColor() const
Qt::TimeSpec dateTimeSpec() const
Definition: qcustomplot.h:1379
QFont getLabelFont() const
void setSelectedBasePen(const QPen &pen)
void setSubTickPen(const QPen &pen)
int offset() const
double coordToPixel(double value) const
void setTickLabelPadding(int padding)
void ticksRequest()
void setScaleRatio(const QCPAxis *otherAxis, double ratio=1.0)
Qt::TimeSpec mDateTimeSpec
Definition: qcustomplot.h:1527
int subTickLengthIn() const
int tickLabelPadding() const
void setTickLengthIn(int inside)
QCPAxisRect * axisRect() const
Definition: qcustomplot.h:1360
void setRangeLower(double lower)
QList< QCPGraph * > graphs() const
QPen getTickPen() const
QPen tickPen() const
Definition: qcustomplot.h:1391
Holds the data of one single data point (one bar) for QCPBars.
Definition: qcustomplot.h:3398
double key
Definition: qcustomplot.h:3402
Groups multiple QCPBars together so they appear side by side.
Definition: qcustomplot.h:6345
double getPixelSpacing(const QCPBars *bars, double keyCoord)
void remove(QCPBars *bars)
void setSpacingType(SpacingType spacingType)
void insert(int i, QCPBars *bars)
double spacing() const
Definition: qcustomplot.h:3360
int size() const
Definition: qcustomplot.h:3369
void registerBars(QCPBars *bars)
void append(QCPBars *bars)
SpacingType spacingType() const
Definition: qcustomplot.h:3359
double keyPixelOffset(const QCPBars *bars, double keyCoord)
QCPBars * bars(int index) const
QList< QCPBars * > bars() const
Definition: qcustomplot.h:3367
QCPBarsGroup(QCustomPlot *parentPlot)
void setSpacing(double spacing)
bool isEmpty() const
Definition: qcustomplot.h:3370
void unregisterBars(QCPBars *bars)
bool contains(QCPBars *bars) const
Definition: qcustomplot.h:3372
A plottable representing a bar chart in a plot.
Definition: qcustomplot.h:6449
QCPBars * barAbove() const
Definition: qcustomplot.h:3454
double getStackedBaseValue(double key, bool positive) const
QCPBarDataMap * data() const
Definition: qcustomplot.h:3455
static void connectBars(QCPBars *lower, QCPBars *upper)
double baseValue() const
Definition: qcustomplot.h:3452
virtual void draw(QCPPainter *painter)
WidthType widthType() const
Definition: qcustomplot.h:3450
void setBaseValue(double baseValue)
QCPBarsGroup * barsGroup() const
Definition: qcustomplot.h:3451
void addData(double key, double value)
void moveBelow(QCPBars *bars)
QCPBars * barBelow() const
Definition: qcustomplot.h:3453
QSharedPointer< QCPBarsDataContainer > data() const
Definition: qcustomplot.h:6489
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
void moveAbove(QCPBars *bars)
void getPixelWidth(double key, double &lower, double &upper) const
void setWidthType(WidthType widthType)
void setBarsGroup(QCPBarsGroup *barsGroup)
QCPBarDataMap * mData
Definition: qcustomplot.h:3485
virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const
void setWidth(double width)
Defines a color gradient for use with e.g. QCPColorMap.
Definition: qcustomplot.h:5165
QRgb color(double position, const QCPRange &range, bool logarithmic=false)
void setLevelCount(int n)
bool periodic() const
Definition: qcustomplot.h:2391
void updateColorBuffer()
void setPeriodic(bool enabled)
void setColorStopAt(double position, const QColor &color)
void setColorStops(const QMap< double, QColor > &colorStops)
void clearColorStops()
QCPColorGradient inverted() const
void loadPreset(GradientPreset preset)
void setColorInterpolation(ColorInterpolation interpolation)
QMap< double, QColor > colorStops() const
Definition: qcustomplot.h:2387
void colorize(const double *data, const QCPRange &range, QRgb *scanLine, int n, int dataIndexFactor=1, bool logarithmic=false)
ColorInterpolation colorInterpolation() const
Definition: qcustomplot.h:2388
int levelCount() const
Definition: qcustomplot.h:2386
Holds the two-dimensional data of a QCPColorMap plottable.
Definition: qcustomplot.h:6720
void setKeyRange(const QCPRange &keyRange)
void setValueSize(int valueSize)
void setSize(int keySize, int valueSize)
QCPColorMapData & operator=(const QCPColorMapData &other)
QCPRange keyRange() const
Definition: qcustomplot.h:3619
double data(double key, double value)
void fill(double z)
QCPColorMapData(const QCPColorMapData &other)
QCPRange valueRange() const
Definition: qcustomplot.h:3620
int valueSize() const
Definition: qcustomplot.h:3618
void setCell(int keyIndex, int valueIndex, double z)
QCPColorMapData(int keySize, int valueSize, const QCPRange &keyRange, const QCPRange &valueRange)
void setRange(const QCPRange &keyRange, const QCPRange &valueRange)
void recalculateDataBounds()
QCPRange dataBounds() const
Definition: qcustomplot.h:3621
int keySize() const
Definition: qcustomplot.h:3617
void setKeySize(int keySize)
void coordToCell(double key, double value, int *keyIndex, int *valueIndex) const
void setValueRange(const QCPRange &valueRange)
bool isEmpty() const
Definition: qcustomplot.h:3639
void cellToCoord(int keyIndex, int valueIndex, double *key, double *value) const
double cell(int keyIndex, int valueIndex)
void setData(double key, double value, double z)
A plottable representing a two-dimensional color map in a plot.
Definition: qcustomplot.h:6784
virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const
bool interpolate() const
Definition: qcustomplot.h:3683
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
Q_SLOT void setDataScaleType(QCPAxis::ScaleType scaleType)
void dataRangeChanged(QCPRange newRange)
void setInterpolate(bool enabled)
virtual void updateMapImage()
bool tightBoundary() const
Definition: qcustomplot.h:3684
Q_SLOT void updateLegendIcon(Qt::TransformationMode transformMode=Qt::SmoothTransformation, const QSize &thumbSize=QSize(32, 18))
void setData(QCPColorMapData *data, bool copy=false)
void rescaleDataRange(bool recalculateDataBounds=false)
void dataScaleTypeChanged(QCPAxis::ScaleType scaleType)
QCPColorScale * colorScale() const
Definition: qcustomplot.h:3686
QCPColorMap(QCPAxis *keyAxis, QCPAxis *valueAxis)
void setColorScale(QCPColorScale *colorScale)
QCPAxis::ScaleType dataScaleType() const
Definition: qcustomplot.h:3682
QCPColorMapData * data() const
Definition: qcustomplot.h:3680
void gradientChanged(QCPColorGradient newGradient)
QCPColorGradient gradient() const
Definition: qcustomplot.h:3685
Q_SLOT void setGradient(const QCPColorGradient &gradient)
void setTightBoundary(bool enabled)
Q_SLOT void setDataRange(const QCPRange &dataRange)
QCPRange dataRange() const
Definition: qcustomplot.h:3681
virtual void draw(QCPPainter *painter)
virtual ~QCPColorMap()
A color scale for use with color coding data such as QCPColorMap.
Definition: qcustomplot.h:5876
virtual void update(UpdatePhase phase)
void setType(QCPAxis::AxisType type)
virtual void wheelEvent(QWheelEvent *event)
void setRangeDrag(bool enabled)
void dataRangeChanged(QCPRange newRange)
bool rangeDrag() const
virtual ~QCPColorScale()
QCPColorGradient gradient() const
Definition: qcustomplot.h:2896
QString label() const
void rescaleDataRange(bool onlyVisibleMaps)
Q_SLOT void setGradient(const QCPColorGradient &gradient)
QCPRange dataRange() const
Definition: qcustomplot.h:2894
void dataScaleTypeChanged(QCPAxis::ScaleType scaleType)
virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const
void gradientChanged(QCPColorGradient newGradient)
QCPAxis::AxisType type() const
Definition: qcustomplot.h:2893
Q_SLOT void setDataScaleType(QCPAxis::ScaleType scaleType)
void setRangeZoom(bool enabled)
QList< QCPColorMap * > colorMaps() const
QCPColorScale(QCustomPlot *parentPlot)
void setBarWidth(int width)
Q_SLOT void setDataRange(const QCPRange &dataRange)
QCPAxis::ScaleType dataScaleType() const
Definition: qcustomplot.h:2895
bool rangeZoom() const
int barWidth() const
Definition: qcustomplot.h:2898
QCPAxis * axis() const
Definition: qcustomplot.h:2892
void setLabel(const QString &str)
Holds the data of one single data point for QCPCurve.
Definition: qcustomplot.h:6164
QCPCurveData(double t, double key, double value)
A plottable representing a parametric curve in a plot.
Definition: qcustomplot.h:6198
LineStyle lineStyle() const
Definition: qcustomplot.h:3231
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
void addData(double t, double key, double value)
virtual void draw(QCPPainter *painter)
int getRegion(double x, double y, double rectLeft, double rectTop, double rectRight, double rectBottom) const
QCPCurve(QCPAxis *keyAxis, QCPAxis *valueAxis)
void setLineStyle(LineStyle style)
void setScatterStyle(const QCPScatterStyle &style)
void getTraverseCornerPoints(int prevRegion, int currentRegion, double rectLeft, double rectTop, double rectRight, double rectBottom, QVector< QPointF > &beforeTraverse, QVector< QPointF > &afterTraverse) const
QCPCurveDataMap * data() const
Definition: qcustomplot.h:3229
virtual ~QCPCurve()
bool getTraverse(double prevKey, double prevValue, double key, double value, double rectLeft, double rectTop, double rectRight, double rectBottom, QPointF &crossA, QPointF &crossB) const
QVector< QPointF > getOptimizedCornerPoints(int prevRegion, int currentRegion, double prevKey, double prevValue, double key, double value, double rectLeft, double rectTop, double rectRight, double rectBottom) const
QCPCurveDataMap * mData
Definition: qcustomplot.h:3263
void setData(const QVector< double > &key, const QVector< double > &value)
void addData(double key, double value)
QPointF getOptimizedPoint(int prevRegion, double prevKey, double prevValue, double key, double value, double rectLeft, double rectTop, double rectRight, double rectBottom) const
virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const
bool mayTraverse(int prevRegion, int currentRegion) const
QCPScatterStyle scatterStyle() const
Definition: qcustomplot.h:3230
Holds the data of one single data point for QCPGraph.
Definition: qcustomplot.h:2952
double key
Definition: qcustomplot.h:2956
double valueErrorMinus
Definition: qcustomplot.h:2958
double keyErrorMinus
Definition: qcustomplot.h:2957
Holds the data of one single data point for QCPFinancial.
Definition: qcustomplot.h:6874
QCPFinancialData(double key, double open, double high, double low, double close)
A plottable representing a financial stock chart.
Definition: qcustomplot.h:6912
double width() const
Definition: qcustomplot.h:3796
void setTwoColored(bool twoColored)
QPen penNegative() const
Definition: qcustomplot.h:3801
QCPFinancialDataMap * mData
Definition: qcustomplot.h:3847
ChartStyle chartStyle() const
Definition: qcustomplot.h:3795
void setChartStyle(ChartStyle style)
void setBrushPositive(const QBrush &brush)
void addData(double key, double open, double high, double low, double close)
virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const
void setBrushNegative(const QBrush &brush)
virtual void draw(QCPPainter *painter)
void setWidth(double width)
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
void setPenPositive(const QPen &pen)
QBrush brushNegative() const
Definition: qcustomplot.h:3799
QPen penPositive() const
Definition: qcustomplot.h:3800
QBrush brushPositive() const
Definition: qcustomplot.h:3798
static QCPFinancialDataMap timeSeriesToOhlc(const QVector< double > &time, const QVector< double > &value, double timeBinSize, double timeBinOffset=0)
bool twoColored() const
Definition: qcustomplot.h:3797
void setPenNegative(const QPen &pen)
A plottable representing a graph in a plot.
Definition: qcustomplot.h:5996
void addData(double key, double value)
void setScatterStyle(const QCPScatterStyle &style)
bool adaptiveSampling() const
Definition: qcustomplot.h:3043
ErrorType errorType() const
Definition: qcustomplot.h:3038
ErrorType mErrorType
Definition: qcustomplot.h:3112
void setChannelFillGraph(QCPGraph *targetGraph)
QCPScatterStyle scatterStyle() const
Definition: qcustomplot.h:3037
void setLineStyle(LineStyle ls)
int findIndexBelowY(const QVector< QPointF > *data, double y) const
double errorBarSize() const
Definition: qcustomplot.h:3040
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
double mErrorBarSize
Definition: qcustomplot.h:3113
bool errorBarSkipSymbol() const
Definition: qcustomplot.h:3041
QCPGraph * channelFillGraph() const
Definition: qcustomplot.h:3042
QCPDataMap * mData
Definition: qcustomplot.h:3108
int findIndexAboveY(const QVector< QPointF > *data, double y) const
int findIndexBelowX(const QVector< QPointF > *data, double x) const
virtual void drawFill(QCPPainter *painter, QVector< QPointF > *lineData) const
QPen mErrorPen
Definition: qcustomplot.h:3109
int findIndexAboveX(const QVector< QPointF > *data, double x) const
void setAdaptiveSampling(bool enabled)
QPen errorPen() const
Definition: qcustomplot.h:3039
LineStyle lineStyle() const
Definition: qcustomplot.h:3036
QSharedPointer< QCPGraphDataContainer > data() const
Definition: qcustomplot.h:6040
bool mErrorBarSkipSymbol
Definition: qcustomplot.h:3114
virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const
virtual void draw(QCPPainter *painter)
Responsible for drawing the grid of a QCPAxis.
Definition: qcustomplot.h:2202
QPen pen() const
Definition: qcustomplot.h:1168
void setZeroLinePen(const QPen &pen)
void setAntialiasedZeroLine(bool enabled)
void setAntialiasedSubGrid(bool enabled)
bool antialiasedZeroLine() const
Definition: qcustomplot.h:1167
void drawSubGridLines(QCPPainter *painter) const
QPen zeroLinePen() const
Definition: qcustomplot.h:1170
void setSubGridPen(const QPen &pen)
void setPen(const QPen &pen)
QCPGrid(QCPAxis *parentAxis)
void setSubGridVisible(bool visible)
virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const
QPen subGridPen() const
Definition: qcustomplot.h:1169
void drawGridLines(QCPPainter *painter) const
bool antialiasedSubGrid() const
Definition: qcustomplot.h:1166
virtual void draw(QCPPainter *painter)
bool subGridVisible() const
Definition: qcustomplot.h:1165
An anchor of an item to which positions can be attached to.
Definition: qcustomplot.h:3948
virtual ~QCPItemAnchor()
void removeChildX(QCPItemPosition *pos)
virtual QCPItemPosition * toQCPItemPosition()
Definition: qcustomplot.h:1835
void removeChildY(QCPItemPosition *pos)
QString name() const
Definition: qcustomplot.h:1821
void addChildX(QCPItemPosition *pos)
void addChildY(QCPItemPosition *pos)
A bracket for referencing/highlighting certain parts in the plot.
Definition: qcustomplot.h:7795
void setSelectedPen(const QPen &pen)
QCPItemBracket(QCustomPlot *parentPlot)
BracketStyle style() const
Definition: qcustomplot.h:4444
QPen pen() const
Definition: qcustomplot.h:4441
void setStyle(BracketStyle style)
virtual void draw(QCPPainter *painter)
virtual ~QCPItemBracket()
void setPen(const QPen &pen)
void setLength(double length)
QPen mainPen() const
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
double length() const
Definition: qcustomplot.h:4443
QPen selectedPen() const
Definition: qcustomplot.h:4442
A curved line from one point to another.
Definition: qcustomplot.h:7319
void setPen(const QPen &pen)
void setHead(const QCPLineEnding &head)
void setSelectedPen(const QPen &pen)
QPen mainPen() const
QPen selectedPen() const
Definition: qcustomplot.h:3987
QCPLineEnding head() const
Definition: qcustomplot.h:3988
virtual void draw(QCPPainter *painter)
QCPLineEnding tail() const
Definition: qcustomplot.h:3989
void setTail(const QCPLineEnding &tail)
QCPItemCurve(QCustomPlot *parentPlot)
QPen pen() const
Definition: qcustomplot.h:3986
virtual ~QCPItemCurve()
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
An ellipse.
Definition: qcustomplot.h:7546
virtual ~QCPItemEllipse()
void setBrush(const QBrush &brush)
QBrush mainBrush() const
void setSelectedPen(const QPen &pen)
QCPItemEllipse(QCustomPlot *parentPlot)
QPen pen() const
Definition: qcustomplot.h:4198
void setSelectedBrush(const QBrush &brush)
QPen selectedPen() const
Definition: qcustomplot.h:4199
QPen mainPen() const
QBrush brush() const
Definition: qcustomplot.h:4200
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
virtual void draw(QCPPainter *painter)
void setPen(const QPen &pen)
QBrush selectedBrush() const
Definition: qcustomplot.h:4201
A line from one point to another.
Definition: qcustomplot.h:7267
virtual ~QCPItemLine()
QCPItemLine(QCustomPlot *parentPlot)
void setSelectedPen(const QPen &pen)
void setPen(const QPen &pen)
QCPLineEnding head() const
Definition: qcustomplot.h:3941
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
QPen pen() const
Definition: qcustomplot.h:3939
QCPLineEnding tail() const
Definition: qcustomplot.h:3942
virtual void draw(QCPPainter *painter)
void setTail(const QCPLineEnding &tail)
QPen selectedPen() const
Definition: qcustomplot.h:3940
void setHead(const QCPLineEnding &head)
QPen mainPen() const
An arbitrary pixmap.
Definition: qcustomplot.h:7618
virtual ~QCPItemPixmap()
QPen selectedPen() const
Definition: qcustomplot.h:4275
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
QRect getFinalRect(bool *flippedHorz=0, bool *flippedVert=0) const
Qt::AspectRatioMode aspectRatioMode() const
Definition: qcustomplot.h:4270
QPen pen() const
Definition: qcustomplot.h:4274
void setPixmap(const QPixmap &pixmap)
QPixmap pixmap() const
Definition: qcustomplot.h:4268
bool scaled() const
Definition: qcustomplot.h:4269
void updateScaledPixmap(QRect finalRect=QRect(), bool flipHorz=false, bool flipVert=false)
QCPItemPixmap(QCustomPlot *parentPlot)
QPen mainPen() const
void setScaled(bool scaled, Qt::AspectRatioMode aspectRatioMode=Qt::KeepAspectRatio, Qt::TransformationMode transformationMode=Qt::SmoothTransformation)
Qt::TransformationMode transformationMode() const
Definition: qcustomplot.h:4271
void setPen(const QPen &pen)
virtual void draw(QCPPainter *painter)
void setSelectedPen(const QPen &pen)
Manages the position of an item.
Definition: qcustomplot.h:3990
void setAxisRect(QCPAxisRect *axisRect)
PositionType typeX() const
Definition: qcustomplot.h:1893
void setTypeX(PositionType type)
void setAxes(QCPAxis *keyAxis, QCPAxis *valueAxis)
QCPAxis * valueAxis() const
Definition: qcustomplot.h:1902
virtual QCPItemPosition * toQCPItemPosition()
Definition: qcustomplot.h:1931
QCPItemAnchor * parentAnchorX() const
Definition: qcustomplot.h:1896
double key() const
Definition: qcustomplot.h:1898
QCPAxis * keyAxis() const
Definition: qcustomplot.h:1901
QCPItemAnchor * parentAnchorY() const
Definition: qcustomplot.h:1897
void setType(PositionType type)
QPointF coords() const
Definition: qcustomplot.h:1900
void setCoords(double key, double value)
PositionType type() const
Definition: qcustomplot.h:1892
bool setParentAnchor(QCPItemAnchor *parentAnchor, bool keepPixelPosition=false)
void setTypeY(PositionType type)
void setCoords(const QPointF &coords)
double value() const
Definition: qcustomplot.h:1899
bool setParentAnchorY(QCPItemAnchor *parentAnchor, bool keepPixelPosition=false)
bool setParentAnchorX(QCPItemAnchor *parentAnchor, bool keepPixelPosition=false)
QCPItemAnchor * parentAnchor() const
Definition: qcustomplot.h:1895
PositionType typeY() const
Definition: qcustomplot.h:1894
QCPAxisRect * axisRect() const
virtual ~QCPItemPosition()
A rectangle.
Definition: qcustomplot.h:7370
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
QBrush selectedBrush() const
Definition: qcustomplot.h:4035
QPen pen() const
Definition: qcustomplot.h:4032
QCPItemRect(QCustomPlot *parentPlot)
void setPen(const QPen &pen)
virtual void draw(QCPPainter *painter)
QBrush brush() const
Definition: qcustomplot.h:4034
void setSelectedPen(const QPen &pen)
QBrush mainBrush() const
virtual ~QCPItemRect()
void setBrush(const QBrush &brush)
void setSelectedBrush(const QBrush &brush)
QPen selectedPen() const
Definition: qcustomplot.h:4033
QPen mainPen() const
A straight line that spans infinitely in both directions.
Definition: qcustomplot.h:7222
QCPItemStraightLine(QCustomPlot *parentPlot)
virtual void draw(QCPPainter *painter)
QPen mainPen() const
void setSelectedPen(const QPen &pen)
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
void setPen(const QPen &pen)
QPen pen() const
Definition: qcustomplot.h:3894
virtual ~QCPItemStraightLine()
QPen selectedPen() const
Definition: qcustomplot.h:3895
A text label.
Definition: qcustomplot.h:7436
double rotation() const
Definition: qcustomplot.h:4115
QColor color() const
Definition: qcustomplot.h:4104
void setSelectedFont(const QFont &font)
Qt::Alignment positionAlignment() const
Definition: qcustomplot.h:4113
void setBrush(const QBrush &brush)
QBrush brush() const
Definition: qcustomplot.h:4108
void setSelectedPen(const QPen &pen)
QPen mainPen() const
QBrush selectedBrush() const
Definition: qcustomplot.h:4109
void setText(const QString &text)
QFont font() const
Definition: qcustomplot.h:4110
void setRotation(double degrees)
QPointF getTextDrawPoint(const QPointF &pos, const QRectF &rect, Qt::Alignment positionAlignment) const
QMargins padding() const
Definition: qcustomplot.h:4116
void setSelectedBrush(const QBrush &brush)
QColor selectedColor() const
Definition: qcustomplot.h:4105
QPen pen() const
Definition: qcustomplot.h:4106
QFont selectedFont() const
Definition: qcustomplot.h:4111
QCPItemText(QCustomPlot *parentPlot)
void setPositionAlignment(Qt::Alignment alignment)
QPen selectedPen() const
Definition: qcustomplot.h:4107
void setFont(const QFont &font)
Qt::Alignment textAlignment() const
Definition: qcustomplot.h:4114
void setPen(const QPen &pen)
void setColor(const QColor &color)
void setTextAlignment(Qt::Alignment alignment)
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
QColor mainColor() const
virtual void draw(QCPPainter *painter)
QBrush mainBrush() const
QString text() const
Definition: qcustomplot.h:4112
virtual ~QCPItemText()
void setSelectedColor(const QColor &color)
void setPadding(const QMargins &padding)
QFont mainFont() const
Item that sticks to QCPGraph data points.
Definition: qcustomplot.h:7702
void setSelectedBrush(const QBrush &brush)
void setBrush(const QBrush &brush)
void setStyle(TracerStyle style)
double size() const
Definition: qcustomplot.h:4372
virtual void draw(QCPPainter *painter)
void updatePosition()
void setGraphKey(double key)
void setInterpolating(bool enabled)
QBrush brush() const
Definition: qcustomplot.h:4370
QBrush mainBrush() const
QPen mainPen() const
double graphKey() const
Definition: qcustomplot.h:4375
QCPGraph * graph() const
Definition: qcustomplot.h:4374
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
QPen selectedPen() const
Definition: qcustomplot.h:4369
void setSelectedPen(const QPen &pen)
QBrush selectedBrush() const
Definition: qcustomplot.h:4371
void setSize(double size)
bool interpolating() const
Definition: qcustomplot.h:4376
void setGraph(QCPGraph *graph)
void setPen(const QPen &pen)
TracerStyle style() const
Definition: qcustomplot.h:4373
A layer that may contain objects, to control the rendering order.
Definition: qcustomplot.h:816
QString name() const
Definition: qcustomplot.h:545
QCustomPlot * parentPlot() const
Definition: qcustomplot.h:544
void addChild(QCPLayerable *layerable, bool prepend)
QCPLayer(QCustomPlot *parentPlot, const QString &layerName)
QList< QCPLayerable * > children() const
Definition: qcustomplot.h:547
void setVisible(bool visible)
void removeChild(QCPLayerable *layerable)
bool visible() const
Definition: qcustomplot.h:548
int index() const
Definition: qcustomplot.h:546
Base class for all drawable objects.
Definition: qcustomplot.h:887
virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged)
virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const =0
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
void setVisible(bool on)
QCustomPlot * parentPlot() const
Definition: qcustomplot.h:589
void setAntialiased(bool enabled)
QCPLayer * layer() const
Definition: qcustomplot.h:591
bool antialiased() const
Definition: qcustomplot.h:592
QCPLayerable(QCustomPlot *plot, QString targetLayer=QString(), QCPLayerable *parentLayerable=0)
virtual void deselectEvent(bool *selectionStateChanged)
void initializeParentPlot(QCustomPlot *parentPlot)
void setParentLayerable(QCPLayerable *parentLayerable)
bool realVisibility() const
bool setLayer(const QString &layerName)
void layerChanged(QCPLayer *newLayer)
QCPLayerable * parentLayerable() const
Definition: qcustomplot.h:590
virtual void parentPlotInitialized(QCustomPlot *parentPlot)
void applyAntialiasingHint(QCPPainter *painter, bool localAntialiased, QCP::AntialiasedElement overrideElement) const
virtual void draw(QCPPainter *painter)=0
virtual QCP::Interaction selectionCategory() const
Q_SLOT bool setLayer(QCPLayer *layer)
bool visible() const
Definition: qcustomplot.h:588
bool moveToLayer(QCPLayer *layer, bool prepend)
virtual QRect clipRect() const
The abstract base class for all objects that form the layout system.
Definition: qcustomplot.h:1409
void setMaximumSize(int width, int height)
void setMinimumMargins(const QMargins &margins)
virtual void mouseMoveEvent(QMouseEvent *event)
Definition: qcustomplot.h:891
QRect rect() const
Definition: qcustomplot.h:842
QCP::MarginSides autoMargins() const
Definition: qcustomplot.h:846
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
QRect outerRect() const
Definition: qcustomplot.h:843
virtual void mousePressEvent(QMouseEvent *event)
Definition: qcustomplot.h:890
virtual void wheelEvent(QWheelEvent *event)
Definition: qcustomplot.h:894
void setOuterRect(const QRect &rect)
void setMarginGroup(QCP::MarginSides sides, QCPMarginGroup *group)
virtual void draw(QCPPainter *painter)
Definition: qcustomplot.h:900
virtual void parentPlotInitialized(QCustomPlot *parentPlot)
void setMinimumSize(const QSize &size)
QMargins minimumMargins() const
Definition: qcustomplot.h:845
QSize minimumSize() const
Definition: qcustomplot.h:847
virtual QList< QCPLayoutElement * > elements(bool recursive) const
void setMaximumSize(const QSize &size)
virtual int calculateAutoMargin(QCP::MarginSide side)
QHash< QCP::MarginSide, QCPMarginGroup * > marginGroups() const
Definition: qcustomplot.h:852
QCPMarginGroup * marginGroup(QCP::MarginSide side) const
Definition: qcustomplot.h:849
void setMinimumSize(int width, int height)
void setMargins(const QMargins &margins)
virtual void mouseDoubleClickEvent(QMouseEvent *event)
Definition: qcustomplot.h:893
virtual QSize minimumSizeHint() const
virtual QSize maximumSizeHint() const
void setAutoMargins(QCP::MarginSides sides)
virtual void update(UpdatePhase phase)
virtual void mouseReleaseEvent(QMouseEvent *event)
Definition: qcustomplot.h:892
virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const
Definition: qcustomplot.h:897
QMargins margins() const
Definition: qcustomplot.h:844
QSize maximumSize() const
Definition: qcustomplot.h:848
A layout that arranges child elements in a grid.
Definition: qcustomplot.h:1574
virtual void simplify()
virtual bool take(QCPLayoutElement *element)
int rowCount() const
int columnCount() const
void insertColumn(int newIndex)
void setRowStretchFactors(const QList< double > &factors)
virtual int elementCount() const
void setColumnSpacing(int pixels)
QCPLayoutElement * element(int row, int column) const
void insertRow(int newIndex)
void getMinimumRowColSizes(QVector< int > *minColWidths, QVector< int > *minRowHeights) const
int rowSpacing() const
Definition: qcustomplot.h:972
virtual QCPLayoutElement * elementAt(int index) const
void setColumnStretchFactors(const QList< double > &factors)
virtual QCPLayoutElement * takeAt(int index)
void setRowStretchFactor(int row, double factor)
void expandTo(int newRowCount, int newColumnCount)
QList< double > columnStretchFactors() const
Definition: qcustomplot.h:969
virtual void updateLayout()
void getMaximumRowColSizes(QVector< int > *maxColWidths, QVector< int > *maxRowHeights) const
QList< double > rowStretchFactors() const
Definition: qcustomplot.h:970
void setRowSpacing(int pixels)
bool hasElement(int row, int column)
virtual ~QCPLayoutGrid()
int columnSpacing() const
Definition: qcustomplot.h:971
bool addElement(int row, int column, QCPLayoutElement *element)
void setColumnStretchFactor(int column, double factor)
virtual QList< QCPLayoutElement * > elements(bool recursive) const
A layout that places child elements aligned to the border or arbitrarily positioned.
Definition: qcustomplot.h:1677
virtual bool take(QCPLayoutElement *element)
virtual int elementCount() const
virtual void updateLayout()
virtual ~QCPLayoutInset()
virtual QCPLayoutElement * elementAt(int index) const
virtual void simplify()
Definition: qcustomplot.h:1052
Qt::Alignment insetAlignment(int index) const
void setInsetAlignment(int index, Qt::Alignment alignment)
void setInsetPlacement(int index, InsetPlacement placement)
void addElement(QCPLayoutElement *element, const QRectF &rect)
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
void setInsetRect(int index, const QRectF &rect)
QRectF insetRect(int index) const
void addElement(QCPLayoutElement *element, Qt::Alignment alignment)
virtual QCPLayoutElement * takeAt(int index)
InsetPlacement insetPlacement(int index) const
The abstract base class for layouts.
Definition: qcustomplot.h:1532
void clear()
bool removeAt(int index)
virtual QList< QCPLayoutElement * > elements(bool recursive) const
virtual QCPLayoutElement * takeAt(int index)=0
void releaseElement(QCPLayoutElement *el)
virtual void update(UpdatePhase phase)
bool remove(QCPLayoutElement *element)
QVector< int > getSectionSizes(QVector< int > maxSizes, QVector< int > minSizes, QVector< double > stretchFactors, int totalSize) const
virtual QCPLayoutElement * elementAt(int index) const =0
virtual int elementCount() const =0
virtual bool take(QCPLayoutElement *element)=0
virtual void simplify()
void sizeConstraintsChanged() const
void adoptElement(QCPLayoutElement *el)
virtual void updateLayout()
Manages a legend inside a QCustomPlot.
Definition: qcustomplot.h:5605
int iconTextPadding() const
Definition: qcustomplot.h:2685
QPen getBorderPen() const
void clearItems()
bool removeItem(QCPAbstractLegendItem *item)
SelectableParts selectedParts() const
void setSelectedBorderPen(const QPen &pen)
void setIconBorderPen(const QPen &pen)
bool addItem(QCPAbstractLegendItem *item)
Q_SLOT void setSelectableParts(const SelectableParts &selectableParts)
QCPAbstractLegendItem * item(int index) const
QFont selectedFont() const
Definition: qcustomplot.h:2692
virtual void parentPlotInitialized(QCustomPlot *parentPlot)
virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const
void setBrush(const QBrush &brush)
bool hasItemWithPlottable(const QCPAbstractPlottable *plottable) const
QList< QCPAbstractLegendItem * > selectedItems() const
virtual void draw(QCPPainter *painter)
int itemCount() const
QPen iconBorderPen() const
Definition: qcustomplot.h:2686
void setIconTextPadding(int padding)
void setSelectedTextColor(const QColor &color)
QBrush selectedBrush() const
Definition: qcustomplot.h:2691
virtual QCP::Interaction selectionCategory() const
void selectionChanged(QCPLegend::SelectableParts parts)
void setBorderPen(const QPen &pen)
void setSelectedBrush(const QBrush &brush)
void selectableChanged(QCPLegend::SelectableParts parts)
void setIconSize(const QSize &size)
Q_SLOT void setSelectedParts(const SelectableParts &selectedParts)
void setIconSize(int width, int height)
void setFont(const QFont &font)
QColor textColor() const
Definition: qcustomplot.h:2683
QBrush brush() const
Definition: qcustomplot.h:2681
QBrush getBrush() const
void setSelectedFont(const QFont &font)
QColor selectedTextColor() const
Definition: qcustomplot.h:2693
virtual void deselectEvent(bool *selectionStateChanged)
bool removeItem(int index)
SelectableParts selectableParts() const
Definition: qcustomplot.h:2687
bool hasItem(QCPAbstractLegendItem *item) const
virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged)
QPen selectedIconBorderPen() const
Definition: qcustomplot.h:2690
QPen selectedBorderPen() const
Definition: qcustomplot.h:2689
void setSelectedIconBorderPen(const QPen &pen)
void setTextColor(const QColor &color)
QFont font() const
Definition: qcustomplot.h:2682
QSize iconSize() const
Definition: qcustomplot.h:2684
QCPPlottableLegendItem * itemWithPlottable(const QCPAbstractPlottable *plottable) const
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
Handles the different ending decorations for line-like items.
Definition: qcustomplot.h:1738
EndingStyle style() const
Definition: qcustomplot.h:1122
double boundingDistance() const
bool inverted() const
Definition: qcustomplot.h:1125
void setWidth(double width)
void setStyle(EndingStyle style)
void setInverted(bool inverted)
QCPLineEnding(EndingStyle style, double width=8, double length=10, bool inverted=false)
double realLength() const
void setLength(double length)
double width() const
Definition: qcustomplot.h:1123
double length() const
Definition: qcustomplot.h:1124
A margin group allows synchronization of margin sides if working with multiple layout elements.
Definition: qcustomplot.h:1378
void removeChild(QCP::MarginSide side, QCPLayoutElement *element)
QList< QCPLayoutElement * > elements(QCP::MarginSide side) const
Definition: qcustomplot.h:787
QCPMarginGroup(QCustomPlot *parentPlot)
void addChild(QCP::MarginSide side, QCPLayoutElement *element)
bool isEmpty() const
int commonMargin(QCP::MarginSide side) const
QPainter subclass used internally.
Definition: qcustomplot.h:637
bool begin(QPaintDevice *device)
void drawLine(const QLineF &line)
void setPen(Qt::PenStyle penStyle)
void setPen(const QColor &color)
void setModes(PainterModes modes)
void restore()
void makeNonCosmetic()
void save()
void setAntialiasing(bool enabled)
void drawLine(const QPointF &p1, const QPointF &p2)
Definition: qcustomplot.h:511
PainterModes modes() const
Definition: qcustomplot.h:497
void setMode(PainterMode mode, bool enabled=true)
void setPen(const QPen &pen)
A layout element displaying a plot title text.
Definition: qcustomplot.h:2773
QString mText
Definition: qcustomplot.h:2820
QColor textColor() const
Definition: qcustomplot.h:2794
QFont font() const
Definition: qcustomplot.h:2793
void selectionChanged(bool selected)
QFont selectedFont() const
Definition: qcustomplot.h:2795
QColor mTextColor
Definition: qcustomplot.h:2822
void selectableChanged(bool selectable)
bool selected() const
Definition: qcustomplot.h:2798
QRect mTextBoundingRect
Definition: qcustomplot.h:2825
QColor mSelectedTextColor
Definition: qcustomplot.h:2824
QFont mSelectedFont
Definition: qcustomplot.h:2823
QString text() const
Definition: qcustomplot.h:2792
bool selectable() const
Definition: qcustomplot.h:2797
QColor selectedTextColor() const
Definition: qcustomplot.h:2796
A legend item representing a plottable with an icon and the plottable name.
Definition: qcustomplot.h:5583
virtual void draw(QCPPainter *painter)
QColor getTextColor() const
QFont getFont() const
QCPPlottableLegendItem(QCPLegend *parent, QCPAbstractPlottable *plottable)
QCPAbstractPlottable * plottable()
Definition: qcustomplot.h:2619
QPen getIconBorderPen() const
Represents the range an axis is encompassing.
Definition: qcustomplot.h:975
void expand(const QCPRange &otherRange)
QCPRange(double lower, double upper)
QCPRange & operator*=(const double &value)
Definition: qcustomplot.h:669
QCPRange & operator-=(const double &value)
Definition: qcustomplot.h:664
static bool validRange(const QCPRange &range)
QCPRange sanitizedForLogScale() const
bool operator!=(const QCPRange &other) const
Definition: qcustomplot.h:657
static bool validRange(double lower, double upper)
double size() const
QCPRange sanitizedForLinScale() const
QCPRange & operator/=(const double &value)
Definition: qcustomplot.h:674
QCPRange expanded(const QCPRange &otherRange) const
bool operator==(const QCPRange &other) const
Definition: qcustomplot.h:654
double lower
Definition: qcustomplot.h:977
QCPRange & operator+=(const double &value)
Definition: qcustomplot.h:659
double upper
Definition: qcustomplot.h:977
bool contains(double value) const
double center() const
void normalize()
Represents the visual appearance of scatter points.
Definition: qcustomplot.h:2695
QCPScatterStyle(ScatterShape shape, double size=6)
double size() const
Definition: qcustomplot.h:427
bool isPenDefined() const
Definition: qcustomplot.h:444
void setPixmap(const QPixmap &pixmap)
QCPScatterStyle(const QPixmap &pixmap)
QCPScatterStyle(ScatterShape shape, const QColor &color, const QColor &fill, double size)
bool isNone() const
Definition: qcustomplot.h:443
void setBrush(const QBrush &brush)
void setPen(const QPen &pen)
void setShape(ScatterShape shape)
QCPScatterStyle(ScatterShape shape, const QPen &pen, const QBrush &brush, double size)
QCPScatterStyle(const QPainterPath &customPath, const QPen &pen, const QBrush &brush=Qt::NoBrush, double size=6)
void drawShape(QCPPainter *painter, double x, double y) const
void setCustomPath(const QPainterPath &customPath)
QPixmap pixmap() const
Definition: qcustomplot.h:431
void setSize(double size)
QPen pen() const
Definition: qcustomplot.h:429
QBrush brush() const
Definition: qcustomplot.h:430
QPainterPath customPath() const
Definition: qcustomplot.h:432
ScatterShape shape() const
Definition: qcustomplot.h:428
QCPScatterStyle(ScatterShape shape, const QColor &color, double size)
void applyTo(QCPPainter *painter, const QPen &defaultPen) const
A plottable representing a single statistical box in a plot.
Definition: qcustomplot.h:6605
double key() const
Definition: qcustomplot.h:3537
QVector< double > outliers() const
Definition: qcustomplot.h:3543
void setWidth(double width)
QVector< double > mOutliers
Definition: qcustomplot.h:3580
QPen whiskerBarPen() const
Definition: qcustomplot.h:3547
void setWhiskerPen(const QPen &pen)
double maximum() const
Definition: qcustomplot.h:3542
QPen whiskerPen() const
Definition: qcustomplot.h:3546
void setMedianPen(const QPen &pen)
QCPStatisticalBox(QCPAxis *keyAxis, QCPAxis *valueAxis)
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
void setWhiskerBarPen(const QPen &pen)
double whiskerWidth() const
Definition: qcustomplot.h:3545
double minimum() const
Definition: qcustomplot.h:3538
double median() const
Definition: qcustomplot.h:3540
void setOutlierStyle(const QCPScatterStyle &style)
void setWhiskerWidth(double width)
double width() const
Definition: qcustomplot.h:3544
QCPScatterStyle outlierStyle() const
Definition: qcustomplot.h:3549
QPen medianPen() const
Definition: qcustomplot.h:3548
virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const
virtual void draw(QCPPainter *painter)
double lowerQuartile() const
Definition: qcustomplot.h:3539
double upperQuartile() const
Definition: qcustomplot.h:3541
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)
void drawBackground(QCPPainter *painter)
void beforeReplot()
QCPGraph * graph() const
void setBackground(const QPixmap &pm)
int itemCount() const
QRect viewport() const
Definition: qcustomplot.h:2075
void toPainter(QCPPainter *painter, int width=0, int height=0)
void titleClick(QMouseEvent *event, QCPPlotTitle *title)
bool setCurrentLayer(QCPLayer *layer)
virtual void legendRemoved(QCPLegend *legend)
Qt::KeyboardModifier multiSelectModifier() const
Definition: qcustomplot.h:2093
const QCP::Interactions interactions() const
Definition: qcustomplot.h:2089
QPointer< QCPLayoutElement > mMouseEventElement
Definition: qcustomplot.h:2282
QCPLayerable * layerableAt(const QPointF &pos, bool onlySelectable, QVariant *selectionDetails=0) const
void setBackgroundScaled(bool scaled)
Q_SLOT void deselectAll()
void setPlottingHint(QCP::PlottingHint hint, bool enabled=true)
virtual void mouseDoubleClickEvent(QMouseEvent *event)
QList< QCPGraph * > selectedGraphs() const
void setViewport(const QRect &rect)
bool removeLayer(QCPLayer *layer)
void setInteraction(const QCP::Interaction &interaction, bool enabled=true)
virtual void mousePressEvent(QMouseEvent *event)
QCustomPlot(QWidget *parent=0)
void setBackgroundScaledMode(Qt::AspectRatioMode mode)
void setSelectionTolerance(int pixels)
QCPAbstractItem * item() const
void selectionChangedByUser()
int selectionTolerance() const
Definition: qcustomplot.h:2090
virtual void paintEvent(QPaintEvent *event)
void plottableClick(QCPAbstractPlottable *plottable, QMouseEvent *event)
QPixmap background() const
Definition: qcustomplot.h:2076
QCPLayer * layer(const QString &name) const
int graphCount() const
void setInteractions(const QCP::Interactions &interactions)
int plottableCount() const
virtual void mouseReleaseEvent(QMouseEvent *event)
QCP::AntialiasedElements antialiasedElements() const
Definition: qcustomplot.h:2082
QCPLayer * currentLayer() const
void axisDoubleClick(QCPAxis *axis, QCPAxis::SelectablePart part, QMouseEvent *event)
virtual ~QCustomPlot()
void afterReplot()
QList< QCPAbstractPlottable * > selectedPlottables() const
virtual QSize sizeHint() const
bool hasPlottable(QCPAbstractPlottable *plottable) const
bool setCurrentLayer(const QString &name)
virtual QSize minimumSizeHint() const
void mouseMove(QMouseEvent *event)
QPixmap mPaintBuffer
Definition: qcustomplot.h:2280
QCP::AntialiasedElements notAntialiasedElements() const
Definition: qcustomplot.h:2085
void setNoAntialiasingOnDrag(bool enabled)
void legendClick(QCPLegend *legend, QCPAbstractLegendItem *item, QMouseEvent *event)
virtual void wheelEvent(QWheelEvent *event)
void updateLayerIndices() const
QCPGraph * addGraph(QCPAxis *keyAxis=0, QCPAxis *valueAxis=0)
void setBackground(const QPixmap &pm, bool scaled, Qt::AspectRatioMode mode=Qt::KeepAspectRatioByExpanding)
QCPLayoutGrid * plotLayout() const
Definition: qcustomplot.h:2081
Q_SLOT void rescaleAxes(bool onlyVisiblePlottables=false)
void setBackground(const QBrush &brush)
virtual void draw(QCPPainter *painter)
int axisRectCount() const
void setMultiSelectModifier(Qt::KeyboardModifier modifier)
virtual void mouseMoveEvent(QMouseEvent *event)
bool removeGraph(QCPGraph *graph)
void setPlottingHints(const QCP::PlottingHints &hints)
bool removeGraph(int index)
int clearPlottables()
void mouseDoubleClick(QMouseEvent *event)
QList< QCPLegend * > selectedLegends() const
QPixmap toPixmap(int width=0, int height=0, double scale=1.0)
bool backgroundScaled() const
Definition: qcustomplot.h:2077
int clearGraphs()
QCPLayoutElement * layoutElementAt(const QPointF &pos) const
Q_SLOT void replot(QCustomPlot::RefreshPriority refreshPriority=QCustomPlot::rpHint)
QCPLayer * layer(int index) const
QList< QCPAxis * > selectedAxes() const
bool removeItem(int index)
int clearItems()
QCPAbstractItem * item(int index) const
void axisClick(QCPAxis *axis, QCPAxis::SelectablePart part, QMouseEvent *event)
virtual void resizeEvent(QResizeEvent *event)
QCPAbstractPlottable * plottableAt(const QPointF &pos, bool onlySelectable=false) const
QCPAbstractPlottable * plottable()
bool autoAddPlottableToLegend() const
Definition: qcustomplot.h:2088
QCP::PlottingHints plottingHints() const
Definition: qcustomplot.h:2092
void mouseWheel(QWheelEvent *event)
void itemDoubleClick(QCPAbstractItem *item, QMouseEvent *event)
void mouseRelease(QMouseEvent *event)
QCPAbstractItem * itemAt(const QPointF &pos, bool onlySelectable=false) const
bool noAntialiasingOnDrag() const
Definition: qcustomplot.h:2091
virtual void axisRemoved(QCPAxis *axis)
void mousePress(QMouseEvent *event)
QCPAbstractPlottable * plottable(int index)
void titleDoubleClick(QMouseEvent *event, QCPPlotTitle *title)
bool addLayer(const QString &name, QCPLayer *otherLayer=0, LayerInsertMode insertMode=limAbove)
QList< QCPAbstractItem * > selectedItems() const
void setAutoAddPlottableToLegend(bool on)
bool removeItem(QCPAbstractItem *item)
void setNotAntialiasedElements(const QCP::AntialiasedElements &notAntialiasedElements)
void itemClick(QCPAbstractItem *item, QMouseEvent *event)
bool moveLayer(QCPLayer *layer, QCPLayer *otherLayer, LayerInsertMode insertMode=limAbove)
QCPGraph * graph(int index) const
void setAntialiasedElement(QCP::AntialiasedElement antialiasedElement, bool enabled=true)
bool hasItem(QCPAbstractItem *item) const
QCPAxisRect * axisRect(int index=0) const
void plottableDoubleClick(QCPAbstractPlottable *plottable, QMouseEvent *event)
bool removePlottable(QCPAbstractPlottable *plottable)
void setAntialiasedElements(const QCP::AntialiasedElements &antialiasedElements)
QList< QCPAxisRect * > axisRects() const
Qt::AspectRatioMode backgroundScaledMode() const
Definition: qcustomplot.h:2078
int layerCount() const
bool removePlottable(int index)
void setNotAntialiasedElement(QCP::AntialiasedElement notAntialiasedElement, bool enabled=true)
Q_DECLARE_OPERATORS_FOR_FLAGS(ecvDisplayTools::INTERACTION_FLAGS)
Q_DECLARE_METATYPE(ccPclPluginInterface *)
GraphType data
Definition: graph_cut.cc:138
QMapIterator< double, QCPData > QCPDataMapIterator
Definition: qcustomplot.h:2970
QMap< double, QCPCurveData > QCPCurveDataMap
Definition: qcustomplot.h:3203
QMutableMapIterator< double, QCPData > QCPDataMutableMapIterator
Definition: qcustomplot.h:2971
#define QCP_LIB_DECL
Definition: qcustomplot.h:122
QMutableMapIterator< double, QCPBarData > QCPBarDataMutableMapIterator
Definition: qcustomplot.h:3415
QMap< double, QCPFinancialData > QCPFinancialDataMap
Definition: qcustomplot.h:3761
QMap< double, QCPData > QCPDataMap
Definition: qcustomplot.h:2969
QMap< double, QCPBarData > QCPBarDataMap
Definition: qcustomplot.h:3413
QMutableMapIterator< double, QCPFinancialData > QCPFinancialDataMutableMapIterator
Definition: qcustomplot.h:3764
QMapIterator< double, QCPFinancialData > QCPFinancialDataMapIterator
Definition: qcustomplot.h:3762
QMutableMapIterator< double, QCPCurveData > QCPCurveDataMutableMapIterator
Definition: qcustomplot.h:3206
QMapIterator< double, QCPBarData > QCPBarDataMapIterator
Definition: qcustomplot.h:3414
QMapIterator< double, QCPCurveData > QCPCurveDataMapIterator
Definition: qcustomplot.h:3204
normal_z y
normal_z x
normal_z z
bool isInvalidData(double value)
Definition: qcustomplot.h:425
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
@ phCacheLabels
Definition: qcustomplot.h:308
@ phNone
0x000 No hints are set
Definition: qcustomplot.h:289
@ phForceRepaint
Definition: qcustomplot.h:214
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
AntialiasedElement
Definition: qcustomplot.h:249
@ aeAxes
0x0001 Axis base line and tick marks
Definition: qcustomplot.h:250
@ aeItems
0x0040 Main lines of items
Definition: qcustomplot.h:262
@ aeScatters
Definition: qcustomplot.h:264
@ aeLegendItems
0x0010 Legend items
Definition: qcustomplot.h:258
@ aeErrorBars
0x0100 Error bars
Definition: qcustomplot.h:186
@ 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
@ 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)