Vespucci  1.0.0
qcustomplot.h
Go to the documentation of this file.
1 /***************************************************************
2  * Vespucci-QCP, a very very minor modification to QCustomPlot *
3  * Modifications as noted in text (C) 2014 Daniel Foose *
4  * QCP IP notice repeated verbatim below *
5  * *************************************************************/
6 /***************************************************************************
7 ** **
8 ** QCustomPlot, an easy to use, modern plotting widget for Qt **
9 ** Copyright (C) 2011, 2012, 2013, 2014 Emanuel Eichhammer **
10 ** **
11 ** This program is free software: you can redistribute it and/or modify **
12 ** it under the terms of the GNU General Public License as published by **
13 ** the Free Software Foundation, either version 3 of the License, or **
14 ** (at your option) any later version. **
15 ** **
16 ** This program is distributed in the hope that it will be useful, **
17 ** but WITHOUT ANY WARRANTY; without even the implied warranty of **
18 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the **
19 ** GNU General Public License for more details. **
20 ** **
21 ** You should have received a copy of the GNU General Public License **
22 ** along with this program. If not, see http://www.gnu.org/licenses/. **
23 ** **
24 ****************************************************************************
25 ** Author: Emanuel Eichhammer **
26 ** Website/Contact: http://www.qcustomplot.com/ **
27 ** Date: 27.12.14 **
28 ** Version: 1.3.0 **
29 ****************************************************************************/
30 
31 #ifndef QCUSTOMPLOT_H
32 #define QCUSTOMPLOT_H
33 
34 #include <QObject>
35 #include <QPointer>
36 #include <QWidget>
37 #include <QPainter>
38 #include <QPaintEvent>
39 #include <QMouseEvent>
40 #include <QPixmap>
41 #include <QVector>
42 #include <QString>
43 #include <QDateTime>
44 #include <QMultiMap>
45 #include <QFlags>
46 #include <QDebug>
47 #include <QVector2D>
48 #include <QStack>
49 #include <QCache>
50 #include <QMargins>
51 #include <qmath.h>
52 #include <limits>
53 #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
54 # include <qnumeric.h>
55 # include <QPrinter>
56 # include <QPrintEngine>
57 #else
58 # include <QtNumeric>
59 # include <QtPrintSupport>
60 #endif
61 
62 class QCPPainter;
63 class QCustomPlot;
64 class QCPLayerable;
65 class QCPLayoutElement;
66 class QCPLayout;
67 class QCPAxis;
68 class QCPAxisRect;
71 class QCPGraph;
72 class QCPAbstractItem;
73 class QCPItemPosition;
74 class QCPLayer;
75 class QCPPlotTitle;
76 class QCPLegend;
78 class QCPColorMap;
79 class QCPColorScale;
80 class QCPBars;
81 
82 
86 // decl definitions for shared library compilation/usage:
87 #if defined(QCUSTOMPLOT_COMPILE_LIBRARY)
88 # define QCP_LIB_DECL Q_DECL_EXPORT
89 #elif defined(QCUSTOMPLOT_USE_LIBRARY)
90 # define QCP_LIB_DECL Q_DECL_IMPORT
91 #else
92 # define QCP_LIB_DECL
93 #endif
94 
98 namespace QCP
99 {
105 enum MarginSide { msLeft = 0x01
106  ,msRight = 0x02
107  ,msTop = 0x04
108  ,msBottom = 0x08
109  ,msAll = 0xFF
110  ,msNone = 0x00
111  };
112 Q_DECLARE_FLAGS(MarginSides, MarginSide)
113 
114 
123 enum AntialiasedElement { aeAxes = 0x0001
124  ,aeGrid = 0x0002
125  ,aeSubGrid = 0x0004
126  ,aeLegend = 0x0008
127  ,aeLegendItems = 0x0010
128  ,aePlottables = 0x0020
129  ,aeItems = 0x0040
130  ,aeScatters = 0x0080
131  ,aeErrorBars = 0x0100
132  ,aeFills = 0x0200
133  ,aeZeroLine = 0x0400
134  ,aeAll = 0xFFFF
135  ,aeNone = 0x0000
136  };
137 Q_DECLARE_FLAGS(AntialiasedElements, AntialiasedElement)
138 
139 
144 enum PlottingHint { phNone = 0x000
145  ,phFastPolylines = 0x001
146  ,phForceRepaint = 0x002
148  ,phCacheLabels = 0x004
150  };
151 Q_DECLARE_FLAGS(PlottingHints, PlottingHint)
152 
153 
160 enum Interaction { iRangeDrag = 0x001
161  ,iRangeZoom = 0x002
162  ,iMultiSelect = 0x004
164  ,iSelectAxes = 0x010
165  ,iSelectLegend = 0x020
166  ,iSelectItems = 0x040
167  ,iSelectOther = 0x080
168  };
169 Q_DECLARE_FLAGS(Interactions, Interaction)
170 
171 
177 inline bool isInvalidData(double value)
178 {
179  return qIsNaN(value) || qIsInf(value);
180 }
181 
187 inline bool isInvalidData(double value1, double value2)
188 {
189  return isInvalidData(value1) || isInvalidData(value2);
190 }
191 
198 inline void setMarginValue(QMargins &margins, QCP::MarginSide side, int value)
199 {
200  switch (side)
201  {
202  case QCP::msLeft: margins.setLeft(value); break;
203  case QCP::msRight: margins.setRight(value); break;
204  case QCP::msTop: margins.setTop(value); break;
205  case QCP::msBottom: margins.setBottom(value); break;
206  case QCP::msAll: margins = QMargins(value, value, value, value); break;
207  default: break;
208  }
209 }
210 
218 inline int getMarginValue(const QMargins &margins, QCP::MarginSide side)
219 {
220  switch (side)
221  {
222  case QCP::msLeft: return margins.left();
223  case QCP::msRight: return margins.right();
224  case QCP::msTop: return margins.top();
225  case QCP::msBottom: return margins.bottom();
226  default: break;
227  }
228  return 0;
229 }
230 
231 } // end of namespace QCP
232 
233 Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::AntialiasedElements)
234 Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::PlottingHints)
235 Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::MarginSides)
236 Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::Interactions)
237 
238 
240 {
241  Q_GADGET
242 public:
250  Q_ENUMS(ScatterShape)
251  enum ScatterShape { ssNone
252  ,ssDot
253  ,ssCross
254  ,ssPlus
255  ,ssCircle
256  ,ssDisc
257  ,ssSquare
258  ,ssDiamond
259  ,ssStar
260  ,ssTriangle
261  ,ssTriangleInverted
262  ,ssCrossSquare
263  ,ssPlusSquare
264  ,ssCrossCircle
265  ,ssPlusCircle
266  ,ssPeace
267  ,ssPixmap
268  ,ssCustom
269  };
270 
271  QCPScatterStyle();
272  QCPScatterStyle(ScatterShape shape, double size=6);
273  QCPScatterStyle(ScatterShape shape, const QColor &color, double size);
274  QCPScatterStyle(ScatterShape shape, const QColor &color, const QColor &fill, double size);
275  QCPScatterStyle(ScatterShape shape, const QPen &pen, const QBrush &brush, double size);
276  QCPScatterStyle(const QPixmap &pixmap);
277  QCPScatterStyle(const QPainterPath &customPath, const QPen &pen, const QBrush &brush=Qt::NoBrush, double size=6);
278 
279  // getters:
280  double size() const { return mSize; }
281  ScatterShape shape() const { return mShape; }
282  QPen pen() const { return mPen; }
283  QBrush brush() const { return mBrush; }
284  QPixmap pixmap() const { return mPixmap; }
285  QPainterPath customPath() const { return mCustomPath; }
286 
287  // setters:
288  void setSize(double size);
289  void setShape(ScatterShape shape);
290  void setPen(const QPen &pen);
291  void setBrush(const QBrush &brush);
292  void setPixmap(const QPixmap &pixmap);
293  void setCustomPath(const QPainterPath &customPath);
294 
295  // non-property methods:
296  bool isNone() const { return mShape == ssNone; }
297  bool isPenDefined() const { return mPenDefined; }
298  void applyTo(QCPPainter *painter, const QPen &defaultPen) const;
299  void drawShape(QCPPainter *painter, QPointF pos) const;
300  void drawShape(QCPPainter *painter, double x, double y) const;
301 
302 protected:
303  // property members:
304  double mSize;
306  QPen mPen;
307  QBrush mBrush;
308  QPixmap mPixmap;
309  QPainterPath mCustomPath;
310 
311  // non-property members:
313 };
314 Q_DECLARE_TYPEINFO(QCPScatterStyle, Q_MOVABLE_TYPE);
315 
316 
317 class QCP_LIB_DECL QCPPainter : public QPainter
318 {
319  Q_GADGET
320 public:
325  enum PainterMode { pmDefault = 0x00
326  ,pmVectorized = 0x01
327  ,pmNoCaching = 0x02
328  ,pmNonCosmetic = 0x04
329  };
330  Q_FLAGS(PainterMode PainterModes)
331  Q_DECLARE_FLAGS(PainterModes, PainterMode)
332 
333  QCPPainter();
334  QCPPainter(QPaintDevice *device);
335  ~QCPPainter();
336 
337  // getters:
338  bool antialiasing() const { return testRenderHint(QPainter::Antialiasing); }
339  PainterModes modes() const { return mModes; }
340 
341  // setters:
342  void setAntialiasing(bool enabled);
343  void setMode(PainterMode mode, bool enabled=true);
344  void setModes(PainterModes modes);
345 
346  // methods hiding non-virtual base class functions (QPainter bug workarounds):
347  bool begin(QPaintDevice *device);
348  void setPen(const QPen &pen);
349  void setPen(const QColor &color);
350  void setPen(Qt::PenStyle penStyle);
351  void drawLine(const QLineF &line);
352  void drawLine(const QPointF &p1, const QPointF &p2) {drawLine(QLineF(p1, p2));}
353  void save();
354  void restore();
355 
356  // non-virtual methods:
357  void makeNonCosmetic();
358 
359 protected:
360  // property members:
361  PainterModes mModes;
363 
364  // non-property members:
365  QStack<bool> mAntialiasingStack;
366 };
367 Q_DECLARE_OPERATORS_FOR_FLAGS(QCPPainter::PainterModes)
368 
369 
370 class QCP_LIB_DECL QCPLayer : public QObject
371 {
372  Q_OBJECT
374  Q_PROPERTY(QCustomPlot* parentPlot READ parentPlot)
375  Q_PROPERTY(QString name READ name)
376  Q_PROPERTY(int index READ index)
377  Q_PROPERTY(QList<QCPLayerable*> children READ children)
378  Q_PROPERTY(bool visible READ visible WRITE setVisible)
380 public:
381  QCPLayer(QCustomPlot* parentPlot, const QString &layerName);
382  ~QCPLayer();
383 
384  // getters:
385  QCustomPlot *parentPlot() const { return mParentPlot; }
386  QString name() const { return mName; }
387  int index() const { return mIndex; }
388  QList<QCPLayerable*> children() const { return mChildren; }
389  bool visible() const { return mVisible; }
390 
391  // setters:
392  void setVisible(bool visible);
393 
394 protected:
395  // property members:
397  QString mName;
398  int mIndex;
399  QList<QCPLayerable*> mChildren;
400  bool mVisible;
401 
402  // non-virtual methods:
403  void addChild(QCPLayerable *layerable, bool prepend);
404  void removeChild(QCPLayerable *layerable);
405 
406 private:
407  Q_DISABLE_COPY(QCPLayer)
408 
409  friend class QCustomPlot;
410  friend class QCPLayerable;
411 };
412 
413 class QCP_LIB_DECL QCPLayerable : public QObject
414 {
415  Q_OBJECT
417  Q_PROPERTY(bool visible READ visible WRITE setVisible)
418  Q_PROPERTY(QCustomPlot* parentPlot READ parentPlot)
419  Q_PROPERTY(QCPLayerable* parentLayerable READ parentLayerable)
420  Q_PROPERTY(QCPLayer* layer READ layer WRITE setLayer NOTIFY layerChanged)
421  Q_PROPERTY(bool antialiased READ antialiased WRITE setAntialiased)
423 public:
424  QCPLayerable(QCustomPlot *plot, QString targetLayer=QString(), QCPLayerable *parentLayerable=0);
425  ~QCPLayerable();
426 
427  // getters:
428  bool visible() const { return mVisible; }
429  QCustomPlot *parentPlot() const { return mParentPlot; }
430  QCPLayerable *parentLayerable() const { return mParentLayerable.data(); }
431  QCPLayer *layer() const { return mLayer; }
432  bool antialiased() const { return mAntialiased; }
433 
434  // setters:
435  void setVisible(bool on);
436  Q_SLOT bool setLayer(QCPLayer *layer);
437  bool setLayer(const QString &layerName);
438  void setAntialiased(bool enabled);
439 
440  // introduced virtual methods:
441  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;
442 
443  // non-property methods:
444  bool realVisibility() const;
445 
446 signals:
447  void layerChanged(QCPLayer *newLayer);
448 
449 protected:
450  // property members:
451  bool mVisible;
452  QCustomPlot *mParentPlot;
453  QPointer<QCPLayerable> mParentLayerable;
456 
457  // introduced virtual methods:
458  virtual void parentPlotInitialized(QCustomPlot *parentPlot);
459  virtual QCP::Interaction selectionCategory() const;
460  virtual QRect clipRect() const;
461  virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const = 0;
462  virtual void draw(QCPPainter *painter) = 0;
463  // events:
464  virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged);
465  virtual void deselectEvent(bool *selectionStateChanged);
466 
467  // non-property methods:
468  void initializeParentPlot(QCustomPlot *parentPlot);
469  void setParentLayerable(QCPLayerable* parentLayerable);
470  bool moveToLayer(QCPLayer *layer, bool prepend);
471  void applyAntialiasingHint(QCPPainter *painter, bool localAntialiased, QCP::AntialiasedElement overrideElement) const;
472 
473 private:
474  Q_DISABLE_COPY(QCPLayerable)
475 
476  friend class QCustomPlot;
477  friend class QCPAxisRect;
478 };
479 
480 
482 {
483 public:
484  double lower, upper;
485 
486  QCPRange();
487  QCPRange(double lower, double upper);
488 
489  bool operator==(const QCPRange& other) const { return lower == other.lower && upper == other.upper; }
490  bool operator!=(const QCPRange& other) const { return !(*this == other); }
491 
492  QCPRange &operator+=(const double& value) { lower+=value; upper+=value; return *this; }
493  QCPRange &operator-=(const double& value) { lower-=value; upper-=value; return *this; }
494  QCPRange &operator*=(const double& value) { lower*=value; upper*=value; return *this; }
495  QCPRange &operator/=(const double& value) { lower/=value; upper/=value; return *this; }
496  friend inline const QCPRange operator+(const QCPRange&, double);
497  friend inline const QCPRange operator+(double, const QCPRange&);
498  friend inline const QCPRange operator-(const QCPRange& range, double value);
499  friend inline const QCPRange operator*(const QCPRange& range, double value);
500  friend inline const QCPRange operator*(double value, const QCPRange& range);
501  friend inline const QCPRange operator/(const QCPRange& range, double value);
502 
503  double size() const;
504  double center() const;
505  void normalize();
506  void expand(const QCPRange &otherRange);
507  QCPRange expanded(const QCPRange &otherRange) const;
508  QCPRange sanitizedForLogScale() const;
509  QCPRange sanitizedForLinScale() const;
510  bool contains(double value) const;
511 
512  static bool validRange(double lower, double upper);
513  static bool validRange(const QCPRange &range);
514  static const double minRange; //1e-280;
515  static const double maxRange; //1e280;
516 
517 };
518 Q_DECLARE_TYPEINFO(QCPRange, Q_MOVABLE_TYPE);
519 
520 /* documentation of inline functions */
521 
542 /* end documentation of inline functions */
543 
547 inline const QCPRange operator+(const QCPRange& range, double value)
548 {
549  QCPRange result(range);
550  result += value;
551  return result;
552 }
553 
557 inline const QCPRange operator+(double value, const QCPRange& range)
558 {
559  QCPRange result(range);
560  result += value;
561  return result;
562 }
563 
567 inline const QCPRange operator-(const QCPRange& range, double value)
568 {
569  QCPRange result(range);
570  result -= value;
571  return result;
572 }
573 
577 inline const QCPRange operator*(const QCPRange& range, double value)
578 {
579  QCPRange result(range);
580  result *= value;
581  return result;
582 }
583 
587 inline const QCPRange operator*(double value, const QCPRange& range)
588 {
589  QCPRange result(range);
590  result *= value;
591  return result;
592 }
593 
597 inline const QCPRange operator/(const QCPRange& range, double value)
598 {
599  QCPRange result(range);
600  result /= value;
601  return result;
602 }
603 
604 
605 class QCP_LIB_DECL QCPMarginGroup : public QObject
606 {
607  Q_OBJECT
608 public:
609  QCPMarginGroup(QCustomPlot *parentPlot);
610  ~QCPMarginGroup();
611 
612  // non-virtual methods:
613  QList<QCPLayoutElement*> elements(QCP::MarginSide side) const { return mChildren.value(side); }
614  bool isEmpty() const;
615  void clear();
616 
617 protected:
618  // non-property members:
619  QCustomPlot *mParentPlot;
620  QHash<QCP::MarginSide, QList<QCPLayoutElement*> > mChildren;
621 
622  // non-virtual methods:
623  int commonMargin(QCP::MarginSide side) const;
624  void addChild(QCP::MarginSide side, QCPLayoutElement *element);
625  void removeChild(QCP::MarginSide side, QCPLayoutElement *element);
626 
627 private:
628  Q_DISABLE_COPY(QCPMarginGroup)
629 
630  friend class QCPLayoutElement;
631 };
632 
633 
634 class QCP_LIB_DECL QCPLayoutElement : public QCPLayerable
635 {
636  Q_OBJECT
638  Q_PROPERTY(QCPLayout* layout READ layout)
639  Q_PROPERTY(QRect rect READ rect)
640  Q_PROPERTY(QRect outerRect READ outerRect WRITE setOuterRect)
641  Q_PROPERTY(QMargins margins READ margins WRITE setMargins)
642  Q_PROPERTY(QMargins minimumMargins READ minimumMargins WRITE setMinimumMargins)
643  Q_PROPERTY(QSize minimumSize READ minimumSize WRITE setMinimumSize)
644  Q_PROPERTY(QSize maximumSize READ maximumSize WRITE setMaximumSize)
646 public:
651  enum UpdatePhase { upPreparation
652  ,upMargins
653  ,upLayout
654  };
655  Q_ENUMS(UpdatePhase)
656 
657  explicit QCPLayoutElement(QCustomPlot *parentPlot=0);
658  virtual ~QCPLayoutElement();
659 
660  // getters:
661  QCPLayout *layout() const { return mParentLayout; }
662  QRect rect() const { return mRect; }
663  QRect outerRect() const { return mOuterRect; }
664  QMargins margins() const { return mMargins; }
665  QMargins minimumMargins() const { return mMinimumMargins; }
666  QCP::MarginSides autoMargins() const { return mAutoMargins; }
667  QSize minimumSize() const { return mMinimumSize; }
668  QSize maximumSize() const { return mMaximumSize; }
669  QCPMarginGroup *marginGroup(QCP::MarginSide side) const { return mMarginGroups.value(side, (QCPMarginGroup*)0); }
670  QHash<QCP::MarginSide, QCPMarginGroup*> marginGroups() const { return mMarginGroups; }
671 
672  // setters:
673  void setOuterRect(const QRect &rect);
674  void setMargins(const QMargins &margins);
675  void setMinimumMargins(const QMargins &margins);
676  void setAutoMargins(QCP::MarginSides sides);
677  void setMinimumSize(const QSize &size);
678  void setMinimumSize(int width, int height);
679  void setMaximumSize(const QSize &size);
680  void setMaximumSize(int width, int height);
681  void setMarginGroup(QCP::MarginSides sides, QCPMarginGroup *group);
682 
683  // introduced virtual methods:
684  virtual void update(UpdatePhase phase);
685  virtual QSize minimumSizeHint() const;
686  virtual QSize maximumSizeHint() const;
687  virtual QList<QCPLayoutElement*> elements(bool recursive) const;
688 
689  // reimplemented virtual methods:
690  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;
691 
692 protected:
693  // property members:
695  QSize mMinimumSize, mMaximumSize;
696  QRect mRect, mOuterRect;
697  QMargins mMargins, mMinimumMargins;
698  QCP::MarginSides mAutoMargins;
699  QHash<QCP::MarginSide, QCPMarginGroup*> mMarginGroups;
700 
701  // introduced virtual methods:
702  virtual int calculateAutoMargin(QCP::MarginSide side);
703  // events:
704  virtual void mousePressEvent(QMouseEvent *event) {Q_UNUSED(event)}
705  virtual void mouseMoveEvent(QMouseEvent *event) {Q_UNUSED(event)}
706  virtual void mouseReleaseEvent(QMouseEvent *event) {Q_UNUSED(event)}
707  virtual void mouseDoubleClickEvent(QMouseEvent *event) {Q_UNUSED(event)}
708  virtual void wheelEvent(QWheelEvent *event) {Q_UNUSED(event)}
709 
710  // reimplemented virtual methods:
711  virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const { Q_UNUSED(painter) }
712  virtual void draw(QCPPainter *painter) { Q_UNUSED(painter) }
713  virtual void parentPlotInitialized(QCustomPlot *parentPlot);
714 
715 private:
716  Q_DISABLE_COPY(QCPLayoutElement)
717 
718  friend class QCustomPlot;
719  friend class QCPLayout;
720  friend class QCPMarginGroup;
721 };
722 
723 
724 class QCP_LIB_DECL QCPLayout : public QCPLayoutElement
725 {
726  Q_OBJECT
727 public:
728  explicit QCPLayout();
729 
730  // reimplemented virtual methods:
731  virtual void update(UpdatePhase phase);
732  virtual QList<QCPLayoutElement*> elements(bool recursive) const;
733 
734  // introduced virtual methods:
735  virtual int elementCount() const = 0;
736  virtual QCPLayoutElement* elementAt(int index) const = 0;
737  virtual QCPLayoutElement* takeAt(int index) = 0;
738  virtual bool take(QCPLayoutElement* element) = 0;
739  virtual void simplify();
740 
741  // non-virtual methods:
742  bool removeAt(int index);
743  bool remove(QCPLayoutElement* element);
744  void clear();
745 
746 protected:
747  // introduced virtual methods:
748  virtual void updateLayout();
749 
750  // non-virtual methods:
751  void sizeConstraintsChanged() const;
752  void adoptElement(QCPLayoutElement *el);
753  void releaseElement(QCPLayoutElement *el);
754  QVector<int> getSectionSizes(QVector<int> maxSizes, QVector<int> minSizes, QVector<double> stretchFactors, int totalSize) const;
755 
756 private:
757  Q_DISABLE_COPY(QCPLayout)
758  friend class QCPLayoutElement;
759 };
760 
761 
762 class QCP_LIB_DECL QCPLayoutGrid : public QCPLayout
763 {
764  Q_OBJECT
766  Q_PROPERTY(int rowCount READ rowCount)
767  Q_PROPERTY(int columnCount READ columnCount)
768  Q_PROPERTY(QList<double> columnStretchFactors READ columnStretchFactors WRITE setColumnStretchFactors)
769  Q_PROPERTY(QList<double> rowStretchFactors READ rowStretchFactors WRITE setRowStretchFactors)
770  Q_PROPERTY(int columnSpacing READ columnSpacing WRITE setColumnSpacing)
771  Q_PROPERTY(int rowSpacing READ rowSpacing WRITE setRowSpacing)
773 public:
774  explicit QCPLayoutGrid();
775  virtual ~QCPLayoutGrid();
776 
777  // getters:
778  int rowCount() const;
779  int columnCount() const;
780  QList<double> columnStretchFactors() const { return mColumnStretchFactors; }
781  QList<double> rowStretchFactors() const { return mRowStretchFactors; }
782  int columnSpacing() const { return mColumnSpacing; }
783  int rowSpacing() const { return mRowSpacing; }
784 
785  // setters:
786  void setColumnStretchFactor(int column, double factor);
787  void setColumnStretchFactors(const QList<double> &factors);
788  void setRowStretchFactor(int row, double factor);
789  void setRowStretchFactors(const QList<double> &factors);
790  void setColumnSpacing(int pixels);
791  void setRowSpacing(int pixels);
792 
793  // reimplemented virtual methods:
794  virtual void updateLayout();
795  virtual int elementCount() const;
796  virtual QCPLayoutElement* elementAt(int index) const;
797  virtual QCPLayoutElement* takeAt(int index);
798  virtual bool take(QCPLayoutElement* element);
799  virtual QList<QCPLayoutElement*> elements(bool recursive) const;
800  virtual void simplify();
801  virtual QSize minimumSizeHint() const;
802  virtual QSize maximumSizeHint() const;
803 
804  // non-virtual methods:
805  QCPLayoutElement *element(int row, int column) const;
806  bool addElement(int row, int column, QCPLayoutElement *element);
807  bool hasElement(int row, int column);
808  void expandTo(int newRowCount, int newColumnCount);
809  void insertRow(int newIndex);
810  void insertColumn(int newIndex);
811 
812 protected:
813  // property members:
814  QList<QList<QCPLayoutElement*> > mElements;
815  QList<double> mColumnStretchFactors;
816  QList<double> mRowStretchFactors;
817  int mColumnSpacing, mRowSpacing;
818 
819  // non-virtual methods:
820  void getMinimumRowColSizes(QVector<int> *minColWidths, QVector<int> *minRowHeights) const;
821  void getMaximumRowColSizes(QVector<int> *maxColWidths, QVector<int> *maxRowHeights) const;
822 
823 private:
824  Q_DISABLE_COPY(QCPLayoutGrid)
825 };
826 
827 
829 {
830  Q_OBJECT
831 public:
835  enum InsetPlacement { ipFree
836  ,ipBorderAligned
837  };
838 
839  explicit QCPLayoutInset();
840  virtual ~QCPLayoutInset();
841 
842  // getters:
843  InsetPlacement insetPlacement(int index) const;
844  Qt::Alignment insetAlignment(int index) const;
845  QRectF insetRect(int index) const;
846 
847  // setters:
848  void setInsetPlacement(int index, InsetPlacement placement);
849  void setInsetAlignment(int index, Qt::Alignment alignment);
850  void setInsetRect(int index, const QRectF &rect);
851 
852  // reimplemented virtual methods:
853  virtual void updateLayout();
854  virtual int elementCount() const;
855  virtual QCPLayoutElement* elementAt(int index) const;
856  virtual QCPLayoutElement* takeAt(int index);
857  virtual bool take(QCPLayoutElement* element);
858  virtual void simplify() {}
859  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;
860 
861  // non-virtual methods:
862  void addElement(QCPLayoutElement *element, Qt::Alignment alignment);
863  void addElement(QCPLayoutElement *element, const QRectF &rect);
864 
865 protected:
866  // property members:
867  QList<QCPLayoutElement*> mElements;
868  QList<InsetPlacement> mInsetPlacement;
869  QList<Qt::Alignment> mInsetAlignment;
870  QList<QRectF> mInsetRect;
871 
872 private:
873  Q_DISABLE_COPY(QCPLayoutInset)
874 };
875 
876 
878 {
879  Q_GADGET
880 public:
892  Q_ENUMS(EndingStyle)
893  enum EndingStyle { esNone
894  ,esFlatArrow
895  ,esSpikeArrow
896  ,esLineArrow
897  ,esDisc
898  ,esSquare
899  ,esDiamond
900  ,esBar
901  ,esHalfBar
902  ,esSkewedBar
903  };
904 
905  QCPLineEnding();
906  QCPLineEnding(EndingStyle style, double width=8, double length=10, bool inverted=false);
907 
908  // getters:
909  EndingStyle style() const { return mStyle; }
910  double width() const { return mWidth; }
911  double length() const { return mLength; }
912  bool inverted() const { return mInverted; }
913 
914  // setters:
915  void setStyle(EndingStyle style);
916  void setWidth(double width);
917  void setLength(double length);
918  void setInverted(bool inverted);
919 
920  // non-property methods:
921  double boundingDistance() const;
922  double realLength() const;
923  void draw(QCPPainter *painter, const QVector2D &pos, const QVector2D &dir) const;
924  void draw(QCPPainter *painter, const QVector2D &pos, double angle) const;
925 
926 protected:
927  // property members:
929  double mWidth, mLength;
930  bool mInverted;
931 };
932 Q_DECLARE_TYPEINFO(QCPLineEnding, Q_MOVABLE_TYPE);
933 
934 
935 class QCP_LIB_DECL QCPGrid :public QCPLayerable
936 {
937  Q_OBJECT
939  Q_PROPERTY(bool subGridVisible READ subGridVisible WRITE setSubGridVisible)
940  Q_PROPERTY(bool antialiasedSubGrid READ antialiasedSubGrid WRITE setAntialiasedSubGrid)
941  Q_PROPERTY(bool antialiasedZeroLine READ antialiasedZeroLine WRITE setAntialiasedZeroLine)
942  Q_PROPERTY(QPen pen READ pen WRITE setPen)
943  Q_PROPERTY(QPen subGridPen READ subGridPen WRITE setSubGridPen)
944  Q_PROPERTY(QPen zeroLinePen READ zeroLinePen WRITE setZeroLinePen)
946 public:
947  QCPGrid(QCPAxis *parentAxis);
948 
949  // getters:
950  bool subGridVisible() const { return mSubGridVisible; }
951  bool antialiasedSubGrid() const { return mAntialiasedSubGrid; }
952  bool antialiasedZeroLine() const { return mAntialiasedZeroLine; }
953  QPen pen() const { return mPen; }
954  QPen subGridPen() const { return mSubGridPen; }
955  QPen zeroLinePen() const { return mZeroLinePen; }
956 
957  // setters:
958  void setSubGridVisible(bool visible);
959  void setAntialiasedSubGrid(bool enabled);
960  void setAntialiasedZeroLine(bool enabled);
961  void setPen(const QPen &pen);
962  void setSubGridPen(const QPen &pen);
963  void setZeroLinePen(const QPen &pen);
964 
965 protected:
966  // property members:
968  bool mAntialiasedSubGrid, mAntialiasedZeroLine;
969  QPen mPen, mSubGridPen, mZeroLinePen;
970  // non-property members:
972 
973  // reimplemented virtual methods:
974  virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const;
975  virtual void draw(QCPPainter *painter);
976 
977  // non-virtual methods:
978  void drawGridLines(QCPPainter *painter) const;
979  void drawSubGridLines(QCPPainter *painter) const;
980 
981  friend class QCPAxis;
982 };
983 
984 
985 class QCP_LIB_DECL QCPAxis : public QCPLayerable
986 {
987  Q_OBJECT
989  Q_PROPERTY(AxisType axisType READ axisType)
990  Q_PROPERTY(QCPAxisRect* axisRect READ axisRect)
991  Q_PROPERTY(ScaleType scaleType READ scaleType WRITE setScaleType NOTIFY scaleTypeChanged)
992  Q_PROPERTY(double scaleLogBase READ scaleLogBase WRITE setScaleLogBase)
993  Q_PROPERTY(QCPRange range READ range WRITE setRange NOTIFY rangeChanged)
994  Q_PROPERTY(bool rangeReversed READ rangeReversed WRITE setRangeReversed)
995  Q_PROPERTY(bool autoTicks READ autoTicks WRITE setAutoTicks)
996  Q_PROPERTY(int autoTickCount READ autoTickCount WRITE setAutoTickCount)
997  Q_PROPERTY(bool autoTickLabels READ autoTickLabels WRITE setAutoTickLabels)
998  Q_PROPERTY(bool autoTickStep READ autoTickStep WRITE setAutoTickStep)
999  Q_PROPERTY(bool autoSubTicks READ autoSubTicks WRITE setAutoSubTicks)
1000  Q_PROPERTY(bool ticks READ ticks WRITE setTicks)
1001  Q_PROPERTY(bool tickLabels READ tickLabels WRITE setTickLabels)
1002  Q_PROPERTY(int tickLabelPadding READ tickLabelPadding WRITE setTickLabelPadding)
1003  Q_PROPERTY(LabelType tickLabelType READ tickLabelType WRITE setTickLabelType)
1004  Q_PROPERTY(QFont tickLabelFont READ tickLabelFont WRITE setTickLabelFont)
1005  Q_PROPERTY(QColor tickLabelColor READ tickLabelColor WRITE setTickLabelColor)
1006  Q_PROPERTY(double tickLabelRotation READ tickLabelRotation WRITE setTickLabelRotation)
1007  Q_PROPERTY(LabelSide tickLabelSide READ tickLabelSide WRITE setTickLabelSide)
1008  Q_PROPERTY(QString dateTimeFormat READ dateTimeFormat WRITE setDateTimeFormat)
1009  Q_PROPERTY(Qt::TimeSpec dateTimeSpec READ dateTimeSpec WRITE setDateTimeSpec)
1010  Q_PROPERTY(QString numberFormat READ numberFormat WRITE setNumberFormat)
1011  Q_PROPERTY(int numberPrecision READ numberPrecision WRITE setNumberPrecision)
1012  Q_PROPERTY(double tickStep READ tickStep WRITE setTickStep)
1013  Q_PROPERTY(QVector<double> tickVector READ tickVector WRITE setTickVector)
1014  Q_PROPERTY(QVector<QString> tickVectorLabels READ tickVectorLabels WRITE setTickVectorLabels)
1015  Q_PROPERTY(int tickLengthIn READ tickLengthIn WRITE setTickLengthIn)
1016  Q_PROPERTY(int tickLengthOut READ tickLengthOut WRITE setTickLengthOut)
1017  Q_PROPERTY(int subTickCount READ subTickCount WRITE setSubTickCount)
1018  Q_PROPERTY(int subTickLengthIn READ subTickLengthIn WRITE setSubTickLengthIn)
1019  Q_PROPERTY(int subTickLengthOut READ subTickLengthOut WRITE setSubTickLengthOut)
1020  Q_PROPERTY(QPen basePen READ basePen WRITE setBasePen)
1021  Q_PROPERTY(QPen tickPen READ tickPen WRITE setTickPen)
1022  Q_PROPERTY(QPen subTickPen READ subTickPen WRITE setSubTickPen)
1023  Q_PROPERTY(QFont labelFont READ labelFont WRITE setLabelFont)
1024  Q_PROPERTY(QColor labelColor READ labelColor WRITE setLabelColor)
1025  Q_PROPERTY(QString label READ label WRITE setLabel)
1026  Q_PROPERTY(int labelPadding READ labelPadding WRITE setLabelPadding)
1027  Q_PROPERTY(int padding READ padding WRITE setPadding)
1028  Q_PROPERTY(int offset READ offset WRITE setOffset)
1029  Q_PROPERTY(SelectableParts selectedParts READ selectedParts WRITE setSelectedParts NOTIFY selectionChanged)
1030  Q_PROPERTY(SelectableParts selectableParts READ selectableParts WRITE setSelectableParts NOTIFY selectableChanged)
1031  Q_PROPERTY(QFont selectedTickLabelFont READ selectedTickLabelFont WRITE setSelectedTickLabelFont)
1032  Q_PROPERTY(QFont selectedLabelFont READ selectedLabelFont WRITE setSelectedLabelFont)
1033  Q_PROPERTY(QColor selectedTickLabelColor READ selectedTickLabelColor WRITE setSelectedTickLabelColor)
1034  Q_PROPERTY(QColor selectedLabelColor READ selectedLabelColor WRITE setSelectedLabelColor)
1035  Q_PROPERTY(QPen selectedBasePen READ selectedBasePen WRITE setSelectedBasePen)
1036  Q_PROPERTY(QPen selectedTickPen READ selectedTickPen WRITE setSelectedTickPen)
1037  Q_PROPERTY(QPen selectedSubTickPen READ selectedSubTickPen WRITE setSelectedSubTickPen)
1038  Q_PROPERTY(QCPLineEnding lowerEnding READ lowerEnding WRITE setLowerEnding)
1039  Q_PROPERTY(QCPLineEnding upperEnding READ upperEnding WRITE setUpperEnding)
1040  Q_PROPERTY(QCPGrid* grid READ grid)
1042 public:
1047  enum AxisType { atLeft = 0x01
1048  ,atRight = 0x02
1049  ,atTop = 0x04
1050  ,atBottom = 0x08
1051  };
1052  Q_FLAGS(AxisType AxisTypes)
1053  Q_DECLARE_FLAGS(AxisTypes, AxisType)
1060  enum LabelType { ltNumber
1061  ,ltDateTime
1062  };
1063  Q_ENUMS(LabelType)
1069  enum LabelSide { lsInside
1070  ,lsOutside
1071  };
1072  Q_ENUMS(LabelSide)
1077  enum ScaleType { stLinear
1078  ,stLogarithmic
1079  };
1080  Q_ENUMS(ScaleType)
1085  enum SelectablePart { spNone = 0
1086  ,spAxis = 0x001
1087  ,spTickLabels = 0x002
1088  ,spAxisLabel = 0x004
1089  };
1090  Q_FLAGS(SelectablePart SelectableParts)
1091  Q_DECLARE_FLAGS(SelectableParts, SelectablePart)
1092 
1093  explicit QCPAxis(QCPAxisRect *parent, AxisType type);
1094  virtual ~QCPAxis();
1095 
1096  // getters:
1097  AxisType axisType() const { return mAxisType; }
1098  QCPAxisRect *axisRect() const { return mAxisRect; }
1099  ScaleType scaleType() const { return mScaleType; }
1100  double scaleLogBase() const { return mScaleLogBase; }
1101  const QCPRange range() const { return mRange; }
1102  bool rangeReversed() const { return mRangeReversed; }
1103  bool autoTicks() const { return mAutoTicks; }
1104  int autoTickCount() const { return mAutoTickCount; }
1105  bool autoTickLabels() const { return mAutoTickLabels; }
1106  bool autoTickStep() const { return mAutoTickStep; }
1107  bool autoSubTicks() const { return mAutoSubTicks; }
1108  bool ticks() const { return mTicks; }
1109  bool tickLabels() const { return mTickLabels; }
1110  int tickLabelPadding() const;
1111  LabelType tickLabelType() const { return mTickLabelType; }
1112  QFont tickLabelFont() const { return mTickLabelFont; }
1113  QColor tickLabelColor() const { return mTickLabelColor; }
1114  double tickLabelRotation() const;
1115  LabelSide tickLabelSide() const;
1116  QString dateTimeFormat() const { return mDateTimeFormat; }
1117  Qt::TimeSpec dateTimeSpec() const { return mDateTimeSpec; }
1118  QString numberFormat() const;
1119  int numberPrecision() const { return mNumberPrecision; }
1120  double tickStep() const { return mTickStep; }
1121  QVector<double> tickVector() const { return mTickVector; }
1122  QVector<QString> tickVectorLabels() const { return mTickVectorLabels; }
1123  int tickLengthIn() const;
1124  int tickLengthOut() const;
1125  int subTickCount() const { return mSubTickCount; }
1126  int subTickLengthIn() const;
1127  int subTickLengthOut() const;
1128  QPen basePen() const { return mBasePen; }
1129  QPen tickPen() const { return mTickPen; }
1130  QPen subTickPen() const { return mSubTickPen; }
1131  QFont labelFont() const { return mLabelFont; }
1132  QColor labelColor() const { return mLabelColor; }
1133  QString label() const { return mLabel; }
1134  int labelPadding() const;
1135  int padding() const { return mPadding; }
1136  int offset() const;
1137  SelectableParts selectedParts() const { return mSelectedParts; }
1138  SelectableParts selectableParts() const { return mSelectableParts; }
1139  QFont selectedTickLabelFont() const { return mSelectedTickLabelFont; }
1140  QFont selectedLabelFont() const { return mSelectedLabelFont; }
1141  QColor selectedTickLabelColor() const { return mSelectedTickLabelColor; }
1142  QColor selectedLabelColor() const { return mSelectedLabelColor; }
1143  QPen selectedBasePen() const { return mSelectedBasePen; }
1144  QPen selectedTickPen() const { return mSelectedTickPen; }
1145  QPen selectedSubTickPen() const { return mSelectedSubTickPen; }
1146  QCPLineEnding lowerEnding() const;
1147  QCPLineEnding upperEnding() const;
1148  QCPGrid *grid() const { return mGrid; }
1149 
1150  // setters:
1151  Q_SLOT void setScaleType(QCPAxis::ScaleType type);
1152  void setScaleLogBase(double base);
1153  Q_SLOT void setRange(const QCPRange &range);
1154  void setRange(double lower, double upper);
1155  void setRange(double position, double size, Qt::AlignmentFlag alignment);
1156  void setRangeLower(double lower);
1157  void setRangeUpper(double upper);
1158  void setRangeReversed(bool reversed);
1159  void setAutoTicks(bool on);
1160  void setAutoTickCount(int approximateCount);
1161  void setAutoTickLabels(bool on);
1162  void setAutoTickStep(bool on);
1163  void setAutoSubTicks(bool on);
1164  void setTicks(bool show);
1165  void setTickLabels(bool show);
1166  void setTickLabelPadding(int padding);
1167  void setTickLabelType(LabelType type);
1168  void setTickLabelFont(const QFont &font);
1169  void setTickLabelColor(const QColor &color);
1170  void setTickLabelRotation(double degrees);
1171  void setTickLabelSide(LabelSide side);
1172  void setDateTimeFormat(const QString &format);
1173  void setDateTimeSpec(const Qt::TimeSpec &timeSpec);
1174  void setNumberFormat(const QString &formatCode);
1175  void setNumberPrecision(int precision);
1176  void setTickStep(double step);
1177  void setTickVector(const QVector<double> &vec);
1178  void setTickVectorLabels(const QVector<QString> &vec);
1179  void setTickLength(int inside, int outside=0);
1180  void setTickLengthIn(int inside);
1181  void setTickLengthOut(int outside);
1182  void setSubTickCount(int count);
1183  void setSubTickLength(int inside, int outside=0);
1184  void setSubTickLengthIn(int inside);
1185  void setSubTickLengthOut(int outside);
1186  void setBasePen(const QPen &pen);
1187  void setTickPen(const QPen &pen);
1188  void setSubTickPen(const QPen &pen);
1189  void setLabelFont(const QFont &font);
1190  void setLabelColor(const QColor &color);
1191  void setLabel(const QString &str);
1192  void setLabelPadding(int padding);
1193  void setPadding(int padding);
1194  void setOffset(int offset);
1195  void setSelectedTickLabelFont(const QFont &font);
1196  void setSelectedLabelFont(const QFont &font);
1197  void setSelectedTickLabelColor(const QColor &color);
1198  void setSelectedLabelColor(const QColor &color);
1199  void setSelectedBasePen(const QPen &pen);
1200  void setSelectedTickPen(const QPen &pen);
1201  void setSelectedSubTickPen(const QPen &pen);
1202  Q_SLOT void setSelectableParts(const QCPAxis::SelectableParts &selectableParts);
1203  Q_SLOT void setSelectedParts(const QCPAxis::SelectableParts &selectedParts);
1204  void setLowerEnding(const QCPLineEnding &ending);
1205  void setUpperEnding(const QCPLineEnding &ending);
1206 
1207  // reimplemented virtual methods:
1208  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;
1209 
1210  // non-property methods:
1211  Qt::Orientation orientation() const { return mOrientation; }
1212  void moveRange(double diff);
1213  void scaleRange(double factor, double center);
1214  void setScaleRatio(const QCPAxis *otherAxis, double ratio=1.0);
1215  void rescale(bool onlyVisiblePlottables=false);
1216  double pixelToCoord(double value) const;
1217  double coordToPixel(double value) const;
1218  SelectablePart getPartAt(const QPointF &pos) const;
1219  QList<QCPAbstractPlottable*> plottables() const;
1220  QList<QCPGraph*> graphs() const;
1221  QList<QCPAbstractItem*> items() const;
1222 
1223  static AxisType marginSideToAxisType(QCP::MarginSide side);
1224  static Qt::Orientation orientation(AxisType type) { return type==atBottom||type==atTop ? Qt::Horizontal : Qt::Vertical; }
1225  static AxisType opposite(AxisType type);
1226 
1227 signals:
1228  void ticksRequest();
1229  void rangeChanged(const QCPRange &newRange);
1230  void rangeChanged(const QCPRange &newRange, const QCPRange &oldRange);
1231  void scaleTypeChanged(QCPAxis::ScaleType scaleType);
1232  void selectionChanged(const QCPAxis::SelectableParts &parts);
1233  void selectableChanged(const QCPAxis::SelectableParts &parts);
1234 
1235 protected:
1236  // property members:
1237  // axis base:
1240  //int mOffset; // in QCPAxisPainter
1242  Qt::Orientation mOrientation;
1243  SelectableParts mSelectableParts, mSelectedParts;
1244  QPen mBasePen, mSelectedBasePen;
1245  //QCPLineEnding mLowerEnding, mUpperEnding; // in QCPAxisPainter
1246  // axis label:
1247  //int mLabelPadding; // in QCPAxisPainter
1248  QString mLabel;
1249  QFont mLabelFont, mSelectedLabelFont;
1250  QColor mLabelColor, mSelectedLabelColor;
1251  // tick labels:
1252  //int mTickLabelPadding; // in QCPAxisPainter
1253  bool mTickLabels, mAutoTickLabels;
1254  //double mTickLabelRotation; // in QCPAxisPainter
1256  QFont mTickLabelFont, mSelectedTickLabelFont;
1257  QColor mTickLabelColor, mSelectedTickLabelColor;
1259  Qt::TimeSpec mDateTimeSpec;
1261  QLatin1Char mNumberFormatChar;
1263  //bool mNumberMultiplyCross; // QCPAxisPainter
1264  // ticks and subticks:
1265  bool mTicks;
1266  double mTickStep;
1267  int mSubTickCount, mAutoTickCount;
1268  bool mAutoTicks, mAutoTickStep, mAutoSubTicks;
1269  //int mTickLengthIn, mTickLengthOut, mSubTickLengthIn, mSubTickLengthOut; // QCPAxisPainter
1270  QPen mTickPen, mSelectedTickPen;
1271  QPen mSubTickPen, mSelectedSubTickPen;
1272  // scale and range:
1276  double mScaleLogBase, mScaleLogBaseLogInv;
1277 
1278  // non-property members:
1281  int mLowestVisibleTick, mHighestVisibleTick;
1282  QVector<double> mTickVector;
1283  QVector<QString> mTickVectorLabels;
1284  QVector<double> mSubTickVector;
1287 
1288  // introduced virtual methods:
1289  virtual void setupTickVectors();
1290  virtual void generateAutoTicks();
1291  virtual int calculateAutoSubTickCount(double tickStep) const;
1292  virtual int calculateMargin();
1293 
1294  // reimplemented virtual methods:
1295  virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const;
1296  virtual void draw(QCPPainter *painter);
1297  virtual QCP::Interaction selectionCategory() const;
1298  // events:
1299  virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged);
1300  virtual void deselectEvent(bool *selectionStateChanged);
1301 
1302  // non-virtual methods:
1303  void visibleTickBounds(int &lowIndex, int &highIndex) const;
1304  double baseLog(double value) const;
1305  double basePow(double value) const;
1306  QPen getBasePen() const;
1307  QPen getTickPen() const;
1308  QPen getSubTickPen() const;
1309  QFont getTickLabelFont() const;
1310  QFont getLabelFont() const;
1311  QColor getTickLabelColor() const;
1312  QColor getLabelColor() const;
1313 
1314 private:
1315  Q_DISABLE_COPY(QCPAxis)
1316 
1317  friend class QCustomPlot;
1318  friend class QCPGrid;
1319  friend class QCPAxisRect;
1320 };
1321 Q_DECLARE_OPERATORS_FOR_FLAGS(QCPAxis::SelectableParts)
1322 Q_DECLARE_OPERATORS_FOR_FLAGS(QCPAxis::AxisTypes)
1323 Q_DECLARE_METATYPE(QCPAxis::SelectablePart)
1324 
1325 
1327 {
1328 public:
1329  explicit QCPAxisPainterPrivate(QCustomPlot *parentPlot);
1330  virtual ~QCPAxisPainterPrivate();
1331 
1332  virtual void draw(QCPPainter *painter);
1333  virtual int size() const;
1334  void clearCache();
1335 
1336  QRect axisSelectionBox() const { return mAxisSelectionBox; }
1337  QRect tickLabelsSelectionBox() const { return mTickLabelsSelectionBox; }
1338  QRect labelSelectionBox() const { return mLabelSelectionBox; }
1339 
1340  // public property members:
1342  QPen basePen;
1343  QCPLineEnding lowerEnding, upperEnding; // directly accessed by QCPAxis setters/getters
1344  int labelPadding; // directly accessed by QCPAxis setters/getters
1345  QFont labelFont;
1346  QColor labelColor;
1347  QString label;
1348  int tickLabelPadding; // directly accessed by QCPAxis setters/getters
1349  double tickLabelRotation; // directly accessed by QCPAxis setters/getters
1350  QCPAxis::LabelSide tickLabelSide; // directly accessed by QCPAxis setters/getters
1352  bool numberMultiplyCross; // directly accessed by QCPAxis setters/getters
1353  int tickLengthIn, tickLengthOut, subTickLengthIn, subTickLengthOut; // directly accessed by QCPAxis setters/getters
1354  QPen tickPen, subTickPen;
1357  QRect axisRect, viewportRect;
1358  double offset; // directly accessed by QCPAxis setters/getters
1361 
1362  QVector<double> subTickPositions;
1363  QVector<double> tickPositions;
1364  QVector<QString> tickLabels;
1365 
1366 protected:
1368  {
1369  QPointF offset;
1370  QPixmap pixmap;
1371  };
1373  {
1374  QString basePart, expPart;
1375  QRect baseBounds, expBounds, totalBounds, rotatedTotalBounds;
1376  QFont baseFont, expFont;
1377  };
1378  QCustomPlot *mParentPlot;
1379  QByteArray mLabelParameterHash; // to determine whether mLabelCache needs to be cleared due to changed parameters
1380  QCache<QString, CachedLabel> mLabelCache;
1381  QRect mAxisSelectionBox, mTickLabelsSelectionBox, mLabelSelectionBox;
1382 
1383  virtual QByteArray generateLabelParameterHash() const;
1384 
1385  virtual void placeTickLabel(QCPPainter *painter, double position, int distanceToAxis, const QString &text, QSize *tickLabelsSize);
1386  virtual void drawTickLabel(QCPPainter *painter, double x, double y, const TickLabelData &labelData) const;
1387  virtual TickLabelData getTickLabelData(const QFont &font, const QString &text) const;
1388  virtual QPointF getTickLabelDrawOffset(const TickLabelData &labelData) const;
1389  virtual void getMaxTickLabelSize(const QFont &font, const QString &text, QSize *tickLabelsSize) const;
1390 };
1391 
1392 
1393 class QCP_LIB_DECL QCPAbstractPlottable : public QCPLayerable
1394 {
1395  Q_OBJECT
1397  Q_PROPERTY(QString name READ name WRITE setName)
1398  Q_PROPERTY(bool antialiasedFill READ antialiasedFill WRITE setAntialiasedFill)
1399  Q_PROPERTY(bool antialiasedScatters READ antialiasedScatters WRITE setAntialiasedScatters)
1400  Q_PROPERTY(bool antialiasedErrorBars READ antialiasedErrorBars WRITE setAntialiasedErrorBars)
1401  Q_PROPERTY(QPen pen READ pen WRITE setPen)
1402  Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
1403  Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
1404  Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
1405  Q_PROPERTY(QCPAxis* keyAxis READ keyAxis WRITE setKeyAxis)
1406  Q_PROPERTY(QCPAxis* valueAxis READ valueAxis WRITE setValueAxis)
1407  Q_PROPERTY(bool selectable READ selectable WRITE setSelectable NOTIFY selectableChanged)
1408  Q_PROPERTY(bool selected READ selected WRITE setSelected NOTIFY selectionChanged)
1410 public:
1411  QCPAbstractPlottable(QCPAxis *keyAxis, QCPAxis *valueAxis);
1412 
1413  // getters:
1414  QString name() const { return mName; }
1415  bool antialiasedFill() const { return mAntialiasedFill; }
1416  bool antialiasedScatters() const { return mAntialiasedScatters; }
1417  bool antialiasedErrorBars() const { return mAntialiasedErrorBars; }
1418  QPen pen() const { return mPen; }
1419  QPen selectedPen() const { return mSelectedPen; }
1420  QBrush brush() const { return mBrush; }
1421  QBrush selectedBrush() const { return mSelectedBrush; }
1422  QCPAxis *keyAxis() const { return mKeyAxis.data(); }
1423  QCPAxis *valueAxis() const { return mValueAxis.data(); }
1424  bool selectable() const { return mSelectable; }
1425  bool selected() const { return mSelected; }
1426 
1427  // setters:
1428  void setName(const QString &name);
1429  void setAntialiasedFill(bool enabled);
1430  void setAntialiasedScatters(bool enabled);
1431  void setAntialiasedErrorBars(bool enabled);
1432  void setPen(const QPen &pen);
1433  void setSelectedPen(const QPen &pen);
1434  void setBrush(const QBrush &brush);
1435  void setSelectedBrush(const QBrush &brush);
1436  void setKeyAxis(QCPAxis *axis);
1437  void setValueAxis(QCPAxis *axis);
1438  Q_SLOT void setSelectable(bool selectable);
1439  Q_SLOT void setSelected(bool selected);
1440 
1441  // introduced virtual methods:
1442  virtual void clearData() = 0;
1443  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const = 0;
1444  virtual bool addToLegend();
1445  virtual bool removeFromLegend() const;
1446 
1447  // non-property methods:
1448  void rescaleAxes(bool onlyEnlarge=false) const;
1449  void rescaleKeyAxis(bool onlyEnlarge=false) const;
1450  void rescaleValueAxis(bool onlyEnlarge=false) const;
1451 
1452 signals:
1453  void selectionChanged(bool selected);
1454  void selectableChanged(bool selectable);
1455 
1456 protected:
1460  enum SignDomain { sdNegative
1461  ,sdBoth
1462  ,sdPositive
1463  };
1464 
1465  // property members:
1466  QString mName;
1467  bool mAntialiasedFill, mAntialiasedScatters, mAntialiasedErrorBars;
1468  QPen mPen, mSelectedPen;
1469  QBrush mBrush, mSelectedBrush;
1470  QPointer<QCPAxis> mKeyAxis, mValueAxis;
1471  bool mSelectable, mSelected;
1472 
1473  // reimplemented virtual methods:
1474  virtual QRect clipRect() const;
1475  virtual void draw(QCPPainter *painter) = 0;
1476  virtual QCP::Interaction selectionCategory() const;
1477  void applyDefaultAntialiasingHint(QCPPainter *painter) const;
1478  // events:
1479  virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged);
1480  virtual void deselectEvent(bool *selectionStateChanged);
1481 
1482  // introduced virtual methods:
1483  virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const = 0;
1484  virtual QCPRange getKeyRange(bool &foundRange, SignDomain inSignDomain=sdBoth) const = 0;
1485  virtual QCPRange getValueRange(bool &foundRange, SignDomain inSignDomain=sdBoth) const = 0;
1486 
1487  // non-virtual methods:
1488  void coordsToPixels(double key, double value, double &x, double &y) const;
1489  const QPointF coordsToPixels(double key, double value) const;
1490  void pixelsToCoords(double x, double y, double &key, double &value) const;
1491  void pixelsToCoords(const QPointF &pixelPos, double &key, double &value) const;
1492  QPen mainPen() const;
1493  QBrush mainBrush() const;
1494  void applyFillAntialiasingHint(QCPPainter *painter) const;
1495  void applyScattersAntialiasingHint(QCPPainter *painter) const;
1496  void applyErrorBarsAntialiasingHint(QCPPainter *painter) const;
1497  double distSqrToLine(const QPointF &start, const QPointF &end, const QPointF &point) const;
1498 
1499 private:
1500  Q_DISABLE_COPY(QCPAbstractPlottable)
1501 
1502  friend class QCustomPlot;
1503  friend class QCPAxis;
1505 };
1506 
1507 
1509 {
1510 public:
1511  QCPItemAnchor(QCustomPlot *parentPlot, QCPAbstractItem *parentItem, const QString name, int anchorId=-1);
1512  virtual ~QCPItemAnchor();
1513 
1514  // getters:
1515  QString name() const { return mName; }
1516  virtual QPointF pixelPoint() const;
1517 
1518 protected:
1519  // property members:
1520  QString mName;
1521 
1522  // non-property members:
1523  QCustomPlot *mParentPlot;
1526  QSet<QCPItemPosition*> mChildrenX, mChildrenY;
1527 
1528  // introduced virtual methods:
1529  virtual QCPItemPosition *toQCPItemPosition() { return 0; }
1530 
1531  // non-virtual methods:
1532  void addChildX(QCPItemPosition* pos); // called from pos when this anchor is set as parent
1533  void removeChildX(QCPItemPosition *pos); // called from pos when its parent anchor is reset or pos deleted
1534  void addChildY(QCPItemPosition* pos); // called from pos when this anchor is set as parent
1535  void removeChildY(QCPItemPosition *pos); // called from pos when its parent anchor is reset or pos deleted
1536 
1537 private:
1538  Q_DISABLE_COPY(QCPItemAnchor)
1539 
1540  friend class QCPItemPosition;
1541 };
1542 
1543 
1544 
1545 class QCP_LIB_DECL QCPItemPosition : public QCPItemAnchor
1546 {
1547 public:
1554  enum PositionType { ptAbsolute
1555  ,ptViewportRatio
1556  ,ptAxisRectRatio
1559  ,ptPlotCoords
1562  };
1563 
1564  QCPItemPosition(QCustomPlot *parentPlot, QCPAbstractItem *parentItem, const QString name);
1565  virtual ~QCPItemPosition();
1566 
1567  // getters:
1568  PositionType type() const { return typeX(); }
1569  PositionType typeX() const { return mPositionTypeX; }
1570  PositionType typeY() const { return mPositionTypeY; }
1571  QCPItemAnchor *parentAnchor() const { return parentAnchorX(); }
1572  QCPItemAnchor *parentAnchorX() const { return mParentAnchorX; }
1573  QCPItemAnchor *parentAnchorY() const { return mParentAnchorY; }
1574  double key() const { return mKey; }
1575  double value() const { return mValue; }
1576  QPointF coords() const { return QPointF(mKey, mValue); }
1577  QCPAxis *keyAxis() const { return mKeyAxis.data(); }
1578  QCPAxis *valueAxis() const { return mValueAxis.data(); }
1579  QCPAxisRect *axisRect() const;
1580  virtual QPointF pixelPoint() const;
1581 
1582  // setters:
1583  void setType(PositionType type);
1584  void setTypeX(PositionType type);
1585  void setTypeY(PositionType type);
1586  bool setParentAnchor(QCPItemAnchor *parentAnchor, bool keepPixelPosition=false);
1587  bool setParentAnchorX(QCPItemAnchor *parentAnchor, bool keepPixelPosition=false);
1588  bool setParentAnchorY(QCPItemAnchor *parentAnchor, bool keepPixelPosition=false);
1589  void setCoords(double key, double value);
1590  void setCoords(const QPointF &coords);
1591  void setAxes(QCPAxis* keyAxis, QCPAxis* valueAxis);
1592  void setAxisRect(QCPAxisRect *axisRect);
1593  void setPixelPoint(const QPointF &pixelPoint);
1594 
1595 protected:
1596  // property members:
1597  PositionType mPositionTypeX, mPositionTypeY;
1598  QPointer<QCPAxis> mKeyAxis, mValueAxis;
1599  QPointer<QCPAxisRect> mAxisRect;
1600  double mKey, mValue;
1601  QCPItemAnchor *mParentAnchorX, *mParentAnchorY;
1602 
1603  // reimplemented virtual methods:
1604  virtual QCPItemPosition *toQCPItemPosition() { return this; }
1605 
1606 private:
1607  Q_DISABLE_COPY(QCPItemPosition)
1608 
1609 };
1610 
1611 
1612 class QCP_LIB_DECL QCPAbstractItem : public QCPLayerable
1613 {
1614  Q_OBJECT
1616  Q_PROPERTY(bool clipToAxisRect READ clipToAxisRect WRITE setClipToAxisRect)
1617  Q_PROPERTY(QCPAxisRect* clipAxisRect READ clipAxisRect WRITE setClipAxisRect)
1618  Q_PROPERTY(bool selectable READ selectable WRITE setSelectable NOTIFY selectableChanged)
1619  Q_PROPERTY(bool selected READ selected WRITE setSelected NOTIFY selectionChanged)
1621 public:
1622  QCPAbstractItem(QCustomPlot *parentPlot);
1623  virtual ~QCPAbstractItem();
1624 
1625  // getters:
1626  bool clipToAxisRect() const { return mClipToAxisRect; }
1627  QCPAxisRect *clipAxisRect() const;
1628  bool selectable() const { return mSelectable; }
1629  bool selected() const { return mSelected; }
1630 
1631  // setters:
1632  void setClipToAxisRect(bool clip);
1633  void setClipAxisRect(QCPAxisRect *rect);
1634  Q_SLOT void setSelectable(bool selectable);
1635  Q_SLOT void setSelected(bool selected);
1636 
1637  // reimplemented virtual methods:
1638  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const = 0;
1639 
1640  // non-virtual methods:
1641  QList<QCPItemPosition*> positions() const { return mPositions; }
1642  QList<QCPItemAnchor*> anchors() const { return mAnchors; }
1643  QCPItemPosition *position(const QString &name) const;
1644  QCPItemAnchor *anchor(const QString &name) const;
1645  bool hasAnchor(const QString &name) const;
1646 
1647 signals:
1648  void selectionChanged(bool selected);
1649  void selectableChanged(bool selectable);
1650 
1651 protected:
1652  // property members:
1654  QPointer<QCPAxisRect> mClipAxisRect;
1655  QList<QCPItemPosition*> mPositions;
1656  QList<QCPItemAnchor*> mAnchors;
1657  bool mSelectable, mSelected;
1658 
1659  // reimplemented virtual methods:
1660  virtual QCP::Interaction selectionCategory() const;
1661  virtual QRect clipRect() const;
1662  virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const;
1663  virtual void draw(QCPPainter *painter) = 0;
1664  // events:
1665  virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged);
1666  virtual void deselectEvent(bool *selectionStateChanged);
1667 
1668  // introduced virtual methods:
1669  virtual QPointF anchorPixelPoint(int anchorId) const;
1670 
1671  // non-virtual methods:
1672  double distSqrToLine(const QPointF &start, const QPointF &end, const QPointF &point) const;
1673  double rectSelectTest(const QRectF &rect, const QPointF &pos, bool filledRect) const;
1674  QCPItemPosition *createPosition(const QString &name);
1675  QCPItemAnchor *createAnchor(const QString &name, int anchorId);
1676 
1677 private:
1678  Q_DISABLE_COPY(QCPAbstractItem)
1679 
1680  friend class QCustomPlot;
1681  friend class QCPItemAnchor;
1682 };
1683 
1684 
1685 class QCP_LIB_DECL QCustomPlot : public QWidget
1686 {
1687  Q_OBJECT
1689  Q_PROPERTY(QRect viewport READ viewport WRITE setViewport)
1690  Q_PROPERTY(QPixmap background READ background WRITE setBackground)
1691  Q_PROPERTY(bool backgroundScaled READ backgroundScaled WRITE setBackgroundScaled)
1692  Q_PROPERTY(Qt::AspectRatioMode backgroundScaledMode READ backgroundScaledMode WRITE setBackgroundScaledMode)
1693  Q_PROPERTY(QCPLayoutGrid* plotLayout READ plotLayout)
1694  Q_PROPERTY(bool autoAddPlottableToLegend READ autoAddPlottableToLegend WRITE setAutoAddPlottableToLegend)
1695  Q_PROPERTY(int selectionTolerance READ selectionTolerance WRITE setSelectionTolerance)
1696  Q_PROPERTY(bool noAntialiasingOnDrag READ noAntialiasingOnDrag WRITE setNoAntialiasingOnDrag)
1697  Q_PROPERTY(Qt::KeyboardModifier multiSelectModifier READ multiSelectModifier WRITE setMultiSelectModifier)
1699 public:
1705  enum LayerInsertMode { limBelow
1706  ,limAbove
1707  };
1708  Q_ENUMS(LayerInsertMode)
1709 
1710 
1715  enum RefreshPriority { rpImmediate
1716  ,rpQueued
1717  ,rpHint
1718  };
1719 
1720  explicit QCustomPlot(QWidget *parent = 0);
1721  virtual ~QCustomPlot();
1722 
1723  // getters:
1724  QRect viewport() const { return mViewport; }
1725  QPixmap background() const { return mBackgroundPixmap; }
1726  bool backgroundScaled() const { return mBackgroundScaled; }
1727  Qt::AspectRatioMode backgroundScaledMode() const { return mBackgroundScaledMode; }
1728  QCPLayoutGrid *plotLayout() const { return mPlotLayout; }
1729  QCP::AntialiasedElements antialiasedElements() const { return mAntialiasedElements; }
1730  QCP::AntialiasedElements notAntialiasedElements() const { return mNotAntialiasedElements; }
1731  bool autoAddPlottableToLegend() const { return mAutoAddPlottableToLegend; }
1732  const QCP::Interactions interactions() const { return mInteractions; }
1733  int selectionTolerance() const { return mSelectionTolerance; }
1734  bool noAntialiasingOnDrag() const { return mNoAntialiasingOnDrag; }
1735  QCP::PlottingHints plottingHints() const { return mPlottingHints; }
1736  Qt::KeyboardModifier multiSelectModifier() const { return mMultiSelectModifier; }
1737 
1738  // setters:
1739  void setViewport(const QRect &rect);
1740  void setBackground(const QPixmap &pm);
1741  void setBackground(const QPixmap &pm, bool scaled, Qt::AspectRatioMode mode=Qt::KeepAspectRatioByExpanding);
1742  void setBackground(const QBrush &brush);
1743  void setBackgroundScaled(bool scaled);
1744  void setBackgroundScaledMode(Qt::AspectRatioMode mode);
1745  void setAntialiasedElements(const QCP::AntialiasedElements &antialiasedElements);
1746  void setAntialiasedElement(QCP::AntialiasedElement antialiasedElement, bool enabled=true);
1747  void setNotAntialiasedElements(const QCP::AntialiasedElements &notAntialiasedElements);
1748  void setNotAntialiasedElement(QCP::AntialiasedElement notAntialiasedElement, bool enabled=true);
1749  void setAutoAddPlottableToLegend(bool on);
1750  void setInteractions(const QCP::Interactions &interactions);
1751  void setInteraction(const QCP::Interaction &interaction, bool enabled=true);
1752  void setSelectionTolerance(int pixels);
1753  void setNoAntialiasingOnDrag(bool enabled);
1754  void setPlottingHints(const QCP::PlottingHints &hints);
1755  void setPlottingHint(QCP::PlottingHint hint, bool enabled=true);
1756  void setMultiSelectModifier(Qt::KeyboardModifier modifier);
1757 
1758  // non-property methods:
1759  // plottable interface:
1760  QCPAbstractPlottable *plottable(int index);
1761  QCPAbstractPlottable *plottable();
1762  bool addPlottable(QCPAbstractPlottable *plottable);
1763  bool removePlottable(QCPAbstractPlottable *plottable);
1764  bool removePlottable(int index);
1765  int clearPlottables();
1766  int plottableCount() const;
1767  QList<QCPAbstractPlottable*> selectedPlottables() const;
1768  QCPAbstractPlottable *plottableAt(const QPointF &pos, bool onlySelectable=false) const;
1769  bool hasPlottable(QCPAbstractPlottable *plottable) const;
1770 
1771  // specialized interface for QCPGraph:
1772  QCPGraph *graph(int index) const;
1773  QCPGraph *graph() const;
1774  QCPGraph *addGraph(QCPAxis *keyAxis=0, QCPAxis *valueAxis=0);
1775  bool removeGraph(QCPGraph *graph);
1776  bool removeGraph(int index);
1777  int clearGraphs();
1778  int graphCount() const;
1779  QList<QCPGraph*> selectedGraphs() const;
1780 
1781  // item interface:
1782  QCPAbstractItem *item(int index) const;
1783  QCPAbstractItem *item() const;
1784  bool addItem(QCPAbstractItem* item);
1785  bool removeItem(QCPAbstractItem *item);
1786  bool removeItem(int index);
1787  int clearItems();
1788  int itemCount() const;
1789  QList<QCPAbstractItem*> selectedItems() const;
1790  QCPAbstractItem *itemAt(const QPointF &pos, bool onlySelectable=false) const;
1791  bool hasItem(QCPAbstractItem *item) const;
1792 
1793  // layer interface:
1794  QCPLayer *layer(const QString &name) const;
1795  QCPLayer *layer(int index) const;
1796  QCPLayer *currentLayer() const;
1797  bool setCurrentLayer(const QString &name);
1798  bool setCurrentLayer(QCPLayer *layer);
1799  int layerCount() const;
1800  bool addLayer(const QString &name, QCPLayer *otherLayer=0, LayerInsertMode insertMode=limAbove);
1801  bool removeLayer(QCPLayer *layer);
1802  bool moveLayer(QCPLayer *layer, QCPLayer *otherLayer, LayerInsertMode insertMode=limAbove);
1803 
1804  // axis rect/layout interface:
1805  int axisRectCount() const;
1806  QCPAxisRect* axisRect(int index=0) const;
1807  QList<QCPAxisRect*> axisRects() const;
1808  QCPLayoutElement* layoutElementAt(const QPointF &pos) const;
1809  Q_SLOT void rescaleAxes(bool onlyVisiblePlottables=false);
1810 
1811  QList<QCPAxis*> selectedAxes() const;
1812  QList<QCPLegend*> selectedLegends() const;
1813  Q_SLOT void deselectAll();
1814 
1815  bool savePdf(const QString &fileName, bool noCosmeticPen=false, int width=0, int height=0, const QString &pdfCreator=QString(), const QString &pdfTitle=QString());
1816  bool savePng(const QString &fileName, int width=0, int height=0, double scale=1.0, int quality=-1);
1817  bool saveJpg(const QString &fileName, int width=0, int height=0, double scale=1.0, int quality=-1);
1818  bool saveBmp(const QString &fileName, int width=0, int height=0, double scale=1.0);
1819  bool saveRastered(const QString &fileName, int width, int height, double scale, const char *format, int quality=-1);
1820  QPixmap toPixmap(int width=0, int height=0, double scale=1.0);
1821  void toPainter(QCPPainter *painter, int width=0, int height=0);
1822  Q_SLOT void replot(QCustomPlot::RefreshPriority refreshPriority=QCustomPlot::rpHint);
1823 
1824  QCPAxis *xAxis, *yAxis, *xAxis2, *yAxis2;
1826 
1827 signals:
1828  void mouseDoubleClick(QMouseEvent *event);
1829  void mousePress(QMouseEvent *event);
1830  void mouseMove(QMouseEvent *event);
1831  void mouseRelease(QMouseEvent *event);
1832  void mouseWheel(QWheelEvent *event);
1833 
1834  void plottableClick(QCPAbstractPlottable *plottable, QMouseEvent *event);
1835  void plottableDoubleClick(QCPAbstractPlottable *plottable, QMouseEvent *event);
1836  void itemClick(QCPAbstractItem *item, QMouseEvent *event);
1837  void itemDoubleClick(QCPAbstractItem *item, QMouseEvent *event);
1838  void axisClick(QCPAxis *axis, QCPAxis::SelectablePart part, QMouseEvent *event);
1839  void axisDoubleClick(QCPAxis *axis, QCPAxis::SelectablePart part, QMouseEvent *event);
1840  void legendClick(QCPLegend *legend, QCPAbstractLegendItem *item, QMouseEvent *event);
1841  void legendDoubleClick(QCPLegend *legend, QCPAbstractLegendItem *item, QMouseEvent *event);
1842  void titleClick(QMouseEvent *event, QCPPlotTitle *title);
1843  void titleDoubleClick(QMouseEvent *event, QCPPlotTitle *title);
1844 
1845  void selectionChangedByUser();
1846  void beforeReplot();
1847  void afterReplot();
1848 
1849 protected:
1850  // property members:
1851  QRect mViewport;
1854  QList<QCPAbstractPlottable*> mPlottables;
1855  QList<QCPGraph*> mGraphs; // extra list of plottables also in mPlottables that are of type QCPGraph
1856  QList<QCPAbstractItem*> mItems;
1857  QList<QCPLayer*> mLayers;
1858  QCP::AntialiasedElements mAntialiasedElements, mNotAntialiasedElements;
1859  QCP::Interactions mInteractions;
1866  Qt::AspectRatioMode mBackgroundScaledMode;
1868  QCP::PlottingHints mPlottingHints;
1869  Qt::KeyboardModifier mMultiSelectModifier;
1870 
1871  // non-property members:
1872  QPixmap mPaintBuffer;
1874  QPointer<QCPLayoutElement> mMouseEventElement;
1876 
1877  // reimplemented virtual methods:
1878  virtual QSize minimumSizeHint() const;
1879  virtual QSize sizeHint() const;
1880  virtual void paintEvent(QPaintEvent *event);
1881  virtual void resizeEvent(QResizeEvent *event);
1882  virtual void mouseDoubleClickEvent(QMouseEvent *event);
1883  virtual void mousePressEvent(QMouseEvent *event);
1884  virtual void mouseMoveEvent(QMouseEvent *event);
1885  virtual void mouseReleaseEvent(QMouseEvent *event);
1886  virtual void wheelEvent(QWheelEvent *event);
1887 
1888  // introduced virtual methods:
1889  virtual void draw(QCPPainter *painter);
1890  virtual void axisRemoved(QCPAxis *axis);
1891  virtual void legendRemoved(QCPLegend *legend);
1892 
1893  // non-virtual methods:
1894  void updateLayerIndices() const;
1895  QCPLayerable *layerableAt(const QPointF &pos, bool onlySelectable, QVariant *selectionDetails=0) const;
1896  void drawBackground(QCPPainter *painter);
1897 
1898  friend class QCPLegend;
1899  friend class QCPAxis;
1900  friend class QCPLayer;
1901  friend class QCPAxisRect;
1902 };
1903 
1904 
1906 {
1907  Q_GADGET
1908 public:
1914  enum ColorInterpolation { ciRGB
1915  ,ciHSV
1916  };
1917  Q_ENUMS(ColorInterpolation)
1918 
1919 
1923  enum GradientPreset { gpGrayscale
1924  ,gpHot
1925  ,gpCold
1926  ,gpNight
1927  ,gpCandy
1928  ,gpGeography
1929  ,gpIon
1930  ,gpThermal
1931  ,gpPolar
1932  ,gpSpectrum
1933  ,gpJet
1934  ,gpHues
1935  //ColorBrewer gradients added by D.P. Foose for Vespucci
1936  //sequential color schemes (8 subdivisions)
1937  ,cbBuGn
1938  ,cbBuPu
1939  ,cbGnBu
1940  ,cbOrRd
1941  ,cbPuBu
1942  ,cbPuBuGn
1943  ,cbPuRd
1944  ,cbRdPu
1945  ,cbYlGn
1946  ,cbYlGnBu
1947  ,cbYlOrBr
1948  ,cbYlOrRd
1949  ,cbBlues
1950  ,cbGreens
1951  ,cbGreys
1952  ,cbOranges
1953  ,cbPurples
1954  ,cbReds
1955 
1956  //diverging color schemes (10 subdivisions)
1957  ,cbBrBG
1958  ,cbPiYG
1959  ,cbPRGn
1960  ,cbPuOr
1961  ,cbRdBu
1962  ,cbRdGy
1963  ,cbRdYlBu
1964  ,cbRdYlGn
1965  ,cbSpectral
1966 
1967  //cluster schemes (number after name is number of clusters)
1968  ,cbCluster9
1969  ,cbCluster8
1970  ,cbCluster7
1971  ,cbCluster6
1972  ,cbCluster5
1973  ,cbCluster4
1974  ,cbCluster3
1975  ,cbCluster2
1976 
1977  //A special spectral class, based on a previous publication
1978  //in my group (this is based partially on matlab jet)
1979  ,vSpectral
1980  };
1981  Q_ENUMS(GradientPreset)
1982 
1983  QCPColorGradient(GradientPreset preset=gpCold);
1984  bool operator==(const QCPColorGradient &other) const;
1985  bool operator!=(const QCPColorGradient &other) const { return !(*this == other); }
1986 
1987  // getters:
1988  int levelCount() const { return mLevelCount; }
1989  QMap<double, QColor> colorStops() const { return mColorStops; }
1990  ColorInterpolation colorInterpolation() const { return mColorInterpolation; }
1991  bool periodic() const { return mPeriodic; }
1992 
1993  // setters:
1994  void setLevelCount(int n);
1995  void setColorStops(const QMap<double, QColor> &colorStops);
1996  void setColorStopAt(double position, const QColor &color);
1997  void setColorInterpolation(ColorInterpolation interpolation);
1998  void setPeriodic(bool enabled);
1999 
2000  // non-property methods:
2001  void colorize(const double *data, const QCPRange &range, QRgb *scanLine, int n, int dataIndexFactor=1, bool logarithmic=false);
2002  QRgb color(double position, const QCPRange &range, bool logarithmic=false);
2003  void loadPreset(GradientPreset preset);
2004  void clearColorStops();
2005  QCPColorGradient inverted() const;
2006 
2007 protected:
2008  void updateColorBuffer();
2009 
2010  // property members:
2012  QMap<double, QColor> mColorStops;
2015 
2016  // non-property members:
2017  QVector<QRgb> mColorBuffer;
2019 };
2020 
2021 
2023 {
2024  Q_OBJECT
2026  Q_PROPERTY(QPixmap background READ background WRITE setBackground)
2027  Q_PROPERTY(bool backgroundScaled READ backgroundScaled WRITE setBackgroundScaled)
2028  Q_PROPERTY(Qt::AspectRatioMode backgroundScaledMode READ backgroundScaledMode WRITE setBackgroundScaledMode)
2029  Q_PROPERTY(Qt::Orientations rangeDrag READ rangeDrag WRITE setRangeDrag)
2030  Q_PROPERTY(Qt::Orientations rangeZoom READ rangeZoom WRITE setRangeZoom)
2032 public:
2033  explicit QCPAxisRect(QCustomPlot *parentPlot, bool setupDefaultAxes=true);
2034  virtual ~QCPAxisRect();
2035 
2036  // getters:
2037  QPixmap background() const { return mBackgroundPixmap; }
2038  bool backgroundScaled() const { return mBackgroundScaled; }
2039  Qt::AspectRatioMode backgroundScaledMode() const { return mBackgroundScaledMode; }
2040  Qt::Orientations rangeDrag() const { return mRangeDrag; }
2041  Qt::Orientations rangeZoom() const { return mRangeZoom; }
2042  QCPAxis *rangeDragAxis(Qt::Orientation orientation);
2043  QCPAxis *rangeZoomAxis(Qt::Orientation orientation);
2044  double rangeZoomFactor(Qt::Orientation orientation);
2045 
2046  // setters:
2047  void setBackground(const QPixmap &pm);
2048  void setBackground(const QPixmap &pm, bool scaled, Qt::AspectRatioMode mode=Qt::KeepAspectRatioByExpanding);
2049  void setBackground(const QBrush &brush);
2050  void setBackgroundScaled(bool scaled);
2051  void setBackgroundScaledMode(Qt::AspectRatioMode mode);
2052  void setRangeDrag(Qt::Orientations orientations);
2053  void setRangeZoom(Qt::Orientations orientations);
2054  void setRangeDragAxes(QCPAxis *horizontal, QCPAxis *vertical);
2055  void setRangeZoomAxes(QCPAxis *horizontal, QCPAxis *vertical);
2056  void setRangeZoomFactor(double horizontalFactor, double verticalFactor);
2057  void setRangeZoomFactor(double factor);
2058 
2059  // non-property methods:
2060  int axisCount(QCPAxis::AxisType type) const;
2061  QCPAxis *axis(QCPAxis::AxisType type, int index=0) const;
2062  QList<QCPAxis*> axes(QCPAxis::AxisTypes types) const;
2063  QList<QCPAxis*> axes() const;
2064  QCPAxis *addAxis(QCPAxis::AxisType type, QCPAxis *axis=0);
2065  QList<QCPAxis*> addAxes(QCPAxis::AxisTypes types);
2066  bool removeAxis(QCPAxis *axis);
2067  QCPLayoutInset *insetLayout() const { return mInsetLayout; }
2068 
2069  void setupFullAxesBox(bool connectRanges=false);
2070  QList<QCPAbstractPlottable*> plottables() const;
2071  QList<QCPGraph*> graphs() const;
2072  QList<QCPAbstractItem*> items() const;
2073 
2074  // read-only interface imitating a QRect:
2075  int left() const { return mRect.left(); }
2076  int right() const { return mRect.right(); }
2077  int top() const { return mRect.top(); }
2078  int bottom() const { return mRect.bottom(); }
2079  int width() const { return mRect.width(); }
2080  int height() const { return mRect.height(); }
2081  QSize size() const { return mRect.size(); }
2082  QPoint topLeft() const { return mRect.topLeft(); }
2083  QPoint topRight() const { return mRect.topRight(); }
2084  QPoint bottomLeft() const { return mRect.bottomLeft(); }
2085  QPoint bottomRight() const { return mRect.bottomRight(); }
2086  QPoint center() const { return mRect.center(); }
2087 
2088  // reimplemented virtual methods:
2089  virtual void update(UpdatePhase phase);
2090  virtual QList<QCPLayoutElement*> elements(bool recursive) const;
2091 
2092 protected:
2093  // property members:
2098  Qt::AspectRatioMode mBackgroundScaledMode;
2100  Qt::Orientations mRangeDrag, mRangeZoom;
2101  QPointer<QCPAxis> mRangeDragHorzAxis, mRangeDragVertAxis, mRangeZoomHorzAxis, mRangeZoomVertAxis;
2102  double mRangeZoomFactorHorz, mRangeZoomFactorVert;
2103  // non-property members:
2104  QCPRange mDragStartHorzRange, mDragStartVertRange;
2105  QCP::AntialiasedElements mAADragBackup, mNotAADragBackup;
2106  QPoint mDragStart;
2108  QHash<QCPAxis::AxisType, QList<QCPAxis*> > mAxes;
2109 
2110  // reimplemented virtual methods:
2111  virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const;
2112  virtual void draw(QCPPainter *painter);
2113  virtual int calculateAutoMargin(QCP::MarginSide side);
2114  // events:
2115  virtual void mousePressEvent(QMouseEvent *event);
2116  virtual void mouseMoveEvent(QMouseEvent *event);
2117  virtual void mouseReleaseEvent(QMouseEvent *event);
2118  virtual void wheelEvent(QWheelEvent *event);
2119 
2120  // non-property methods:
2121  void drawBackground(QCPPainter *painter);
2122  void updateAxesOffset(QCPAxis::AxisType type);
2123 
2124 private:
2125  Q_DISABLE_COPY(QCPAxisRect)
2126 
2127  friend class QCustomPlot;
2128 };
2129 
2130 
2132 {
2133  Q_OBJECT
2135  Q_PROPERTY(QCPLegend* parentLegend READ parentLegend)
2136  Q_PROPERTY(QFont font READ font WRITE setFont)
2137  Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor)
2138  Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont)
2139  Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE setSelectedTextColor)
2140  Q_PROPERTY(bool selectable READ selectable WRITE setSelectable NOTIFY selectionChanged)
2141  Q_PROPERTY(bool selected READ selected WRITE setSelected NOTIFY selectableChanged)
2143 public:
2144  explicit QCPAbstractLegendItem(QCPLegend *parent);
2145 
2146  // getters:
2147  QCPLegend *parentLegend() const { return mParentLegend; }
2148  QFont font() const { return mFont; }
2149  QColor textColor() const { return mTextColor; }
2150  QFont selectedFont() const { return mSelectedFont; }
2151  QColor selectedTextColor() const { return mSelectedTextColor; }
2152  bool selectable() const { return mSelectable; }
2153  bool selected() const { return mSelected; }
2154 
2155  // setters:
2156  void setFont(const QFont &font);
2157  void setTextColor(const QColor &color);
2158  void setSelectedFont(const QFont &font);
2159  void setSelectedTextColor(const QColor &color);
2160  Q_SLOT void setSelectable(bool selectable);
2161  Q_SLOT void setSelected(bool selected);
2162 
2163  // reimplemented virtual methods:
2164  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;
2165 
2166 signals:
2167  void selectionChanged(bool selected);
2168  void selectableChanged(bool selectable);
2169 
2170 protected:
2171  // property members:
2173  QFont mFont;
2174  QColor mTextColor;
2177  bool mSelectable, mSelected;
2178 
2179  // reimplemented virtual methods:
2180  virtual QCP::Interaction selectionCategory() const;
2181  virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const;
2182  virtual QRect clipRect() const;
2183  virtual void draw(QCPPainter *painter) = 0;
2184  // events:
2185  virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged);
2186  virtual void deselectEvent(bool *selectionStateChanged);
2187 
2188 private:
2189  Q_DISABLE_COPY(QCPAbstractLegendItem)
2190 
2191  friend class QCPLegend;
2192 };
2193 
2194 
2196 {
2197  Q_OBJECT
2198 public:
2199  QCPPlottableLegendItem(QCPLegend *parent, QCPAbstractPlottable *plottable);
2200 
2201  // getters:
2202  QCPAbstractPlottable *plottable() { return mPlottable; }
2203 
2204 protected:
2205  // property members:
2207 
2208  // reimplemented virtual methods:
2209  virtual void draw(QCPPainter *painter);
2210  virtual QSize minimumSizeHint() const;
2211 
2212  // non-virtual methods:
2213  QPen getIconBorderPen() const;
2214  QColor getTextColor() const;
2215  QFont getFont() const;
2216 };
2217 
2218 
2220 {
2221  Q_OBJECT
2223  Q_PROPERTY(QPen borderPen READ borderPen WRITE setBorderPen)
2224  Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
2225  Q_PROPERTY(QFont font READ font WRITE setFont)
2226  Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor)
2227  Q_PROPERTY(QSize iconSize READ iconSize WRITE setIconSize)
2228  Q_PROPERTY(int iconTextPadding READ iconTextPadding WRITE setIconTextPadding)
2229  Q_PROPERTY(QPen iconBorderPen READ iconBorderPen WRITE setIconBorderPen)
2230  Q_PROPERTY(SelectableParts selectableParts READ selectableParts WRITE setSelectableParts NOTIFY selectionChanged)
2231  Q_PROPERTY(SelectableParts selectedParts READ selectedParts WRITE setSelectedParts NOTIFY selectableChanged)
2232  Q_PROPERTY(QPen selectedBorderPen READ selectedBorderPen WRITE setSelectedBorderPen)
2233  Q_PROPERTY(QPen selectedIconBorderPen READ selectedIconBorderPen WRITE setSelectedIconBorderPen)
2234  Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
2235  Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont)
2236  Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE setSelectedTextColor)
2238 public:
2244  enum SelectablePart { spNone = 0x000
2245  ,spLegendBox = 0x001
2246  ,spItems = 0x002
2247  };
2248  Q_FLAGS(SelectablePart SelectableParts)
2249  Q_DECLARE_FLAGS(SelectableParts, SelectablePart)
2250 
2251  explicit QCPLegend();
2252  virtual ~QCPLegend();
2253 
2254  // getters:
2255  QPen borderPen() const { return mBorderPen; }
2256  QBrush brush() const { return mBrush; }
2257  QFont font() const { return mFont; }
2258  QColor textColor() const { return mTextColor; }
2259  QSize iconSize() const { return mIconSize; }
2260  int iconTextPadding() const { return mIconTextPadding; }
2261  QPen iconBorderPen() const { return mIconBorderPen; }
2262  SelectableParts selectableParts() const { return mSelectableParts; }
2263  SelectableParts selectedParts() const;
2264  QPen selectedBorderPen() const { return mSelectedBorderPen; }
2265  QPen selectedIconBorderPen() const { return mSelectedIconBorderPen; }
2266  QBrush selectedBrush() const { return mSelectedBrush; }
2267  QFont selectedFont() const { return mSelectedFont; }
2268  QColor selectedTextColor() const { return mSelectedTextColor; }
2269 
2270  // setters:
2271  void setBorderPen(const QPen &pen);
2272  void setBrush(const QBrush &brush);
2273  void setFont(const QFont &font);
2274  void setTextColor(const QColor &color);
2275  void setIconSize(const QSize &size);
2276  void setIconSize(int width, int height);
2277  void setIconTextPadding(int padding);
2278  void setIconBorderPen(const QPen &pen);
2279  Q_SLOT void setSelectableParts(const SelectableParts &selectableParts);
2280  Q_SLOT void setSelectedParts(const SelectableParts &selectedParts);
2281  void setSelectedBorderPen(const QPen &pen);
2282  void setSelectedIconBorderPen(const QPen &pen);
2283  void setSelectedBrush(const QBrush &brush);
2284  void setSelectedFont(const QFont &font);
2285  void setSelectedTextColor(const QColor &color);
2286 
2287  // reimplemented virtual methods:
2288  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;
2289 
2290  // non-virtual methods:
2291  QCPAbstractLegendItem *item(int index) const;
2292  QCPPlottableLegendItem *itemWithPlottable(const QCPAbstractPlottable *plottable) const;
2293  int itemCount() const;
2294  bool hasItem(QCPAbstractLegendItem *item) const;
2295  bool hasItemWithPlottable(const QCPAbstractPlottable *plottable) const;
2296  bool addItem(QCPAbstractLegendItem *item);
2297  bool removeItem(int index);
2298  bool removeItem(QCPAbstractLegendItem *item);
2299  void clearItems();
2300  QList<QCPAbstractLegendItem*> selectedItems() const;
2301 
2302 signals:
2303  void selectionChanged(QCPLegend::SelectableParts parts);
2304  void selectableChanged(QCPLegend::SelectableParts parts);
2305 
2306 protected:
2307  // property members:
2308  QPen mBorderPen, mIconBorderPen;
2309  QBrush mBrush;
2310  QFont mFont;
2311  QColor mTextColor;
2312  QSize mIconSize;
2314  SelectableParts mSelectedParts, mSelectableParts;
2315  QPen mSelectedBorderPen, mSelectedIconBorderPen;
2319 
2320  // reimplemented virtual methods:
2321  virtual void parentPlotInitialized(QCustomPlot *parentPlot);
2322  virtual QCP::Interaction selectionCategory() const;
2323  virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const;
2324  virtual void draw(QCPPainter *painter);
2325  // events:
2326  virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged);
2327  virtual void deselectEvent(bool *selectionStateChanged);
2328 
2329  // non-virtual methods:
2330  QPen getBorderPen() const;
2331  QBrush getBrush() const;
2332 
2333 private:
2334  Q_DISABLE_COPY(QCPLegend)
2335 
2336  friend class QCustomPlot;
2338 };
2339 Q_DECLARE_OPERATORS_FOR_FLAGS(QCPLegend::SelectableParts)
2340 Q_DECLARE_METATYPE(QCPLegend::SelectablePart)
2341 
2342 
2343 class QCP_LIB_DECL QCPPlotTitle : public QCPLayoutElement
2344 {
2345  Q_OBJECT
2347  Q_PROPERTY(QString text READ text WRITE setText)
2348  Q_PROPERTY(QFont font READ font WRITE setFont)
2349  Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor)
2350  Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont)
2351  Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE setSelectedTextColor)
2352  Q_PROPERTY(bool selectable READ selectable WRITE setSelectable NOTIFY selectableChanged)
2353  Q_PROPERTY(bool selected READ selected WRITE setSelected NOTIFY selectionChanged)
2355 public:
2356  explicit QCPPlotTitle(QCustomPlot *parentPlot);
2357  explicit QCPPlotTitle(QCustomPlot *parentPlot, const QString &text);
2358 
2359  // getters:
2360  QString text() const { return mText; }
2361  QFont font() const { return mFont; }
2362  QColor textColor() const { return mTextColor; }
2363  QFont selectedFont() const { return mSelectedFont; }
2364  QColor selectedTextColor() const { return mSelectedTextColor; }
2365  bool selectable() const { return mSelectable; }
2366  bool selected() const { return mSelected; }
2367 
2368  // setters:
2369  void setText(const QString &text);
2370  void setFont(const QFont &font);
2371  void setTextColor(const QColor &color);
2372  void setSelectedFont(const QFont &font);
2373  void setSelectedTextColor(const QColor &color);
2374  Q_SLOT void setSelectable(bool selectable);
2375  Q_SLOT void setSelected(bool selected);
2376 
2377  // reimplemented virtual methods:
2378  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;
2379 
2380 signals:
2381  void selectionChanged(bool selected);
2382  void selectableChanged(bool selectable);
2383 
2384 protected:
2385  // property members:
2386  QString mText;
2387  QFont mFont;
2388  QColor mTextColor;
2392  bool mSelectable, mSelected;
2393 
2394  // reimplemented virtual methods:
2395  virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const;
2396  virtual void draw(QCPPainter *painter);
2397  virtual QSize minimumSizeHint() const;
2398  virtual QSize maximumSizeHint() const;
2399  // events:
2400  virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged);
2401  virtual void deselectEvent(bool *selectionStateChanged);
2402 
2403  // non-virtual methods:
2404  QFont mainFont() const;
2405  QColor mainTextColor() const;
2406 
2407 private:
2408  Q_DISABLE_COPY(QCPPlotTitle)
2409 };
2410 
2411 
2413 {
2414  Q_OBJECT
2415 public:
2416  explicit QCPColorScaleAxisRectPrivate(QCPColorScale *parentColorScale);
2417 protected:
2421  // re-using some methods of QCPAxisRect to make them available to friend class QCPColorScale
2427  using QCPAxisRect::update;
2428  virtual void draw(QCPPainter *painter);
2429  void updateGradientImage();
2430  Q_SLOT void axisSelectionChanged(QCPAxis::SelectableParts selectedParts);
2431  Q_SLOT void axisSelectableChanged(QCPAxis::SelectableParts selectableParts);
2432  friend class QCPColorScale;
2433 };
2434 
2435 
2436 class QCP_LIB_DECL QCPColorScale : public QCPLayoutElement
2437 {
2438  Q_OBJECT
2440  Q_PROPERTY(QCPAxis::AxisType type READ type WRITE setType)
2441  Q_PROPERTY(QCPRange dataRange READ dataRange WRITE setDataRange NOTIFY dataRangeChanged)
2442  Q_PROPERTY(QCPAxis::ScaleType dataScaleType READ dataScaleType WRITE setDataScaleType NOTIFY dataScaleTypeChanged)
2443  Q_PROPERTY(QCPColorGradient gradient READ gradient WRITE setGradient NOTIFY gradientChanged)
2444  Q_PROPERTY(QString label READ label WRITE setLabel)
2445  Q_PROPERTY(int barWidth READ barWidth WRITE setBarWidth)
2446  Q_PROPERTY(bool rangeDrag READ rangeDrag WRITE setRangeDrag)
2447  Q_PROPERTY(bool rangeZoom READ rangeZoom WRITE setRangeZoom)
2449 public:
2450  explicit QCPColorScale(QCustomPlot *parentPlot);
2451  virtual ~QCPColorScale();
2452 
2453  // getters:
2454  QCPAxis *axis() const { return mColorAxis.data(); }
2455  QCPAxis::AxisType type() const { return mType; }
2456  QCPRange dataRange() const { return mDataRange; }
2457  QCPAxis::ScaleType dataScaleType() const { return mDataScaleType; }
2458  QCPColorGradient gradient() const { return mGradient; }
2459  QString label() const;
2460  int barWidth () const { return mBarWidth; }
2461  bool rangeDrag() const;
2462  bool rangeZoom() const;
2463 
2464  // setters:
2465  void setType(QCPAxis::AxisType type);
2466  Q_SLOT void setDataRange(const QCPRange &dataRange);
2467  Q_SLOT void setDataScaleType(QCPAxis::ScaleType scaleType);
2468  Q_SLOT void setGradient(const QCPColorGradient &gradient);
2469  void setLabel(const QString &str);
2470  void setBarWidth(int width);
2471  void setRangeDrag(bool enabled);
2472  void setRangeZoom(bool enabled);
2473 
2474  // non-property methods:
2475  QList<QCPColorMap*> colorMaps() const;
2476  void rescaleDataRange(bool onlyVisibleMaps);
2477 
2478  // reimplemented virtual methods:
2479  virtual void update(UpdatePhase phase);
2480 
2481 signals:
2482  void dataRangeChanged(QCPRange newRange);
2483  void dataScaleTypeChanged(QCPAxis::ScaleType scaleType);
2484  void gradientChanged(QCPColorGradient newGradient);
2485 
2486 protected:
2487  // property members:
2493 
2494  // non-property members:
2495  QPointer<QCPColorScaleAxisRectPrivate> mAxisRect;
2496  QPointer<QCPAxis> mColorAxis;
2497 
2498  // reimplemented virtual methods:
2499  virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const;
2500  // events:
2501  virtual void mousePressEvent(QMouseEvent *event);
2502  virtual void mouseMoveEvent(QMouseEvent *event);
2503  virtual void mouseReleaseEvent(QMouseEvent *event);
2504  virtual void wheelEvent(QWheelEvent *event);
2505 
2506 private:
2507  Q_DISABLE_COPY(QCPColorScale)
2508 
2510 };
2511 
2512 
2518 {
2519 public:
2520  QCPData();
2521  QCPData(double key, double value);
2522  double key, value;
2523  double keyErrorPlus, keyErrorMinus;
2524  double valueErrorPlus, valueErrorMinus;
2525 };
2526 Q_DECLARE_TYPEINFO(QCPData, Q_MOVABLE_TYPE);
2527 
2535 typedef QMap<double, QCPData> QCPDataMap;
2536 typedef QMapIterator<double, QCPData> QCPDataMapIterator;
2537 typedef QMutableMapIterator<double, QCPData> QCPDataMutableMapIterator;
2538 
2539 
2541 {
2542  Q_OBJECT
2544  Q_PROPERTY(LineStyle lineStyle READ lineStyle WRITE setLineStyle)
2545  Q_PROPERTY(QCPScatterStyle scatterStyle READ scatterStyle WRITE setScatterStyle)
2546  Q_PROPERTY(ErrorType errorType READ errorType WRITE setErrorType)
2547  Q_PROPERTY(QPen errorPen READ errorPen WRITE setErrorPen)
2548  Q_PROPERTY(double errorBarSize READ errorBarSize WRITE setErrorBarSize)
2549  Q_PROPERTY(bool errorBarSkipSymbol READ errorBarSkipSymbol WRITE setErrorBarSkipSymbol)
2550  Q_PROPERTY(QCPGraph* channelFillGraph READ channelFillGraph WRITE setChannelFillGraph)
2551  Q_PROPERTY(bool adaptiveSampling READ adaptiveSampling WRITE setAdaptiveSampling)
2553 public:
2559  enum LineStyle { lsNone
2560  ,lsLine
2562  ,lsStepLeft
2563  ,lsStepRight
2564  ,lsStepCenter
2565  ,lsImpulse
2566  };
2567  Q_ENUMS(LineStyle)
2571  enum ErrorType { etNone
2572  ,etKey
2573  ,etValue
2574  ,etBoth
2575  };
2576  Q_ENUMS(ErrorType)
2577 
2578  explicit QCPGraph(QCPAxis *keyAxis, QCPAxis *valueAxis);
2579  virtual ~QCPGraph();
2580 
2581  // getters:
2582  QCPDataMap *data() const { return mData; }
2583  LineStyle lineStyle() const { return mLineStyle; }
2584  QCPScatterStyle scatterStyle() const { return mScatterStyle; }
2585  ErrorType errorType() const { return mErrorType; }
2586  QPen errorPen() const { return mErrorPen; }
2587  double errorBarSize() const { return mErrorBarSize; }
2588  bool errorBarSkipSymbol() const { return mErrorBarSkipSymbol; }
2589  QCPGraph *channelFillGraph() const { return mChannelFillGraph.data(); }
2590  bool adaptiveSampling() const { return mAdaptiveSampling; }
2591 
2592  // setters:
2593  void setData(QCPDataMap *data, bool copy=false);
2594  void setData(const QVector<double> &key, const QVector<double> &value);
2595  void setDataKeyError(const QVector<double> &key, const QVector<double> &value, const QVector<double> &keyError);
2596  void setDataKeyError(const QVector<double> &key, const QVector<double> &value, const QVector<double> &keyErrorMinus, const QVector<double> &keyErrorPlus);
2597  void setDataValueError(const QVector<double> &key, const QVector<double> &value, const QVector<double> &valueError);
2598  void setDataValueError(const QVector<double> &key, const QVector<double> &value, const QVector<double> &valueErrorMinus, const QVector<double> &valueErrorPlus);
2599  void setDataBothError(const QVector<double> &key, const QVector<double> &value, const QVector<double> &keyError, const QVector<double> &valueError);
2600  void setDataBothError(const QVector<double> &key, const QVector<double> &value, const QVector<double> &keyErrorMinus, const QVector<double> &keyErrorPlus, const QVector<double> &valueErrorMinus, const QVector<double> &valueErrorPlus);
2601  void setLineStyle(LineStyle ls);
2602  void setScatterStyle(const QCPScatterStyle &style);
2603  void setErrorType(ErrorType errorType);
2604  void setErrorPen(const QPen &pen);
2605  void setErrorBarSize(double size);
2606  void setErrorBarSkipSymbol(bool enabled);
2607  void setChannelFillGraph(QCPGraph *targetGraph);
2608  void setAdaptiveSampling(bool enabled);
2609 
2610  // non-property methods:
2611  void addData(const QCPDataMap &dataMap);
2612  void addData(const QCPData &data);
2613  void addData(double key, double value);
2614  void addData(const QVector<double> &keys, const QVector<double> &values);
2615  void removeDataBefore(double key);
2616  void removeDataAfter(double key);
2617  void removeData(double fromKey, double toKey);
2618  void removeData(double key);
2619 
2620  // reimplemented virtual methods:
2621  virtual void clearData();
2622  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;
2626  void rescaleAxes(bool onlyEnlarge, bool includeErrorBars) const; // overloads base class interface
2627  void rescaleKeyAxis(bool onlyEnlarge, bool includeErrorBars) const; // overloads base class interface
2628  void rescaleValueAxis(bool onlyEnlarge, bool includeErrorBars) const; // overloads base class interface
2629 
2630 protected:
2631  // property members:
2632  QCPDataMap *mData;
2639  QPointer<QCPGraph> mChannelFillGraph;
2641 
2642  // reimplemented virtual methods:
2643  virtual void draw(QCPPainter *painter);
2644  virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const;
2645  virtual QCPRange getKeyRange(bool &foundRange, SignDomain inSignDomain=sdBoth) const;
2646  virtual QCPRange getValueRange(bool &foundRange, SignDomain inSignDomain=sdBoth) const;
2647  virtual QCPRange getKeyRange(bool &foundRange, SignDomain inSignDomain, bool includeErrors) const; // overloads base class interface
2648  virtual QCPRange getValueRange(bool &foundRange, SignDomain inSignDomain, bool includeErrors) const; // overloads base class interface
2649 
2650  // introduced virtual methods:
2651  virtual void drawFill(QCPPainter *painter, QVector<QPointF> *lineData) const;
2652  virtual void drawScatterPlot(QCPPainter *painter, QVector<QCPData> *scatterData) const;
2653  virtual void drawLinePlot(QCPPainter *painter, QVector<QPointF> *lineData) const;
2654  virtual void drawImpulsePlot(QCPPainter *painter, QVector<QPointF> *lineData) const;
2655 
2656  // non-virtual methods:
2657  void getPreparedData(QVector<QCPData> *lineData, QVector<QCPData> *scatterData) const;
2658  void getPlotData(QVector<QPointF> *lineData, QVector<QCPData> *scatterData) const;
2659  void getScatterPlotData(QVector<QCPData> *scatterData) const;
2660  void getLinePlotData(QVector<QPointF> *linePixelData, QVector<QCPData> *scatterData) const;
2661  void getStepLeftPlotData(QVector<QPointF> *linePixelData, QVector<QCPData> *scatterData) const;
2662  void getStepRightPlotData(QVector<QPointF> *linePixelData, QVector<QCPData> *scatterData) const;
2663  void getStepCenterPlotData(QVector<QPointF> *linePixelData, QVector<QCPData> *scatterData) const;
2664  void getImpulsePlotData(QVector<QPointF> *linePixelData, QVector<QCPData> *scatterData) const;
2665  void drawError(QCPPainter *painter, double x, double y, const QCPData &data) const;
2666  void getVisibleDataBounds(QCPDataMap::const_iterator &lower, QCPDataMap::const_iterator &upper) const;
2667  int countDataInBounds(const QCPDataMap::const_iterator &lower, const QCPDataMap::const_iterator &upper, int maxCount) const;
2668  void addFillBasePoints(QVector<QPointF> *lineData) const;
2669  void removeFillBasePoints(QVector<QPointF> *lineData) const;
2670  QPointF lowerFillBasePoint(double lowerKey) const;
2671  QPointF upperFillBasePoint(double upperKey) const;
2672  const QPolygonF getChannelFillPolygon(const QVector<QPointF> *lineData) const;
2673  int findIndexBelowX(const QVector<QPointF> *data, double x) const;
2674  int findIndexAboveX(const QVector<QPointF> *data, double x) const;
2675  int findIndexBelowY(const QVector<QPointF> *data, double y) const;
2676  int findIndexAboveY(const QVector<QPointF> *data, double y) const;
2677  double pointDistance(const QPointF &pixelPoint) const;
2678 
2679  friend class QCustomPlot;
2680  friend class QCPLegend;
2681 };
2682 
2683 
2689 {
2690 public:
2691  QCPCurveData();
2692  QCPCurveData(double t, double key, double value);
2693  double t, key, value;
2694 };
2695 Q_DECLARE_TYPEINFO(QCPCurveData, Q_MOVABLE_TYPE);
2696 
2705 typedef QMap<double, QCPCurveData> QCPCurveDataMap;
2706 typedef QMapIterator<double, QCPCurveData> QCPCurveDataMapIterator;
2707 typedef QMutableMapIterator<double, QCPCurveData> QCPCurveDataMutableMapIterator;
2708 
2709 
2711 {
2712  Q_OBJECT
2714  Q_PROPERTY(QCPScatterStyle scatterStyle READ scatterStyle WRITE setScatterStyle)
2715  Q_PROPERTY(LineStyle lineStyle READ lineStyle WRITE setLineStyle)
2717 public:
2723  enum LineStyle { lsNone
2724  ,lsLine
2725  };
2726  explicit QCPCurve(QCPAxis *keyAxis, QCPAxis *valueAxis);
2727  virtual ~QCPCurve();
2728 
2729  // getters:
2730  QCPCurveDataMap *data() const { return mData; }
2731  QCPScatterStyle scatterStyle() const { return mScatterStyle; }
2732  LineStyle lineStyle() const { return mLineStyle; }
2733 
2734  // setters:
2735  void setData(QCPCurveDataMap *data, bool copy=false);
2736  void setData(const QVector<double> &t, const QVector<double> &key, const QVector<double> &value);
2737  void setData(const QVector<double> &key, const QVector<double> &value);
2738  void setScatterStyle(const QCPScatterStyle &style);
2739  void setLineStyle(LineStyle style);
2740 
2741  // non-property methods:
2742  void addData(const QCPCurveDataMap &dataMap);
2743  void addData(const QCPCurveData &data);
2744  void addData(double t, double key, double value);
2745  void addData(double key, double value);
2746  void addData(const QVector<double> &ts, const QVector<double> &keys, const QVector<double> &values);
2747  void removeDataBefore(double t);
2748  void removeDataAfter(double t);
2749  void removeData(double fromt, double tot);
2750  void removeData(double t);
2751 
2752  // reimplemented virtual methods:
2753  virtual void clearData();
2754  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;
2755 
2756 protected:
2757  // property members:
2758  QCPCurveDataMap *mData;
2761 
2762  // reimplemented virtual methods:
2763  virtual void draw(QCPPainter *painter);
2764  virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const;
2765  virtual QCPRange getKeyRange(bool &foundRange, SignDomain inSignDomain=sdBoth) const;
2766  virtual QCPRange getValueRange(bool &foundRange, SignDomain inSignDomain=sdBoth) const;
2767 
2768  // introduced virtual methods:
2769  virtual void drawScatterPlot(QCPPainter *painter, const QVector<QPointF> *pointData) const;
2770 
2771  // non-virtual methods:
2772  void getCurveData(QVector<QPointF> *lineData) const;
2773  int getRegion(double x, double y, double rectLeft, double rectTop, double rectRight, double rectBottom) const;
2774  QPointF getOptimizedPoint(int prevRegion, double prevKey, double prevValue, double key, double value, double rectLeft, double rectTop, double rectRight, double rectBottom) const;
2775  QVector<QPointF> getOptimizedCornerPoints(int prevRegion, int currentRegion, double prevKey, double prevValue, double key, double value, double rectLeft, double rectTop, double rectRight, double rectBottom) const;
2776  bool mayTraverse(int prevRegion, int currentRegion) const;
2777  bool getTraverse(double prevKey, double prevValue, double key, double value, double rectLeft, double rectTop, double rectRight, double rectBottom, QPointF &crossA, QPointF &crossB) const;
2778  void getTraverseCornerPoints(int prevRegion, int currentRegion, double rectLeft, double rectTop, double rectRight, double rectBottom, QVector<QPointF> &beforeTraverse, QVector<QPointF> &afterTraverse) const;
2779  double pointDistance(const QPointF &pixelPoint) const;
2780 
2781  friend class QCustomPlot;
2782  friend class QCPLegend;
2783 };
2784 
2785 
2790 class QCP_LIB_DECL QCPBarsGroup : public QObject
2791 {
2792  Q_OBJECT
2794  Q_PROPERTY(SpacingType spacingType READ spacingType WRITE setSpacingType)
2795  Q_PROPERTY(double spacing READ spacing WRITE setSpacing)
2797 public:
2804  enum SpacingType { stAbsolute
2805  ,stAxisRectRatio
2806  ,stPlotCoords
2807  };
2808  QCPBarsGroup(QCustomPlot *parentPlot);
2809  ~QCPBarsGroup();
2810 
2811  // getters:
2812  SpacingType spacingType() const { return mSpacingType; }
2813  double spacing() const { return mSpacing; }
2814 
2815  // setters:
2816  void setSpacingType(SpacingType spacingType);
2817  void setSpacing(double spacing);
2818 
2819  // non-virtual methods:
2820  QList<QCPBars*> bars() const { return mBars; }
2821  QCPBars* bars(int index) const;
2822  int size() const { return mBars.size(); }
2823  bool isEmpty() const { return mBars.isEmpty(); }
2824  void clear();
2825  bool contains(QCPBars *bars) const { return mBars.contains(bars); }
2826  void append(QCPBars *bars);
2827  void insert(int i, QCPBars *bars);
2828  void remove(QCPBars *bars);
2829 
2830 protected:
2831  // non-property members:
2832  QCustomPlot *mParentPlot;
2834  double mSpacing;
2835  QList<QCPBars*> mBars;
2836 
2837  // non-virtual methods:
2838  void registerBars(QCPBars *bars);
2839  void unregisterBars(QCPBars *bars);
2840 
2841  // virtual methods:
2842  double keyPixelOffset(const QCPBars *bars, double keyCoord);
2843  double getPixelSpacing(const QCPBars *bars, double keyCoord);
2844 
2845 private:
2846  Q_DISABLE_COPY(QCPBarsGroup)
2847 
2848  friend class QCPBars;
2849 };
2850 
2851 
2853 {
2854 public:
2855  QCPBarData();
2856  QCPBarData(double key, double value);
2857  double key, value;
2858 };
2859 Q_DECLARE_TYPEINFO(QCPBarData, Q_MOVABLE_TYPE);
2860 
2868 typedef QMap<double, QCPBarData> QCPBarDataMap;
2869 typedef QMapIterator<double, QCPBarData> QCPBarDataMapIterator;
2870 typedef QMutableMapIterator<double, QCPBarData> QCPBarDataMutableMapIterator;
2871 
2872 
2874 {
2875  Q_OBJECT
2877  Q_PROPERTY(double width READ width WRITE setWidth)
2878  Q_PROPERTY(WidthType widthType READ widthType WRITE setWidthType)
2879  Q_PROPERTY(QCPBarsGroup* barsGroup READ barsGroup WRITE setBarsGroup)
2880  Q_PROPERTY(double baseValue READ baseValue WRITE setBaseValue)
2881  Q_PROPERTY(QCPBars* barBelow READ barBelow)
2882  Q_PROPERTY(QCPBars* barAbove READ barAbove)
2884 public:
2891  enum WidthType { wtAbsolute
2892  ,wtAxisRectRatio
2893  ,wtPlotCoords
2894  };
2895  Q_ENUMS(WidthType)
2896 
2897  explicit QCPBars(QCPAxis *keyAxis, QCPAxis *valueAxis);
2898  virtual ~QCPBars();
2899 
2900  // getters:
2901  double width() const { return mWidth; }
2902  WidthType widthType() const { return mWidthType; }
2903  QCPBarsGroup *barsGroup() const { return mBarsGroup; }
2904  double baseValue() const { return mBaseValue; }
2905  QCPBars *barBelow() const { return mBarBelow.data(); }
2906  QCPBars *barAbove() const { return mBarAbove.data(); }
2907  QCPBarDataMap *data() const { return mData; }
2908 
2909  // setters:
2910  void setWidth(double width);
2911  void setWidthType(WidthType widthType);
2912  void setBarsGroup(QCPBarsGroup *barsGroup);
2913  void setBaseValue(double baseValue);
2914  void setData(QCPBarDataMap *data, bool copy=false);
2915  void setData(const QVector<double> &key, const QVector<double> &value);
2916 
2917  // non-property methods:
2918  void moveBelow(QCPBars *bars);
2919  void moveAbove(QCPBars *bars);
2920  void addData(const QCPBarDataMap &dataMap);
2921  void addData(const QCPBarData &data);
2922  void addData(double key, double value);
2923  void addData(const QVector<double> &keys, const QVector<double> &values);
2924  void removeDataBefore(double key);
2925  void removeDataAfter(double key);
2926  void removeData(double fromKey, double toKey);
2927  void removeData(double key);
2928 
2929  // reimplemented virtual methods:
2930  virtual void clearData();
2931  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;
2932 
2933 protected:
2934  // property members:
2935  QCPBarDataMap *mData;
2936  double mWidth;
2939  double mBaseValue;
2940  QPointer<QCPBars> mBarBelow, mBarAbove;
2941 
2942  // reimplemented virtual methods:
2943  virtual void draw(QCPPainter *painter);
2944  virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const;
2945  virtual QCPRange getKeyRange(bool &foundRange, SignDomain inSignDomain=sdBoth) const;
2946  virtual QCPRange getValueRange(bool &foundRange, SignDomain inSignDomain=sdBoth) const;
2947 
2948  // non-virtual methods:
2949  void getVisibleDataBounds(QCPBarDataMap::const_iterator &lower, QCPBarDataMap::const_iterator &upperEnd) const;
2950  QPolygonF getBarPolygon(double key, double value) const;
2951  void getPixelWidth(double key, double &lower, double &upper) const;
2952  double getStackedBaseValue(double key, bool positive) const;
2953  static void connectBars(QCPBars* lower, QCPBars* upper);
2954 
2955  friend class QCustomPlot;
2956  friend class QCPLegend;
2957  friend class QCPBarsGroup;
2958 };
2959 
2960 
2966 {
2967  Q_OBJECT
2969  Q_PROPERTY(double key READ key WRITE setKey)
2970  Q_PROPERTY(double minimum READ minimum WRITE setMinimum)
2971  Q_PROPERTY(double lowerQuartile READ lowerQuartile WRITE setLowerQuartile)
2972  Q_PROPERTY(double median READ median WRITE setMedian)
2973  Q_PROPERTY(double upperQuartile READ upperQuartile WRITE setUpperQuartile)
2974  Q_PROPERTY(double maximum READ maximum WRITE setMaximum)
2975  Q_PROPERTY(QVector<double> outliers READ outliers WRITE setOutliers)
2976  Q_PROPERTY(double width READ width WRITE setWidth)
2977  Q_PROPERTY(double whiskerWidth READ whiskerWidth WRITE setWhiskerWidth)
2978  Q_PROPERTY(QPen whiskerPen READ whiskerPen WRITE setWhiskerPen)
2979  Q_PROPERTY(QPen whiskerBarPen READ whiskerBarPen WRITE setWhiskerBarPen)
2980  Q_PROPERTY(QPen medianPen READ medianPen WRITE setMedianPen)
2981  Q_PROPERTY(QCPScatterStyle outlierStyle READ outlierStyle WRITE setOutlierStyle)
2983 public:
2984  explicit QCPStatisticalBox(QCPAxis *keyAxis, QCPAxis *valueAxis);
2985 
2986  // getters:
2987  double key() const { return mKey; }
2988  double minimum() const { return mMinimum; }
2989  double lowerQuartile() const { return mLowerQuartile; }
2990  double median() const { return mMedian; }
2991  double upperQuartile() const { return mUpperQuartile; }
2992  double maximum() const { return mMaximum; }
2993  QVector<double> outliers() const { return mOutliers; }
2994  double width() const { return mWidth; }
2995  double whiskerWidth() const { return mWhiskerWidth; }
2996  QPen whiskerPen() const { return mWhiskerPen; }
2997  QPen whiskerBarPen() const { return mWhiskerBarPen; }
2998  QPen medianPen() const { return mMedianPen; }
2999  QCPScatterStyle outlierStyle() const { return mOutlierStyle; }
3000 
3001  // setters:
3002  void setKey(double key);
3003  void setMinimum(double value);
3004  void setLowerQuartile(double value);
3005  void setMedian(double value);
3006  void setUpperQuartile(double value);
3007  void setMaximum(double value);
3008  void setOutliers(const QVector<double> &values);
3009  void setData(double key, double minimum, double lowerQuartile, double median, double upperQuartile, double maximum);
3010  void setWidth(double width);
3011  void setWhiskerWidth(double width);
3012  void setWhiskerPen(const QPen &pen);
3013  void setWhiskerBarPen(const QPen &pen);
3014  void setMedianPen(const QPen &pen);
3015  void setOutlierStyle(const QCPScatterStyle &style);
3016 
3017  // non-property methods:
3018  virtual void clearData();
3019  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;
3020 
3021 protected:
3022  // property members:
3023  QVector<double> mOutliers;
3024  double mKey, mMinimum, mLowerQuartile, mMedian, mUpperQuartile, mMaximum;
3025  double mWidth;
3027  QPen mWhiskerPen, mWhiskerBarPen, mMedianPen;
3029 
3030  // reimplemented virtual methods:
3031  virtual void draw(QCPPainter *painter);
3032  virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const;
3033  virtual QCPRange getKeyRange(bool &foundRange, SignDomain inSignDomain=sdBoth) const;
3034  virtual QCPRange getValueRange(bool &foundRange, SignDomain inSignDomain=sdBoth) const;
3035 
3036  // introduced virtual methods:
3037  virtual void drawQuartileBox(QCPPainter *painter, QRectF *quartileBox=0) const;
3038  virtual void drawMedian(QCPPainter *painter) const;
3039  virtual void drawWhiskers(QCPPainter *painter) const;
3040  virtual void drawOutliers(QCPPainter *painter) const;
3041 
3042  friend class QCustomPlot;
3043  friend class QCPLegend;
3044 };
3045 
3046 
3048 {
3049 public:
3050  QCPColorMapData(int keySize, int valueSize, const QCPRange &keyRange, const QCPRange &valueRange);
3051  ~QCPColorMapData();
3052  QCPColorMapData(const QCPColorMapData &other);
3053  QCPColorMapData &operator=(const QCPColorMapData &other);
3054 
3055  // getters:
3056  int keySize() const { return mKeySize; }
3057  int valueSize() const { return mValueSize; }
3058  QCPRange keyRange() const { return mKeyRange; }
3059  QCPRange valueRange() const { return mValueRange; }
3060  QCPRange dataBounds() const { return mDataBounds; }
3061  double data(double key, double value);
3062  double cell(int keyIndex, int valueIndex);
3063 
3064  // setters:
3065  void setSize(int keySize, int valueSize);
3066  void setKeySize(int keySize);
3067  void setValueSize(int valueSize);
3068  void setRange(const QCPRange &keyRange, const QCPRange &valueRange);
3069  void setKeyRange(const QCPRange &keyRange);
3070  void setValueRange(const QCPRange &valueRange);
3071  void setData(double key, double value, double z);
3072  void setCell(int keyIndex, int valueIndex, double z);
3073 
3074  // non-property methods:
3075  void recalculateDataBounds();
3076  void clear();
3077  void fill(double z);
3078  bool isEmpty() const { return mIsEmpty; }
3079  void coordToCell(double key, double value, int *keyIndex, int *valueIndex) const;
3080  void cellToCoord(int keyIndex, int valueIndex, double *key, double *value) const;
3081 
3082 protected:
3083  // property members:
3084  int mKeySize, mValueSize;
3085  QCPRange mKeyRange, mValueRange;
3086  bool mIsEmpty;
3087  // non-property members:
3088  double *mData;
3091 
3092  friend class QCPColorMap;
3093 };
3094 
3095 
3097 {
3098  Q_OBJECT
3100  Q_PROPERTY(QCPRange dataRange READ dataRange WRITE setDataRange NOTIFY dataRangeChanged)
3101  Q_PROPERTY(QCPAxis::ScaleType dataScaleType READ dataScaleType WRITE setDataScaleType NOTIFY dataScaleTypeChanged)
3102  Q_PROPERTY(QCPColorGradient gradient READ gradient WRITE setGradient NOTIFY gradientChanged)
3103  Q_PROPERTY(bool interpolate READ interpolate WRITE setInterpolate)
3104  Q_PROPERTY(bool tightBoundary READ tightBoundary WRITE setTightBoundary)
3105  Q_PROPERTY(QCPColorScale* colorScale READ colorScale WRITE setColorScale)
3107 public:
3108  explicit QCPColorMap(QCPAxis *keyAxis, QCPAxis *valueAxis);
3109  virtual ~QCPColorMap();
3110 
3111  // getters:
3112  QCPColorMapData *data() const { return mMapData; }
3113  QCPRange dataRange() const { return mDataRange; }
3114  QCPAxis::ScaleType dataScaleType() const { return mDataScaleType; }
3115  bool interpolate() const { return mInterpolate; }
3116  bool tightBoundary() const { return mTightBoundary; }
3117  QCPColorGradient gradient() const { return mGradient; }
3118  QCPColorScale *colorScale() const { return mColorScale.data(); }
3119 
3120  // setters:
3121  void setData(QCPColorMapData *data, bool copy=false);
3122  Q_SLOT void setDataRange(const QCPRange &dataRange);
3123  Q_SLOT void setDataScaleType(QCPAxis::ScaleType scaleType);
3124  Q_SLOT void setGradient(const QCPColorGradient &gradient);
3125  void setInterpolate(bool enabled);
3126  void setTightBoundary(bool enabled);
3127  void setColorScale(QCPColorScale *colorScale);
3128 
3129  // non-property methods:
3130  void rescaleDataRange(bool recalculateDataBounds=false);
3131  Q_SLOT void updateLegendIcon(Qt::TransformationMode transformMode=Qt::SmoothTransformation, const QSize &thumbSize=QSize(32, 18));
3132 
3133  // reimplemented virtual methods:
3134  virtual void clearData();
3135  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;
3136 
3137 signals:
3138  void dataRangeChanged(QCPRange newRange);
3139  void dataScaleTypeChanged(QCPAxis::ScaleType scaleType);
3140  void gradientChanged(QCPColorGradient newGradient);
3141 
3142 protected:
3143  // property members:
3150  QPointer<QCPColorScale> mColorScale;
3151  // non-property members:
3152  QImage mMapImage;
3153  QPixmap mLegendIcon;
3155 
3156  // introduced virtual methods:
3157  virtual void updateMapImage();
3158 
3159  // reimplemented virtual methods:
3160  virtual void draw(QCPPainter *painter);
3161  virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const;
3162  virtual QCPRange getKeyRange(bool &foundRange, SignDomain inSignDomain=sdBoth) const;
3163  virtual QCPRange getValueRange(bool &foundRange, SignDomain inSignDomain=sdBoth) const;
3164 
3165  friend class QCustomPlot;
3166  friend class QCPLegend;
3167 };
3168 
3169 
3175 {
3176 public:
3177  QCPFinancialData();
3178  QCPFinancialData(double key, double open, double high, double low, double close);
3179  double key, open, high, low, close;
3180 };
3181 Q_DECLARE_TYPEINFO(QCPFinancialData, Q_MOVABLE_TYPE);
3182 
3190 typedef QMap<double, QCPFinancialData> QCPFinancialDataMap;
3191 typedef QMapIterator<double, QCPFinancialData> QCPFinancialDataMapIterator;
3192 typedef QMutableMapIterator<double, QCPFinancialData> QCPFinancialDataMutableMapIterator;
3193 
3194 
3196 {
3197  Q_OBJECT
3199  Q_PROPERTY(ChartStyle chartStyle READ chartStyle WRITE setChartStyle)
3200  Q_PROPERTY(double width READ width WRITE setWidth)
3201  Q_PROPERTY(bool twoColored READ twoColored WRITE setTwoColored)
3202  Q_PROPERTY(QBrush brushPositive READ brushPositive WRITE setBrushPositive)
3203  Q_PROPERTY(QBrush brushNegative READ brushNegative WRITE setBrushNegative)
3204  Q_PROPERTY(QPen penPositive READ penPositive WRITE setPenPositive)
3205  Q_PROPERTY(QPen penNegative READ penNegative WRITE setPenNegative)
3207 public:
3213  enum ChartStyle { csOhlc
3214  ,csCandlestick
3215  };
3216  Q_ENUMS(ChartStyle)
3217 
3218  explicit QCPFinancial(QCPAxis *keyAxis, QCPAxis *valueAxis);
3219  virtual ~QCPFinancial();
3220 
3221  // getters:
3222  QCPFinancialDataMap *data() const { return mData; }
3223  ChartStyle chartStyle() const { return mChartStyle; }
3224  double width() const { return mWidth; }
3225  bool twoColored() const { return mTwoColored; }
3226  QBrush brushPositive() const { return mBrushPositive; }
3227  QBrush brushNegative() const { return mBrushNegative; }
3228  QPen penPositive() const { return mPenPositive; }
3229  QPen penNegative() const { return mPenNegative; }
3230 
3231 
3232  // setters:
3233  void setData(QCPFinancialDataMap *data, bool copy=false);
3234  void setData(const QVector<double> &key, const QVector<double> &open, const QVector<double> &high, const QVector<double> &low, const QVector<double> &close);
3235  void setChartStyle(ChartStyle style);
3236  void setWidth(double width);
3237  void setTwoColored(bool twoColored);
3238  void setBrushPositive(const QBrush &brush);
3239  void setBrushNegative(const QBrush &brush);
3240  void setPenPositive(const QPen &pen);
3241  void setPenNegative(const QPen &pen);
3242 
3243  // non-property methods:
3244  void addData(const QCPFinancialDataMap &dataMap);
3245  void addData(const QCPFinancialData &data);
3246  void addData(double key, double open, double high, double low, double close);
3247  void addData(const QVector<double> &key, const QVector<double> &open, const QVector<double> &high, const QVector<double> &low, const QVector<double> &close);
3248  void removeDataBefore(double key);
3249  void removeDataAfter(double key);
3250  void removeData(double fromKey, double toKey);
3251  void removeData(double key);
3252 
3253  // reimplemented virtual methods:
3254  virtual void clearData();
3255  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;
3256 
3257  // static methods:
3258  static QCPFinancialDataMap timeSeriesToOhlc(const QVector<double> &time, const QVector<double> &value, double timeBinSize, double timeBinOffset = 0);
3259 
3260 protected:
3261  // property members:
3262  QCPFinancialDataMap *mData;
3264  double mWidth;
3266  QBrush mBrushPositive, mBrushNegative;
3267  QPen mPenPositive, mPenNegative;
3268 
3269  // reimplemented virtual methods:
3270  virtual void draw(QCPPainter *painter);
3271  virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const;
3272  virtual QCPRange getKeyRange(bool &foundRange, SignDomain inSignDomain=sdBoth) const;
3273  virtual QCPRange getValueRange(bool &foundRange, SignDomain inSignDomain=sdBoth) const;
3274 
3275  // non-virtual methods:
3276  void drawOhlcPlot(QCPPainter *painter, const QCPFinancialDataMap::const_iterator &begin, const QCPFinancialDataMap::const_iterator &end);
3277  void drawCandlestickPlot(QCPPainter *painter, const QCPFinancialDataMap::const_iterator &begin, const QCPFinancialDataMap::const_iterator &end);
3278  double ohlcSelectTest(const QPointF &pos, const QCPFinancialDataMap::const_iterator &begin, const QCPFinancialDataMap::const_iterator &end) const;
3279  double candlestickSelectTest(const QPointF &pos, const QCPFinancialDataMap::const_iterator &begin, const QCPFinancialDataMap::const_iterator &end) const;
3280  void getVisibleDataBounds(QCPFinancialDataMap::const_iterator &lower, QCPFinancialDataMap::const_iterator &upper) const;
3281 
3282  friend class QCustomPlot;
3283  friend class QCPLegend;
3284 };
3285 
3286 
3288 {
3289  Q_OBJECT
3291  Q_PROPERTY(QPen pen READ pen WRITE setPen)
3292  Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
3294 public:
3295  QCPItemStraightLine(QCustomPlot *parentPlot);
3296  virtual ~QCPItemStraightLine();
3297 
3298  // getters:
3299  QPen pen() const { return mPen; }
3300  QPen selectedPen() const { return mSelectedPen; }
3301 
3302  // setters;
3303  void setPen(const QPen &pen);
3304  void setSelectedPen(const QPen &pen);
3305 
3306  // reimplemented virtual methods:
3307  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;
3308 
3311 
3312 protected:
3313  // property members:
3314  QPen mPen, mSelectedPen;
3315 
3316  // reimplemented virtual methods:
3317  virtual void draw(QCPPainter *painter);
3318 
3319  // non-virtual methods:
3320  double distToStraightLine(const QVector2D &point1, const QVector2D &vec, const QVector2D &point) const;
3321  QLineF getRectClippedStraightLine(const QVector2D &point1, const QVector2D &vec, const QRect &rect) const;
3322  QPen mainPen() const;
3323 };
3324 
3325 
3327 {
3328  Q_OBJECT
3330  Q_PROPERTY(QPen pen READ pen WRITE setPen)
3331  Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
3332  Q_PROPERTY(QCPLineEnding head READ head WRITE setHead)
3333  Q_PROPERTY(QCPLineEnding tail READ tail WRITE setTail)
3335 public:
3336  QCPItemLine(QCustomPlot *parentPlot);
3337  virtual ~QCPItemLine();
3338 
3339  // getters:
3340  QPen pen() const { return mPen; }
3341  QPen selectedPen() const { return mSelectedPen; }
3342  QCPLineEnding head() const { return mHead; }
3343  QCPLineEnding tail() const { return mTail; }
3344 
3345  // setters;
3346  void setPen(const QPen &pen);
3347  void setSelectedPen(const QPen &pen);
3348  void setHead(const QCPLineEnding &head);
3349  void setTail(const QCPLineEnding &tail);
3350 
3351  // reimplemented virtual methods:
3352  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;
3353 
3356 
3357 protected:
3358  // property members:
3359  QPen mPen, mSelectedPen;
3361 
3362  // reimplemented virtual methods:
3363  virtual void draw(QCPPainter *painter);
3364 
3365  // non-virtual methods:
3366  QLineF getRectClippedLine(const QVector2D &start, const QVector2D &end, const QRect &rect) const;
3367  QPen mainPen() const;
3368 };
3369 
3370 
3372 {
3373  Q_OBJECT
3375  Q_PROPERTY(QPen pen READ pen WRITE setPen)
3376  Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
3377  Q_PROPERTY(QCPLineEnding head READ head WRITE setHead)
3378  Q_PROPERTY(QCPLineEnding tail READ tail WRITE setTail)
3380 public:
3381  QCPItemCurve(QCustomPlot *parentPlot);
3382  virtual ~QCPItemCurve();
3383 
3384  // getters:
3385  QPen pen() const { return mPen; }
3386  QPen selectedPen() const { return mSelectedPen; }
3387  QCPLineEnding head() const { return mHead; }
3388  QCPLineEnding tail() const { return mTail; }
3389 
3390  // setters;
3391  void setPen(const QPen &pen);
3392  void setSelectedPen(const QPen &pen);
3393  void setHead(const QCPLineEnding &head);
3394  void setTail(const QCPLineEnding &tail);
3395 
3396  // reimplemented virtual methods:
3397  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;
3398 
3403 
3404 protected:
3405  // property members:
3406  QPen mPen, mSelectedPen;
3408 
3409  // reimplemented virtual methods:
3410  virtual void draw(QCPPainter *painter);
3411 
3412  // non-virtual methods:
3413  QPen mainPen() const;
3414 };
3415 
3416 
3418 {
3419  Q_OBJECT
3421  Q_PROPERTY(QPen pen READ pen WRITE setPen)
3422  Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
3423  Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
3424  Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
3426 public:
3427  QCPItemRect(QCustomPlot *parentPlot);
3428  virtual ~QCPItemRect();
3429 
3430  // getters:
3431  QPen pen() const { return mPen; }
3432  QPen selectedPen() const { return mSelectedPen; }
3433  QBrush brush() const { return mBrush; }
3434  QBrush selectedBrush() const { return mSelectedBrush; }
3435 
3436  // setters;
3437  void setPen(const QPen &pen);
3438  void setSelectedPen(const QPen &pen);
3439  void setBrush(const QBrush &brush);
3440  void setSelectedBrush(const QBrush &brush);
3441 
3442  // reimplemented virtual methods:
3443  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;
3444 
3453 
3454 protected:
3455  enum AnchorIndex {aiTop, aiTopRight, aiRight, aiBottom, aiBottomLeft, aiLeft};
3456 
3457  // property members:
3458  QPen mPen, mSelectedPen;
3459  QBrush mBrush, mSelectedBrush;
3460 
3461  // reimplemented virtual methods:
3462  virtual void draw(QCPPainter *painter);
3463  virtual QPointF anchorPixelPoint(int anchorId) const;
3464 
3465  // non-virtual methods:
3466  QPen mainPen() const;
3467  QBrush mainBrush() const;
3468 };
3469 
3470 
3472 {
3473  Q_OBJECT
3475  Q_PROPERTY(QColor color READ color WRITE setColor)
3476  Q_PROPERTY(QColor selectedColor READ selectedColor WRITE setSelectedColor)
3477  Q_PROPERTY(QPen pen READ pen WRITE setPen)
3478  Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
3479  Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
3480  Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
3481  Q_PROPERTY(QFont font READ font WRITE setFont)
3482  Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont)
3483  Q_PROPERTY(QString text READ text WRITE setText)
3484  Q_PROPERTY(Qt::Alignment positionAlignment READ positionAlignment WRITE setPositionAlignment)
3485  Q_PROPERTY(Qt::Alignment textAlignment READ textAlignment WRITE setTextAlignment)
3486  Q_PROPERTY(double rotation READ rotation WRITE setRotation)
3487  Q_PROPERTY(QMargins padding READ padding WRITE setPadding)
3489 public:
3490  QCPItemText(QCustomPlot *parentPlot);
3491  virtual ~QCPItemText();
3492 
3493  // getters:
3494  QColor color() const { return mColor; }
3495  QColor selectedColor() const { return mSelectedColor; }
3496  QPen pen() const { return mPen; }
3497  QPen selectedPen() const { return mSelectedPen; }
3498  QBrush brush() const { return mBrush; }
3499  QBrush selectedBrush() const { return mSelectedBrush; }
3500  QFont font() const { return mFont; }
3501  QFont selectedFont() const { return mSelectedFont; }
3502  QString text() const { return mText; }
3503  Qt::Alignment positionAlignment() const { return mPositionAlignment; }
3504  Qt::Alignment textAlignment() const { return mTextAlignment; }
3505  double rotation() const { return mRotation; }
3506  QMargins padding() const { return mPadding; }
3507 
3508  // setters;
3509  void setColor(const QColor &color);
3510  void setSelectedColor(const QColor &color);
3511  void setPen(const QPen &pen);
3512  void setSelectedPen(const QPen &pen);
3513  void setBrush(const QBrush &brush);
3514  void setSelectedBrush(const QBrush &brush);
3515  void setFont(const QFont &font);
3516  void setSelectedFont(const QFont &font);
3517  void setText(const QString &text);
3518  void setPositionAlignment(Qt::Alignment alignment);
3519  void setTextAlignment(Qt::Alignment alignment);
3520  void setRotation(double degrees);
3521  void setPadding(const QMargins &padding);
3522 
3523  // reimplemented virtual methods:
3524  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;
3525 
3535 
3536 protected:
3537  enum AnchorIndex {aiTopLeft, aiTop, aiTopRight, aiRight, aiBottomRight, aiBottom, aiBottomLeft, aiLeft};
3538 
3539  // property members:
3540  QColor mColor, mSelectedColor;
3541  QPen mPen, mSelectedPen;
3542  QBrush mBrush, mSelectedBrush;
3543  QFont mFont, mSelectedFont;
3544  QString mText;
3545  Qt::Alignment mPositionAlignment;
3546  Qt::Alignment mTextAlignment;
3547  double mRotation;
3548  QMargins mPadding;
3549 
3550  // reimplemented virtual methods:
3551  virtual void draw(QCPPainter *painter);
3552  virtual QPointF anchorPixelPoint(int anchorId) const;
3553 
3554  // non-virtual methods:
3555  QPointF getTextDrawPoint(const QPointF &pos, const QRectF &rect, Qt::Alignment positionAlignment) const;
3556  QFont mainFont() const;
3557  QColor mainColor() const;
3558  QPen mainPen() const;
3559  QBrush mainBrush() const;
3560 };
3561 
3562 
3564 {
3565  Q_OBJECT
3567  Q_PROPERTY(QPen pen READ pen WRITE setPen)
3568  Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
3569  Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
3570  Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
3572 public:
3573  QCPItemEllipse(QCustomPlot *parentPlot);
3574  virtual ~QCPItemEllipse();
3575 
3576  // getters:
3577  QPen pen() const { return mPen; }
3578  QPen selectedPen() const { return mSelectedPen; }
3579  QBrush brush() const { return mBrush; }
3580  QBrush selectedBrush() const { return mSelectedBrush; }
3581 
3582  // setters;
3583  void setPen(const QPen &pen);
3584  void setSelectedPen(const QPen &pen);
3585  void setBrush(const QBrush &brush);
3586  void setSelectedBrush(const QBrush &brush);
3587 
3588  // reimplemented virtual methods:
3589  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;
3590 
3602 
3603 protected:
3604  enum AnchorIndex {aiTopLeftRim, aiTop, aiTopRightRim, aiRight, aiBottomRightRim, aiBottom, aiBottomLeftRim, aiLeft, aiCenter};
3605 
3606  // property members:
3607  QPen mPen, mSelectedPen;
3608  QBrush mBrush, mSelectedBrush;
3609 
3610  // reimplemented virtual methods:
3611  virtual void draw(QCPPainter *painter);
3612  virtual QPointF anchorPixelPoint(int anchorId) const;
3613 
3614  // non-virtual methods:
3615  QPen mainPen() const;
3616  QBrush mainBrush() const;
3617 };
3618 
3619 
3621 {
3622  Q_OBJECT
3624  Q_PROPERTY(QPixmap pixmap READ pixmap WRITE setPixmap)
3625  Q_PROPERTY(bool scaled READ scaled WRITE setScaled)
3626  Q_PROPERTY(Qt::AspectRatioMode aspectRatioMode READ aspectRatioMode)
3627  Q_PROPERTY(Qt::TransformationMode transformationMode READ transformationMode)
3628  Q_PROPERTY(QPen pen READ pen WRITE setPen)
3629  Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
3631 public:
3632  QCPItemPixmap(QCustomPlot *parentPlot);
3633  virtual ~QCPItemPixmap();
3634 
3635  // getters:
3636  QPixmap pixmap() const { return mPixmap; }
3637  bool scaled() const { return mScaled; }
3638  Qt::AspectRatioMode aspectRatioMode() const { return mAspectRatioMode; }
3639  Qt::TransformationMode transformationMode() const { return mTransformationMode; }
3640  QPen pen() const { return mPen; }
3641  QPen selectedPen() const { return mSelectedPen; }
3642 
3643  // setters;
3644  void setPixmap(const QPixmap &pixmap);
3645  void setScaled(bool scaled, Qt::AspectRatioMode aspectRatioMode=Qt::KeepAspectRatio, Qt::TransformationMode transformationMode=Qt::SmoothTransformation);
3646  void setPen(const QPen &pen);
3647  void setSelectedPen(const QPen &pen);
3648 
3649  // reimplemented virtual methods:
3650  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;
3651 
3660 
3661 protected:
3662  enum AnchorIndex {aiTop, aiTopRight, aiRight, aiBottom, aiBottomLeft, aiLeft};
3663 
3664  // property members:
3665  QPixmap mPixmap;
3666  QPixmap mScaledPixmap;
3667  bool mScaled;
3668  Qt::AspectRatioMode mAspectRatioMode;
3669  Qt::TransformationMode mTransformationMode;
3670  QPen mPen, mSelectedPen;
3671 
3672  // reimplemented virtual methods:
3673  virtual void draw(QCPPainter *painter);
3674  virtual QPointF anchorPixelPoint(int anchorId) const;
3675 
3676  // non-virtual methods:
3677  void updateScaledPixmap(QRect finalRect=QRect(), bool flipHorz=false, bool flipVert=false);
3678  QRect getFinalRect(bool *flippedHorz=0, bool *flippedVert=0) const;
3679  QPen mainPen() const;
3680 };
3681 
3682 
3684 {
3685  Q_OBJECT
3687  Q_PROPERTY(QPen pen READ pen WRITE setPen)
3688  Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
3689  Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
3690  Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
3691  Q_PROPERTY(double size READ size WRITE setSize)
3692  Q_PROPERTY(TracerStyle style READ style WRITE setStyle)
3693  Q_PROPERTY(QCPGraph* graph READ graph WRITE setGraph)
3694  Q_PROPERTY(double graphKey READ graphKey WRITE setGraphKey)
3695  Q_PROPERTY(bool interpolating READ interpolating WRITE setInterpolating)
3697 public:
3703  enum TracerStyle { tsNone
3704  ,tsPlus
3705  ,tsCrosshair
3706  ,tsCircle
3707  ,tsSquare
3708  };
3709  Q_ENUMS(TracerStyle)
3710 
3711  QCPItemTracer(QCustomPlot *parentPlot);
3712  virtual ~QCPItemTracer();
3713 
3714  // getters:
3715  QPen pen() const { return mPen; }
3716  QPen selectedPen() const { return mSelectedPen; }
3717  QBrush brush() const { return mBrush; }
3718  QBrush selectedBrush() const { return mSelectedBrush; }
3719  double size() const { return mSize; }
3720  TracerStyle style() const { return mStyle; }
3721  QCPGraph *graph() const { return mGraph; }
3722  double graphKey() const { return mGraphKey; }
3723  bool interpolating() const { return mInterpolating; }
3724 
3725  // setters;
3726  void setPen(const QPen &pen);
3727  void setSelectedPen(const QPen &pen);
3728  void setBrush(const QBrush &brush);
3729  void setSelectedBrush(const QBrush &brush);
3730  void setSize(double size);
3731  void setStyle(TracerStyle style);
3732  void setGraph(QCPGraph *graph);
3733  void setGraphKey(double key);
3734  void setInterpolating(bool enabled);
3735 
3736  // reimplemented virtual methods:
3737  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;
3738 
3739  // non-virtual methods:
3740  void updatePosition();
3741 
3743 
3744 protected:
3745  // property members:
3746  QPen mPen, mSelectedPen;
3747  QBrush mBrush, mSelectedBrush;
3748  double mSize;
3751  double mGraphKey;
3753 
3754  // reimplemented virtual methods:
3755  virtual void draw(QCPPainter *painter);
3756 
3757  // non-virtual methods:
3758  QPen mainPen() const;
3759  QBrush mainBrush() const;
3760 };
3761 
3762 
3764 {
3765  Q_OBJECT
3767  Q_PROPERTY(QPen pen READ pen WRITE setPen)
3768  Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
3769  Q_PROPERTY(double length READ length WRITE setLength)
3770  Q_PROPERTY(BracketStyle style READ style WRITE setStyle)
3772 public:
3773  enum BracketStyle { bsSquare
3774  ,bsRound
3775  ,bsCurly
3776  ,bsCalligraphic
3777  };
3778 
3779  QCPItemBracket(QCustomPlot *parentPlot);
3780  virtual ~QCPItemBracket();
3781 
3782  // getters:
3783  QPen pen() const { return mPen; }
3784  QPen selectedPen() const { return mSelectedPen; }
3785  double length() const { return mLength; }
3786  BracketStyle style() const { return mStyle; }
3787 
3788  // setters;
3789  void setPen(const QPen &pen);
3790  void setSelectedPen(const QPen &pen);
3791  void setLength(double length);
3792  void setStyle(BracketStyle style);
3793 
3794  // reimplemented virtual methods:
3795  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;
3796 
3800 
3801 protected:
3802  // property members:
3803  enum AnchorIndex {aiCenter};
3804  QPen mPen, mSelectedPen;
3805  double mLength;
3807 
3808  // reimplemented virtual methods:
3809  virtual void draw(QCPPainter *painter);
3810  virtual QPointF anchorPixelPoint(int anchorId) const;
3811 
3812  // non-virtual methods:
3813  QPen mainPen() const;
3814 };
3815 
3816 #endif // QCUSTOMPLOT_H
3817 
QList< QList< QCPLayoutElement * > > mElements
Definition: qcustomplot.h:814
QCP::AntialiasedElements mNotAADragBackup
Definition: qcustomplot.h:2105
QCPLayoutGrid * plotLayout() const
Definition: qcustomplot.h:1728
QPen basePen() const
Definition: qcustomplot.h:1128
A bracket for referencing/highlighting certain parts in the plot.
Definition: qcustomplot.h:3763
QPen mSelectedPen
Definition: qcustomplot.h:3458
QCustomPlot * mParentPlot
Definition: qcustomplot.h:619
A margin group allows synchronization of margin sides if working with multiple layout elements...
Definition: qcustomplot.h:605
QList< QCPGraph * > mGraphs
Definition: qcustomplot.h:1855
QMargins padding() const
Definition: qcustomplot.h:3506
bool operator==(const QCPRange &other) const
Definition: qcustomplot.h:489
An arbitrary pixmap.
Definition: qcustomplot.h:3620
0xFFFF All elements
Definition: qcustomplot.h:134
QList< QCPLayoutElement * > elements(QCP::MarginSide side) const
Definition: qcustomplot.h:613
static const double maxRange
Definition: qcustomplot.h:515
Whether to use immediate repaint or queued update depends on whether the plotting hint QCP::phForceRe...
Definition: qcustomplot.h:1717
bool isInvalidData(double value)
Definition: qcustomplot.h:177
QCPColorGradient gradient() const
Definition: qcustomplot.h:2458
0x08 bottom margin
Definition: qcustomplot.h:108
bool clipToAxisRect() const
Definition: qcustomplot.h:1626
QPen selectedPen() const
Definition: qcustomplot.h:3432
QPen whiskerBarPen() const
Definition: qcustomplot.h:2997
QBrush brushNegative() const
Definition: qcustomplot.h:3227
QCPItemPosition *const end
Definition: qcustomplot.h:3402
QPen mErrorPen
Definition: qcustomplot.h:2633
QCPColorMapData * mMapData
Definition: qcustomplot.h:3146
QFont mSelectedFont
Definition: qcustomplot.h:2317
bool subGridVisible() const
Definition: qcustomplot.h:950
QCPLayout * mParentLayout
Definition: qcustomplot.h:694
QCPAxis * mParentAxis
Definition: qcustomplot.h:971
void drawLine(const QPointF &p1, const QPointF &p2)
Definition: qcustomplot.h:352
PainterModes modes() const
Definition: qcustomplot.h:339
QCPRange dataRange() const
Definition: qcustomplot.h:2456
bool mAutoTickStep
Definition: qcustomplot.h:1268
QMap< double, QCPData > QCPDataMap
Definition: qcustomplot.h:2535
QCPGrid * mGrid
Definition: qcustomplot.h:1279
int padding() const
Definition: qcustomplot.h:1135
QCP::AntialiasedElements antialiasedElements() const
Definition: qcustomplot.h:1729
QColor textColor() const
Definition: qcustomplot.h:2258
Holds the data of one single data point for QCPCurve.
Definition: qcustomplot.h:2688
QCPRange keyRange() const
Definition: qcustomplot.h:3058
QCPLineEnding tail() const
Definition: qcustomplot.h:3388
void rescaleKeyAxis(bool onlyEnlarge=false) const
bool mNumberBeautifulPowers
Definition: qcustomplot.h:1262
QCPItemAnchor *const center
Definition: qcustomplot.h:3601
QPen selectedPen() const
Definition: qcustomplot.h:1419
A legend item representing a plottable with an icon and the plottable name.
Definition: qcustomplot.h:2195
QHash< QCP::MarginSide, QCPMarginGroup * > mMarginGroups
Definition: qcustomplot.h:699
QBrush selectedBrush() const
Definition: qcustomplot.h:3499
QCPItemPosition *const start
Definition: qcustomplot.h:3399
int numberPrecision() const
Definition: qcustomplot.h:1119
double mErrorBarSize
Definition: qcustomplot.h:2637
QFont font() const
Definition: qcustomplot.h:2257
QByteArray mLabelParameterHash
Definition: qcustomplot.h:1379
QBrush mSelectedBrush
Definition: qcustomplot.h:3747
QBrush mBackgroundBrush
Definition: qcustomplot.h:2094
double maximum() const
Definition: qcustomplot.h:2992
QCPAbstractPlottable * plottable()
Definition: qcustomplot.h:2202
bool periodic() const
Definition: qcustomplot.h:1991
bool scaled() const
Definition: qcustomplot.h:3637
PositionType typeX() const
Definition: qcustomplot.h:1569
QCPBarDataMap * data() const
Definition: qcustomplot.h:2907
EndingStyle style() const
Definition: qcustomplot.h:909
virtual void mouseMoveEvent(QMouseEvent *event)
Definition: qcustomplot.h:705
QString text() const
Definition: qcustomplot.h:3502
int bottom() const
Definition: qcustomplot.h:2078
bool isEmpty() const
Definition: qcustomplot.h:2823
double errorBarSize() const
Definition: qcustomplot.h:2587
QCPItemPosition *const topLeft
Definition: qcustomplot.h:3445
SelectableParts mSelectedParts
Definition: qcustomplot.h:1243
QPen selectedBorderPen() const
Definition: qcustomplot.h:2264
The abstract base class for all entries in a QCPLegend.
Definition: qcustomplot.h:2131
QCPItemAnchor *const topRight
Definition: qcustomplot.h:3529
bool twoColored() const
Definition: qcustomplot.h:3225
bool mAntialiasedZeroLine
Definition: qcustomplot.h:968
double graphKey() const
Definition: qcustomplot.h:3722
QCPAxisRect * mAxisRect
Definition: qcustomplot.h:1239
0x0001 Axis base line and tick marks
Definition: qcustomplot.h:123
QCPAxis::AxisType mType
Definition: qcustomplot.h:2488
QPainterPath customPath() const
Definition: qcustomplot.h:285
QColor textColor() const
Definition: qcustomplot.h:2362
0x0008 Legend box
Definition: qcustomplot.h:126
Responsible for drawing the grid of a QCPAxis.
Definition: qcustomplot.h:935
Qt::Alignment positionAlignment() const
Definition: qcustomplot.h:3503
0x001 Axis ranges are draggable (see QCPAxisRect::setRangeDrag, QCPAxisRect::setRangeDragAxes) ...
Definition: qcustomplot.h:160
QCPItemAnchor * parentAnchor() const
Definition: qcustomplot.h:1571
0x00 no margin
Definition: qcustomplot.h:110
QVector< QString > tickLabels
Definition: qcustomplot.h:1364
QImage mMapImage
Definition: qcustomplot.h:3152
Qt::AspectRatioMode backgroundScaledMode() const
Definition: qcustomplot.h:1727
QSize maximumSize() const
Definition: qcustomplot.h:668
int mIconTextPadding
Definition: qcustomplot.h:2313
QCPLayer * mLayer
Definition: qcustomplot.h:454
bool visible() const
Definition: qcustomplot.h:428
const QCPRange range() const
Definition: qcustomplot.h:1101
QCPColorGradient mGradient
Definition: qcustomplot.h:2491
0x04 top margin
Definition: qcustomplot.h:107
QCPColorMapData * data() const
Definition: qcustomplot.h:3112
double size() const
Definition: qcustomplot.h:280
bool noAntialiasingOnDrag() const
Definition: qcustomplot.h:1734
QRect axisSelectionBox() const
Definition: qcustomplot.h:1336
QColor color() const
Definition: qcustomplot.h:3494
QList< QCPItemPosition * > mPositions
Definition: qcustomplot.h:1655
QCP::PlottingHints plottingHints() const
Definition: qcustomplot.h:1735
QCustomPlot * mParentPlot
Definition: qcustomplot.h:1523
QColor mSelectedTextColor
Definition: qcustomplot.h:2390
QCPLayer * layer() const
Definition: qcustomplot.h:431
virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const
Definition: qcustomplot.h:711
QColor labelColor() const
Definition: qcustomplot.h:1132
double value
Definition: qcustomplot.h:2522
An anchor of an item to which positions can be attached to.
Definition: qcustomplot.h:1508
Qt::Orientations mRangeZoom
Definition: qcustomplot.h:2100
QBrush mSelectedBrush
Definition: qcustomplot.h:2316
QCPItemAnchor *const bottomLeftRim
Definition: qcustomplot.h:3599
virtual int calculateAutoMargin(QCP::MarginSide side)
int mSelectionTolerance
Definition: qcustomplot.h:1860
QHash< QCP::MarginSide, QCPMarginGroup * > marginGroups() const
Definition: qcustomplot.h:670
QBrush selectedBrush() const
Definition: qcustomplot.h:3718
QCPAxis * keyAxis() const
Definition: qcustomplot.h:1577
double width() const
Definition: qcustomplot.h:2994
0x0004 Sub grid lines
Definition: qcustomplot.h:125
QCache< QString, CachedLabel > mLabelCache
Definition: qcustomplot.h:1380
QCPItemPosition *const right
Definition: qcustomplot.h:3798
QCP::MarginSides autoMargins() const
Definition: qcustomplot.h:666
QVector< double > subTickPositions
Definition: qcustomplot.h:1362
virtual void mouseReleaseEvent(QMouseEvent *event)
QCPFinancialDataMap * mData
Definition: qcustomplot.h:3262
QCPLineEnding mTail
Definition: qcustomplot.h:3407
0x0002 Grid lines
Definition: qcustomplot.h:124
QCPLineEnding head() const
Definition: qcustomplot.h:3387
0x01 left margin
Definition: qcustomplot.h:105
QCPRange & operator*=(const double &value)
Definition: qcustomplot.h:494
int rowSpacing() const
Definition: qcustomplot.h:783
Base class for all drawable objects.
Definition: qcustomplot.h:413
QBrush mBrush
Definition: qcustomplot.h:2309
QPixmap mBackgroundPixmap
Definition: qcustomplot.h:1863
QPen selectedBasePen() const
Definition: qcustomplot.h:1143
bool antialiasedErrorBars() const
Definition: qcustomplot.h:1417
QFont font() const
Definition: qcustomplot.h:2361
QCPAxis::ScaleType dataScaleType() const
Definition: qcustomplot.h:2457
QBrush brushPositive() const
Definition: qcustomplot.h:3226
A plottable representing a bar chart in a plot.
Definition: qcustomplot.h:2873
const QCP::Interactions interactions() const
Definition: qcustomplot.h:1732
QFont mFont
Definition: qcustomplot.h:2310
QPen subTickPen() const
Definition: qcustomplot.h:1130
QFont font() const
Definition: qcustomplot.h:3500
QCPRange & operator+=(const double &value)
Definition: qcustomplot.h:492
QVector< double > mTickVector
Definition: qcustomplot.h:1282
0x080 All other objects are selectable (e.g. your own derived layerables, the plot title...
Definition: qcustomplot.h:167
T diff(const T &X, arma::uword deriv_order=1)
Vespucci::Math::diff.
A curved line from one point to another.
Definition: qcustomplot.h:3371
SpacingType mSpacingType
Definition: qcustomplot.h:2833
0x0080 Scatter symbols of plottables (excluding scatter symbols of type ssPixmap) ...
Definition: qcustomplot.h:130
QString mDateTimeFormat
Definition: qcustomplot.h:1258
bool operator!=(const QCPRange &other) const
Definition: qcustomplot.h:490
QFont selectedTickLabelFont() const
Definition: qcustomplot.h:1139
QSize mIconSize
Definition: qcustomplot.h:2312
QPen mSubTickPen
Definition: qcustomplot.h:1271
int valueSize() const
Definition: qcustomplot.h:3057
QPoint mDragStart
Definition: qcustomplot.h:2106
QPen selectedPen() const
Definition: qcustomplot.h:3716
int mLowestVisibleTick
Definition: qcustomplot.h:1281
QPen pen() const
Definition: qcustomplot.h:3385
QPointer< QCPBars > mBarBelow
Definition: qcustomplot.h:2940
QPixmap mScaledPixmap
Definition: qcustomplot.h:3666
QCustomPlot * mParentPlot
Definition: qcustomplot.h:2832
QList< QCPLayerable * > children() const
Definition: qcustomplot.h:388
double spacing() const
Definition: qcustomplot.h:2813
bool interpolate() const
Definition: qcustomplot.h:3115
QCPScatterStyle mScatterStyle
Definition: qcustomplot.h:2759
QPen mIconBorderPen
Definition: qcustomplot.h:2308
TracerStyle mStyle
Definition: qcustomplot.h:3749
A layout that arranges child elements in a grid.
Definition: qcustomplot.h:762
virtual void mousePressEvent(QMouseEvent *event)
int levelCount() const
Definition: qcustomplot.h:1988
QMargins margins() const
Definition: qcustomplot.h:664
QPoint bottomLeft() const
Definition: qcustomplot.h:2084
QCPScatterStyle mOutlierStyle
Definition: qcustomplot.h:3028
double mSpacing
Definition: qcustomplot.h:2834
double valueErrorPlus
Definition: qcustomplot.h:2524
QList< QCPLayer * > mLayers
Definition: qcustomplot.h:1857
QBrush brush() const
Definition: qcustomplot.h:2256
QCP::AntialiasedElements mNotAntialiasedElements
Definition: qcustomplot.h:1858
QCPItemAnchor *const bottom
Definition: qcustomplot.h:3532
0x0040 Main lines of items
Definition: qcustomplot.h:129
double value() const
Definition: qcustomplot.h:1575
QCP::MarginSides mAutoMargins
Definition: qcustomplot.h:698
The abstract base class for all data representing objects in a plot.
Definition: qcustomplot.h:1393
QColor textColor() const
Definition: qcustomplot.h:2149
EndingStyle mStyle
Definition: qcustomplot.h:928
QCPScatterStyle outlierStyle() const
Definition: qcustomplot.h:2999
QVector< QString > tickVectorLabels() const
Definition: qcustomplot.h:1122
A plottable representing a single statistical box in a plot.
Definition: qcustomplot.h:2965
QColor tickLabelColor() const
Definition: qcustomplot.h:1113
Qt::Alignment textAlignment() const
Definition: qcustomplot.h:3504
Q_DECLARE_TYPEINFO(QCPScatterStyle, Q_MOVABLE_TYPE)
QPen medianPen() const
Definition: qcustomplot.h:2998
QPointF coords() const
Definition: qcustomplot.h:1576
bool autoAddPlottableToLegend() const
Definition: qcustomplot.h:1731
QCPItemAnchor *const left
Definition: qcustomplot.h:3600
QPointer< QCPAxis > mValueAxis
Definition: qcustomplot.h:1470
double mGraphKey
Definition: qcustomplot.h:3751
QList< QCPBars * > bars() const
Definition: qcustomplot.h:2820
QPen selectedTickPen() const
Definition: qcustomplot.h:1144
QPointer< QCPAxis > mColorAxis
Definition: qcustomplot.h:2496
bool errorBarSkipSymbol() const
Definition: qcustomplot.h:2588
0x008 Plottables are selectable (e.g. graphs, curves, bars,... see QCPAbstractPlottable) ...
Definition: qcustomplot.h:163
QCPItemAnchor * parentAnchorY() const
Definition: qcustomplot.h:1573
QMutableMapIterator< double, QCPBarData > QCPBarDataMutableMapIterator
Definition: qcustomplot.h:2870
QColor selectedColor() const
Definition: qcustomplot.h:3495
QCPItemPosition *const endDir
Definition: qcustomplot.h:3401
double minimum() const
Definition: qcustomplot.h:2988
bool antialiasedSubGrid() const
Definition: qcustomplot.h:951
QCPItemPosition *const bottomRight
Definition: qcustomplot.h:3592
QColor selectedTextColor() const
Definition: qcustomplot.h:2268
double width() const
Definition: qcustomplot.h:910
bool mInterpolate
Definition: qcustomplot.h:3148
QCPColorGradient mGradient
Definition: qcustomplot.h:3147
bool antialiasedFill() const
Definition: qcustomplot.h:1415
Qt::AspectRatioMode aspectRatioMode() const
Definition: qcustomplot.h:3638
#define QCP_LIB_DECL
Definition: qcustomplot.h:92
QCustomPlot * mParentPlot
Definition: qcustomplot.h:396
QCPColorScale * colorScale() const
Definition: qcustomplot.h:3118
A plottable representing a graph in a plot.
Definition: qcustomplot.h:2540
QCPItemPosition *const start
Definition: qcustomplot.h:3354
int iconTextPadding() const
Definition: qcustomplot.h:2260
The abstract base class for all items in a plot.
Definition: qcustomplot.h:1612
QList< QRectF > mInsetRect
Definition: qcustomplot.h:870
QString name() const
Definition: qcustomplot.h:386
QCPLayoutInset * mInsetLayout
Definition: qcustomplot.h:2099
double length() const
Definition: qcustomplot.h:3785
0x004 axis (tick) labels will be cached as pixmaps, increasing replot performance.
Definition: qcustomplot.h:149
QRect tickLabelsSelectionBox() const
Definition: qcustomplot.h:1337
Item that sticks to QCPGraph data points.
Definition: qcustomplot.h:3683
QCPCurveDataMap * mData
Definition: qcustomplot.h:2758
QCPLegend * mParentLegend
Definition: qcustomplot.h:2172
QBrush brush() const
Definition: qcustomplot.h:3717
QFont mSelectedLabelFont
Definition: qcustomplot.h:1249
QCPItemAnchor *const right
Definition: qcustomplot.h:3449
bool mNoAntialiasingOnDrag
Definition: qcustomplot.h:1861
The central class of the library. This is the QWidget which displays the plot and interacts with the ...
Definition: qcustomplot.h:1685
int size() const
Definition: qcustomplot.h:2822
VESPUCCI_EXPORT void position(arma::uword index, arma::uword n_rows, arma::uword n_cols, arma::uword &i, arma::uword &j)
Vespucci::Math::position Find row and column numbers for index.
Definition: accessory.cpp:469
0x040 Items are selectable (Rectangles, Arrows, Textitems, etc. see QCPAbstractItem) ...
Definition: qcustomplot.h:166
int columnSpacing() const
Definition: qcustomplot.h:782
bool backgroundScaled() const
Definition: qcustomplot.h:2038
virtual void wheelEvent(QWheelEvent *event)
Definition: qcustomplot.h:708
bool selectable() const
Definition: qcustomplot.h:1628
Manages a single axis inside a QCustomPlot.
Definition: qcustomplot.h:985
QCPLineEnding tail() const
Definition: qcustomplot.h:3343
QList< QCPItemAnchor * > anchors() const
Definition: qcustomplot.h:1642
QCPAxis::AxisType type() const
Definition: qcustomplot.h:2455
double upperQuartile() const
Definition: qcustomplot.h:2991
QCPBarsGroup * barsGroup() const
Definition: qcustomplot.h:2903
bool isPenDefined() const
Definition: qcustomplot.h:297
double lowerQuartile() const
Definition: qcustomplot.h:2989
QBrush brush() const
Definition: qcustomplot.h:283
QCPScatterStyle scatterStyle() const
Definition: qcustomplot.h:2584
bool mIsAntialiasing
Definition: qcustomplot.h:362
QCPItemAnchor *const topRight
Definition: qcustomplot.h:3655
QCPColorScale * mParentColorScale
Definition: qcustomplot.h:2418
double rotation() const
Definition: qcustomplot.h:3505
QCPItemAnchor *const topLeftRim
Definition: qcustomplot.h:3593
QPen pen() const
Definition: qcustomplot.h:3340
PositionType type() const
Definition: qcustomplot.h:1568
Represents the visual appearance of scatter points.
Definition: qcustomplot.h:239
int index() const
Definition: qcustomplot.h:387
Manages a legend inside a QCustomPlot.
Definition: qcustomplot.h:2219
QList< QCPItemPosition * > positions() const
Definition: qcustomplot.h:1641
QList< QCPLayerable * > mChildren
Definition: qcustomplot.h:399
QSet< QCPItemPosition * > mChildrenY
Definition: qcustomplot.h:1526
QCPRange mDataRange
Definition: qcustomplot.h:3144
PositionType mPositionTypeY
Definition: qcustomplot.h:1597
QCPLayerable * parentLayerable() const
Definition: qcustomplot.h:430
QPointer< QCPColorScaleAxisRectPrivate > mAxisRect
Definition: qcustomplot.h:2495
QPen selectedPen() const
Definition: qcustomplot.h:3784
Qt::AspectRatioMode mBackgroundScaledMode
Definition: qcustomplot.h:2098
0x0200 Borders of fills (e.g. under or between graphs)
Definition: qcustomplot.h:132
QFont selectedFont() const
Definition: qcustomplot.h:2363
0x004 The user can select multiple objects by holding the modifier set by QCustomPlot::setMultiSelect...
Definition: qcustomplot.h:162
QList< double > rowStretchFactors() const
Definition: qcustomplot.h:781
QCPItemAnchor *const bottomRight
Definition: qcustomplot.h:3531
QCPItemAnchor *const bottomLeft
Definition: qcustomplot.h:3658
QPointer< QCPAxis > mValueAxis
Definition: qcustomplot.h:1598
QCPRange valueRange() const
Definition: qcustomplot.h:3059
QCPRange mDragStartVertRange
Definition: qcustomplot.h:2104
QVector< double > mSubTickVector
Definition: qcustomplot.h:1284
QPen tickPen() const
Definition: qcustomplot.h:1129
QList< QCPBars * > mBars
Definition: qcustomplot.h:2835
bool isEmpty() const
Definition: qcustomplot.h:3078
QPen pen() const
Definition: qcustomplot.h:3496
double width() const
Definition: qcustomplot.h:3224
int height() const
Definition: qcustomplot.h:2080
QCPItemAnchor *const topRightRim
Definition: qcustomplot.h:3595
A layer that may contain objects, to control the rendering order.
Definition: qcustomplot.h:370
bool mTickLabels
Definition: qcustomplot.h:1253
Qt::Orientation orientation() const
Definition: qcustomplot.h:1211
QString label() const
Definition: qcustomplot.h:1133
A rectangle.
Definition: qcustomplot.h:3417
QCPItemPosition *const position
Definition: qcustomplot.h:3742
bool interpolating() const
Definition: qcustomplot.h:3723
LineStyle mLineStyle
Definition: qcustomplot.h:2760
SpacingType spacingType() const
Definition: qcustomplot.h:2812
The abstract base class for all objects that form the layout system.
Definition: qcustomplot.h:634
PlottingHint
Definition: qcustomplot.h:144
QCPRange mValueRange
Definition: qcustomplot.h:3085
QCPAxis * keyAxis() const
Definition: qcustomplot.h:1422
QString mName
Definition: qcustomplot.h:397
QBrush brush() const
Definition: qcustomplot.h:3498
QList< InsetPlacement > mInsetPlacement
Definition: qcustomplot.h:868
QPen selectedPen() const
Definition: qcustomplot.h:3341
QCPColorGradient gradient() const
Definition: qcustomplot.h:3117
int keySize() const
Definition: qcustomplot.h:3056
QCPLineEnding upperEnding
Definition: qcustomplot.h:1343
QString mLabel
Definition: qcustomplot.h:1248
Qt::AspectRatioMode mAspectRatioMode
Definition: qcustomplot.h:3668
bool selected() const
Definition: qcustomplot.h:1425
QColor mTextColor
Definition: qcustomplot.h:2388
QBrush mSelectedBrush
Definition: qcustomplot.h:3542
QPen selectedIconBorderPen() const
Definition: qcustomplot.h:2265
QCPItemAnchor * parentAnchorX() const
Definition: qcustomplot.h:1572
double mRotation
Definition: qcustomplot.h:3547
QCPLayer * mCurrentLayer
Definition: qcustomplot.h:1867
QPainterPath mCustomPath
Definition: qcustomplot.h:309
WidthType mWidthType
Definition: qcustomplot.h:2937
A straight line that spans infinitely in both directions.
Definition: qcustomplot.h:3287
QCPBarsGroup * mBarsGroup
Definition: qcustomplot.h:2938
QMap< double, QCPBarData > QCPBarDataMap
Definition: qcustomplot.h:2868
QCPItemAnchor *const left
Definition: qcustomplot.h:3534
bool mReplotting
Definition: qcustomplot.h:1875
QFont tickLabelFont() const
Definition: qcustomplot.h:1112
bool autoSubTicks() const
Definition: qcustomplot.h:1107
PainterModes mModes
Definition: qcustomplot.h:361
A layout that places child elements aligned to the border or arbitrarily positioned.
Definition: qcustomplot.h:828
0x020 Legends are selectable (or their child items, see QCPLegend::setSelectableParts) ...
Definition: qcustomplot.h:165
double scaleLogBase() const
Definition: qcustomplot.h:1100
Handles the different ending decorations for line-like items.
Definition: qcustomplot.h:877
A color scale for use with color coding data such as QCPColorMap.
Definition: qcustomplot.h:2436
QCPDataMap * data() const
Definition: qcustomplot.h:2582
QPoint center() const
Definition: qcustomplot.h:2086
QPen pen() const
Definition: qcustomplot.h:3577
QPen mTickPen
Definition: qcustomplot.h:1270
QCP::PlottingHints mPlottingHints
Definition: qcustomplot.h:1868
BracketStyle mStyle
Definition: qcustomplot.h:3806
Holds the data of one single data point for QCPGraph.
Definition: qcustomplot.h:2517
QCPAxis * valueAxis() const
Definition: qcustomplot.h:1578
int mCachedMargin
Definition: qcustomplot.h:1286
virtual QCPItemPosition * toQCPItemPosition()
Definition: qcustomplot.h:1529
QPointer< QCPAxisRect > mClipAxisRect
Definition: qcustomplot.h:1654
QVector< QString > mTickVectorLabels
Definition: qcustomplot.h:1283
int getMarginValue(const QMargins &margins, QCP::MarginSide side)
Definition: qcustomplot.h:218
QPen errorPen() const
Definition: qcustomplot.h:2586
QList< QCPAbstractPlottable * > mPlottables
Definition: qcustomplot.h:1854
QCustomPlot * parentPlot() const
Definition: qcustomplot.h:385
QPen pen() const
Definition: qcustomplot.h:3783
QPen pen() const
Definition: qcustomplot.h:1418
QPainter subclass used internally.
Definition: qcustomplot.h:317
Qt::TransformationMode transformationMode() const
Definition: qcustomplot.h:3639
Qt::KeyboardModifier multiSelectModifier() const
Definition: qcustomplot.h:1736
QCPCurveDataMap * data() const
Definition: qcustomplot.h:2730
ScaleType mScaleType
Definition: qcustomplot.h:1275
QMutableMapIterator< double, QCPData > QCPDataMutableMapIterator
Definition: qcustomplot.h:2537
bool selectable() const
Definition: qcustomplot.h:2152
QPixmap mLegendIcon
Definition: qcustomplot.h:3153
Qt::TimeSpec mDateTimeSpec
Definition: qcustomplot.h:1259
QCPScatterStyle scatterStyle() const
Definition: qcustomplot.h:2731
WidthType widthType() const
Definition: qcustomplot.h:2902
bool autoTicks() const
Definition: qcustomplot.h:1103
QFont selectedLabelFont() const
Definition: qcustomplot.h:1140
int left() const
Definition: qcustomplot.h:2075
bool mCachedMarginValid
Definition: qcustomplot.h:1285
bool selected() const
Definition: qcustomplot.h:2366
QCPItemAnchor *const bottom
Definition: qcustomplot.h:3598
QPixmap mPixmap
Definition: qcustomplot.h:3665
QVector< double > outliers() const
Definition: qcustomplot.h:2993
QColor mSelectedColor
Definition: qcustomplot.h:3540
QPen mSelectedBasePen
Definition: qcustomplot.h:1244
QCPLineEnding head() const
Definition: qcustomplot.h:3342
double median() const
Definition: qcustomplot.h:2990
0x0100 Error bars
Definition: qcustomplot.h:131
int mPadding
Definition: qcustomplot.h:1241
SelectableParts mSelectedParts
Definition: qcustomplot.h:2314
virtual void mouseMoveEvent(QMouseEvent *event)
QCPAxis * yAxis2
Definition: qcustomplot.h:1824
QVector< QRgb > mColorBuffer
Definition: qcustomplot.h:2017
QCPAxisRect * axisRect() const
Definition: qcustomplot.h:1098
QCPAbstractItem * mParentItem
Definition: qcustomplot.h:1524
int selectionTolerance() const
Definition: qcustomplot.h:1733
LineStyle lineStyle() const
Definition: qcustomplot.h:2732
QMargins minimumMargins() const
Definition: qcustomplot.h:665
QCPRange & operator/=(const double &value)
Definition: qcustomplot.h:495
QBrush mSelectedBrush
Definition: qcustomplot.h:3608
Qt::Orientation mOrientation
Definition: qcustomplot.h:1242
QRect labelSelectionBox() const
Definition: qcustomplot.h:1338
static const double minRange
Definition: qcustomplot.h:514
QString mText
Definition: qcustomplot.h:2386
double keyErrorPlus
Definition: qcustomplot.h:2523
QVector< double > mOutliers
Definition: qcustomplot.h:3023
bool backgroundScaled() const
Definition: qcustomplot.h:1726
QPointer< QCPAxis > mRangeZoomVertAxis
Definition: qcustomplot.h:2101
QCPGraph * graph() const
Definition: qcustomplot.h:3721
QCPAxis::AxisType type
Definition: qcustomplot.h:1341
bool isNone() const
Definition: qcustomplot.h:296
QCPItemAnchor *const bottom
Definition: qcustomplot.h:3657
void rescaleAxes(bool onlyEnlarge=false) const
0x0020 Main lines of plottables (excluding error bars, see element aeErrorBars)
Definition: qcustomplot.h:128
bool autoTickStep() const
Definition: qcustomplot.h:1106
LabelType tickLabelType() const
Definition: qcustomplot.h:1111
QBrush selectedBrush() const
Definition: qcustomplot.h:3580
Qt::Orientations rangeZoom() const
Definition: qcustomplot.h:2041
Interaction
Definition: qcustomplot.h:160
QFont selectedFont() const
Definition: qcustomplot.h:3501
QCPBars * barBelow() const
Definition: qcustomplot.h:2905
bool rangeReversed() const
Definition: qcustomplot.h:1102
QCPItemAnchor *const center
Definition: qcustomplot.h:3799
int top() const
Definition: qcustomplot.h:2077
QPen mSelectedPen
Definition: qcustomplot.h:3359
QPen selectedPen() const
Definition: qcustomplot.h:3300
0x000 No hints are set
Definition: qcustomplot.h:144
QBrush mBrushPositive
Definition: qcustomplot.h:3266
QFont labelFont() const
Definition: qcustomplot.h:1131
bool inverted() const
Definition: qcustomplot.h:912
virtual QCPItemPosition * toQCPItemPosition()
Definition: qcustomplot.h:1604
A plottable representing a parametric curve in a plot.
Definition: qcustomplot.h:2710
QCPItemPosition *const topLeft
Definition: qcustomplot.h:3652
QMap< double, QCPFinancialData > QCPFinancialDataMap
Definition: qcustomplot.h:3190
QCPItemAnchor *const bottom
Definition: qcustomplot.h:3450
bool mAutoAddPlottableToLegend
Definition: qcustomplot.h:1853
QList< Qt::Alignment > mInsetAlignment
Definition: qcustomplot.h:869
QCustomPlot * parentPlot() const
Definition: qcustomplot.h:429
QVector< double > tickVector() const
Definition: qcustomplot.h:1121
QPen pen() const
Definition: qcustomplot.h:953
bool mErrorBarSkipSymbol
Definition: qcustomplot.h:2638
LabelType mTickLabelType
Definition: qcustomplot.h:1255
0x0000 No elements
Definition: qcustomplot.h:135
void rescaleValueAxis(bool onlyEnlarge=false) const
QMapIterator< double, QCPBarData > QCPBarDataMapIterator
Definition: qcustomplot.h:2869
QList< double > mColumnStretchFactors
Definition: qcustomplot.h:815
bool mMapImageInvalidated
Definition: qcustomplot.h:3154
BracketStyle style() const
Definition: qcustomplot.h:3786
QCPItemAnchor *const top
Definition: qcustomplot.h:3528
A layout element displaying a plot title text.
Definition: qcustomplot.h:2343
0x02 right margin
Definition: qcustomplot.h:106
QCPItemAnchor *const bottomRightRim
Definition: qcustomplot.h:3597
SelectableParts selectedParts() const
Definition: qcustomplot.h:1137
QPointer< QCPColorScale > mColorScale
Definition: qcustomplot.h:3150
bool selected() const
Definition: qcustomplot.h:1629
QColor mTextColor
Definition: qcustomplot.h:2311
QCPLineEnding mTail
Definition: qcustomplot.h:3360
QCPLayoutInset * insetLayout() const
Definition: qcustomplot.h:2067
QCPRange mDataRange
Definition: qcustomplot.h:2489
QFont mSelectedFont
Definition: qcustomplot.h:2389
QCPLegend * parentLegend() const
Definition: qcustomplot.h:2147
QString name() const
Definition: qcustomplot.h:1414
An ellipse.
Definition: qcustomplot.h:3563
int mNumberPrecision
Definition: qcustomplot.h:1260
QColor selectedTickLabelColor() const
Definition: qcustomplot.h:1141
QMap< double, QColor > mColorStops
Definition: qcustomplot.h:2012
QStack< bool > mAntialiasingStack
Definition: qcustomplot.h:365
QPoint topLeft() const
Definition: qcustomplot.h:2082
QSize iconSize() const
Definition: qcustomplot.h:2259
double mScaleLogBaseLogInv
Definition: qcustomplot.h:1276
QPen selectedPen() const
Definition: qcustomplot.h:3386
QCPItemPosition *const point1
Definition: qcustomplot.h:3309
int mIndex
Definition: qcustomplot.h:398
double tickStep() const
Definition: qcustomplot.h:1120
QPen selectedPen() const
Definition: qcustomplot.h:3641
bool mSubGridVisible
Definition: qcustomplot.h:967
QCPAxis::ScaleType mDataScaleType
Definition: qcustomplot.h:3145
virtual void mouseDoubleClickEvent(QMouseEvent *event)
Definition: qcustomplot.h:707
QPixmap pixmap() const
Definition: qcustomplot.h:284
QCPAxis::ScaleType mDataScaleType
Definition: qcustomplot.h:2490
QCPItemAnchor *const bottomLeft
Definition: qcustomplot.h:3533
QColor selectedTextColor() const
Definition: qcustomplot.h:2364
LineStyle lineStyle() const
Definition: qcustomplot.h:2583
ErrorType mErrorType
Definition: qcustomplot.h:2636
QBrush selectedBrush() const
Definition: qcustomplot.h:3434
QPen pen() const
Definition: qcustomplot.h:3640
bool mBackgroundScaled
Definition: qcustomplot.h:1865
QRect rect() const
Definition: qcustomplot.h:662
QHash< QCPAxis::AxisType, QList< QCPAxis * > > mAxes
Definition: qcustomplot.h:2108
QString name() const
Definition: qcustomplot.h:1515
QCPItemAnchor *const right
Definition: qcustomplot.h:3530
QPen selectedPen() const
Definition: qcustomplot.h:3578
QBrush mSelectedBrush
Definition: qcustomplot.h:3459
QPen selectedSubTickPen() const
Definition: qcustomplot.h:1145
QMapIterator< double, QCPData > QCPDataMapIterator
Definition: qcustomplot.h:2536
ChartStyle chartStyle() const
Definition: qcustomplot.h:3223
bool visible() const
Definition: qcustomplot.h:389
QCPItemPosition *const startDir
Definition: qcustomplot.h:3400
QMapIterator< double, QCPFinancialData > QCPFinancialDataMapIterator
Definition: qcustomplot.h:3191
ErrorType errorType() const
Definition: qcustomplot.h:2585
bool mAntialiased
Definition: qcustomplot.h:455
QRect mTextBoundingRect
Definition: qcustomplot.h:2391
QPen pen() const
Definition: qcustomplot.h:282
QColor selectedLabelColor() const
Definition: qcustomplot.h:1142
QPen whiskerPen() const
Definition: qcustomplot.h:2996
Holds the two-dimensional data of a QCPColorMap plottable.
Definition: qcustomplot.h:3047
virtual void update(UpdatePhase phase)
QList< QCPAbstractItem * > mItems
Definition: qcustomplot.h:1856
int autoTickCount() const
Definition: qcustomplot.h:1104
PositionType typeY() const
Definition: qcustomplot.h:1570
0x002 Axis ranges are zoomable with the mouse wheel (see QCPAxisRect::setRangeZoom, QCPAxisRect::setRangeZoomAxes)
Definition: qcustomplot.h:161
QPen selectedPen() const
Definition: qcustomplot.h:3497
QCPItemAnchor *const top
Definition: qcustomplot.h:3594
QCPDataMap * mData
Definition: qcustomplot.h:2632
double mRangeZoomFactorVert
Definition: qcustomplot.h:2102
double size() const
Definition: qcustomplot.h:3719
A plottable representing a financial stock chart.
Definition: qcustomplot.h:3195
TracerStyle style() const
Definition: qcustomplot.h:3720
0x0010 Legend items
Definition: qcustomplot.h:127
QBrush selectedBrush() const
Definition: qcustomplot.h:2266
QMutableMapIterator< double, QCPFinancialData > QCPFinancialDataMutableMapIterator
Definition: qcustomplot.h:3192
int barWidth() const
Definition: qcustomplot.h:2460
void setMarginValue(QMargins &margins, QCP::MarginSide side, int value)
Definition: qcustomplot.h:198
QCPAxisPainterPrivate * mAxisPainter
Definition: qcustomplot.h:1280
The abstract base class for layouts.
Definition: qcustomplot.h:724
QPixmap mPaintBuffer
Definition: qcustomplot.h:1872
Holds the data of one single data point for QCPFinancial.
Definition: qcustomplot.h:3174
A text label.
Definition: qcustomplot.h:3471
QBrush mBackgroundBrush
Definition: qcustomplot.h:1862
QCPAxis * axis() const
Definition: qcustomplot.h:2454
QPen mSelectedIconBorderPen
Definition: qcustomplot.h:2315
QCPItemPosition *const bottomRight
Definition: qcustomplot.h:3653
QCPItemAnchor *const left
Definition: qcustomplot.h:3452
QCPAbstractPlottable * mPlottable
Definition: qcustomplot.h:2206
ColorInterpolation mColorInterpolation
Definition: qcustomplot.h:2013
QCPBars * barAbove() const
Definition: qcustomplot.h:2906
QPen penNegative() const
Definition: qcustomplot.h:3229
QSize size() const
Definition: qcustomplot.h:2081
QCPItemAnchor *const bottomLeft
Definition: qcustomplot.h:3451
QPen subGridPen() const
Definition: qcustomplot.h:954
A plottable representing a two-dimensional color map in a plot.
Definition: qcustomplot.h:3096
bool mAdaptiveSampling
Definition: qcustomplot.h:2640
QCPBarDataMap * mData
Definition: qcustomplot.h:2935
QHash< QCP::MarginSide, QList< QCPLayoutElement * > > mChildren
Definition: qcustomplot.h:620
QCPAxis * valueAxis() const
Definition: qcustomplot.h:1423
QColor mTickLabelColor
Definition: qcustomplot.h:1257
QRect viewport() const
Definition: qcustomplot.h:1724
QString dateTimeFormat() const
Definition: qcustomplot.h:1116
bool mVisible
Definition: qcustomplot.h:400
QCPItemPosition *const position
Definition: qcustomplot.h:3526
QCPAxis::LabelSide tickLabelSide
Definition: qcustomplot.h:1350
QPointer< QCPLayerable > mParentLayerable
Definition: qcustomplot.h:453
QCPItemAnchor *const topLeft
Definition: qcustomplot.h:3527
virtual void mousePressEvent(QMouseEvent *event)
Definition: qcustomplot.h:704
QPen mZeroLinePen
Definition: qcustomplot.h:969
QPoint mMousePressPos
Definition: qcustomplot.h:1873
bool ticks() const
Definition: qcustomplot.h:1108
QCPItemAnchor *const right
Definition: qcustomplot.h:3596
ChartStyle mChartStyle
Definition: qcustomplot.h:3263
QList< double > mRowStretchFactors
Definition: qcustomplot.h:816
QRect mViewport
Definition: qcustomplot.h:1851
QPixmap mScaledBackgroundPixmap
Definition: qcustomplot.h:2096
bool selectable() const
Definition: qcustomplot.h:2365
double key() const
Definition: qcustomplot.h:1574
Qt::TimeSpec dateTimeSpec() const
Definition: qcustomplot.h:1117
QRect outerRect() const
Definition: qcustomplot.h:663
QPoint bottomRight() const
Definition: qcustomplot.h:2085
QPointer< QCPAxisRect > mAxisRect
Definition: qcustomplot.h:1599
QList< QCPLayoutElement * > mElements
Definition: qcustomplot.h:867
Qt::TransformationMode mTransformationMode
Definition: qcustomplot.h:3669
double baseValue() const
Definition: qcustomplot.h:2904
QPen pen() const
Definition: qcustomplot.h:3299
QFont mTickLabelFont
Definition: qcustomplot.h:1256
QPoint topRight() const
Definition: qcustomplot.h:2083
QVector< double > tickPositions
Definition: qcustomplot.h:1363
QFont selectedFont() const
Definition: qcustomplot.h:2267
QPen pen() const
Definition: qcustomplot.h:3431
QCPRange dataBounds() const
Definition: qcustomplot.h:3060
A line from one point to another.
Definition: qcustomplot.h:3326
int subTickCount() const
Definition: qcustomplot.h:1125
double mTickStep
Definition: qcustomplot.h:1266
QColor mSelectedTextColor
Definition: qcustomplot.h:2318
bool contains(QCPBars *bars) const
Definition: qcustomplot.h:2825
SelectableParts selectableParts() const
Definition: qcustomplot.h:1138
double key() const
Definition: qcustomplot.h:2987
QCPItemPosition *const point2
Definition: qcustomplot.h:3310
const QCPRange operator*(const QCPRange &range, double value)
Definition: qcustomplot.h:577
QString text() const
Definition: qcustomplot.h:2360
QMargins mPadding
Definition: qcustomplot.h:3548
QCPRange mDataBounds
Definition: qcustomplot.h:3089
double length() const
Definition: qcustomplot.h:911
bool autoTickLabels() const
Definition: qcustomplot.h:1105
QCPItemAnchor * mParentAnchorY
Definition: qcustomplot.h:1601
double whiskerWidth() const
Definition: qcustomplot.h:2995
0x0400 Zero-lines, see QCPGrid::setZeroLinePen
Definition: qcustomplot.h:133
QString mText
Definition: qcustomplot.h:3544
bool antialiasedScatters() const
Definition: qcustomplot.h:1416
Manages the position of an item.
Definition: qcustomplot.h:1545
bool antialiased() const
Definition: qcustomplot.h:432
QPen iconBorderPen() const
Definition: qcustomplot.h:2261
QCPItemPosition *const end
Definition: qcustomplot.h:3355
QCPAxis::ScaleType dataScaleType() const
Definition: qcustomplot.h:3114
bool tightBoundary() const
Definition: qcustomplot.h:3116
QPixmap mBackgroundPixmap
Definition: qcustomplot.h:2095
QFont mSelectedFont
Definition: qcustomplot.h:3543
Defines a color gradient for use with e.g. QCPColorMap.
Definition: qcustomplot.h:1905
QPixmap background() const
Definition: qcustomplot.h:1725
QList< double > columnStretchFactors() const
Definition: qcustomplot.h:780
QCPGrid * grid() const
Definition: qcustomplot.h:1148
double upper
Definition: qcustomplot.h:484
QCPMarginGroup * marginGroup(QCP::MarginSide side) const
Definition: qcustomplot.h:669
static Qt::Orientation orientation(AxisType type)
Definition: qcustomplot.h:1224
QPixmap mScaledBackgroundPixmap
Definition: qcustomplot.h:1864
bool selectable() const
Definition: qcustomplot.h:1424
QMap< double, QColor > colorStops() const
Definition: qcustomplot.h:1989
QMargins mMinimumMargins
Definition: qcustomplot.h:697
Represents the range an axis is encompassing.
Definition: qcustomplot.h:481
QCPRange dataRange() const
Definition: qcustomplot.h:3113
bool tickLabels() const
Definition: qcustomplot.h:1109
QCPLayoutGrid * mPlotLayout
Definition: qcustomplot.h:1852
QList< QCPItemAnchor * > mAnchors
Definition: qcustomplot.h:1656
QCPScatterStyle mScatterStyle
Definition: qcustomplot.h:2635
Groups multiple QCPBars together so they appear side by side.
Definition: qcustomplot.h:2790
QPixmap background() const
Definition: qcustomplot.h:2037
ColorInterpolation colorInterpolation() const
Definition: qcustomplot.h:1990
0x010 Axes are selectable (or parts of them, see QCPAxis::setSelectableParts)
Definition: qcustomplot.h:164
QBrush selectedBrush() const
Definition: qcustomplot.h:1421
double lower
Definition: qcustomplot.h:484
bool adaptiveSampling() const
Definition: qcustomplot.h:2590
QMutableMapIterator< double, QCPCurveData > QCPCurveDataMutableMapIterator
Definition: qcustomplot.h:2707
QSize minimumSize() const
Definition: qcustomplot.h:667
QFont font() const
Definition: qcustomplot.h:2148
Qt::Orientations rangeDrag() const
Definition: qcustomplot.h:2040
ScaleType scaleType() const
Definition: qcustomplot.h:1099
ScatterShape mShape
Definition: qcustomplot.h:305
QCPItemPosition *const topLeft
Definition: qcustomplot.h:3591
SelectableParts selectableParts() const
Definition: qcustomplot.h:2262
0xFF all margins
Definition: qcustomplot.h:109
QPixmap pixmap() const
Definition: qcustomplot.h:3636
bool antialiasedZeroLine() const
Definition: qcustomplot.h:952
bool mTightBoundary
Definition: qcustomplot.h:3149
bool mRangeReversed
Definition: qcustomplot.h:1274
QCPItemAnchor *const top
Definition: qcustomplot.h:3654
Qt::Alignment mPositionAlignment
Definition: qcustomplot.h:3545
QPen zeroLinePen() const
Definition: qcustomplot.h:955
Holds multiple axes and arranges them in a rectangular shape.
Definition: qcustomplot.h:2022
Qt::AspectRatioMode backgroundScaledMode() const
Definition: qcustomplot.h:2039
QCPItemAnchor *const left
Definition: qcustomplot.h:3659
QBrush brush() const
Definition: qcustomplot.h:3579
int width() const
Definition: qcustomplot.h:2079
const QCPRange operator-(const QCPRange &range, double value)
Definition: qcustomplot.h:567
QCPRange mRange
Definition: qcustomplot.h:1273
double mBaseValue