gepetto-viewer 6.0.0
An user-friendly Graphical Interface
Loading...
Searching...
No Matches
qcustomplot.h
Go to the documentation of this file.
1/***************************************************************************
2** **
3** QCustomPlot, an easy to use, modern plotting widget for Qt **
4** Copyright (C) 2011-2015 Emanuel Eichhammer **
5** **
6** This program is free software: you can redistribute it and/or modify **
7** it under the terms of the GNU General Public License as published by **
8** the Free Software Foundation, either version 3 of the License, or **
9** (at your option) any later version. **
10** **
11** This program is distributed in the hope that it will be useful, **
12** but WITHOUT ANY WARRANTY; without even the implied warranty of **
13** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the **
14** GNU General Public License for more details. **
15** **
16** You should have received a copy of the GNU General Public License **
17** along with this program. If not, see http://www.gnu.org/licenses/. **
18** **
19****************************************************************************
20** Author: Emanuel Eichhammer **
21** Website/Contact: http://www.qcustomplot.com/ **
22** Date: 22.12.15 **
23** Version: 1.3.2 **
24****************************************************************************/
25
26#ifndef QCUSTOMPLOT_H
27#define QCUSTOMPLOT_H
28
29#include <qmath.h>
30
31#include <QCache>
32#include <QDateTime>
33#include <QDebug>
34#include <QFlags>
35#include <QMargins>
36#include <QMouseEvent>
37#include <QMultiMap>
38#include <QObject>
39#include <QPaintEvent>
40#include <QPainter>
41#include <QPixmap>
42#include <QPointer>
43#include <QStack>
44#include <QString>
45#include <QVector2D>
46#include <QVector>
47#include <QWidget>
48#include <limits>
49#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
50#include <qnumeric.h>
51
52#include <QPrintEngine>
53#include <QPrinter>
54#else
55#include <QtNumeric>
56#include <QtPrintSupport/QtPrintSupport>
57#endif
58
59class QCPPainter;
60class QCustomPlot;
61class QCPLayerable;
63class QCPLayout;
64class QCPAxis;
65class QCPAxisRect;
68class QCPGraph;
69class QCPAbstractItem;
70class QCPItemPosition;
71class QCPLayer;
72class QCPPlotTitle;
73class QCPLegend;
75class QCPColorMap;
76class QCPColorScale;
77class QCPBars;
78
81// decl definitions for shared library compilation/usage:
82#if defined(QCUSTOMPLOT_COMPILE_LIBRARY)
83#define QCP_LIB_DECL Q_DECL_EXPORT
84#elif defined(QCUSTOMPLOT_USE_LIBRARY)
85#define QCP_LIB_DECL Q_DECL_IMPORT
86#else
87#define QCP_LIB_DECL
88#endif
89
94namespace QCP {
101 msLeft = 0x01
102 ,
103 msRight = 0x02
104 ,
105 msTop = 0x04
106 ,
107 msBottom = 0x08
108 ,
109 msAll = 0xFF
110 ,
111 msNone = 0x00
112};
113Q_DECLARE_FLAGS(MarginSides, MarginSide)
114
115
127 aeAxes = 0x0001
128 ,
129 aeGrid = 0x0002
130 ,
131 aeSubGrid = 0x0004
132 ,
133 aeLegend = 0x0008
134 ,
135 aeLegendItems = 0x0010
136 ,
138 0x0020
140 ,
141 aeItems = 0x0040
142 ,
143 aeScatters = 0x0080
145 ,
146 aeErrorBars = 0x0100
147 ,
148 aeFills = 0x0200
150 ,
151 aeZeroLine =
152 0x0400
153 ,
154 aeAll = 0xFFFF
155 ,
156 aeNone = 0x0000
157};
158Q_DECLARE_FLAGS(AntialiasedElements, AntialiasedElement)
159
160
167 phNone = 0x000
168 ,
170 0x001
174 ,
176 0x002
182 ,
183 phCacheLabels = 0x004
185};
186Q_DECLARE_FLAGS(PlottingHints, PlottingHint)
187
188
196 iRangeDrag =
197 0x001
199 ,
200 iRangeZoom = 0x002
203 ,
204 iMultiSelect = 0x004
207 ,
209 0x008
211 ,
212 iSelectAxes = 0x010
214 ,
215 iSelectLegend = 0x020
217 ,
218 iSelectItems = 0x040
220 ,
222 0x080
224};
225Q_DECLARE_FLAGS(Interactions, Interaction)
226
227
234inline bool isInvalidData(double value) {
235 return qIsNaN(value) || qIsInf(value);
236}
237
243inline bool isInvalidData(double value1, double value2) {
244 return isInvalidData(value1) || isInvalidData(value2);
245}
246
253inline void setMarginValue(QMargins &margins, QCP::MarginSide side, int value) {
254 switch (side) {
255 case QCP::msLeft:
256 margins.setLeft(value);
257 break;
258 case QCP::msRight:
259 margins.setRight(value);
260 break;
261 case QCP::msTop:
262 margins.setTop(value);
263 break;
264 case QCP::msBottom:
265 margins.setBottom(value);
266 break;
267 case QCP::msAll:
268 margins = QMargins(value, value, value, value);
269 break;
270 default:
271 break;
272 }
273}
274
282inline int getMarginValue(const QMargins &margins, QCP::MarginSide side) {
283 switch (side) {
284 case QCP::msLeft:
285 return margins.left();
286 case QCP::msRight:
287 return margins.right();
288 case QCP::msTop:
289 return margins.top();
290 case QCP::msBottom:
291 return margins.bottom();
292 default:
293 break;
294 }
295 return 0;
296}
297
298} // end of namespace QCP
299
300Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::AntialiasedElements)
301Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::PlottingHints)
302Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::MarginSides)
303Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::Interactions)
304
306 Q_GADGET
307 public:
316 Q_ENUMS(ScatterShape)
318 ssNone
320 ,
321 ssDot
323 ,
324 ssCross
325 ,
326 ssPlus
327 ,
328 ssCircle
329 ,
330 ssDisc
332 ,
333 ssSquare
334 ,
335 ssDiamond
336 ,
337 ssStar
339 ,
340 ssTriangle
342 ,
343 ssTriangleInverted
345 ,
346 ssCrossSquare
348 ,
349 ssPlusSquare
350 ,
351 ssCrossCircle
353 ,
354 ssPlusCircle
355 ,
356 ssPeace
358 ,
359 ssPixmap
361 ,
362 ssCustom
364 };
365
367 QCPScatterStyle(ScatterShape shape, double size = 6);
368 QCPScatterStyle(ScatterShape shape, const QColor &color, double size);
369 QCPScatterStyle(ScatterShape shape, const QColor &color, const QColor &fill,
370 double size);
371 QCPScatterStyle(ScatterShape shape, const QPen &pen, const QBrush &brush,
372 double size);
373 QCPScatterStyle(const QPixmap &pixmap);
374 QCPScatterStyle(const QPainterPath &customPath, const QPen &pen,
375 const QBrush &brush = Qt::NoBrush, double size = 6);
376
377 // getters:
378 double size() const { return mSize; }
379 ScatterShape shape() const { return mShape; }
380 QPen pen() const { return mPen; }
381 QBrush brush() const { return mBrush; }
382 QPixmap pixmap() const { return mPixmap; }
383 QPainterPath customPath() const { return mCustomPath; }
384
385 // setters:
386 void setSize(double size);
388 void setPen(const QPen &pen);
389 void setBrush(const QBrush &brush);
390 void setPixmap(const QPixmap &pixmap);
391 void setCustomPath(const QPainterPath &customPath);
392
393 // non-property methods:
394 bool isNone() const { return mShape == ssNone; }
395 bool isPenDefined() const { return mPenDefined; }
396 void applyTo(QCPPainter *painter, const QPen &defaultPen) const;
397 void drawShape(QCPPainter *painter, QPointF pos) const;
398 void drawShape(QCPPainter *painter, double x, double y) const;
399
400 protected:
401 // property members:
402 double mSize;
403 ScatterShape mShape;
404 QPen mPen;
405 QBrush mBrush;
406 QPixmap mPixmap;
407 QPainterPath mCustomPath;
408
409 // non-property members:
410 bool mPenDefined;
411};
413
414class QCP_LIB_DECL QCPPainter : public QPainter {
415 Q_GADGET
416 public:
423 pmDefault =
424 0x00
425 ,
426 pmVectorized =
427 0x01
429 ,
430 pmNoCaching = 0x02
433 ,
434 pmNonCosmetic =
435 0x04
438 };
439 Q_FLAGS(PainterMode PainterModes)
440 Q_DECLARE_FLAGS(PainterModes, PainterMode)
441
443 QCPPainter(QPaintDevice *device);
445
446 // getters:
447 bool antialiasing() const { return testRenderHint(QPainter::Antialiasing); }
448 PainterModes modes() const { return mModes; }
449
450 // setters:
451 void setAntialiasing(bool enabled);
452 void setMode(PainterMode mode, bool enabled = true);
453 void setModes(PainterModes modes);
454
455 // methods hiding non-virtual base class functions (QPainter bug workarounds):
456 bool begin(QPaintDevice *device);
457 void setPen(const QPen &pen);
458 void setPen(const QColor &color);
459 void setPen(Qt::PenStyle penStyle);
460 void drawLine(const QLineF &line);
461 void drawLine(const QPointF &p1, const QPointF &p2) {
462 drawLine(QLineF(p1, p2));
463 }
464 void save();
465 void restore();
466
467 // non-virtual methods:
469
470 protected:
471 // property members:
472 PainterModes mModes;
473 bool mIsAntialiasing;
474
475 // non-property members:
476 QStack<bool> mAntialiasingStack;
477};
478Q_DECLARE_OPERATORS_FOR_FLAGS(QCPPainter::PainterModes)
479
480class QCP_LIB_DECL QCPLayer : public QObject {
481 Q_OBJECT
483 Q_PROPERTY(QCustomPlot *parentPlot READ parentPlot)
484 Q_PROPERTY(QString name READ name)
485 Q_PROPERTY(int index READ index)
486 Q_PROPERTY(QList<QCPLayerable *> children READ children)
487 Q_PROPERTY(bool visible READ visible WRITE setVisible)
489 public:
490 QCPLayer(QCustomPlot *parentPlot, const QString &layerName);
492
493 // getters:
494 QCustomPlot *parentPlot() const { return mParentPlot; }
495 QString name() const { return mName; }
496 int index() const { return mIndex; }
497 QList<QCPLayerable *> children() const { return mChildren; }
498 bool visible() const { return mVisible; }
499
500 // setters:
501 void setVisible(bool visible);
502
503 protected:
504 // property members:
505 QCustomPlot *mParentPlot;
506 QString mName;
507 int mIndex;
508 QList<QCPLayerable *> mChildren;
509 bool mVisible;
510
511 // non-virtual methods:
512 void addChild(QCPLayerable *layerable, bool prepend);
513 void removeChild(QCPLayerable *layerable);
514
515 private:
516 Q_DISABLE_COPY(QCPLayer)
517
518 friend class QCustomPlot;
519 friend class QCPLayerable;
520};
521
522class QCP_LIB_DECL QCPLayerable : public QObject {
523 Q_OBJECT
525 Q_PROPERTY(bool visible READ visible WRITE setVisible)
526 Q_PROPERTY(QCustomPlot *parentPlot READ parentPlot)
527 Q_PROPERTY(QCPLayerable *parentLayerable READ parentLayerable)
528 Q_PROPERTY(QCPLayer *layer READ layer WRITE setLayer NOTIFY layerChanged)
529 Q_PROPERTY(bool antialiased READ antialiased WRITE setAntialiased)
531 public:
532 QCPLayerable(QCustomPlot *plot, QString targetLayer = QString(),
533 QCPLayerable *parentLayerable = 0);
535
536 // getters:
537 bool visible() const { return mVisible; }
538 QCustomPlot *parentPlot() const { return mParentPlot; }
539 QCPLayerable *parentLayerable() const { return mParentLayerable.data(); }
540 QCPLayer *layer() const { return mLayer; }
541 bool antialiased() const { return mAntialiased; }
542
543 // setters:
544 void setVisible(bool on);
545 Q_SLOT bool setLayer(QCPLayer *layer);
546 bool setLayer(const QString &layerName);
547 void setAntialiased(bool enabled);
548
549 // introduced virtual methods:
550 virtual double selectTest(const QPointF &pos, bool onlySelectable,
551 QVariant *details = 0) const;
552
553 // non-property methods:
554 bool realVisibility() const;
555
556 signals:
557 void layerChanged(QCPLayer *newLayer);
558
559 protected:
560 // property members:
561 bool mVisible;
562 QCustomPlot *mParentPlot;
563 QPointer<QCPLayerable> mParentLayerable;
564 QCPLayer *mLayer;
565 bool mAntialiased;
566
567 // introduced virtual methods:
568 virtual void parentPlotInitialized(QCustomPlot *parentPlot);
570 virtual QRect clipRect() const;
571 virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const = 0;
572 virtual void draw(QCPPainter *painter) = 0;
573 // events:
574 virtual void selectEvent(QMouseEvent *event, bool additive,
575 const QVariant &details,
576 bool *selectionStateChanged);
577 virtual void deselectEvent(bool *selectionStateChanged);
578
579 // non-property methods:
581 void setParentLayerable(QCPLayerable *parentLayerable);
582 bool moveToLayer(QCPLayer *layer, bool prepend);
583 void applyAntialiasingHint(QCPPainter *painter, bool localAntialiased,
584 QCP::AntialiasedElement overrideElement) const;
585
586 private:
587 Q_DISABLE_COPY(QCPLayerable)
588
589 friend class QCustomPlot;
590 friend class QCPAxisRect;
591};
592
594 public:
595 double lower, upper;
596
598 QCPRange(double lower, double upper);
599
600 bool operator==(const QCPRange &other) const {
601 return lower == other.lower && upper == other.upper;
602 }
603 bool operator!=(const QCPRange &other) const { return !(*this == other); }
604
605 QCPRange &operator+=(const double &value) {
606 lower += value;
607 upper += value;
608 return *this;
609 }
610 QCPRange &operator-=(const double &value) {
611 lower -= value;
612 upper -= value;
613 return *this;
614 }
615 QCPRange &operator*=(const double &value) {
616 lower *= value;
617 upper *= value;
618 return *this;
619 }
620 QCPRange &operator/=(const double &value) {
621 lower /= value;
622 upper /= value;
623 return *this;
624 }
625 friend inline const QCPRange operator+(const QCPRange &, double);
626 friend inline const QCPRange operator+(double, const QCPRange &);
627 friend inline const QCPRange operator-(const QCPRange &range, double value);
628 friend inline const QCPRange operator*(const QCPRange &range, double value);
629 friend inline const QCPRange operator*(double value, const QCPRange &range);
630 friend inline const QCPRange operator/(const QCPRange &range, double value);
631
632 double size() const;
633 double center() const;
634 void normalize();
635 void expand(const QCPRange &otherRange);
636 QCPRange expanded(const QCPRange &otherRange) const;
639 bool contains(double value) const;
640
641 static bool validRange(double lower, double upper);
642 static bool validRange(const QCPRange &range);
643 static const double minRange; // 1e-280;
644 static const double maxRange; // 1e280;
645};
647
648/* documentation of inline functions */
649
670/* end documentation of inline functions */
671
675inline const QCPRange operator+(const QCPRange &range, double value) {
676 QCPRange result(range);
677 result += value;
678 return result;
679}
680
684inline const QCPRange operator+(double value, const QCPRange &range) {
685 QCPRange result(range);
686 result += value;
687 return result;
688}
689
693inline const QCPRange operator-(const QCPRange &range, double value) {
694 QCPRange result(range);
695 result -= value;
696 return result;
697}
698
702inline const QCPRange operator*(const QCPRange &range, double value) {
703 QCPRange result(range);
704 result *= value;
705 return result;
706}
707
711inline const QCPRange operator*(double value, const QCPRange &range) {
712 QCPRange result(range);
713 result *= value;
714 return result;
715}
716
720inline const QCPRange operator/(const QCPRange &range, double value) {
721 QCPRange result(range);
722 result /= value;
723 return result;
724}
725
726class QCP_LIB_DECL QCPMarginGroup : public QObject {
727 Q_OBJECT
728 public:
731
732 // non-virtual methods:
733 QList<QCPLayoutElement *> elements(QCP::MarginSide side) const {
734 return mChildren.value(side);
735 }
736 bool isEmpty() const;
737 void clear();
738
739 protected:
740 // non-property members:
741 QCustomPlot *mParentPlot;
742 QHash<QCP::MarginSide, QList<QCPLayoutElement *> > mChildren;
743
744 // non-virtual methods:
748
749 private:
750 Q_DISABLE_COPY(QCPMarginGroup)
751
752 friend class QCPLayoutElement;
753};
754
756 Q_OBJECT
758 Q_PROPERTY(QCPLayout *layout READ layout)
759 Q_PROPERTY(QRect rect READ rect)
760 Q_PROPERTY(QRect outerRect READ outerRect WRITE setOuterRect)
761 Q_PROPERTY(QMargins margins READ margins WRITE setMargins)
762 Q_PROPERTY(
763 QMargins minimumMargins READ minimumMargins WRITE setMinimumMargins)
764 Q_PROPERTY(QSize minimumSize READ minimumSize WRITE setMinimumSize)
765 Q_PROPERTY(QSize maximumSize READ maximumSize WRITE setMaximumSize)
767 public:
773 upPreparation
775 ,
776 upMargins
777 ,
778 upLayout
780 };
781 Q_ENUMS(UpdatePhase)
782
783 explicit QCPLayoutElement(QCustomPlot *parentPlot = 0);
785
786 // getters:
787 QCPLayout *layout() const { return mParentLayout; }
788 QRect rect() const { return mRect; }
789 QRect outerRect() const { return mOuterRect; }
790 QMargins margins() const { return mMargins; }
791 QMargins minimumMargins() const { return mMinimumMargins; }
792 QCP::MarginSides autoMargins() const { return mAutoMargins; }
793 QSize minimumSize() const { return mMinimumSize; }
794 QSize maximumSize() const { return mMaximumSize; }
796 return mMarginGroups.value(side, (QCPMarginGroup *)0);
797 }
798 QHash<QCP::MarginSide, QCPMarginGroup *> marginGroups() const {
799 return mMarginGroups;
800 }
801
802 // setters:
803 void setOuterRect(const QRect &rect);
804 void setMargins(const QMargins &margins);
805 void setMinimumMargins(const QMargins &margins);
806 void setAutoMargins(QCP::MarginSides sides);
807 void setMinimumSize(const QSize &size);
808 void setMinimumSize(int width, int height);
809 void setMaximumSize(const QSize &size);
810 void setMaximumSize(int width, int height);
811 void setMarginGroup(QCP::MarginSides sides, QCPMarginGroup *group);
812
813 // introduced virtual methods:
814 virtual void update(UpdatePhase phase);
815 virtual QSize minimumSizeHint() const;
816 virtual QSize maximumSizeHint() const;
817 virtual QList<QCPLayoutElement *> elements(bool recursive) const;
818
819 // reimplemented virtual methods:
820 virtual double selectTest(const QPointF &pos, bool onlySelectable,
821 QVariant *details = 0) const;
822
823 protected:
824 // property members:
825 QCPLayout *mParentLayout;
826 QSize mMinimumSize, mMaximumSize;
827 QRect mRect, mOuterRect;
828 QMargins mMargins, mMinimumMargins;
829 QCP::MarginSides mAutoMargins;
830 QHash<QCP::MarginSide, QCPMarginGroup *> mMarginGroups;
831
832 // introduced virtual methods:
834 // events:
835 virtual void mousePressEvent(QMouseEvent *event) { Q_UNUSED(event) }
836 virtual void mouseMoveEvent(QMouseEvent *event) { Q_UNUSED(event) }
837 virtual void mouseReleaseEvent(QMouseEvent *event) { Q_UNUSED(event) }
838 virtual void mouseDoubleClickEvent(QMouseEvent *event) { Q_UNUSED(event) }
839 virtual void wheelEvent(QWheelEvent *event) { Q_UNUSED(event) }
840
841 // reimplemented virtual methods:
842 virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const {
843 Q_UNUSED(painter)
844 }
845 virtual void draw(QCPPainter *painter) { Q_UNUSED(painter) }
846 virtual void parentPlotInitialized(QCustomPlot *parentPlot);
847
848 private:
849 Q_DISABLE_COPY(QCPLayoutElement)
850
851 friend class QCustomPlot;
852 friend class QCPLayout;
853 friend class QCPMarginGroup;
854};
855
857 Q_OBJECT
858 public:
859 explicit QCPLayout();
860
861 // reimplemented virtual methods:
862 virtual void update(UpdatePhase phase);
863 virtual QList<QCPLayoutElement *> elements(bool recursive) const;
864
865 // introduced virtual methods:
866 virtual int elementCount() const = 0;
867 virtual QCPLayoutElement *elementAt(int index) const = 0;
868 virtual QCPLayoutElement *takeAt(int index) = 0;
869 virtual bool take(QCPLayoutElement *element) = 0;
870 virtual void simplify();
871
872 // non-virtual methods:
873 bool removeAt(int index);
874 bool remove(QCPLayoutElement *element);
875 void clear();
876
877 protected:
878 // introduced virtual methods:
879 virtual void updateLayout();
880
881 // non-virtual methods:
885 QVector<int> getSectionSizes(QVector<int> maxSizes, QVector<int> minSizes,
886 QVector<double> stretchFactors,
887 int totalSize) const;
888
889 private:
890 Q_DISABLE_COPY(QCPLayout)
891 friend class QCPLayoutElement;
892};
893
894class QCP_LIB_DECL QCPLayoutGrid : public QCPLayout {
895 Q_OBJECT
897 Q_PROPERTY(int rowCount READ rowCount)
898 Q_PROPERTY(int columnCount READ columnCount)
899 Q_PROPERTY(QList<double> columnStretchFactors READ columnStretchFactors WRITE
900 setColumnStretchFactors)
901 Q_PROPERTY(QList<double> rowStretchFactors READ rowStretchFactors WRITE
902 setRowStretchFactors)
903 Q_PROPERTY(int columnSpacing READ columnSpacing WRITE setColumnSpacing)
904 Q_PROPERTY(int rowSpacing READ rowSpacing WRITE setRowSpacing)
906 public:
907 explicit QCPLayoutGrid();
908 virtual ~QCPLayoutGrid();
909
910 // getters:
911 int rowCount() const;
912 int columnCount() const;
913 QList<double> columnStretchFactors() const { return mColumnStretchFactors; }
914 QList<double> rowStretchFactors() const { return mRowStretchFactors; }
915 int columnSpacing() const { return mColumnSpacing; }
916 int rowSpacing() const { return mRowSpacing; }
917
918 // setters:
919 void setColumnStretchFactor(int column, double factor);
920 void setColumnStretchFactors(const QList<double> &factors);
921 void setRowStretchFactor(int row, double factor);
922 void setRowStretchFactors(const QList<double> &factors);
923 void setColumnSpacing(int pixels);
924 void setRowSpacing(int pixels);
925
926 // reimplemented virtual methods:
927 virtual void updateLayout();
928 virtual int elementCount() const;
929 virtual QCPLayoutElement *elementAt(int index) const;
930 virtual QCPLayoutElement *takeAt(int index);
931 virtual bool take(QCPLayoutElement *element);
932 virtual QList<QCPLayoutElement *> elements(bool recursive) const;
933 virtual void simplify();
934 virtual QSize minimumSizeHint() const;
935 virtual QSize maximumSizeHint() const;
936
937 // non-virtual methods:
938 QCPLayoutElement *element(int row, int column) const;
939 bool addElement(int row, int column, QCPLayoutElement *element);
940 bool hasElement(int row, int column);
941 void expandTo(int newRowCount, int newColumnCount);
942 void insertRow(int newIndex);
943 void insertColumn(int newIndex);
944
945 protected:
946 // property members:
947 QList<QList<QCPLayoutElement *> > mElements;
948 QList<double> mColumnStretchFactors;
949 QList<double> mRowStretchFactors;
950 int mColumnSpacing, mRowSpacing;
951
952 // non-virtual methods:
953 void getMinimumRowColSizes(QVector<int> *minColWidths,
954 QVector<int> *minRowHeights) const;
955 void getMaximumRowColSizes(QVector<int> *maxColWidths,
956 QVector<int> *maxRowHeights) const;
957
958 private:
959 Q_DISABLE_COPY(QCPLayoutGrid)
960};
961
963 Q_OBJECT
964 public:
970 ipFree
972 ,
973 ipBorderAligned
975 };
976
977 explicit QCPLayoutInset();
979
980 // getters:
982 Qt::Alignment insetAlignment(int index) const;
983 QRectF insetRect(int index) const;
984
985 // setters:
986 void setInsetPlacement(int index, InsetPlacement placement);
987 void setInsetAlignment(int index, Qt::Alignment alignment);
988 void setInsetRect(int index, const QRectF &rect);
989
990 // reimplemented virtual methods:
991 virtual void updateLayout();
992 virtual int elementCount() const;
993 virtual QCPLayoutElement *elementAt(int index) const;
994 virtual QCPLayoutElement *takeAt(int index);
995 virtual bool take(QCPLayoutElement *element);
996 virtual void simplify() {}
997 virtual double selectTest(const QPointF &pos, bool onlySelectable,
998 QVariant *details = 0) const;
999
1000 // non-virtual methods:
1001 void addElement(QCPLayoutElement *element, Qt::Alignment alignment);
1002 void addElement(QCPLayoutElement *element, const QRectF &rect);
1003
1004 protected:
1005 // property members:
1006 QList<QCPLayoutElement *> mElements;
1007 QList<InsetPlacement> mInsetPlacement;
1008 QList<Qt::Alignment> mInsetAlignment;
1009 QList<QRectF> mInsetRect;
1010
1011 private:
1012 Q_DISABLE_COPY(QCPLayoutInset)
1013};
1014
1016 Q_GADGET
1017 public:
1031 Q_ENUMS(EndingStyle)
1033 esNone
1034 ,
1035 esFlatArrow
1036 ,
1037 esSpikeArrow
1038 ,
1039 esLineArrow
1040 ,
1041 esDisc
1042 ,
1043 esSquare
1044 ,
1045 esDiamond
1046 ,
1047 esBar
1048 ,
1049 esHalfBar
1051 ,
1052 esSkewedBar
1054 };
1055
1057 QCPLineEnding(EndingStyle style, double width = 8, double length = 10,
1058 bool inverted = false);
1059
1060 // getters:
1061 EndingStyle style() const { return mStyle; }
1062 double width() const { return mWidth; }
1063 double length() const { return mLength; }
1064 bool inverted() const { return mInverted; }
1065
1066 // setters:
1068 void setWidth(double width);
1069 void setLength(double length);
1070 void setInverted(bool inverted);
1071
1072 // non-property methods:
1073 double boundingDistance() const;
1074 double realLength() const;
1075 void draw(QCPPainter *painter, const QVector2D &pos,
1076 const QVector2D &dir) const;
1077 void draw(QCPPainter *painter, const QVector2D &pos, double angle) const;
1078
1079 protected:
1080 // property members:
1081 EndingStyle mStyle;
1082 double mWidth, mLength;
1083 bool mInverted;
1084};
1086
1087class QCP_LIB_DECL QCPGrid : public QCPLayerable {
1088 Q_OBJECT
1090 Q_PROPERTY(bool subGridVisible READ subGridVisible WRITE setSubGridVisible)
1091 Q_PROPERTY(bool antialiasedSubGrid READ antialiasedSubGrid WRITE
1092 setAntialiasedSubGrid)
1093 Q_PROPERTY(bool antialiasedZeroLine READ antialiasedZeroLine WRITE
1094 setAntialiasedZeroLine)
1095 Q_PROPERTY(QPen pen READ pen WRITE setPen)
1096 Q_PROPERTY(QPen subGridPen READ subGridPen WRITE setSubGridPen)
1097 Q_PROPERTY(QPen zeroLinePen READ zeroLinePen WRITE setZeroLinePen)
1099 public:
1100 QCPGrid(QCPAxis *parentAxis);
1101
1102 // getters:
1103 bool subGridVisible() const { return mSubGridVisible; }
1104 bool antialiasedSubGrid() const { return mAntialiasedSubGrid; }
1105 bool antialiasedZeroLine() const { return mAntialiasedZeroLine; }
1106 QPen pen() const { return mPen; }
1107 QPen subGridPen() const { return mSubGridPen; }
1108 QPen zeroLinePen() const { return mZeroLinePen; }
1109
1110 // setters:
1111 void setSubGridVisible(bool visible);
1112 void setAntialiasedSubGrid(bool enabled);
1113 void setAntialiasedZeroLine(bool enabled);
1114 void setPen(const QPen &pen);
1115 void setSubGridPen(const QPen &pen);
1116 void setZeroLinePen(const QPen &pen);
1117
1118 protected:
1119 // property members:
1120 bool mSubGridVisible;
1121 bool mAntialiasedSubGrid, mAntialiasedZeroLine;
1122 QPen mPen, mSubGridPen, mZeroLinePen;
1123 // non-property members:
1124 QCPAxis *mParentAxis;
1125
1126 // reimplemented virtual methods:
1127 virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const;
1128 virtual void draw(QCPPainter *painter);
1129
1130 // non-virtual methods:
1131 void drawGridLines(QCPPainter *painter) const;
1132 void drawSubGridLines(QCPPainter *painter) const;
1133
1134 friend class QCPAxis;
1135};
1136
1137class QCP_LIB_DECL QCPAxis : public QCPLayerable {
1138 Q_OBJECT
1140 Q_PROPERTY(AxisType axisType READ axisType)
1141 Q_PROPERTY(QCPAxisRect *axisRect READ axisRect)
1142 Q_PROPERTY(ScaleType scaleType READ scaleType WRITE setScaleType NOTIFY
1143 scaleTypeChanged)
1144 Q_PROPERTY(double scaleLogBase READ scaleLogBase WRITE setScaleLogBase)
1145 Q_PROPERTY(QCPRange range READ range WRITE setRange NOTIFY rangeChanged)
1146 Q_PROPERTY(bool rangeReversed READ rangeReversed WRITE setRangeReversed)
1147 Q_PROPERTY(bool autoTicks READ autoTicks WRITE setAutoTicks)
1148 Q_PROPERTY(int autoTickCount READ autoTickCount WRITE setAutoTickCount)
1149 Q_PROPERTY(bool autoTickLabels READ autoTickLabels WRITE setAutoTickLabels)
1150 Q_PROPERTY(bool autoTickStep READ autoTickStep WRITE setAutoTickStep)
1151 Q_PROPERTY(bool autoSubTicks READ autoSubTicks WRITE setAutoSubTicks)
1152 Q_PROPERTY(bool ticks READ ticks WRITE setTicks)
1153 Q_PROPERTY(bool tickLabels READ tickLabels WRITE setTickLabels)
1154 Q_PROPERTY(
1155 int tickLabelPadding READ tickLabelPadding WRITE setTickLabelPadding)
1156 Q_PROPERTY(LabelType tickLabelType READ tickLabelType WRITE setTickLabelType)
1157 Q_PROPERTY(QFont tickLabelFont READ tickLabelFont WRITE setTickLabelFont)
1158 Q_PROPERTY(QColor tickLabelColor READ tickLabelColor WRITE setTickLabelColor)
1159 Q_PROPERTY(double tickLabelRotation READ tickLabelRotation WRITE
1160 setTickLabelRotation)
1161 Q_PROPERTY(LabelSide tickLabelSide READ tickLabelSide WRITE setTickLabelSide)
1162 Q_PROPERTY(QString dateTimeFormat READ dateTimeFormat WRITE setDateTimeFormat)
1163 Q_PROPERTY(Qt::TimeSpec dateTimeSpec READ dateTimeSpec WRITE setDateTimeSpec)
1164 Q_PROPERTY(QString numberFormat READ numberFormat WRITE setNumberFormat)
1165 Q_PROPERTY(int numberPrecision READ numberPrecision WRITE setNumberPrecision)
1166 Q_PROPERTY(double tickStep READ tickStep WRITE setTickStep)
1167 Q_PROPERTY(QVector<double> tickVector READ tickVector WRITE setTickVector)
1168 Q_PROPERTY(QVector<QString> tickVectorLabels READ tickVectorLabels WRITE
1169 setTickVectorLabels)
1170 Q_PROPERTY(int tickLengthIn READ tickLengthIn WRITE setTickLengthIn)
1171 Q_PROPERTY(int tickLengthOut READ tickLengthOut WRITE setTickLengthOut)
1172 Q_PROPERTY(int subTickCount READ subTickCount WRITE setSubTickCount)
1173 Q_PROPERTY(int subTickLengthIn READ subTickLengthIn WRITE setSubTickLengthIn)
1174 Q_PROPERTY(
1175 int subTickLengthOut READ subTickLengthOut WRITE setSubTickLengthOut)
1176 Q_PROPERTY(QPen basePen READ basePen WRITE setBasePen)
1177 Q_PROPERTY(QPen tickPen READ tickPen WRITE setTickPen)
1178 Q_PROPERTY(QPen subTickPen READ subTickPen WRITE setSubTickPen)
1179 Q_PROPERTY(QFont labelFont READ labelFont WRITE setLabelFont)
1180 Q_PROPERTY(QColor labelColor READ labelColor WRITE setLabelColor)
1181 Q_PROPERTY(QString label READ label WRITE setLabel)
1182 Q_PROPERTY(int labelPadding READ labelPadding WRITE setLabelPadding)
1183 Q_PROPERTY(int padding READ padding WRITE setPadding)
1184 Q_PROPERTY(int offset READ offset WRITE setOffset)
1185 Q_PROPERTY(SelectableParts selectedParts READ selectedParts WRITE
1186 setSelectedParts NOTIFY selectionChanged)
1187 Q_PROPERTY(SelectableParts selectableParts READ selectableParts WRITE
1188 setSelectableParts NOTIFY selectableChanged)
1189 Q_PROPERTY(QFont selectedTickLabelFont READ selectedTickLabelFont WRITE
1190 setSelectedTickLabelFont)
1191 Q_PROPERTY(
1192 QFont selectedLabelFont READ selectedLabelFont WRITE setSelectedLabelFont)
1193 Q_PROPERTY(QColor selectedTickLabelColor READ selectedTickLabelColor WRITE
1194 setSelectedTickLabelColor)
1195 Q_PROPERTY(QColor selectedLabelColor READ selectedLabelColor WRITE
1196 setSelectedLabelColor)
1197 Q_PROPERTY(QPen selectedBasePen READ selectedBasePen WRITE setSelectedBasePen)
1198 Q_PROPERTY(QPen selectedTickPen READ selectedTickPen WRITE setSelectedTickPen)
1199 Q_PROPERTY(QPen selectedSubTickPen READ selectedSubTickPen WRITE
1200 setSelectedSubTickPen)
1201 Q_PROPERTY(QCPLineEnding lowerEnding READ lowerEnding WRITE setLowerEnding)
1202 Q_PROPERTY(QCPLineEnding upperEnding READ upperEnding WRITE setUpperEnding)
1203 Q_PROPERTY(QCPGrid *grid READ grid)
1205 public:
1212 atLeft = 0x01
1214 ,
1215 atRight = 0x02
1217 ,
1218 atTop = 0x04
1220 ,
1221 atBottom = 0x08
1223 };
1224 Q_FLAGS(AxisType AxisTypes)
1225 Q_DECLARE_FLAGS(AxisTypes, AxisType)
1234 ltNumber
1236 ,
1237 ltDateTime
1241 };
1242 Q_ENUMS(LabelType)
1249 lsInside
1251 ,
1252 lsOutside
1253 };
1254 Q_ENUMS(LabelSide)
1260 stLinear
1261 ,
1262 stLogarithmic
1265 };
1266 Q_ENUMS(ScaleType)
1272 spNone = 0
1273 ,
1274 spAxis = 0x001
1275 ,
1276 spTickLabels = 0x002
1278 ,
1279 spAxisLabel = 0x004
1280 };
1281 Q_FLAGS(SelectablePart SelectableParts)
1282 Q_DECLARE_FLAGS(SelectableParts, SelectablePart)
1283
1284 explicit QCPAxis(QCPAxisRect *parent, AxisType type);
1285 virtual ~QCPAxis();
1286
1287 // getters:
1288 AxisType axisType() const { return mAxisType; }
1289 QCPAxisRect *axisRect() const { return mAxisRect; }
1290 ScaleType scaleType() const { return mScaleType; }
1291 double scaleLogBase() const { return mScaleLogBase; }
1292 const QCPRange range() const { return mRange; }
1293 bool rangeReversed() const { return mRangeReversed; }
1294 bool autoTicks() const { return mAutoTicks; }
1295 int autoTickCount() const { return mAutoTickCount; }
1296 bool autoTickLabels() const { return mAutoTickLabels; }
1297 bool autoTickStep() const { return mAutoTickStep; }
1298 bool autoSubTicks() const { return mAutoSubTicks; }
1299 bool ticks() const { return mTicks; }
1300 bool tickLabels() const { return mTickLabels; }
1301 int tickLabelPadding() const;
1302 LabelType tickLabelType() const { return mTickLabelType; }
1303 QFont tickLabelFont() const { return mTickLabelFont; }
1304 QColor tickLabelColor() const { return mTickLabelColor; }
1305 double tickLabelRotation() const;
1307 QString dateTimeFormat() const { return mDateTimeFormat; }
1308 Qt::TimeSpec dateTimeSpec() const { return mDateTimeSpec; }
1309 QString numberFormat() const;
1310 int numberPrecision() const { return mNumberPrecision; }
1311 double tickStep() const { return mTickStep; }
1312 QVector<double> tickVector() const { return mTickVector; }
1313 QVector<QString> tickVectorLabels() const { return mTickVectorLabels; }
1314 int tickLengthIn() const;
1315 int tickLengthOut() const;
1316 int subTickCount() const { return mSubTickCount; }
1317 int subTickLengthIn() const;
1318 int subTickLengthOut() const;
1319 QPen basePen() const { return mBasePen; }
1320 QPen tickPen() const { return mTickPen; }
1321 QPen subTickPen() const { return mSubTickPen; }
1322 QFont labelFont() const { return mLabelFont; }
1323 QColor labelColor() const { return mLabelColor; }
1324 QString label() const { return mLabel; }
1325 int labelPadding() const;
1326 int padding() const { return mPadding; }
1327 int offset() const;
1328 SelectableParts selectedParts() const { return mSelectedParts; }
1329 SelectableParts selectableParts() const { return mSelectableParts; }
1330 QFont selectedTickLabelFont() const { return mSelectedTickLabelFont; }
1331 QFont selectedLabelFont() const { return mSelectedLabelFont; }
1332 QColor selectedTickLabelColor() const { return mSelectedTickLabelColor; }
1333 QColor selectedLabelColor() const { return mSelectedLabelColor; }
1334 QPen selectedBasePen() const { return mSelectedBasePen; }
1335 QPen selectedTickPen() const { return mSelectedTickPen; }
1336 QPen selectedSubTickPen() const { return mSelectedSubTickPen; }
1339 QCPGrid *grid() const { return mGrid; }
1340
1341 // setters:
1343 void setScaleLogBase(double base);
1344 Q_SLOT void setRange(const QCPRange &range);
1345 void setRange(double lower, double upper);
1346 void setRange(double position, double size, Qt::AlignmentFlag alignment);
1347 void setRangeLower(double lower);
1348 void setRangeUpper(double upper);
1349 void setRangeReversed(bool reversed);
1350 void setAutoTicks(bool on);
1351 void setAutoTickCount(int approximateCount);
1352 void setAutoTickLabels(bool on);
1353 void setAutoTickStep(bool on);
1354 void setAutoSubTicks(bool on);
1355 void setTicks(bool show);
1356 void setTickLabels(bool show);
1357 void setTickLabelPadding(int padding);
1359 void setTickLabelFont(const QFont &font);
1360 void setTickLabelColor(const QColor &color);
1361 void setTickLabelRotation(double degrees);
1363 void setDateTimeFormat(const QString &format);
1364 void setDateTimeSpec(const Qt::TimeSpec &timeSpec);
1365 void setNumberFormat(const QString &formatCode);
1366 void setNumberPrecision(int precision);
1367 void setTickStep(double step);
1368 void setTickVector(const QVector<double> &vec);
1369 void setTickVectorLabels(const QVector<QString> &vec);
1370 void setTickLength(int inside, int outside = 0);
1371 void setTickLengthIn(int inside);
1372 void setTickLengthOut(int outside);
1373 void setSubTickCount(int count);
1374 void setSubTickLength(int inside, int outside = 0);
1375 void setSubTickLengthIn(int inside);
1376 void setSubTickLengthOut(int outside);
1377 void setBasePen(const QPen &pen);
1378 void setTickPen(const QPen &pen);
1379 void setSubTickPen(const QPen &pen);
1380 void setLabelFont(const QFont &font);
1381 void setLabelColor(const QColor &color);
1382 void setLabel(const QString &str);
1383 void setLabelPadding(int padding);
1384 void setPadding(int padding);
1385 void setOffset(int offset);
1386 void setSelectedTickLabelFont(const QFont &font);
1387 void setSelectedLabelFont(const QFont &font);
1388 void setSelectedTickLabelColor(const QColor &color);
1389 void setSelectedLabelColor(const QColor &color);
1390 void setSelectedBasePen(const QPen &pen);
1391 void setSelectedTickPen(const QPen &pen);
1392 void setSelectedSubTickPen(const QPen &pen);
1394 const QCPAxis::SelectableParts &selectableParts);
1395 Q_SLOT void setSelectedParts(const QCPAxis::SelectableParts &selectedParts);
1396 void setLowerEnding(const QCPLineEnding &ending);
1397 void setUpperEnding(const QCPLineEnding &ending);
1398
1399 // reimplemented virtual methods:
1400 virtual double selectTest(const QPointF &pos, bool onlySelectable,
1401 QVariant *details = 0) const;
1402
1403 // non-property methods:
1404 Qt::Orientation orientation() const { return mOrientation; }
1405 void moveRange(double diff);
1406 void scaleRange(double factor, double center);
1407 void setScaleRatio(const QCPAxis *otherAxis, double ratio = 1.0);
1408 void rescale(bool onlyVisiblePlottables = false);
1409 double pixelToCoord(double value) const;
1410 double coordToPixel(double value) const;
1411 SelectablePart getPartAt(const QPointF &pos) const;
1412 QList<QCPAbstractPlottable *> plottables() const;
1413 QList<QCPGraph *> graphs() const;
1414 QList<QCPAbstractItem *> items() const;
1415
1417 static Qt::Orientation orientation(AxisType type) {
1418 return type == atBottom || type == atTop ? Qt::Horizontal : Qt::Vertical;
1419 }
1421
1422 signals:
1424 void rangeChanged(const QCPRange &newRange);
1425 void rangeChanged(const QCPRange &newRange, const QCPRange &oldRange);
1427 void selectionChanged(const QCPAxis::SelectableParts &parts);
1428 void selectableChanged(const QCPAxis::SelectableParts &parts);
1429
1430 protected:
1431 // property members:
1432 // axis base:
1433 AxisType mAxisType;
1434 QCPAxisRect *mAxisRect;
1435 // int mOffset; // in QCPAxisPainter
1436 int mPadding;
1437 Qt::Orientation mOrientation;
1438 SelectableParts mSelectableParts, mSelectedParts;
1439 QPen mBasePen, mSelectedBasePen;
1440 // QCPLineEnding mLowerEnding, mUpperEnding; // in QCPAxisPainter
1441 // axis label:
1442 // int mLabelPadding; // in QCPAxisPainter
1443 QString mLabel;
1444 QFont mLabelFont, mSelectedLabelFont;
1445 QColor mLabelColor, mSelectedLabelColor;
1446 // tick labels:
1447 // int mTickLabelPadding; // in QCPAxisPainter
1448 bool mTickLabels, mAutoTickLabels;
1449 // double mTickLabelRotation; // in QCPAxisPainter
1450 LabelType mTickLabelType;
1451 QFont mTickLabelFont, mSelectedTickLabelFont;
1452 QColor mTickLabelColor, mSelectedTickLabelColor;
1453 QString mDateTimeFormat;
1454 Qt::TimeSpec mDateTimeSpec;
1455 int mNumberPrecision;
1456 QLatin1Char mNumberFormatChar;
1457 bool mNumberBeautifulPowers;
1458 // bool mNumberMultiplyCross; // QCPAxisPainter
1459 // ticks and subticks:
1460 bool mTicks;
1461 double mTickStep;
1462 int mSubTickCount, mAutoTickCount;
1463 bool mAutoTicks, mAutoTickStep, mAutoSubTicks;
1464 // int mTickLengthIn, mTickLengthOut, mSubTickLengthIn, mSubTickLengthOut; //
1465 // QCPAxisPainter
1466 QPen mTickPen, mSelectedTickPen;
1467 QPen mSubTickPen, mSelectedSubTickPen;
1468 // scale and range:
1469 QCPRange mRange;
1470 bool mRangeReversed;
1471 ScaleType mScaleType;
1472 double mScaleLogBase, mScaleLogBaseLogInv;
1473
1474 // non-property members:
1475 QCPGrid *mGrid;
1476 QCPAxisPainterPrivate *mAxisPainter;
1477 int mLowestVisibleTick, mHighestVisibleTick;
1478 QVector<double> mTickVector;
1479 QVector<QString> mTickVectorLabels;
1480 QVector<double> mSubTickVector;
1481 bool mCachedMarginValid;
1482 int mCachedMargin;
1483
1484 // introduced virtual methods:
1485 virtual void setupTickVectors();
1486 virtual void generateAutoTicks();
1487 virtual int calculateAutoSubTickCount(double tickStep) const;
1488 virtual int calculateMargin();
1489
1490 // reimplemented virtual methods:
1491 virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const;
1492 virtual void draw(QCPPainter *painter);
1494 // events:
1495 virtual void selectEvent(QMouseEvent *event, bool additive,
1496 const QVariant &details,
1497 bool *selectionStateChanged);
1498 virtual void deselectEvent(bool *selectionStateChanged);
1499
1500 // non-virtual methods:
1501 void visibleTickBounds(int &lowIndex, int &highIndex) const;
1502 double baseLog(double value) const;
1503 double basePow(double value) const;
1504 QPen getBasePen() const;
1505 QPen getTickPen() const;
1506 QPen getSubTickPen() const;
1507 QFont getTickLabelFont() const;
1508 QFont getLabelFont() const;
1509 QColor getTickLabelColor() const;
1510 QColor getLabelColor() const;
1511
1512 private:
1513 Q_DISABLE_COPY(QCPAxis)
1514
1515 friend class QCustomPlot;
1516 friend class QCPGrid;
1517 friend class QCPAxisRect;
1518};
1519Q_DECLARE_OPERATORS_FOR_FLAGS(QCPAxis::SelectableParts)
1520Q_DECLARE_OPERATORS_FOR_FLAGS(QCPAxis::AxisTypes)
1521Q_DECLARE_METATYPE(QCPAxis::SelectablePart)
1522
1524 public:
1525 explicit QCPAxisPainterPrivate(QCustomPlot *parentPlot);
1527
1528 virtual void draw(QCPPainter *painter);
1529 virtual int size() const;
1531
1532 QRect axisSelectionBox() const { return mAxisSelectionBox; }
1534 QRect labelSelectionBox() const { return mLabelSelectionBox; }
1535
1536 // public property members:
1538 QPen basePen;
1540 upperEnding; // directly accessed by QCPAxis setters/getters
1541 int labelPadding; // directly accessed by QCPAxis setters/getters
1542 QFont labelFont;
1543 QColor labelColor;
1544 QString label;
1545 int tickLabelPadding; // directly accessed by QCPAxis setters/getters
1546 double tickLabelRotation; // directly accessed by QCPAxis setters/getters
1548 tickLabelSide; // directly accessed by QCPAxis setters/getters
1549 bool substituteExponent;
1550 bool numberMultiplyCross; // directly accessed by QCPAxis setters/getters
1552 subTickLengthOut; // directly accessed by QCPAxis setters/getters
1553 QPen tickPen, subTickPen;
1554 QFont tickLabelFont;
1555 QColor tickLabelColor;
1556 QRect axisRect, viewportRect;
1557 double offset; // directly accessed by QCPAxis setters/getters
1559 bool reversedEndings;
1560
1561 QVector<double> subTickPositions;
1562 QVector<double> tickPositions;
1563 QVector<QString> tickLabels;
1564
1565 protected:
1566 struct CachedLabel {
1567 QPointF offset;
1568 QPixmap pixmap;
1569 };
1570 struct TickLabelData {
1571 QString basePart, expPart;
1573 QFont baseFont, expFont;
1574 };
1576 QByteArray mLabelParameterHash; // to determine whether mLabelCache needs to
1577 // be cleared due to changed parameters
1578 QCache<QString, CachedLabel> mLabelCache;
1580
1581 virtual QByteArray generateLabelParameterHash() const;
1582
1583 virtual void placeTickLabel(QCPPainter *painter, double position,
1584 int distanceToAxis, const QString &text,
1585 QSize *tickLabelsSize);
1586 virtual void drawTickLabel(QCPPainter *painter, double x, double y,
1587 const TickLabelData &labelData) const;
1588 virtual TickLabelData getTickLabelData(const QFont &font,
1589 const QString &text) const;
1590 virtual QPointF getTickLabelDrawOffset(const TickLabelData &labelData) const;
1591 virtual void getMaxTickLabelSize(const QFont &font, const QString &text,
1592 QSize *tickLabelsSize) const;
1593};
1594
1596 Q_OBJECT
1598 Q_PROPERTY(QString name READ name WRITE setName)
1599 Q_PROPERTY(bool antialiasedFill READ antialiasedFill WRITE setAntialiasedFill)
1600 Q_PROPERTY(bool antialiasedScatters READ antialiasedScatters WRITE
1601 setAntialiasedScatters)
1602 Q_PROPERTY(bool antialiasedErrorBars READ antialiasedErrorBars WRITE
1603 setAntialiasedErrorBars)
1604 Q_PROPERTY(QPen pen READ pen WRITE setPen)
1605 Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
1606 Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
1607 Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
1608 Q_PROPERTY(QCPAxis *keyAxis READ keyAxis WRITE setKeyAxis)
1609 Q_PROPERTY(QCPAxis *valueAxis READ valueAxis WRITE setValueAxis)
1610 Q_PROPERTY(bool selectable READ selectable WRITE setSelectable NOTIFY
1611 selectableChanged)
1612 Q_PROPERTY(
1613 bool selected READ selected WRITE setSelected NOTIFY selectionChanged)
1615 public:
1616 QCPAbstractPlottable(QCPAxis *keyAxis, QCPAxis *valueAxis);
1617
1618 // getters:
1619 QString name() const { return mName; }
1620 bool antialiasedFill() const { return mAntialiasedFill; }
1621 bool antialiasedScatters() const { return mAntialiasedScatters; }
1622 bool antialiasedErrorBars() const { return mAntialiasedErrorBars; }
1623 QPen pen() const { return mPen; }
1624 QPen selectedPen() const { return mSelectedPen; }
1625 QBrush brush() const { return mBrush; }
1626 QBrush selectedBrush() const { return mSelectedBrush; }
1627 QCPAxis *keyAxis() const { return mKeyAxis.data(); }
1628 QCPAxis *valueAxis() const { return mValueAxis.data(); }
1629 bool selectable() const { return mSelectable; }
1630 bool selected() const { return mSelected; }
1631
1632 // setters:
1633 void setName(const QString &name);
1634 void setAntialiasedFill(bool enabled);
1635 void setAntialiasedScatters(bool enabled);
1636 void setAntialiasedErrorBars(bool enabled);
1637 void setPen(const QPen &pen);
1638 void setSelectedPen(const QPen &pen);
1639 void setBrush(const QBrush &brush);
1640 void setSelectedBrush(const QBrush &brush);
1641 void setKeyAxis(QCPAxis *axis);
1643 Q_SLOT void setSelectable(bool selectable);
1644 Q_SLOT void setSelected(bool selected);
1645
1646 // introduced virtual methods:
1647 virtual void clearData() = 0;
1648 virtual double selectTest(const QPointF &pos, bool onlySelectable,
1649 QVariant *details = 0) const = 0;
1650 virtual bool addToLegend();
1651 virtual bool removeFromLegend() const;
1652
1653 // non-property methods:
1654 void rescaleAxes(bool onlyEnlarge = false) const;
1655 void rescaleKeyAxis(bool onlyEnlarge = false) const;
1656 void rescaleValueAxis(bool onlyEnlarge = false) const;
1657
1658 signals:
1659 void selectionChanged(bool selected);
1660 void selectableChanged(bool selectable);
1661
1662 protected:
1668 sdNegative
1669 ,
1670 sdBoth
1671 ,
1672 sdPositive
1673 };
1674
1675 // property members:
1676 QString mName;
1677 bool mAntialiasedFill, mAntialiasedScatters, mAntialiasedErrorBars;
1678 QPen mPen, mSelectedPen;
1679 QBrush mBrush, mSelectedBrush;
1680 QPointer<QCPAxis> mKeyAxis, mValueAxis;
1681 bool mSelectable, mSelected;
1682
1683 // reimplemented virtual methods:
1684 virtual QRect clipRect() const;
1685 virtual void draw(QCPPainter *painter) = 0;
1688 // events:
1689 virtual void selectEvent(QMouseEvent *event, bool additive,
1690 const QVariant &details,
1691 bool *selectionStateChanged);
1692 virtual void deselectEvent(bool *selectionStateChanged);
1693
1694 // introduced virtual methods:
1695 virtual void drawLegendIcon(QCPPainter *painter,
1696 const QRectF &rect) const = 0;
1697 virtual QCPRange getKeyRange(bool &foundRange,
1698 SignDomain inSignDomain = sdBoth) const = 0;
1699 virtual QCPRange getValueRange(bool &foundRange,
1700 SignDomain inSignDomain = sdBoth) const = 0;
1701
1702 // non-virtual methods:
1703 void coordsToPixels(double key, double value, double &x, double &y) const;
1704 const QPointF coordsToPixels(double key, double value) const;
1705 void pixelsToCoords(double x, double y, double &key, double &value) const;
1706 void pixelsToCoords(const QPointF &pixelPos, double &key,
1707 double &value) const;
1708 QPen mainPen() const;
1709 QBrush mainBrush() const;
1713 double distSqrToLine(const QPointF &start, const QPointF &end,
1714 const QPointF &point) const;
1715
1716 private:
1717 Q_DISABLE_COPY(QCPAbstractPlottable)
1718
1719 friend class QCustomPlot;
1720 friend class QCPAxis;
1721 friend class QCPPlottableLegendItem;
1722};
1723
1725 public:
1727 const QString name, int anchorId = -1);
1729
1730 // getters:
1731 QString name() const { return mName; }
1732 virtual QPointF pixelPoint() const;
1733
1734 protected:
1735 // property members:
1736 QString mName;
1737
1738 // non-property members:
1739 QCustomPlot *mParentPlot;
1740 QCPAbstractItem *mParentItem;
1741 int mAnchorId;
1742 QSet<QCPItemPosition *> mChildrenX, mChildrenY;
1743
1744 // introduced virtual methods:
1745 virtual QCPItemPosition *toQCPItemPosition() { return 0; }
1746
1747 // non-virtual methods:
1749 pos); // called from pos when this anchor is set as parent
1750 void removeChildX(QCPItemPosition *pos); // called from pos when its parent
1751 // anchor is reset or pos deleted
1753 pos); // called from pos when this anchor is set as parent
1754 void removeChildY(QCPItemPosition *pos); // called from pos when its parent
1755 // anchor is reset or pos deleted
1756
1757 private:
1758 Q_DISABLE_COPY(QCPItemAnchor)
1759
1760 friend class QCPItemPosition;
1761};
1762
1764 public:
1772 ptAbsolute
1774 ,
1775 ptViewportRatio
1782 ,
1783 ptAxisRectRatio
1792 ,
1793 ptPlotCoords
1795 };
1796
1798 const QString name);
1800
1801 // getters:
1802 PositionType type() const { return typeX(); }
1803 PositionType typeX() const { return mPositionTypeX; }
1804 PositionType typeY() const { return mPositionTypeY; }
1805 QCPItemAnchor *parentAnchor() const { return parentAnchorX(); }
1806 QCPItemAnchor *parentAnchorX() const { return mParentAnchorX; }
1807 QCPItemAnchor *parentAnchorY() const { return mParentAnchorY; }
1808 double key() const { return mKey; }
1809 double value() const { return mValue; }
1810 QPointF coords() const { return QPointF(mKey, mValue); }
1811 QCPAxis *keyAxis() const { return mKeyAxis.data(); }
1812 QCPAxis *valueAxis() const { return mValueAxis.data(); }
1814 virtual QPointF pixelPoint() const;
1815
1816 // setters:
1820 bool setParentAnchor(QCPItemAnchor *parentAnchor,
1821 bool keepPixelPosition = false);
1823 bool keepPixelPosition = false);
1825 bool keepPixelPosition = false);
1826 void setCoords(double key, double value);
1827 void setCoords(const QPointF &coords);
1828 void setAxes(QCPAxis *keyAxis, QCPAxis *valueAxis);
1829 void setAxisRect(QCPAxisRect *axisRect);
1830 void setPixelPoint(const QPointF &pixelPoint);
1831
1832 protected:
1833 // property members:
1834 PositionType mPositionTypeX, mPositionTypeY;
1835 QPointer<QCPAxis> mKeyAxis, mValueAxis;
1836 QPointer<QCPAxisRect> mAxisRect;
1837 double mKey, mValue;
1838 QCPItemAnchor *mParentAnchorX, *mParentAnchorY;
1839
1840 // reimplemented virtual methods:
1841 virtual QCPItemPosition *toQCPItemPosition() { return this; }
1842
1843 private:
1844 Q_DISABLE_COPY(QCPItemPosition)
1845};
1846
1848 Q_OBJECT
1850 Q_PROPERTY(bool clipToAxisRect READ clipToAxisRect WRITE setClipToAxisRect)
1851 Q_PROPERTY(QCPAxisRect *clipAxisRect READ clipAxisRect WRITE setClipAxisRect)
1852 Q_PROPERTY(bool selectable READ selectable WRITE setSelectable NOTIFY
1853 selectableChanged)
1854 Q_PROPERTY(
1855 bool selected READ selected WRITE setSelected NOTIFY selectionChanged)
1857 public:
1860
1861 // getters:
1862 bool clipToAxisRect() const { return mClipToAxisRect; }
1864 bool selectable() const { return mSelectable; }
1865 bool selected() const { return mSelected; }
1866
1867 // setters:
1868 void setClipToAxisRect(bool clip);
1870 Q_SLOT void setSelectable(bool selectable);
1871 Q_SLOT void setSelected(bool selected);
1872
1873 // reimplemented virtual methods:
1874 virtual double selectTest(const QPointF &pos, bool onlySelectable,
1875 QVariant *details = 0) const = 0;
1876
1877 // non-virtual methods:
1878 QList<QCPItemPosition *> positions() const { return mPositions; }
1879 QList<QCPItemAnchor *> anchors() const { return mAnchors; }
1880 QCPItemPosition *position(const QString &name) const;
1881 QCPItemAnchor *anchor(const QString &name) const;
1882 bool hasAnchor(const QString &name) const;
1883
1884 signals:
1885 void selectionChanged(bool selected);
1886 void selectableChanged(bool selectable);
1887
1888 protected:
1889 // property members:
1890 bool mClipToAxisRect;
1891 QPointer<QCPAxisRect> mClipAxisRect;
1892 QList<QCPItemPosition *> mPositions;
1893 QList<QCPItemAnchor *> mAnchors;
1894 bool mSelectable, mSelected;
1895
1896 // reimplemented virtual methods:
1898 virtual QRect clipRect() const;
1899 virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const;
1900 virtual void draw(QCPPainter *painter) = 0;
1901 // events:
1902 virtual void selectEvent(QMouseEvent *event, bool additive,
1903 const QVariant &details,
1904 bool *selectionStateChanged);
1905 virtual void deselectEvent(bool *selectionStateChanged);
1906
1907 // introduced virtual methods:
1908 virtual QPointF anchorPixelPoint(int anchorId) const;
1909
1910 // non-virtual methods:
1911 double distSqrToLine(const QPointF &start, const QPointF &end,
1912 const QPointF &point) const;
1913 double rectSelectTest(const QRectF &rect, const QPointF &pos,
1914 bool filledRect) const;
1915 QCPItemPosition *createPosition(const QString &name);
1916 QCPItemAnchor *createAnchor(const QString &name, int anchorId);
1917
1918 private:
1919 Q_DISABLE_COPY(QCPAbstractItem)
1920
1921 friend class QCustomPlot;
1922 friend class QCPItemAnchor;
1923};
1924
1925class QCP_LIB_DECL QCustomPlot : public QWidget {
1926 Q_OBJECT
1928 Q_PROPERTY(QRect viewport READ viewport WRITE setViewport)
1929 Q_PROPERTY(QPixmap background READ background WRITE setBackground)
1930 Q_PROPERTY(
1931 bool backgroundScaled READ backgroundScaled WRITE setBackgroundScaled)
1932 Q_PROPERTY(Qt::AspectRatioMode backgroundScaledMode READ backgroundScaledMode
1933 WRITE setBackgroundScaledMode)
1934 Q_PROPERTY(QCPLayoutGrid *plotLayout READ plotLayout)
1935 Q_PROPERTY(bool autoAddPlottableToLegend READ autoAddPlottableToLegend WRITE
1936 setAutoAddPlottableToLegend)
1937 Q_PROPERTY(int selectionTolerance READ selectionTolerance WRITE
1938 setSelectionTolerance)
1939 Q_PROPERTY(bool noAntialiasingOnDrag READ noAntialiasingOnDrag WRITE
1940 setNoAntialiasingOnDrag)
1941 Q_PROPERTY(Qt::KeyboardModifier multiSelectModifier READ multiSelectModifier
1942 WRITE setMultiSelectModifier)
1944 public:
1951 limBelow
1952 ,
1953 limAbove
1954 };
1955 Q_ENUMS(LayerInsertMode)
1956
1957
1964 rpImmediate
1966 ,
1967 rpQueued
1970 ,
1971 rpHint
1974 };
1975
1976 explicit QCustomPlot(QWidget *parent = 0);
1977 virtual ~QCustomPlot();
1978
1979 // getters:
1980 QRect viewport() const { return mViewport; }
1981 QPixmap background() const { return mBackgroundPixmap; }
1982 bool backgroundScaled() const { return mBackgroundScaled; }
1983 Qt::AspectRatioMode backgroundScaledMode() const {
1984 return mBackgroundScaledMode;
1985 }
1986 QCPLayoutGrid *plotLayout() const { return mPlotLayout; }
1987 QCP::AntialiasedElements antialiasedElements() const {
1988 return mAntialiasedElements;
1989 }
1990 QCP::AntialiasedElements notAntialiasedElements() const {
1991 return mNotAntialiasedElements;
1992 }
1993 bool autoAddPlottableToLegend() const { return mAutoAddPlottableToLegend; }
1994 const QCP::Interactions interactions() const { return mInteractions; }
1995 int selectionTolerance() const { return mSelectionTolerance; }
1996 bool noAntialiasingOnDrag() const { return mNoAntialiasingOnDrag; }
1997 QCP::PlottingHints plottingHints() const { return mPlottingHints; }
1998 Qt::KeyboardModifier multiSelectModifier() const {
1999 return mMultiSelectModifier;
2000 }
2001
2002 // setters:
2003 void setViewport(const QRect &rect);
2004 void setBackground(const QPixmap &pm);
2005 void setBackground(const QPixmap &pm, bool scaled,
2006 Qt::AspectRatioMode mode = Qt::KeepAspectRatioByExpanding);
2007 void setBackground(const QBrush &brush);
2008 void setBackgroundScaled(bool scaled);
2009 void setBackgroundScaledMode(Qt::AspectRatioMode mode);
2011 const QCP::AntialiasedElements &antialiasedElements);
2013 bool enabled = true);
2015 const QCP::AntialiasedElements &notAntialiasedElements);
2017 bool enabled = true);
2019 void setInteractions(const QCP::Interactions &interactions);
2020 void setInteraction(const QCP::Interaction &interaction, bool enabled = true);
2021 void setSelectionTolerance(int pixels);
2022 void setNoAntialiasingOnDrag(bool enabled);
2023 void setPlottingHints(const QCP::PlottingHints &hints);
2024 void setPlottingHint(QCP::PlottingHint hint, bool enabled = true);
2025 void setMultiSelectModifier(Qt::KeyboardModifier modifier);
2026
2027 // non-property methods:
2028 // plottable interface:
2033 bool removePlottable(int index);
2035 int plottableCount() const;
2036 QList<QCPAbstractPlottable *> selectedPlottables() const;
2038 bool onlySelectable = false) const;
2039 bool hasPlottable(QCPAbstractPlottable *plottable) const;
2040
2041 // specialized interface for QCPGraph:
2042 QCPGraph *graph(int index) const;
2043 QCPGraph *graph() const;
2044 QCPGraph *addGraph(QCPAxis *keyAxis = 0, QCPAxis *valueAxis = 0);
2045 bool removeGraph(QCPGraph *graph);
2046 bool removeGraph(int index);
2048 int graphCount() const;
2049 QList<QCPGraph *> selectedGraphs() const;
2050
2051 // item interface:
2052 QCPAbstractItem *item(int index) const;
2056 bool removeItem(int index);
2058 int itemCount() const;
2059 QList<QCPAbstractItem *> selectedItems() const;
2060 QCPAbstractItem *itemAt(const QPointF &pos,
2061 bool onlySelectable = false) const;
2062 bool hasItem(QCPAbstractItem *item) const;
2063
2064 // layer interface:
2065 QCPLayer *layer(const QString &name) const;
2066 QCPLayer *layer(int index) const;
2068 bool setCurrentLayer(const QString &name);
2070 int layerCount() const;
2071 bool addLayer(const QString &name, QCPLayer *otherLayer = 0,
2072 LayerInsertMode insertMode = limAbove);
2073 bool removeLayer(QCPLayer *layer);
2074 bool moveLayer(QCPLayer *layer, QCPLayer *otherLayer,
2075 LayerInsertMode insertMode = limAbove);
2076
2077 // axis rect/layout interface:
2078 int axisRectCount() const;
2079 QCPAxisRect *axisRect(int index = 0) const;
2080 QList<QCPAxisRect *> axisRects() const;
2081 QCPLayoutElement *layoutElementAt(const QPointF &pos) const;
2082 Q_SLOT void rescaleAxes(bool onlyVisiblePlottables = false);
2083
2084 QList<QCPAxis *> selectedAxes() const;
2085 QList<QCPLegend *> selectedLegends() const;
2086 Q_SLOT void deselectAll();
2087
2088 bool savePdf(const QString &fileName, bool noCosmeticPen = false,
2089 int width = 0, int height = 0,
2090 const QString &pdfCreator = QString(),
2091 const QString &pdfTitle = QString());
2092 bool savePng(const QString &fileName, int width = 0, int height = 0,
2093 double scale = 1.0, int quality = -1);
2094 bool saveJpg(const QString &fileName, int width = 0, int height = 0,
2095 double scale = 1.0, int quality = -1);
2096 bool saveBmp(const QString &fileName, int width = 0, int height = 0,
2097 double scale = 1.0);
2098 bool saveRastered(const QString &fileName, int width, int height,
2099 double scale, const char *format, int quality = -1);
2100 QPixmap toPixmap(int width = 0, int height = 0, double scale = 1.0);
2101 void toPainter(QCPPainter *painter, int width = 0, int height = 0);
2102 Q_SLOT void replot(
2104
2105 QCPAxis *xAxis, *yAxis, *xAxis2, *yAxis2;
2106 QCPLegend *legend;
2107
2108 signals:
2109 void mouseDoubleClick(QMouseEvent *event);
2110 void mousePress(QMouseEvent *event);
2111 void mouseMove(QMouseEvent *event);
2112 void mouseRelease(QMouseEvent *event);
2113 void mouseWheel(QWheelEvent *event);
2114
2115 void plottableClick(QCPAbstractPlottable *plottable, QMouseEvent *event);
2117 QMouseEvent *event);
2118 void itemClick(QCPAbstractItem *item, QMouseEvent *event);
2119 void itemDoubleClick(QCPAbstractItem *item, QMouseEvent *event);
2121 QMouseEvent *event);
2123 QMouseEvent *event);
2125 QMouseEvent *event);
2127 QMouseEvent *event);
2128 void titleClick(QMouseEvent *event, QCPPlotTitle *title);
2129 void titleDoubleClick(QMouseEvent *event, QCPPlotTitle *title);
2130
2134
2135 protected:
2136 // property members:
2137 QRect mViewport;
2138 QCPLayoutGrid *mPlotLayout;
2139 bool mAutoAddPlottableToLegend;
2140 QList<QCPAbstractPlottable *> mPlottables;
2141 QList<QCPGraph *> mGraphs; // extra list of plottables also in mPlottables
2142 // that are of type QCPGraph
2143 QList<QCPAbstractItem *> mItems;
2144 QList<QCPLayer *> mLayers;
2145 QCP::AntialiasedElements mAntialiasedElements, mNotAntialiasedElements;
2146 QCP::Interactions mInteractions;
2147 int mSelectionTolerance;
2148 bool mNoAntialiasingOnDrag;
2149 QBrush mBackgroundBrush;
2150 QPixmap mBackgroundPixmap;
2151 QPixmap mScaledBackgroundPixmap;
2152 bool mBackgroundScaled;
2153 Qt::AspectRatioMode mBackgroundScaledMode;
2154 QCPLayer *mCurrentLayer;
2155 QCP::PlottingHints mPlottingHints;
2156 Qt::KeyboardModifier mMultiSelectModifier;
2157
2158 // non-property members:
2159 QPixmap mPaintBuffer;
2160 QPoint mMousePressPos;
2161 QPointer<QCPLayoutElement> mMouseEventElement;
2162 bool mReplotting;
2163
2164 // reimplemented virtual methods:
2165 virtual QSize minimumSizeHint() const;
2166 virtual QSize sizeHint() const;
2167 virtual void paintEvent(QPaintEvent *event);
2168 virtual void resizeEvent(QResizeEvent *event);
2169 virtual void mouseDoubleClickEvent(QMouseEvent *event);
2170 virtual void mousePressEvent(QMouseEvent *event);
2171 virtual void mouseMoveEvent(QMouseEvent *event);
2172 virtual void mouseReleaseEvent(QMouseEvent *event);
2173 virtual void wheelEvent(QWheelEvent *event);
2174
2175 // introduced virtual methods:
2176 virtual void draw(QCPPainter *painter);
2177 virtual void axisRemoved(QCPAxis *axis);
2178 virtual void legendRemoved(QCPLegend *legend);
2179
2180 // non-virtual methods:
2182 QCPLayerable *layerableAt(const QPointF &pos, bool onlySelectable,
2183 QVariant *selectionDetails = 0) const;
2185
2186 friend class QCPLegend;
2187 friend class QCPAxis;
2188 friend class QCPLayer;
2189 friend class QCPAxisRect;
2190};
2191
2193 Q_GADGET
2194 public:
2202 ciRGB
2203 ,
2204 ciHSV
2207 };
2208 Q_ENUMS(ColorInterpolation)
2209
2210
2215 gpGrayscale
2217 ,
2218 gpHot
2220 ,
2221 gpCold
2223 ,
2224 gpNight
2226 ,
2227 gpCandy
2228 ,
2229 gpGeography
2231 ,
2232 gpIon
2235 ,
2236 gpThermal
2238 ,
2239 gpPolar
2242 ,
2243 gpSpectrum
2246 ,
2247 gpJet
2250 ,
2251 gpHues
2253 };
2254 Q_ENUMS(GradientPreset)
2255
2257 bool operator==(const QCPColorGradient &other) const;
2258 bool operator!=(const QCPColorGradient &other) const {
2259 return !(*this == other);
2260 }
2261
2262 // getters:
2263 int levelCount() const { return mLevelCount; }
2264 QMap<double, QColor> colorStops() const { return mColorStops; }
2265 ColorInterpolation colorInterpolation() const { return mColorInterpolation; }
2266 bool periodic() const { return mPeriodic; }
2267
2268 // setters:
2269 void setLevelCount(int n);
2270 void setColorStops(const QMap<double, QColor> &colorStops);
2271 void setColorStopAt(double position, const QColor &color);
2273 void setPeriodic(bool enabled);
2274
2275 // non-property methods:
2276 void colorize(const double *data, const QCPRange &range, QRgb *scanLine,
2277 int n, int dataIndexFactor = 1, bool logarithmic = false);
2278 QRgb color(double position, const QCPRange &range, bool logarithmic = false);
2282
2283 protected:
2285
2286 // property members:
2287 int mLevelCount;
2288 QMap<double, QColor> mColorStops;
2289 ColorInterpolation mColorInterpolation;
2290 bool mPeriodic;
2291
2292 // non-property members:
2293 QVector<QRgb> mColorBuffer;
2294 bool mColorBufferInvalidated;
2295};
2296
2298 Q_OBJECT
2300 Q_PROPERTY(QPixmap background READ background WRITE setBackground)
2301 Q_PROPERTY(
2302 bool backgroundScaled READ backgroundScaled WRITE setBackgroundScaled)
2303 Q_PROPERTY(Qt::AspectRatioMode backgroundScaledMode READ backgroundScaledMode
2304 WRITE setBackgroundScaledMode)
2305 Q_PROPERTY(Qt::Orientations rangeDrag READ rangeDrag WRITE setRangeDrag)
2306 Q_PROPERTY(Qt::Orientations rangeZoom READ rangeZoom WRITE setRangeZoom)
2308 public:
2309 explicit QCPAxisRect(QCustomPlot *parentPlot, bool setupDefaultAxes = true);
2310 virtual ~QCPAxisRect();
2311
2312 // getters:
2313 QPixmap background() const { return mBackgroundPixmap; }
2314 bool backgroundScaled() const { return mBackgroundScaled; }
2315 Qt::AspectRatioMode backgroundScaledMode() const {
2316 return mBackgroundScaledMode;
2317 }
2318 Qt::Orientations rangeDrag() const { return mRangeDrag; }
2319 Qt::Orientations rangeZoom() const { return mRangeZoom; }
2320 QCPAxis *rangeDragAxis(Qt::Orientation orientation);
2321 QCPAxis *rangeZoomAxis(Qt::Orientation orientation);
2322 double rangeZoomFactor(Qt::Orientation orientation);
2323
2324 // setters:
2325 void setBackground(const QPixmap &pm);
2326 void setBackground(const QPixmap &pm, bool scaled,
2327 Qt::AspectRatioMode mode = Qt::KeepAspectRatioByExpanding);
2328 void setBackground(const QBrush &brush);
2329 void setBackgroundScaled(bool scaled);
2330 void setBackgroundScaledMode(Qt::AspectRatioMode mode);
2331 void setRangeDrag(Qt::Orientations orientations);
2332 void setRangeZoom(Qt::Orientations orientations);
2333 void setRangeDragAxes(QCPAxis *horizontal, QCPAxis *vertical);
2334 void setRangeZoomAxes(QCPAxis *horizontal, QCPAxis *vertical);
2335 void setRangeZoomFactor(double horizontalFactor, double verticalFactor);
2336 void setRangeZoomFactor(double factor);
2337
2338 // non-property methods:
2340 QCPAxis *axis(QCPAxis::AxisType type, int index = 0) const;
2341 QList<QCPAxis *> axes(QCPAxis::AxisTypes types) const;
2342 QList<QCPAxis *> axes() const;
2344 QList<QCPAxis *> addAxes(QCPAxis::AxisTypes types);
2345 bool removeAxis(QCPAxis *axis);
2346 QCPLayoutInset *insetLayout() const { return mInsetLayout; }
2347
2348 void setupFullAxesBox(bool connectRanges = false);
2349 QList<QCPAbstractPlottable *> plottables() const;
2350 QList<QCPGraph *> graphs() const;
2351 QList<QCPAbstractItem *> items() const;
2352
2353 // read-only interface imitating a QRect:
2354 int left() const { return mRect.left(); }
2355 int right() const { return mRect.right(); }
2356 int top() const { return mRect.top(); }
2357 int bottom() const { return mRect.bottom(); }
2358 int width() const { return mRect.width(); }
2359 int height() const { return mRect.height(); }
2360 QSize size() const { return mRect.size(); }
2361 QPoint topLeft() const { return mRect.topLeft(); }
2362 QPoint topRight() const { return mRect.topRight(); }
2363 QPoint bottomLeft() const { return mRect.bottomLeft(); }
2364 QPoint bottomRight() const { return mRect.bottomRight(); }
2365 QPoint center() const { return mRect.center(); }
2366
2367 // reimplemented virtual methods:
2368 virtual void update(UpdatePhase phase);
2369 virtual QList<QCPLayoutElement *> elements(bool recursive) const;
2370
2371 protected:
2372 // property members:
2373 QBrush mBackgroundBrush;
2374 QPixmap mBackgroundPixmap;
2375 QPixmap mScaledBackgroundPixmap;
2376 bool mBackgroundScaled;
2377 Qt::AspectRatioMode mBackgroundScaledMode;
2378 QCPLayoutInset *mInsetLayout;
2379 Qt::Orientations mRangeDrag, mRangeZoom;
2380 QPointer<QCPAxis> mRangeDragHorzAxis, mRangeDragVertAxis, mRangeZoomHorzAxis,
2381 mRangeZoomVertAxis;
2382 double mRangeZoomFactorHorz, mRangeZoomFactorVert;
2383 // non-property members:
2384 QCPRange mDragStartHorzRange, mDragStartVertRange;
2385 QCP::AntialiasedElements mAADragBackup, mNotAADragBackup;
2386 QPoint mDragStart;
2387 bool mDragging;
2388 QHash<QCPAxis::AxisType, QList<QCPAxis *> > mAxes;
2389
2390 // reimplemented virtual methods:
2391 virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const;
2392 virtual void draw(QCPPainter *painter);
2394 // events:
2395 virtual void mousePressEvent(QMouseEvent *event);
2396 virtual void mouseMoveEvent(QMouseEvent *event);
2397 virtual void mouseReleaseEvent(QMouseEvent *event);
2398 virtual void wheelEvent(QWheelEvent *event);
2399
2400 // non-property methods:
2403
2404 private:
2405 Q_DISABLE_COPY(QCPAxisRect)
2406
2407 friend class QCustomPlot;
2408};
2409
2411 Q_OBJECT
2413 Q_PROPERTY(QCPLegend *parentLegend READ parentLegend)
2414 Q_PROPERTY(QFont font READ font WRITE setFont)
2415 Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor)
2416 Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont)
2417 Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE
2418 setSelectedTextColor)
2419 Q_PROPERTY(bool selectable READ selectable WRITE setSelectable NOTIFY
2420 selectionChanged)
2421 Q_PROPERTY(
2422 bool selected READ selected WRITE setSelected NOTIFY selectableChanged)
2424 public:
2426
2427 // getters:
2428 QCPLegend *parentLegend() const { return mParentLegend; }
2429 QFont font() const { return mFont; }
2430 QColor textColor() const { return mTextColor; }
2431 QFont selectedFont() const { return mSelectedFont; }
2432 QColor selectedTextColor() const { return mSelectedTextColor; }
2433 bool selectable() const { return mSelectable; }
2434 bool selected() const { return mSelected; }
2435
2436 // setters:
2437 void setFont(const QFont &font);
2438 void setTextColor(const QColor &color);
2439 void setSelectedFont(const QFont &font);
2440 void setSelectedTextColor(const QColor &color);
2441 Q_SLOT void setSelectable(bool selectable);
2442 Q_SLOT void setSelected(bool selected);
2443
2444 // reimplemented virtual methods:
2445 virtual double selectTest(const QPointF &pos, bool onlySelectable,
2446 QVariant *details = 0) const;
2447
2448 signals:
2449 void selectionChanged(bool selected);
2450 void selectableChanged(bool selectable);
2451
2452 protected:
2453 // property members:
2454 QCPLegend *mParentLegend;
2455 QFont mFont;
2456 QColor mTextColor;
2457 QFont mSelectedFont;
2458 QColor mSelectedTextColor;
2459 bool mSelectable, mSelected;
2460
2461 // reimplemented virtual methods:
2463 virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const;
2464 virtual QRect clipRect() const;
2465 virtual void draw(QCPPainter *painter) = 0;
2466 // events:
2467 virtual void selectEvent(QMouseEvent *event, bool additive,
2468 const QVariant &details,
2469 bool *selectionStateChanged);
2470 virtual void deselectEvent(bool *selectionStateChanged);
2471
2472 private:
2473 Q_DISABLE_COPY(QCPAbstractLegendItem)
2474
2475 friend class QCPLegend;
2476};
2477
2479 Q_OBJECT
2480 public:
2482
2483 // getters:
2484 QCPAbstractPlottable *plottable() { return mPlottable; }
2485
2486 protected:
2487 // property members:
2488 QCPAbstractPlottable *mPlottable;
2489
2490 // reimplemented virtual methods:
2491 virtual void draw(QCPPainter *painter);
2492 virtual QSize minimumSizeHint() const;
2493
2494 // non-virtual methods:
2495 QPen getIconBorderPen() const;
2496 QColor getTextColor() const;
2497 QFont getFont() const;
2498};
2499
2500class QCP_LIB_DECL QCPLegend : public QCPLayoutGrid {
2501 Q_OBJECT
2503 Q_PROPERTY(QPen borderPen READ borderPen WRITE setBorderPen)
2504 Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
2505 Q_PROPERTY(QFont font READ font WRITE setFont)
2506 Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor)
2507 Q_PROPERTY(QSize iconSize READ iconSize WRITE setIconSize)
2508 Q_PROPERTY(int iconTextPadding READ iconTextPadding WRITE setIconTextPadding)
2509 Q_PROPERTY(QPen iconBorderPen READ iconBorderPen WRITE setIconBorderPen)
2510 Q_PROPERTY(SelectableParts selectableParts READ selectableParts WRITE
2511 setSelectableParts NOTIFY selectionChanged)
2512 Q_PROPERTY(SelectableParts selectedParts READ selectedParts WRITE
2513 setSelectedParts NOTIFY selectableChanged)
2514 Q_PROPERTY(
2515 QPen selectedBorderPen READ selectedBorderPen WRITE setSelectedBorderPen)
2516 Q_PROPERTY(QPen selectedIconBorderPen READ selectedIconBorderPen WRITE
2517 setSelectedIconBorderPen)
2518 Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
2519 Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont)
2520 Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE
2521 setSelectedTextColor)
2523 public:
2530 spNone = 0x000
2531 ,
2532 spLegendBox = 0x001
2533 ,
2534 spItems = 0x002
2536 };
2537 Q_FLAGS(SelectablePart SelectableParts)
2538 Q_DECLARE_FLAGS(SelectableParts, SelectablePart)
2539
2540 explicit QCPLegend();
2541 virtual ~QCPLegend();
2542
2543 // getters:
2544 QPen borderPen() const { return mBorderPen; }
2545 QBrush brush() const { return mBrush; }
2546 QFont font() const { return mFont; }
2547 QColor textColor() const { return mTextColor; }
2548 QSize iconSize() const { return mIconSize; }
2549 int iconTextPadding() const { return mIconTextPadding; }
2550 QPen iconBorderPen() const { return mIconBorderPen; }
2551 SelectableParts selectableParts() const { return mSelectableParts; }
2552 SelectableParts selectedParts() const;
2553 QPen selectedBorderPen() const { return mSelectedBorderPen; }
2554 QPen selectedIconBorderPen() const { return mSelectedIconBorderPen; }
2555 QBrush selectedBrush() const { return mSelectedBrush; }
2556 QFont selectedFont() const { return mSelectedFont; }
2557 QColor selectedTextColor() const { return mSelectedTextColor; }
2558
2559 // setters:
2560 void setBorderPen(const QPen &pen);
2561 void setBrush(const QBrush &brush);
2562 void setFont(const QFont &font);
2563 void setTextColor(const QColor &color);
2564 void setIconSize(const QSize &size);
2565 void setIconSize(int width, int height);
2566 void setIconTextPadding(int padding);
2567 void setIconBorderPen(const QPen &pen);
2568 Q_SLOT void setSelectableParts(const SelectableParts &selectableParts);
2569 Q_SLOT void setSelectedParts(const SelectableParts &selectedParts);
2570 void setSelectedBorderPen(const QPen &pen);
2571 void setSelectedIconBorderPen(const QPen &pen);
2572 void setSelectedBrush(const QBrush &brush);
2573 void setSelectedFont(const QFont &font);
2574 void setSelectedTextColor(const QColor &color);
2575
2576 // reimplemented virtual methods:
2577 virtual double selectTest(const QPointF &pos, bool onlySelectable,
2578 QVariant *details = 0) const;
2579
2580 // non-virtual methods:
2581 QCPAbstractLegendItem *item(int index) const;
2583 const QCPAbstractPlottable *plottable) const;
2584 int itemCount() const;
2586 bool hasItemWithPlottable(const QCPAbstractPlottable *plottable) const;
2588 bool removeItem(int index);
2591 QList<QCPAbstractLegendItem *> selectedItems() const;
2592
2593 signals:
2594 void selectionChanged(QCPLegend::SelectableParts parts);
2595 void selectableChanged(QCPLegend::SelectableParts parts);
2596
2597 protected:
2598 // property members:
2599 QPen mBorderPen, mIconBorderPen;
2600 QBrush mBrush;
2601 QFont mFont;
2602 QColor mTextColor;
2603 QSize mIconSize;
2604 int mIconTextPadding;
2605 SelectableParts mSelectedParts, mSelectableParts;
2606 QPen mSelectedBorderPen, mSelectedIconBorderPen;
2607 QBrush mSelectedBrush;
2608 QFont mSelectedFont;
2609 QColor mSelectedTextColor;
2610
2611 // reimplemented virtual methods:
2612 virtual void parentPlotInitialized(QCustomPlot *parentPlot);
2614 virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const;
2615 virtual void draw(QCPPainter *painter);
2616 // events:
2617 virtual void selectEvent(QMouseEvent *event, bool additive,
2618 const QVariant &details,
2619 bool *selectionStateChanged);
2620 virtual void deselectEvent(bool *selectionStateChanged);
2621
2622 // non-virtual methods:
2623 QPen getBorderPen() const;
2624 QBrush getBrush() const;
2625
2626 private:
2627 Q_DISABLE_COPY(QCPLegend)
2628
2629 friend class QCustomPlot;
2630 friend class QCPAbstractLegendItem;
2631};
2632Q_DECLARE_OPERATORS_FOR_FLAGS(QCPLegend::SelectableParts)
2633Q_DECLARE_METATYPE(QCPLegend::SelectablePart)
2634
2636 Q_OBJECT
2638 Q_PROPERTY(QString text READ text WRITE setText)
2639 Q_PROPERTY(QFont font READ font WRITE setFont)
2640 Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor)
2641 Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont)
2642 Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE
2643 setSelectedTextColor)
2644 Q_PROPERTY(bool selectable READ selectable WRITE setSelectable NOTIFY
2645 selectableChanged)
2646 Q_PROPERTY(
2647 bool selected READ selected WRITE setSelected NOTIFY selectionChanged)
2649 public:
2650 explicit QCPPlotTitle(QCustomPlot *parentPlot);
2651 explicit QCPPlotTitle(QCustomPlot *parentPlot, const QString &text);
2652
2653 // getters:
2654 QString text() const { return mText; }
2655 QFont font() const { return mFont; }
2656 QColor textColor() const { return mTextColor; }
2657 QFont selectedFont() const { return mSelectedFont; }
2658 QColor selectedTextColor() const { return mSelectedTextColor; }
2659 bool selectable() const { return mSelectable; }
2660 bool selected() const { return mSelected; }
2661
2662 // setters:
2663 void setText(const QString &text);
2664 void setFont(const QFont &font);
2665 void setTextColor(const QColor &color);
2666 void setSelectedFont(const QFont &font);
2667 void setSelectedTextColor(const QColor &color);
2668 Q_SLOT void setSelectable(bool selectable);
2669 Q_SLOT void setSelected(bool selected);
2670
2671 // reimplemented virtual methods:
2672 virtual double selectTest(const QPointF &pos, bool onlySelectable,
2673 QVariant *details = 0) const;
2674
2675 signals:
2676 void selectionChanged(bool selected);
2677 void selectableChanged(bool selectable);
2678
2679 protected:
2680 // property members:
2681 QString mText;
2682 QFont mFont;
2683 QColor mTextColor;
2684 QFont mSelectedFont;
2685 QColor mSelectedTextColor;
2686 QRect mTextBoundingRect;
2687 bool mSelectable, mSelected;
2688
2689 // reimplemented virtual methods:
2690 virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const;
2691 virtual void draw(QCPPainter *painter);
2692 virtual QSize minimumSizeHint() const;
2693 virtual QSize maximumSizeHint() const;
2694 // events:
2695 virtual void selectEvent(QMouseEvent *event, bool additive,
2696 const QVariant &details,
2697 bool *selectionStateChanged);
2698 virtual void deselectEvent(bool *selectionStateChanged);
2699
2700 // non-virtual methods:
2701 QFont mainFont() const;
2702 QColor mainTextColor() const;
2703
2704 private:
2705 Q_DISABLE_COPY(QCPPlotTitle)
2706};
2707
2709 Q_OBJECT
2710 public:
2711 explicit QCPColorScaleAxisRectPrivate(QCPColorScale *parentColorScale);
2712
2713 protected:
2715 QImage mGradientImage;
2717 // re-using some methods of QCPAxisRect to make them available to friend class
2718 // QCPColorScale
2723 using QCPAxisRect::update;
2725 virtual void draw(QCPPainter *painter);
2727 Q_SLOT void axisSelectionChanged(QCPAxis::SelectableParts selectedParts);
2728 Q_SLOT void axisSelectableChanged(QCPAxis::SelectableParts selectableParts);
2729 friend class QCPColorScale;
2730};
2731
2733 Q_OBJECT
2735 Q_PROPERTY(QCPAxis::AxisType type READ type WRITE setType)
2736 Q_PROPERTY(QCPRange dataRange READ dataRange WRITE setDataRange NOTIFY
2737 dataRangeChanged)
2738 Q_PROPERTY(QCPAxis::ScaleType dataScaleType READ dataScaleType WRITE
2739 setDataScaleType NOTIFY dataScaleTypeChanged)
2740 Q_PROPERTY(QCPColorGradient gradient READ gradient WRITE setGradient NOTIFY
2741 gradientChanged)
2742 Q_PROPERTY(QString label READ label WRITE setLabel)
2743 Q_PROPERTY(int barWidth READ barWidth WRITE setBarWidth)
2744 Q_PROPERTY(bool rangeDrag READ rangeDrag WRITE setRangeDrag)
2745 Q_PROPERTY(bool rangeZoom READ rangeZoom WRITE setRangeZoom)
2747 public:
2748 explicit QCPColorScale(QCustomPlot *parentPlot);
2750
2751 // getters:
2752 QCPAxis *axis() const { return mColorAxis.data(); }
2753 QCPAxis::AxisType type() const { return mType; }
2754 QCPRange dataRange() const { return mDataRange; }
2755 QCPAxis::ScaleType dataScaleType() const { return mDataScaleType; }
2756 QCPColorGradient gradient() const { return mGradient; }
2757 QString label() const;
2758 int barWidth() const { return mBarWidth; }
2759 bool rangeDrag() const;
2760 bool rangeZoom() const;
2761
2762 // setters:
2764 Q_SLOT void setDataRange(const QCPRange &dataRange);
2765 Q_SLOT void setDataScaleType(QCPAxis::ScaleType scaleType);
2766 Q_SLOT void setGradient(const QCPColorGradient &gradient);
2767 void setLabel(const QString &str);
2768 void setBarWidth(int width);
2769 void setRangeDrag(bool enabled);
2770 void setRangeZoom(bool enabled);
2771
2772 // non-property methods:
2773 QList<QCPColorMap *> colorMaps() const;
2774 void rescaleDataRange(bool onlyVisibleMaps);
2775
2776 // reimplemented virtual methods:
2777 virtual void update(UpdatePhase phase);
2778
2779 signals:
2783
2784 protected:
2785 // property members:
2786 QCPAxis::AxisType mType;
2787 QCPRange mDataRange;
2788 QCPAxis::ScaleType mDataScaleType;
2789 QCPColorGradient mGradient;
2790 int mBarWidth;
2791
2792 // non-property members:
2793 QPointer<QCPColorScaleAxisRectPrivate> mAxisRect;
2794 QPointer<QCPAxis> mColorAxis;
2795
2796 // reimplemented virtual methods:
2797 virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const;
2798 // events:
2799 virtual void mousePressEvent(QMouseEvent *event);
2800 virtual void mouseMoveEvent(QMouseEvent *event);
2801 virtual void mouseReleaseEvent(QMouseEvent *event);
2802 virtual void wheelEvent(QWheelEvent *event);
2803
2804 private:
2805 Q_DISABLE_COPY(QCPColorScale)
2806
2807 friend class QCPColorScaleAxisRectPrivate;
2808};
2809
2812class QCP_LIB_DECL QCPData {
2813 public:
2815 QCPData(double key, double value);
2816 double key, value;
2817 double keyErrorPlus, keyErrorMinus;
2818 double valueErrorPlus, valueErrorMinus;
2819};
2821
2829typedef QMap<double, QCPData> QCPDataMap;
2830typedef QMapIterator<double, QCPData> QCPDataMapIterator;
2831typedef QMutableMapIterator<double, QCPData> QCPDataMutableMapIterator;
2832
2834 Q_OBJECT
2836 Q_PROPERTY(LineStyle lineStyle READ lineStyle WRITE setLineStyle)
2837 Q_PROPERTY(
2838 QCPScatterStyle scatterStyle READ scatterStyle WRITE setScatterStyle)
2839 Q_PROPERTY(ErrorType errorType READ errorType WRITE setErrorType)
2840 Q_PROPERTY(QPen errorPen READ errorPen WRITE setErrorPen)
2841 Q_PROPERTY(double errorBarSize READ errorBarSize WRITE setErrorBarSize)
2842 Q_PROPERTY(bool errorBarSkipSymbol READ errorBarSkipSymbol WRITE
2843 setErrorBarSkipSymbol)
2844 Q_PROPERTY(QCPGraph *channelFillGraph READ channelFillGraph WRITE
2845 setChannelFillGraph)
2846 Q_PROPERTY(
2847 bool adaptiveSampling READ adaptiveSampling WRITE setAdaptiveSampling)
2849 public:
2855 lsNone
2858 ,
2859 lsLine
2860 ,
2861 lsStepLeft
2863 ,
2864 lsStepRight
2866 ,
2867 lsStepCenter
2869 ,
2870 lsImpulse
2873 };
2874 Q_ENUMS(LineStyle)
2879 etNone
2880 ,
2881 etKey
2882 ,
2883 etValue
2884 ,
2885 etBoth
2887 };
2888 Q_ENUMS(ErrorType)
2889
2890 explicit QCPGraph(QCPAxis *keyAxis, QCPAxis *valueAxis);
2891 virtual ~QCPGraph();
2892
2893 // getters:
2894 QCPDataMap *data() const { return mData; }
2895 LineStyle lineStyle() const { return mLineStyle; }
2896 QCPScatterStyle scatterStyle() const { return mScatterStyle; }
2897 ErrorType errorType() const { return mErrorType; }
2898 QPen errorPen() const { return mErrorPen; }
2899 double errorBarSize() const { return mErrorBarSize; }
2900 bool errorBarSkipSymbol() const { return mErrorBarSkipSymbol; }
2901 QCPGraph *channelFillGraph() const { return mChannelFillGraph.data(); }
2902 bool adaptiveSampling() const { return mAdaptiveSampling; }
2903
2904 // setters:
2905 void setData(QCPDataMap *data, bool copy = false);
2906 void setData(const QVector<double> &key, const QVector<double> &value);
2907 void setDataKeyError(const QVector<double> &key, const QVector<double> &value,
2908 const QVector<double> &keyError);
2909 void setDataKeyError(const QVector<double> &key, const QVector<double> &value,
2910 const QVector<double> &keyErrorMinus,
2911 const QVector<double> &keyErrorPlus);
2912 void setDataValueError(const QVector<double> &key,
2913 const QVector<double> &value,
2914 const QVector<double> &valueError);
2915 void setDataValueError(const QVector<double> &key,
2916 const QVector<double> &value,
2917 const QVector<double> &valueErrorMinus,
2918 const QVector<double> &valueErrorPlus);
2919 void setDataBothError(const QVector<double> &key,
2920 const QVector<double> &value,
2921 const QVector<double> &keyError,
2922 const QVector<double> &valueError);
2923 void setDataBothError(const QVector<double> &key,
2924 const QVector<double> &value,
2925 const QVector<double> &keyErrorMinus,
2926 const QVector<double> &keyErrorPlus,
2927 const QVector<double> &valueErrorMinus,
2928 const QVector<double> &valueErrorPlus);
2931 void setErrorType(ErrorType errorType);
2932 void setErrorPen(const QPen &pen);
2933 void setErrorBarSize(double size);
2934 void setErrorBarSkipSymbol(bool enabled);
2935 void setChannelFillGraph(QCPGraph *targetGraph);
2936 void setAdaptiveSampling(bool enabled);
2937
2938 // non-property methods:
2939 void addData(const QCPDataMap &dataMap);
2940 void addData(const QCPData &data);
2941 void addData(double key, double value);
2942 void addData(const QVector<double> &keys, const QVector<double> &values);
2943 void removeDataBefore(double key);
2944 void removeDataAfter(double key);
2945 void removeData(double fromKey, double toKey);
2946 void removeData(double key);
2947
2948 // reimplemented virtual methods:
2949 virtual void clearData();
2950 virtual double selectTest(const QPointF &pos, bool onlySelectable,
2951 QVariant *details = 0) const;
2955 void rescaleAxes(bool onlyEnlarge, bool includeErrorBars)
2956 const; // overloads base class interface
2957 void rescaleKeyAxis(bool onlyEnlarge, bool includeErrorBars)
2958 const; // overloads base class interface
2959 void rescaleValueAxis(bool onlyEnlarge, bool includeErrorBars)
2960 const; // overloads base class interface
2961
2962 protected:
2963 // property members:
2964 QCPDataMap *mData;
2965 QPen mErrorPen;
2966 LineStyle mLineStyle;
2967 QCPScatterStyle mScatterStyle;
2968 ErrorType mErrorType;
2969 double mErrorBarSize;
2970 bool mErrorBarSkipSymbol;
2971 QPointer<QCPGraph> mChannelFillGraph;
2972 bool mAdaptiveSampling;
2973
2974 // reimplemented virtual methods:
2975 virtual void draw(QCPPainter *painter);
2976 virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const;
2977 virtual QCPRange getKeyRange(bool &foundRange,
2978 SignDomain inSignDomain = sdBoth) const;
2979 virtual QCPRange getValueRange(bool &foundRange,
2980 SignDomain inSignDomain = sdBoth) const;
2982 bool &foundRange, SignDomain inSignDomain,
2983 bool includeErrors) const; // overloads base class interface
2985 bool &foundRange, SignDomain inSignDomain,
2986 bool includeErrors) const; // overloads base class interface
2987
2988 // introduced virtual methods:
2989 virtual void drawFill(QCPPainter *painter, QVector<QPointF> *lineData) const;
2990 virtual void drawScatterPlot(QCPPainter *painter,
2991 QVector<QCPData> *scatterData) const;
2992 virtual void drawLinePlot(QCPPainter *painter,
2993 QVector<QPointF> *lineData) const;
2994 virtual void drawImpulsePlot(QCPPainter *painter,
2995 QVector<QPointF> *lineData) const;
2996
2997 // non-virtual methods:
2998 void getPreparedData(QVector<QCPData> *lineData,
2999 QVector<QCPData> *scatterData) const;
3000 void getPlotData(QVector<QPointF> *lineData,
3001 QVector<QCPData> *scatterData) const;
3002 void getScatterPlotData(QVector<QCPData> *scatterData) const;
3003 void getLinePlotData(QVector<QPointF> *linePixelData,
3004 QVector<QCPData> *scatterData) const;
3005 void getStepLeftPlotData(QVector<QPointF> *linePixelData,
3006 QVector<QCPData> *scatterData) const;
3007 void getStepRightPlotData(QVector<QPointF> *linePixelData,
3008 QVector<QCPData> *scatterData) const;
3009 void getStepCenterPlotData(QVector<QPointF> *linePixelData,
3010 QVector<QCPData> *scatterData) const;
3011 void getImpulsePlotData(QVector<QPointF> *linePixelData,
3012 QVector<QCPData> *scatterData) const;
3013 void drawError(QCPPainter *painter, double x, double y,
3014 const QCPData &data) const;
3015 void getVisibleDataBounds(QCPDataMap::const_iterator &lower,
3016 QCPDataMap::const_iterator &upper) const;
3017 int countDataInBounds(const QCPDataMap::const_iterator &lower,
3018 const QCPDataMap::const_iterator &upper,
3019 int maxCount) const;
3020 void addFillBasePoints(QVector<QPointF> *lineData) const;
3021 void removeFillBasePoints(QVector<QPointF> *lineData) const;
3022 QPointF lowerFillBasePoint(double lowerKey) const;
3023 QPointF upperFillBasePoint(double upperKey) const;
3024 const QPolygonF getChannelFillPolygon(const QVector<QPointF> *lineData) const;
3025 int findIndexBelowX(const QVector<QPointF> *data, double x) const;
3026 int findIndexAboveX(const QVector<QPointF> *data, double x) const;
3027 int findIndexBelowY(const QVector<QPointF> *data, double y) const;
3028 int findIndexAboveY(const QVector<QPointF> *data, double y) const;
3029 double pointDistance(const QPointF &pixelPoint) const;
3030
3031 friend class QCustomPlot;
3032 friend class QCPLegend;
3033};
3034
3038 public:
3040 QCPCurveData(double t, double key, double value);
3041 double t, key, value;
3042};
3044
3053typedef QMap<double, QCPCurveData> QCPCurveDataMap;
3054typedef QMapIterator<double, QCPCurveData> QCPCurveDataMapIterator;
3055typedef QMutableMapIterator<double, QCPCurveData>
3057
3059 Q_OBJECT
3061 Q_PROPERTY(
3062 QCPScatterStyle scatterStyle READ scatterStyle WRITE setScatterStyle)
3063 Q_PROPERTY(LineStyle lineStyle READ lineStyle WRITE setLineStyle)
3065 public:
3071 lsNone
3072 ,
3073 lsLine
3074 };
3075 explicit QCPCurve(QCPAxis *keyAxis, QCPAxis *valueAxis);
3076 virtual ~QCPCurve();
3077
3078 // getters:
3079 QCPCurveDataMap *data() const { return mData; }
3080 QCPScatterStyle scatterStyle() const { return mScatterStyle; }
3081 LineStyle lineStyle() const { return mLineStyle; }
3082
3083 // setters:
3084 void setData(QCPCurveDataMap *data, bool copy = false);
3085 void setData(const QVector<double> &t, const QVector<double> &key,
3086 const QVector<double> &value);
3087 void setData(const QVector<double> &key, const QVector<double> &value);
3090
3091 // non-property methods:
3092 void addData(const QCPCurveDataMap &dataMap);
3093 void addData(const QCPCurveData &data);
3094 void addData(double t, double key, double value);
3095 void addData(double key, double value);
3096 void addData(const QVector<double> &ts, const QVector<double> &keys,
3097 const QVector<double> &values);
3098 void removeDataBefore(double t);
3099 void removeDataAfter(double t);
3100 void removeData(double fromt, double tot);
3101 void removeData(double t);
3102
3103 // reimplemented virtual methods:
3104 virtual void clearData();
3105 virtual double selectTest(const QPointF &pos, bool onlySelectable,
3106 QVariant *details = 0) const;
3107
3108 protected:
3109 // property members:
3110 QCPCurveDataMap *mData;
3111 QCPScatterStyle mScatterStyle;
3112 LineStyle mLineStyle;
3113
3114 // reimplemented virtual methods:
3115 virtual void draw(QCPPainter *painter);
3116 virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const;
3117 virtual QCPRange getKeyRange(bool &foundRange,
3118 SignDomain inSignDomain = sdBoth) const;
3119 virtual QCPRange getValueRange(bool &foundRange,
3120 SignDomain inSignDomain = sdBoth) const;
3121
3122 // introduced virtual methods:
3123 virtual void drawScatterPlot(QCPPainter *painter,
3124 const QVector<QPointF> *pointData) const;
3125
3126 // non-virtual methods:
3127 void getCurveData(QVector<QPointF> *lineData) const;
3128 int getRegion(double x, double y, double rectLeft, double rectTop,
3129 double rectRight, double rectBottom) const;
3130 QPointF getOptimizedPoint(int prevRegion, double prevKey, double prevValue,
3131 double key, double value, double rectLeft,
3132 double rectTop, double rectRight,
3133 double rectBottom) const;
3134 QVector<QPointF> getOptimizedCornerPoints(int prevRegion, int currentRegion,
3135 double prevKey, double prevValue,
3136 double key, double value,
3137 double rectLeft, double rectTop,
3138 double rectRight,
3139 double rectBottom) const;
3140 bool mayTraverse(int prevRegion, int currentRegion) const;
3141 bool getTraverse(double prevKey, double prevValue, double key, double value,
3142 double rectLeft, double rectTop, double rectRight,
3143 double rectBottom, QPointF &crossA, QPointF &crossB) const;
3144 void getTraverseCornerPoints(int prevRegion, int currentRegion,
3145 double rectLeft, double rectTop,
3146 double rectRight, double rectBottom,
3147 QVector<QPointF> &beforeTraverse,
3148 QVector<QPointF> &afterTraverse) const;
3149 double pointDistance(const QPointF &pixelPoint) const;
3150
3151 friend class QCustomPlot;
3152 friend class QCPLegend;
3153};
3154
3157class QCP_LIB_DECL QCPBarsGroup : public QObject {
3158 Q_OBJECT
3160 Q_PROPERTY(SpacingType spacingType READ spacingType WRITE setSpacingType)
3161 Q_PROPERTY(double spacing READ spacing WRITE setSpacing)
3163 public:
3171 stAbsolute
3172 ,
3173 stAxisRectRatio
3175 ,
3176 stPlotCoords
3178 };
3181
3182 // getters:
3183 SpacingType spacingType() const { return mSpacingType; }
3184 double spacing() const { return mSpacing; }
3185
3186 // setters:
3187 void setSpacingType(SpacingType spacingType);
3188 void setSpacing(double spacing);
3189
3190 // non-virtual methods:
3191 QList<QCPBars *> bars() const { return mBars; }
3192 QCPBars *bars(int index) const;
3193 int size() const { return mBars.size(); }
3194 bool isEmpty() const { return mBars.isEmpty(); }
3195 void clear();
3196 bool contains(QCPBars *bars) const { return mBars.contains(bars); }
3197 void append(QCPBars *bars);
3198 void insert(int i, QCPBars *bars);
3199 void remove(QCPBars *bars);
3200
3201 protected:
3202 // non-property members:
3203 QCustomPlot *mParentPlot;
3204 SpacingType mSpacingType;
3205 double mSpacing;
3206 QList<QCPBars *> mBars;
3207
3208 // non-virtual methods:
3211
3212 // virtual methods:
3213 double keyPixelOffset(const QCPBars *bars, double keyCoord);
3214 double getPixelSpacing(const QCPBars *bars, double keyCoord);
3215
3216 private:
3217 Q_DISABLE_COPY(QCPBarsGroup)
3218
3219 friend class QCPBars;
3220};
3221
3223 public:
3225 QCPBarData(double key, double value);
3226 double key, value;
3227};
3229
3237typedef QMap<double, QCPBarData> QCPBarDataMap;
3238typedef QMapIterator<double, QCPBarData> QCPBarDataMapIterator;
3239typedef QMutableMapIterator<double, QCPBarData> QCPBarDataMutableMapIterator;
3240
3242 Q_OBJECT
3244 Q_PROPERTY(double width READ width WRITE setWidth)
3245 Q_PROPERTY(WidthType widthType READ widthType WRITE setWidthType)
3246 Q_PROPERTY(QCPBarsGroup *barsGroup READ barsGroup WRITE setBarsGroup)
3247 Q_PROPERTY(double baseValue READ baseValue WRITE setBaseValue)
3248 Q_PROPERTY(QCPBars *barBelow READ barBelow)
3249 Q_PROPERTY(QCPBars *barAbove READ barAbove)
3251 public:
3259 wtAbsolute
3260 ,
3261 wtAxisRectRatio
3262 ,
3263 wtPlotCoords
3265 };
3266 Q_ENUMS(WidthType)
3267
3268 explicit QCPBars(QCPAxis *keyAxis, QCPAxis *valueAxis);
3269 virtual ~QCPBars();
3270
3271 // getters:
3272 double width() const { return mWidth; }
3273 WidthType widthType() const { return mWidthType; }
3274 QCPBarsGroup *barsGroup() const { return mBarsGroup; }
3275 double baseValue() const { return mBaseValue; }
3276 QCPBars *barBelow() const { return mBarBelow.data(); }
3277 QCPBars *barAbove() const { return mBarAbove.data(); }
3278 QCPBarDataMap *data() const { return mData; }
3279
3280 // setters:
3281 void setWidth(double width);
3282 void setWidthType(WidthType widthType);
3283 void setBarsGroup(QCPBarsGroup *barsGroup);
3284 void setBaseValue(double baseValue);
3285 void setData(QCPBarDataMap *data, bool copy = false);
3286 void setData(const QVector<double> &key, const QVector<double> &value);
3287
3288 // non-property methods:
3289 void moveBelow(QCPBars *bars);
3290 void moveAbove(QCPBars *bars);
3291 void addData(const QCPBarDataMap &dataMap);
3292 void addData(const QCPBarData &data);
3293 void addData(double key, double value);
3294 void addData(const QVector<double> &keys, const QVector<double> &values);
3295 void removeDataBefore(double key);
3296 void removeDataAfter(double key);
3297 void removeData(double fromKey, double toKey);
3298 void removeData(double key);
3299
3300 // reimplemented virtual methods:
3301 virtual void clearData();
3302 virtual double selectTest(const QPointF &pos, bool onlySelectable,
3303 QVariant *details = 0) const;
3304
3305 protected:
3306 // property members:
3307 QCPBarDataMap *mData;
3308 double mWidth;
3309 WidthType mWidthType;
3310 QCPBarsGroup *mBarsGroup;
3311 double mBaseValue;
3312 QPointer<QCPBars> mBarBelow, mBarAbove;
3313
3314 // reimplemented virtual methods:
3315 virtual void draw(QCPPainter *painter);
3316 virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const;
3317 virtual QCPRange getKeyRange(bool &foundRange,
3318 SignDomain inSignDomain = sdBoth) const;
3319 virtual QCPRange getValueRange(bool &foundRange,
3320 SignDomain inSignDomain = sdBoth) const;
3321
3322 // non-virtual methods:
3323 void getVisibleDataBounds(QCPBarDataMap::const_iterator &lower,
3324 QCPBarDataMap::const_iterator &upperEnd) const;
3325 QPolygonF getBarPolygon(double key, double value) const;
3326 void getPixelWidth(double key, double &lower, double &upper) const;
3327 double getStackedBaseValue(double key, bool positive) const;
3328 static void connectBars(QCPBars *lower, QCPBars *upper);
3329
3330 friend class QCustomPlot;
3331 friend class QCPLegend;
3332 friend class QCPBarsGroup;
3333};
3334
3338 Q_OBJECT
3340 Q_PROPERTY(double key READ key WRITE setKey)
3341 Q_PROPERTY(double minimum READ minimum WRITE setMinimum)
3342 Q_PROPERTY(double lowerQuartile READ lowerQuartile WRITE setLowerQuartile)
3343 Q_PROPERTY(double median READ median WRITE setMedian)
3344 Q_PROPERTY(double upperQuartile READ upperQuartile WRITE setUpperQuartile)
3345 Q_PROPERTY(double maximum READ maximum WRITE setMaximum)
3346 Q_PROPERTY(QVector<double> outliers READ outliers WRITE setOutliers)
3347 Q_PROPERTY(double width READ width WRITE setWidth)
3348 Q_PROPERTY(double whiskerWidth READ whiskerWidth WRITE setWhiskerWidth)
3349 Q_PROPERTY(QPen whiskerPen READ whiskerPen WRITE setWhiskerPen)
3350 Q_PROPERTY(QPen whiskerBarPen READ whiskerBarPen WRITE setWhiskerBarPen)
3351 Q_PROPERTY(QPen medianPen READ medianPen WRITE setMedianPen)
3352 Q_PROPERTY(
3353 QCPScatterStyle outlierStyle READ outlierStyle WRITE setOutlierStyle)
3355 public:
3356 explicit QCPStatisticalBox(QCPAxis *keyAxis, QCPAxis *valueAxis);
3357
3358 // getters:
3359 double key() const { return mKey; }
3360 double minimum() const { return mMinimum; }
3361 double lowerQuartile() const { return mLowerQuartile; }
3362 double median() const { return mMedian; }
3363 double upperQuartile() const { return mUpperQuartile; }
3364 double maximum() const { return mMaximum; }
3365 QVector<double> outliers() const { return mOutliers; }
3366 double width() const { return mWidth; }
3367 double whiskerWidth() const { return mWhiskerWidth; }
3368 QPen whiskerPen() const { return mWhiskerPen; }
3369 QPen whiskerBarPen() const { return mWhiskerBarPen; }
3370 QPen medianPen() const { return mMedianPen; }
3371 QCPScatterStyle outlierStyle() const { return mOutlierStyle; }
3372
3373 // setters:
3374 void setKey(double key);
3375 void setMinimum(double value);
3376 void setLowerQuartile(double value);
3377 void setMedian(double value);
3378 void setUpperQuartile(double value);
3379 void setMaximum(double value);
3380 void setOutliers(const QVector<double> &values);
3381 void setData(double key, double minimum, double lowerQuartile, double median,
3382 double upperQuartile, double maximum);
3383 void setWidth(double width);
3384 void setWhiskerWidth(double width);
3385 void setWhiskerPen(const QPen &pen);
3386 void setWhiskerBarPen(const QPen &pen);
3387 void setMedianPen(const QPen &pen);
3389
3390 // non-property methods:
3391 virtual void clearData();
3392 virtual double selectTest(const QPointF &pos, bool onlySelectable,
3393 QVariant *details = 0) const;
3394
3395 protected:
3396 // property members:
3397 QVector<double> mOutliers;
3398 double mKey, mMinimum, mLowerQuartile, mMedian, mUpperQuartile, mMaximum;
3399 double mWidth;
3400 double mWhiskerWidth;
3401 QPen mWhiskerPen, mWhiskerBarPen, mMedianPen;
3402 QCPScatterStyle mOutlierStyle;
3403
3404 // reimplemented virtual methods:
3405 virtual void draw(QCPPainter *painter);
3406 virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const;
3407 virtual QCPRange getKeyRange(bool &foundRange,
3408 SignDomain inSignDomain = sdBoth) const;
3409 virtual QCPRange getValueRange(bool &foundRange,
3410 SignDomain inSignDomain = sdBoth) const;
3411
3412 // introduced virtual methods:
3413 virtual void drawQuartileBox(QCPPainter *painter,
3414 QRectF *quartileBox = 0) const;
3415 virtual void drawMedian(QCPPainter *painter) const;
3416 virtual void drawWhiskers(QCPPainter *painter) const;
3417 virtual void drawOutliers(QCPPainter *painter) const;
3418
3419 friend class QCustomPlot;
3420 friend class QCPLegend;
3421};
3422
3424 public:
3425 QCPColorMapData(int keySize, int valueSize, const QCPRange &keyRange,
3426 const QCPRange &valueRange);
3430
3431 // getters:
3432 int keySize() const { return mKeySize; }
3433 int valueSize() const { return mValueSize; }
3434 QCPRange keyRange() const { return mKeyRange; }
3435 QCPRange valueRange() const { return mValueRange; }
3436 QCPRange dataBounds() const { return mDataBounds; }
3437 double data(double key, double value);
3438 double cell(int keyIndex, int valueIndex);
3439
3440 // setters:
3441 void setSize(int keySize, int valueSize);
3442 void setKeySize(int keySize);
3443 void setValueSize(int valueSize);
3444 void setRange(const QCPRange &keyRange, const QCPRange &valueRange);
3445 void setKeyRange(const QCPRange &keyRange);
3446 void setValueRange(const QCPRange &valueRange);
3447 void setData(double key, double value, double z);
3448 void setCell(int keyIndex, int valueIndex, double z);
3449
3450 // non-property methods:
3452 void clear();
3453 void fill(double z);
3454 bool isEmpty() const { return mIsEmpty; }
3455 void coordToCell(double key, double value, int *keyIndex,
3456 int *valueIndex) const;
3457 void cellToCoord(int keyIndex, int valueIndex, double *key,
3458 double *value) const;
3459
3460 protected:
3461 // property members:
3462 int mKeySize, mValueSize;
3463 QCPRange mKeyRange, mValueRange;
3464 bool mIsEmpty;
3465 // non-property members:
3466 double *mData;
3467 QCPRange mDataBounds;
3468 bool mDataModified;
3469
3470 friend class QCPColorMap;
3471};
3472
3474 Q_OBJECT
3476 Q_PROPERTY(QCPRange dataRange READ dataRange WRITE setDataRange NOTIFY
3477 dataRangeChanged)
3478 Q_PROPERTY(QCPAxis::ScaleType dataScaleType READ dataScaleType WRITE
3479 setDataScaleType NOTIFY dataScaleTypeChanged)
3480 Q_PROPERTY(QCPColorGradient gradient READ gradient WRITE setGradient NOTIFY
3481 gradientChanged)
3482 Q_PROPERTY(bool interpolate READ interpolate WRITE setInterpolate)
3483 Q_PROPERTY(bool tightBoundary READ tightBoundary WRITE setTightBoundary)
3484 Q_PROPERTY(QCPColorScale *colorScale READ colorScale WRITE setColorScale)
3486 public:
3487 explicit QCPColorMap(QCPAxis *keyAxis, QCPAxis *valueAxis);
3488 virtual ~QCPColorMap();
3489
3490 // getters:
3491 QCPColorMapData *data() const { return mMapData; }
3492 QCPRange dataRange() const { return mDataRange; }
3493 QCPAxis::ScaleType dataScaleType() const { return mDataScaleType; }
3494 bool interpolate() const { return mInterpolate; }
3495 bool tightBoundary() const { return mTightBoundary; }
3496 QCPColorGradient gradient() const { return mGradient; }
3497 QCPColorScale *colorScale() const { return mColorScale.data(); }
3498
3499 // setters:
3500 void setData(QCPColorMapData *data, bool copy = false);
3501 Q_SLOT void setDataRange(const QCPRange &dataRange);
3502 Q_SLOT void setDataScaleType(QCPAxis::ScaleType scaleType);
3503 Q_SLOT void setGradient(const QCPColorGradient &gradient);
3504 void setInterpolate(bool enabled);
3505 void setTightBoundary(bool enabled);
3506 void setColorScale(QCPColorScale *colorScale);
3507
3508 // non-property methods:
3509 void rescaleDataRange(bool recalculateDataBounds = false);
3510 Q_SLOT void updateLegendIcon(
3511 Qt::TransformationMode transformMode = Qt::SmoothTransformation,
3512 const QSize &thumbSize = QSize(32, 18));
3513
3514 // reimplemented virtual methods:
3515 virtual void clearData();
3516 virtual double selectTest(const QPointF &pos, bool onlySelectable,
3517 QVariant *details = 0) const;
3518
3519 signals:
3523
3524 protected:
3525 // property members:
3526 QCPRange mDataRange;
3527 QCPAxis::ScaleType mDataScaleType;
3528 QCPColorMapData *mMapData;
3529 QCPColorGradient mGradient;
3530 bool mInterpolate;
3531 bool mTightBoundary;
3532 QPointer<QCPColorScale> mColorScale;
3533 // non-property members:
3534 QImage mMapImage, mUndersampledMapImage;
3535 QPixmap mLegendIcon;
3536 bool mMapImageInvalidated;
3537
3538 // introduced virtual methods:
3539 virtual void updateMapImage();
3540
3541 // reimplemented virtual methods:
3542 virtual void draw(QCPPainter *painter);
3543 virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const;
3544 virtual QCPRange getKeyRange(bool &foundRange,
3545 SignDomain inSignDomain = sdBoth) const;
3546 virtual QCPRange getValueRange(bool &foundRange,
3547 SignDomain inSignDomain = sdBoth) const;
3548
3549 friend class QCustomPlot;
3550 friend class QCPLegend;
3551};
3552
3556 public:
3558 QCPFinancialData(double key, double open, double high, double low,
3559 double close);
3560 double key, open, high, low, close;
3561};
3563
3571typedef QMap<double, QCPFinancialData> QCPFinancialDataMap;
3572typedef QMapIterator<double, QCPFinancialData> QCPFinancialDataMapIterator;
3573typedef QMutableMapIterator<double, QCPFinancialData>
3575
3577 Q_OBJECT
3579 Q_PROPERTY(ChartStyle chartStyle READ chartStyle WRITE setChartStyle)
3580 Q_PROPERTY(double width READ width WRITE setWidth)
3581 Q_PROPERTY(bool twoColored READ twoColored WRITE setTwoColored)
3582 Q_PROPERTY(QBrush brushPositive READ brushPositive WRITE setBrushPositive)
3583 Q_PROPERTY(QBrush brushNegative READ brushNegative WRITE setBrushNegative)
3584 Q_PROPERTY(QPen penPositive READ penPositive WRITE setPenPositive)
3585 Q_PROPERTY(QPen penNegative READ penNegative WRITE setPenNegative)
3587 public:
3594 csOhlc
3595 ,
3596 csCandlestick
3597 };
3598 Q_ENUMS(ChartStyle)
3599
3600 explicit QCPFinancial(QCPAxis *keyAxis, QCPAxis *valueAxis);
3601 virtual ~QCPFinancial();
3602
3603 // getters:
3604 QCPFinancialDataMap *data() const { return mData; }
3605 ChartStyle chartStyle() const { return mChartStyle; }
3606 double width() const { return mWidth; }
3607 bool twoColored() const { return mTwoColored; }
3608 QBrush brushPositive() const { return mBrushPositive; }
3609 QBrush brushNegative() const { return mBrushNegative; }
3610 QPen penPositive() const { return mPenPositive; }
3611 QPen penNegative() const { return mPenNegative; }
3612
3613 // setters:
3614 void setData(QCPFinancialDataMap *data, bool copy = false);
3615 void setData(const QVector<double> &key, const QVector<double> &open,
3616 const QVector<double> &high, const QVector<double> &low,
3617 const QVector<double> &close);
3619 void setWidth(double width);
3620 void setTwoColored(bool twoColored);
3621 void setBrushPositive(const QBrush &brush);
3622 void setBrushNegative(const QBrush &brush);
3623 void setPenPositive(const QPen &pen);
3624 void setPenNegative(const QPen &pen);
3625
3626 // non-property methods:
3627 void addData(const QCPFinancialDataMap &dataMap);
3628 void addData(const QCPFinancialData &data);
3629 void addData(double key, double open, double high, double low, double close);
3630 void addData(const QVector<double> &key, const QVector<double> &open,
3631 const QVector<double> &high, const QVector<double> &low,
3632 const QVector<double> &close);
3633 void removeDataBefore(double key);
3634 void removeDataAfter(double key);
3635 void removeData(double fromKey, double toKey);
3636 void removeData(double key);
3637
3638 // reimplemented virtual methods:
3639 virtual void clearData();
3640 virtual double selectTest(const QPointF &pos, bool onlySelectable,
3641 QVariant *details = 0) const;
3642
3643 // static methods:
3644 static QCPFinancialDataMap timeSeriesToOhlc(const QVector<double> &time,
3645 const QVector<double> &value,
3646 double timeBinSize,
3647 double timeBinOffset = 0);
3648
3649 protected:
3650 // property members:
3651 QCPFinancialDataMap *mData;
3652 ChartStyle mChartStyle;
3653 double mWidth;
3654 bool mTwoColored;
3655 QBrush mBrushPositive, mBrushNegative;
3656 QPen mPenPositive, mPenNegative;
3657
3658 // reimplemented virtual methods:
3659 virtual void draw(QCPPainter *painter);
3660 virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const;
3661 virtual QCPRange getKeyRange(bool &foundRange,
3662 SignDomain inSignDomain = sdBoth) const;
3663 virtual QCPRange getValueRange(bool &foundRange,
3664 SignDomain inSignDomain = sdBoth) const;
3665
3666 // non-virtual methods:
3668 const QCPFinancialDataMap::const_iterator &begin,
3669 const QCPFinancialDataMap::const_iterator &end);
3671 const QCPFinancialDataMap::const_iterator &begin,
3672 const QCPFinancialDataMap::const_iterator &end);
3673 double ohlcSelectTest(const QPointF &pos,
3674 const QCPFinancialDataMap::const_iterator &begin,
3675 const QCPFinancialDataMap::const_iterator &end) const;
3677 const QPointF &pos, const QCPFinancialDataMap::const_iterator &begin,
3678 const QCPFinancialDataMap::const_iterator &end) const;
3679 void getVisibleDataBounds(QCPFinancialDataMap::const_iterator &lower,
3680 QCPFinancialDataMap::const_iterator &upper) const;
3681
3682 friend class QCustomPlot;
3683 friend class QCPLegend;
3684};
3685
3687 Q_OBJECT
3689 Q_PROPERTY(QPen pen READ pen WRITE setPen)
3690 Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
3692 public:
3695
3696 // getters:
3697 QPen pen() const { return mPen; }
3698 QPen selectedPen() const { return mSelectedPen; }
3699
3700 // setters;
3701 void setPen(const QPen &pen);
3702 void setSelectedPen(const QPen &pen);
3703
3704 // reimplemented virtual methods:
3705 virtual double selectTest(const QPointF &pos, bool onlySelectable,
3706 QVariant *details = 0) const;
3707
3708 QCPItemPosition *const point1;
3709 QCPItemPosition *const point2;
3710
3711 protected:
3712 // property members:
3713 QPen mPen, mSelectedPen;
3714
3715 // reimplemented virtual methods:
3716 virtual void draw(QCPPainter *painter);
3717
3718 // non-virtual methods:
3719 double distToStraightLine(const QVector2D &point1, const QVector2D &vec,
3720 const QVector2D &point) const;
3721 QLineF getRectClippedStraightLine(const QVector2D &point1,
3722 const QVector2D &vec,
3723 const QRect &rect) const;
3724 QPen mainPen() const;
3725};
3726
3728 Q_OBJECT
3730 Q_PROPERTY(QPen pen READ pen WRITE setPen)
3731 Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
3732 Q_PROPERTY(QCPLineEnding head READ head WRITE setHead)
3733 Q_PROPERTY(QCPLineEnding tail READ tail WRITE setTail)
3735 public:
3737 virtual ~QCPItemLine();
3738
3739 // getters:
3740 QPen pen() const { return mPen; }
3741 QPen selectedPen() const { return mSelectedPen; }
3742 QCPLineEnding head() const { return mHead; }
3743 QCPLineEnding tail() const { return mTail; }
3744
3745 // setters;
3746 void setPen(const QPen &pen);
3747 void setSelectedPen(const QPen &pen);
3748 void setHead(const QCPLineEnding &head);
3749 void setTail(const QCPLineEnding &tail);
3750
3751 // reimplemented virtual methods:
3752 virtual double selectTest(const QPointF &pos, bool onlySelectable,
3753 QVariant *details = 0) const;
3754
3755 QCPItemPosition *const start;
3756 QCPItemPosition *const end;
3757
3758 protected:
3759 // property members:
3760 QPen mPen, mSelectedPen;
3761 QCPLineEnding mHead, mTail;
3762
3763 // reimplemented virtual methods:
3764 virtual void draw(QCPPainter *painter);
3765
3766 // non-virtual methods:
3767 QLineF getRectClippedLine(const QVector2D &start, const QVector2D &end,
3768 const QRect &rect) const;
3769 QPen mainPen() const;
3770};
3771
3773 Q_OBJECT
3775 Q_PROPERTY(QPen pen READ pen WRITE setPen)
3776 Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
3777 Q_PROPERTY(QCPLineEnding head READ head WRITE setHead)
3778 Q_PROPERTY(QCPLineEnding tail READ tail WRITE setTail)
3780 public:
3782 virtual ~QCPItemCurve();
3783
3784 // getters:
3785 QPen pen() const { return mPen; }
3786 QPen selectedPen() const { return mSelectedPen; }
3787 QCPLineEnding head() const { return mHead; }
3788 QCPLineEnding tail() const { return mTail; }
3789
3790 // setters;
3791 void setPen(const QPen &pen);
3792 void setSelectedPen(const QPen &pen);
3793 void setHead(const QCPLineEnding &head);
3794 void setTail(const QCPLineEnding &tail);
3795
3796 // reimplemented virtual methods:
3797 virtual double selectTest(const QPointF &pos, bool onlySelectable,
3798 QVariant *details = 0) const;
3799
3800 QCPItemPosition *const start;
3801 QCPItemPosition *const startDir;
3802 QCPItemPosition *const endDir;
3803 QCPItemPosition *const end;
3804
3805 protected:
3806 // property members:
3807 QPen mPen, mSelectedPen;
3808 QCPLineEnding mHead, mTail;
3809
3810 // reimplemented virtual methods:
3811 virtual void draw(QCPPainter *painter);
3812
3813 // non-virtual methods:
3814 QPen mainPen() const;
3815};
3816
3818 Q_OBJECT
3820 Q_PROPERTY(QPen pen READ pen WRITE setPen)
3821 Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
3822 Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
3823 Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
3825 public:
3827 virtual ~QCPItemRect();
3828
3829 // getters:
3830 QPen pen() const { return mPen; }
3831 QPen selectedPen() const { return mSelectedPen; }
3832 QBrush brush() const { return mBrush; }
3833 QBrush selectedBrush() const { return mSelectedBrush; }
3834
3835 // setters;
3836 void setPen(const QPen &pen);
3837 void setSelectedPen(const QPen &pen);
3838 void setBrush(const QBrush &brush);
3839 void setSelectedBrush(const QBrush &brush);
3840
3841 // reimplemented virtual methods:
3842 virtual double selectTest(const QPointF &pos, bool onlySelectable,
3843 QVariant *details = 0) const;
3844
3845 QCPItemPosition *const topLeft;
3846 QCPItemPosition *const bottomRight;
3847 QCPItemAnchor *const top;
3848 QCPItemAnchor *const topRight;
3849 QCPItemAnchor *const right;
3850 QCPItemAnchor *const bottom;
3851 QCPItemAnchor *const bottomLeft;
3852 QCPItemAnchor *const left;
3853
3854 protected:
3856 aiTop,
3857 aiTopRight,
3858 aiRight,
3859 aiBottom,
3860 aiBottomLeft,
3861 aiLeft
3862 };
3863
3864 // property members:
3865 QPen mPen, mSelectedPen;
3866 QBrush mBrush, mSelectedBrush;
3867
3868 // reimplemented virtual methods:
3869 virtual void draw(QCPPainter *painter);
3870 virtual QPointF anchorPixelPoint(int anchorId) const;
3871
3872 // non-virtual methods:
3873 QPen mainPen() const;
3874 QBrush mainBrush() const;
3875};
3876
3878 Q_OBJECT
3880 Q_PROPERTY(QColor color READ color WRITE setColor)
3881 Q_PROPERTY(QColor selectedColor READ selectedColor WRITE setSelectedColor)
3882 Q_PROPERTY(QPen pen READ pen WRITE setPen)
3883 Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
3884 Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
3885 Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
3886 Q_PROPERTY(QFont font READ font WRITE setFont)
3887 Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont)
3888 Q_PROPERTY(QString text READ text WRITE setText)
3889 Q_PROPERTY(Qt::Alignment positionAlignment READ positionAlignment WRITE
3890 setPositionAlignment)
3891 Q_PROPERTY(
3892 Qt::Alignment textAlignment READ textAlignment WRITE setTextAlignment)
3893 Q_PROPERTY(double rotation READ rotation WRITE setRotation)
3894 Q_PROPERTY(QMargins padding READ padding WRITE setPadding)
3896 public:
3898 virtual ~QCPItemText();
3899
3900 // getters:
3901 QColor color() const { return mColor; }
3902 QColor selectedColor() const { return mSelectedColor; }
3903 QPen pen() const { return mPen; }
3904 QPen selectedPen() const { return mSelectedPen; }
3905 QBrush brush() const { return mBrush; }
3906 QBrush selectedBrush() const { return mSelectedBrush; }
3907 QFont font() const { return mFont; }
3908 QFont selectedFont() const { return mSelectedFont; }
3909 QString text() const { return mText; }
3910 Qt::Alignment positionAlignment() const { return mPositionAlignment; }
3911 Qt::Alignment textAlignment() const { return mTextAlignment; }
3912 double rotation() const { return mRotation; }
3913 QMargins padding() const { return mPadding; }
3914
3915 // setters;
3916 void setColor(const QColor &color);
3917 void setSelectedColor(const QColor &color);
3918 void setPen(const QPen &pen);
3919 void setSelectedPen(const QPen &pen);
3920 void setBrush(const QBrush &brush);
3921 void setSelectedBrush(const QBrush &brush);
3922 void setFont(const QFont &font);
3923 void setSelectedFont(const QFont &font);
3924 void setText(const QString &text);
3925 void setPositionAlignment(Qt::Alignment alignment);
3926 void setTextAlignment(Qt::Alignment alignment);
3927 void setRotation(double degrees);
3928 void setPadding(const QMargins &padding);
3929
3930 // reimplemented virtual methods:
3931 virtual double selectTest(const QPointF &pos, bool onlySelectable,
3932 QVariant *details = 0) const;
3933
3934 QCPItemPosition *const position;
3935 QCPItemAnchor *const topLeft;
3936 QCPItemAnchor *const top;
3937 QCPItemAnchor *const topRight;
3938 QCPItemAnchor *const right;
3939 QCPItemAnchor *const bottomRight;
3940 QCPItemAnchor *const bottom;
3941 QCPItemAnchor *const bottomLeft;
3942 QCPItemAnchor *const left;
3943
3944 protected:
3946 aiTopLeft,
3947 aiTop,
3948 aiTopRight,
3949 aiRight,
3950 aiBottomRight,
3951 aiBottom,
3952 aiBottomLeft,
3953 aiLeft
3954 };
3955
3956 // property members:
3957 QColor mColor, mSelectedColor;
3958 QPen mPen, mSelectedPen;
3959 QBrush mBrush, mSelectedBrush;
3960 QFont mFont, mSelectedFont;
3961 QString mText;
3962 Qt::Alignment mPositionAlignment;
3963 Qt::Alignment mTextAlignment;
3964 double mRotation;
3965 QMargins mPadding;
3966
3967 // reimplemented virtual methods:
3968 virtual void draw(QCPPainter *painter);
3969 virtual QPointF anchorPixelPoint(int anchorId) const;
3970
3971 // non-virtual methods:
3972 QPointF getTextDrawPoint(const QPointF &pos, const QRectF &rect,
3973 Qt::Alignment positionAlignment) const;
3974 QFont mainFont() const;
3975 QColor mainColor() const;
3976 QPen mainPen() const;
3977 QBrush mainBrush() const;
3978};
3979
3981 Q_OBJECT
3983 Q_PROPERTY(QPen pen READ pen WRITE setPen)
3984 Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
3985 Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
3986 Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
3988 public:
3991
3992 // getters:
3993 QPen pen() const { return mPen; }
3994 QPen selectedPen() const { return mSelectedPen; }
3995 QBrush brush() const { return mBrush; }
3996 QBrush selectedBrush() const { return mSelectedBrush; }
3997
3998 // setters;
3999 void setPen(const QPen &pen);
4000 void setSelectedPen(const QPen &pen);
4001 void setBrush(const QBrush &brush);
4002 void setSelectedBrush(const QBrush &brush);
4003
4004 // reimplemented virtual methods:
4005 virtual double selectTest(const QPointF &pos, bool onlySelectable,
4006 QVariant *details = 0) const;
4007
4008 QCPItemPosition *const topLeft;
4009 QCPItemPosition *const bottomRight;
4010 QCPItemAnchor *const topLeftRim;
4011 QCPItemAnchor *const top;
4012 QCPItemAnchor *const topRightRim;
4013 QCPItemAnchor *const right;
4014 QCPItemAnchor *const bottomRightRim;
4015 QCPItemAnchor *const bottom;
4016 QCPItemAnchor *const bottomLeftRim;
4017 QCPItemAnchor *const left;
4018 QCPItemAnchor *const center;
4019
4020 protected:
4022 aiTopLeftRim,
4023 aiTop,
4024 aiTopRightRim,
4025 aiRight,
4026 aiBottomRightRim,
4027 aiBottom,
4028 aiBottomLeftRim,
4029 aiLeft,
4030 aiCenter
4031 };
4032
4033 // property members:
4034 QPen mPen, mSelectedPen;
4035 QBrush mBrush, mSelectedBrush;
4036
4037 // reimplemented virtual methods:
4038 virtual void draw(QCPPainter *painter);
4039 virtual QPointF anchorPixelPoint(int anchorId) const;
4040
4041 // non-virtual methods:
4042 QPen mainPen() const;
4043 QBrush mainBrush() const;
4044};
4045
4047 Q_OBJECT
4049 Q_PROPERTY(QPixmap pixmap READ pixmap WRITE setPixmap)
4050 Q_PROPERTY(bool scaled READ scaled WRITE setScaled)
4051 Q_PROPERTY(Qt::AspectRatioMode aspectRatioMode READ aspectRatioMode)
4052 Q_PROPERTY(Qt::TransformationMode transformationMode READ transformationMode)
4053 Q_PROPERTY(QPen pen READ pen WRITE setPen)
4054 Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
4056 public:
4059
4060 // getters:
4061 QPixmap pixmap() const { return mPixmap; }
4062 bool scaled() const { return mScaled; }
4063 Qt::AspectRatioMode aspectRatioMode() const { return mAspectRatioMode; }
4064 Qt::TransformationMode transformationMode() const {
4065 return mTransformationMode;
4066 }
4067 QPen pen() const { return mPen; }
4068 QPen selectedPen() const { return mSelectedPen; }
4069
4070 // setters;
4071 void setPixmap(const QPixmap &pixmap);
4073 bool scaled, Qt::AspectRatioMode aspectRatioMode = Qt::KeepAspectRatio,
4074 Qt::TransformationMode transformationMode = Qt::SmoothTransformation);
4075 void setPen(const QPen &pen);
4076 void setSelectedPen(const QPen &pen);
4077
4078 // reimplemented virtual methods:
4079 virtual double selectTest(const QPointF &pos, bool onlySelectable,
4080 QVariant *details = 0) const;
4081
4082 QCPItemPosition *const topLeft;
4083 QCPItemPosition *const bottomRight;
4084 QCPItemAnchor *const top;
4085 QCPItemAnchor *const topRight;
4086 QCPItemAnchor *const right;
4087 QCPItemAnchor *const bottom;
4088 QCPItemAnchor *const bottomLeft;
4089 QCPItemAnchor *const left;
4090
4091 protected:
4093 aiTop,
4094 aiTopRight,
4095 aiRight,
4096 aiBottom,
4097 aiBottomLeft,
4098 aiLeft
4099 };
4100
4101 // property members:
4102 QPixmap mPixmap;
4103 QPixmap mScaledPixmap;
4104 bool mScaled;
4105 bool mScaledPixmapInvalidated;
4106 Qt::AspectRatioMode mAspectRatioMode;
4107 Qt::TransformationMode mTransformationMode;
4108 QPen mPen, mSelectedPen;
4109
4110 // reimplemented virtual methods:
4111 virtual void draw(QCPPainter *painter);
4112 virtual QPointF anchorPixelPoint(int anchorId) const;
4113
4114 // non-virtual methods:
4115 void updateScaledPixmap(QRect finalRect = QRect(), bool flipHorz = false,
4116 bool flipVert = false);
4117 QRect getFinalRect(bool *flippedHorz = 0, bool *flippedVert = 0) const;
4118 QPen mainPen() const;
4119};
4120
4122 Q_OBJECT
4124 Q_PROPERTY(QPen pen READ pen WRITE setPen)
4125 Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
4126 Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
4127 Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
4128 Q_PROPERTY(double size READ size WRITE setSize)
4129 Q_PROPERTY(TracerStyle style READ style WRITE setStyle)
4130 Q_PROPERTY(QCPGraph *graph READ graph WRITE setGraph)
4131 Q_PROPERTY(double graphKey READ graphKey WRITE setGraphKey)
4132 Q_PROPERTY(bool interpolating READ interpolating WRITE setInterpolating)
4134 public:
4142 tsNone
4143 ,
4144 tsPlus
4145 ,
4146 tsCrosshair
4147 ,
4148 tsCircle
4149 ,
4150 tsSquare
4151 };
4152 Q_ENUMS(TracerStyle)
4153
4155 virtual ~QCPItemTracer();
4156
4157 // getters:
4158 QPen pen() const { return mPen; }
4159 QPen selectedPen() const { return mSelectedPen; }
4160 QBrush brush() const { return mBrush; }
4161 QBrush selectedBrush() const { return mSelectedBrush; }
4162 double size() const { return mSize; }
4163 TracerStyle style() const { return mStyle; }
4164 QCPGraph *graph() const { return mGraph; }
4165 double graphKey() const { return mGraphKey; }
4166 bool interpolating() const { return mInterpolating; }
4167
4168 // setters;
4169 void setPen(const QPen &pen);
4170 void setSelectedPen(const QPen &pen);
4171 void setBrush(const QBrush &brush);
4172 void setSelectedBrush(const QBrush &brush);
4173 void setSize(double size);
4175 void setGraph(QCPGraph *graph);
4176 void setGraphKey(double key);
4177 void setInterpolating(bool enabled);
4178
4179 // reimplemented virtual methods:
4180 virtual double selectTest(const QPointF &pos, bool onlySelectable,
4181 QVariant *details = 0) const;
4182
4183 // non-virtual methods:
4185
4186 QCPItemPosition *const position;
4187
4188 protected:
4189 // property members:
4190 QPen mPen, mSelectedPen;
4191 QBrush mBrush, mSelectedBrush;
4192 double mSize;
4193 TracerStyle mStyle;
4194 QCPGraph *mGraph;
4195 double mGraphKey;
4196 bool mInterpolating;
4197
4198 // reimplemented virtual methods:
4199 virtual void draw(QCPPainter *painter);
4200
4201 // non-virtual methods:
4202 QPen mainPen() const;
4203 QBrush mainBrush() const;
4204};
4205
4207 Q_OBJECT
4209 Q_PROPERTY(QPen pen READ pen WRITE setPen)
4210 Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
4211 Q_PROPERTY(double length READ length WRITE setLength)
4212 Q_PROPERTY(BracketStyle style READ style WRITE setStyle)
4214 public:
4216 bsSquare
4217 ,
4218 bsRound
4219 ,
4220 bsCurly
4221 ,
4222 bsCalligraphic
4224 };
4225
4228
4229 // getters:
4230 QPen pen() const { return mPen; }
4231 QPen selectedPen() const { return mSelectedPen; }
4232 double length() const { return mLength; }
4233 BracketStyle style() const { return mStyle; }
4234
4235 // setters;
4236 void setPen(const QPen &pen);
4237 void setSelectedPen(const QPen &pen);
4238 void setLength(double length);
4240
4241 // reimplemented virtual methods:
4242 virtual double selectTest(const QPointF &pos, bool onlySelectable,
4243 QVariant *details = 0) const;
4244
4245 QCPItemPosition *const left;
4246 QCPItemPosition *const right;
4247 QCPItemAnchor *const center;
4248
4249 protected:
4250 // property members:
4251 enum AnchorIndex { aiCenter };
4252 QPen mPen, mSelectedPen;
4253 double mLength;
4254 BracketStyle mStyle;
4255
4256 // reimplemented virtual methods:
4257 virtual void draw(QCPPainter *painter);
4258 virtual QPointF anchorPixelPoint(int anchorId) const;
4259
4260 // non-virtual methods:
4261 QPen mainPen() const;
4262};
4263
4264#endif // QCUSTOMPLOT_H
Definition qcustomplot.h:1847
virtual void deselectEvent(bool *selectionStateChanged)
QCPItemAnchor * anchor(const QString &name) const
virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const
virtual QPointF anchorPixelPoint(int anchorId) const
QCPItemPosition * position(const QString &name) const
double rectSelectTest(const QRectF &rect, const QPointF &pos, bool filledRect) const
void setClipToAxisRect(bool clip)
bool clipToAxisRect() const
Definition qcustomplot.h:1862
void selectableChanged(bool selectable)
virtual QCP::Interaction selectionCategory() const
QList< QCPItemPosition * > positions() const
Definition qcustomplot.h:1878
QCPItemPosition * createPosition(const QString &name)
void setClipAxisRect(QCPAxisRect *rect)
QList< QCPItemAnchor * > anchors() const
Definition qcustomplot.h:1879
bool hasAnchor(const QString &name) const
double distSqrToLine(const QPointF &start, const QPointF &end, const QPointF &point) const
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const =0
QCPAbstractItem(QCustomPlot *parentPlot)
virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged)
bool selected() const
Definition qcustomplot.h:1865
Q_SLOT void setSelected(bool selected)
void selectionChanged(bool selected)
Q_SLOT void setSelectable(bool selectable)
QCPAxisRect * clipAxisRect() const
bool selectable() const
Definition qcustomplot.h:1864
virtual ~QCPAbstractItem()
virtual void draw(QCPPainter *painter)=0
QCPItemAnchor * createAnchor(const QString &name, int anchorId)
virtual QRect clipRect() const
Definition qcustomplot.h:2410
virtual QCP::Interaction selectionCategory() const
QCPLegend * parentLegend() const
Definition qcustomplot.h:2428
QColor selectedTextColor() const
Definition qcustomplot.h:2432
virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const
QColor textColor() const
Definition qcustomplot.h:2430
void setFont(const QFont &font)
void setSelectedTextColor(const QColor &color)
QFont font() const
Definition qcustomplot.h:2429
void setTextColor(const QColor &color)
void selectionChanged(bool selected)
virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged)
Q_SLOT void setSelectable(bool selectable)
virtual QRect clipRect() const
void setSelectedFont(const QFont &font)
virtual void draw(QCPPainter *painter)=0
void selectableChanged(bool selectable)
QFont selectedFont() const
Definition qcustomplot.h:2431
Q_SLOT void setSelected(bool selected)
bool selected() const
Definition qcustomplot.h:2434
bool selectable() const
Definition qcustomplot.h:2433
virtual void deselectEvent(bool *selectionStateChanged)
QCPAbstractLegendItem(QCPLegend *parent)
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
Definition qcustomplot.h:1595
void selectableChanged(bool selectable)
virtual QRect clipRect() const
bool antialiasedFill() const
Definition qcustomplot.h:1620
void applyErrorBarsAntialiasingHint(QCPPainter *painter) const
void setAntialiasedFill(bool enabled)
bool selected() const
Definition qcustomplot.h:1630
void rescaleAxes(bool onlyEnlarge=false) const
virtual bool removeFromLegend() const
Q_SLOT void setSelected(bool selected)
void pixelsToCoords(const QPointF &pixelPos, double &key, double &value) const
virtual bool addToLegend()
virtual QCPRange getValueRange(bool &foundRange, SignDomain inSignDomain=sdBoth) const =0
void setAntialiasedScatters(bool enabled)
Q_SLOT void setSelectable(bool selectable)
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const =0
void pixelsToCoords(double x, double y, double &key, double &value) const
void selectionChanged(bool selected)
QString name() const
Definition qcustomplot.h:1619
void applyDefaultAntialiasingHint(QCPPainter *painter) const
const QPointF coordsToPixels(double key, double value) const
SignDomain
Definition qcustomplot.h:1667
void setSelectedPen(const QPen &pen)
void setValueAxis(QCPAxis *axis)
virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const =0
void setAntialiasedErrorBars(bool enabled)
virtual QCPRange getKeyRange(bool &foundRange, SignDomain inSignDomain=sdBoth) const =0
bool antialiasedScatters() const
Definition qcustomplot.h:1621
void setBrush(const QBrush &brush)
void coordsToPixels(double key, double value, double &x, double &y) const
virtual void clearData()=0
virtual void deselectEvent(bool *selectionStateChanged)
QCPAxis * valueAxis() const
Definition qcustomplot.h:1628
void setKeyAxis(QCPAxis *axis)
QBrush brush() const
Definition qcustomplot.h:1625
void applyFillAntialiasingHint(QCPPainter *painter) const
void rescaleValueAxis(bool onlyEnlarge=false) const
QCPAxis * keyAxis() const
Definition qcustomplot.h:1627
QPen selectedPen() const
Definition qcustomplot.h:1624
virtual QCP::Interaction selectionCategory() const
void setPen(const QPen &pen)
void setName(const QString &name)
QPen mainPen() const
QBrush mainBrush() const
void applyScattersAntialiasingHint(QCPPainter *painter) const
virtual void draw(QCPPainter *painter)=0
QPen pen() const
Definition qcustomplot.h:1623
bool antialiasedErrorBars() const
Definition qcustomplot.h:1622
bool selectable() const
Definition qcustomplot.h:1629
void setSelectedBrush(const QBrush &brush)
void rescaleKeyAxis(bool onlyEnlarge=false) const
virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged)
QCPAbstractPlottable(QCPAxis *keyAxis, QCPAxis *valueAxis)
double distSqrToLine(const QPointF &start, const QPointF &end, const QPointF &point) const
QBrush selectedBrush() const
Definition qcustomplot.h:1626
Definition qcustomplot.h:1523
QFont tickLabelFont
Definition qcustomplot.h:1554
bool reversedEndings
Definition qcustomplot.h:1559
QCPLineEnding lowerEnding
Definition qcustomplot.h:1539
QRect mTickLabelsSelectionBox
Definition qcustomplot.h:1579
bool numberMultiplyCross
Definition qcustomplot.h:1550
QCPAxisPainterPrivate(QCustomPlot *parentPlot)
int tickLabelPadding
Definition qcustomplot.h:1545
QVector< QString > tickLabels
Definition qcustomplot.h:1563
QVector< double > tickPositions
Definition qcustomplot.h:1562
QPen tickPen
Definition qcustomplot.h:1553
virtual void drawTickLabel(QCPPainter *painter, double x, double y, const TickLabelData &labelData) const
int labelPadding
Definition qcustomplot.h:1541
QVector< double > subTickPositions
Definition qcustomplot.h:1561
bool substituteExponent
Definition qcustomplot.h:1549
QColor labelColor
Definition qcustomplot.h:1543
virtual ~QCPAxisPainterPrivate()
int subTickLengthOut
Definition qcustomplot.h:1552
bool abbreviateDecimalPowers
Definition qcustomplot.h:1558
virtual void getMaxTickLabelSize(const QFont &font, const QString &text, QSize *tickLabelsSize) const
virtual void draw(QCPPainter *painter)
virtual QByteArray generateLabelParameterHash() const
virtual void placeTickLabel(QCPPainter *painter, double position, int distanceToAxis, const QString &text, QSize *tickLabelsSize)
QCustomPlot * mParentPlot
Definition qcustomplot.h:1575
QRect viewportRect
Definition qcustomplot.h:1556
QColor tickLabelColor
Definition qcustomplot.h:1555
QPen subTickPen
Definition qcustomplot.h:1553
QCPAxis::LabelSide tickLabelSide
Definition qcustomplot.h:1548
QRect mAxisSelectionBox
Definition qcustomplot.h:1579
QByteArray mLabelParameterHash
Definition qcustomplot.h:1576
QRect axisSelectionBox() const
Definition qcustomplot.h:1532
QPen basePen
Definition qcustomplot.h:1538
QRect mLabelSelectionBox
Definition qcustomplot.h:1579
QCache< QString, CachedLabel > mLabelCache
Definition qcustomplot.h:1578
int tickLengthOut
Definition qcustomplot.h:1551
QRect tickLabelsSelectionBox() const
Definition qcustomplot.h:1533
QFont labelFont
Definition qcustomplot.h:1542
virtual int size() const
QCPAxis::AxisType type
Definition qcustomplot.h:1537
double tickLabelRotation
Definition qcustomplot.h:1546
virtual TickLabelData getTickLabelData(const QFont &font, const QString &text) const
int tickLengthIn
Definition qcustomplot.h:1551
QRect labelSelectionBox() const
Definition qcustomplot.h:1534
double offset
Definition qcustomplot.h:1557
virtual QPointF getTickLabelDrawOffset(const TickLabelData &labelData) const
int subTickLengthIn
Definition qcustomplot.h:1551
QCPLineEnding upperEnding
Definition qcustomplot.h:1540
QRect axisRect
Definition qcustomplot.h:1556
QString label
Definition qcustomplot.h:1544
Definition qcustomplot.h:2297
virtual ~QCPAxisRect()
QList< QCPAbstractItem * > items() const
bool removeAxis(QCPAxis *axis)
bool backgroundScaled() const
Definition qcustomplot.h:2314
Qt::AspectRatioMode backgroundScaledMode() const
Definition qcustomplot.h:2315
QList< QCPAxis * > axes() const
virtual void wheelEvent(QWheelEvent *event)
virtual int calculateAutoMargin(QCP::MarginSide side)
int width() const
Definition qcustomplot.h:2358
void setBackground(const QBrush &brush)
QList< QCPGraph * > graphs() const
QCPAxis * addAxis(QCPAxis::AxisType type, QCPAxis *axis=0)
QPoint bottomRight() const
Definition qcustomplot.h:2364
int right() const
Definition qcustomplot.h:2355
int top() const
Definition qcustomplot.h:2356
QPixmap background() const
Definition qcustomplot.h:2313
QCPAxis * axis(QCPAxis::AxisType type, int index=0) const
QList< QCPAbstractPlottable * > plottables() const
QPoint topLeft() const
Definition qcustomplot.h:2361
void setBackgroundScaledMode(Qt::AspectRatioMode mode)
void setupFullAxesBox(bool connectRanges=false)
void updateAxesOffset(QCPAxis::AxisType type)
QCPAxisRect(QCustomPlot *parentPlot, bool setupDefaultAxes=true)
void setRangeDragAxes(QCPAxis *horizontal, QCPAxis *vertical)
QCPAxis * rangeZoomAxis(Qt::Orientation orientation)
QCPAxis * rangeDragAxis(Qt::Orientation orientation)
QList< QCPAxis * > addAxes(QCPAxis::AxisTypes types)
void setRangeZoom(Qt::Orientations orientations)
QSize size() const
Definition qcustomplot.h:2360
QPoint topRight() const
Definition qcustomplot.h:2362
virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const
int axisCount(QCPAxis::AxisType type) const
void setRangeZoomFactor(double horizontalFactor, double verticalFactor)
QList< QCPAxis * > axes(QCPAxis::AxisTypes types) const
void setRangeZoomAxes(QCPAxis *horizontal, QCPAxis *vertical)
QCPLayoutInset * insetLayout() const
Definition qcustomplot.h:2346
virtual void draw(QCPPainter *painter)
virtual void mousePressEvent(QMouseEvent *event)
Qt::Orientations rangeZoom() const
Definition qcustomplot.h:2319
Qt::Orientations rangeDrag() const
Definition qcustomplot.h:2318
virtual void update(UpdatePhase phase)
QPoint bottomLeft() const
Definition qcustomplot.h:2363
void drawBackground(QCPPainter *painter)
virtual QList< QCPLayoutElement * > elements(bool recursive) const
void setBackground(const QPixmap &pm, bool scaled, Qt::AspectRatioMode mode=Qt::KeepAspectRatioByExpanding)
int height() const
Definition qcustomplot.h:2359
int bottom() const
Definition qcustomplot.h:2357
QPoint center() const
Definition qcustomplot.h:2365
double rangeZoomFactor(Qt::Orientation orientation)
virtual void mouseReleaseEvent(QMouseEvent *event)
void setRangeDrag(Qt::Orientations orientations)
void setBackgroundScaled(bool scaled)
void setRangeZoomFactor(double factor)
virtual void mouseMoveEvent(QMouseEvent *event)
void setBackground(const QPixmap &pm)
int left() const
Definition qcustomplot.h:2354
Definition qcustomplot.h:1137
QCPAxisRect * axisRect() const
Definition qcustomplot.h:1289
void setSelectedLabelFont(const QFont &font)
void setOffset(int offset)
void setTickLabels(bool show)
QColor labelColor() const
Definition qcustomplot.h:1323
int padding() const
Definition qcustomplot.h:1326
virtual int calculateAutoSubTickCount(double tickStep) const
void rangeChanged(const QCPRange &newRange)
void setLowerEnding(const QCPLineEnding &ending)
SelectablePart getPartAt(const QPointF &pos) const
QFont selectedTickLabelFont() const
Definition qcustomplot.h:1330
QFont tickLabelFont() const
Definition qcustomplot.h:1303
LabelType tickLabelType() const
Definition qcustomplot.h:1302
QCPLineEnding lowerEnding() const
QPen selectedBasePen() const
Definition qcustomplot.h:1334
virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged)
QFont selectedLabelFont() const
Definition qcustomplot.h:1331
void setTickLabelSide(LabelSide side)
bool autoTickStep() const
Definition qcustomplot.h:1297
void moveRange(double diff)
Q_SLOT void setRange(const QCPRange &range)
void setTickLabelRotation(double degrees)
SelectableParts selectableParts() const
Definition qcustomplot.h:1329
QString numberFormat() const
QPen basePen() const
Definition qcustomplot.h:1319
void setRangeReversed(bool reversed)
void setNumberPrecision(int precision)
LabelSide
Definition qcustomplot.h:1248
int numberPrecision() const
Definition qcustomplot.h:1310
void setDateTimeSpec(const Qt::TimeSpec &timeSpec)
virtual void draw(QCPPainter *painter)
void setSelectedSubTickPen(const QPen &pen)
void setTickLabelFont(const QFont &font)
QString dateTimeFormat() const
Definition qcustomplot.h:1307
bool autoTicks() const
Definition qcustomplot.h:1294
void setDateTimeFormat(const QString &format)
QString label() const
Definition qcustomplot.h:1324
void setLabel(const QString &str)
void scaleTypeChanged(QCPAxis::ScaleType scaleType)
ScaleType
Definition qcustomplot.h:1259
void setTickLabelColor(const QColor &color)
void setTickLengthOut(int outside)
int autoTickCount() const
Definition qcustomplot.h:1295
QList< QCPAbstractItem * > items() const
void setLabelPadding(int padding)
void rescale(bool onlyVisiblePlottables=false)
LabelType
Definition qcustomplot.h:1233
void setSubTickCount(int count)
void setSubTickLengthOut(int outside)
virtual void generateAutoTicks()
double pixelToCoord(double value) const
void setTickLabelType(LabelType type)
void setPadding(int padding)
void setRange(double lower, double upper)
bool ticks() const
Definition qcustomplot.h:1299
double tickLabelRotation() const
void setSelectedLabelColor(const QColor &color)
void selectionChanged(const QCPAxis::SelectableParts &parts)
void setTickLength(int inside, int outside=0)
QCPGrid * grid() const
Definition qcustomplot.h:1339
virtual void deselectEvent(bool *selectionStateChanged)
void setUpperEnding(const QCPLineEnding &ending)
QFont getTickLabelFont() const
virtual int calculateMargin()
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
void setLabelColor(const QColor &color)
int labelPadding() const
void scaleRange(double factor, double center)
void setLabelFont(const QFont &font)
void setScaleLogBase(double base)
QPen selectedSubTickPen() const
Definition qcustomplot.h:1336
QColor selectedTickLabelColor() const
Definition qcustomplot.h:1332
QPen selectedTickPen() const
Definition qcustomplot.h:1335
void setBasePen(const QPen &pen)
QPen subTickPen() const
Definition qcustomplot.h:1321
QColor selectedLabelColor() const
Definition qcustomplot.h:1333
void setAutoTickCount(int approximateCount)
Q_SLOT void setSelectedParts(const QCPAxis::SelectableParts &selectedParts)
void setSelectedTickPen(const QPen &pen)
void setSelectedTickLabelFont(const QFont &font)
void setTickVector(const QVector< double > &vec)
SelectableParts selectedParts() const
Definition qcustomplot.h:1328
QPen getBasePen() const
QColor getTickLabelColor() const
double scaleLogBase() const
Definition qcustomplot.h:1291
void setTickVectorLabels(const QVector< QString > &vec)
double tickStep() const
Definition qcustomplot.h:1311
virtual QCP::Interaction selectionCategory() const
bool autoTickLabels() const
Definition qcustomplot.h:1296
void setAutoTickStep(bool on)
static Qt::Orientation orientation(AxisType type)
Definition qcustomplot.h:1417
void setSelectedTickLabelColor(const QColor &color)
QColor tickLabelColor() const
Definition qcustomplot.h:1304
QCPLineEnding upperEnding() const
static AxisType opposite(AxisType type)
void selectableChanged(const QCPAxis::SelectableParts &parts)
virtual void setupTickVectors()
QFont labelFont() const
Definition qcustomplot.h:1322
void setAutoTickLabels(bool on)
double basePow(double value) const
void rangeChanged(const QCPRange &newRange, const QCPRange &oldRange)
static AxisType marginSideToAxisType(QCP::MarginSide side)
QPen getSubTickPen() const
Q_SLOT void setSelectableParts(const QCPAxis::SelectableParts &selectableParts)
virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const
void setSubTickLength(int inside, int outside=0)
bool rangeReversed() const
Definition qcustomplot.h:1293
Qt::Orientation orientation() const
Definition qcustomplot.h:1404
int subTickCount() const
Definition qcustomplot.h:1316
SelectablePart
Definition qcustomplot.h:1271
const QCPRange range() const
Definition qcustomplot.h:1292
void setSubTickLengthIn(int inside)
Q_SLOT void setScaleType(QCPAxis::ScaleType type)
QList< QCPAbstractPlottable * > plottables() const
void setTicks(bool show)
int subTickLengthOut() const
LabelSide tickLabelSide() const
void setRangeUpper(double upper)
int tickLengthIn() const
void setRange(double position, double size, Qt::AlignmentFlag alignment)
ScaleType scaleType() const
Definition qcustomplot.h:1290
int tickLengthOut() const
QList< QCPGraph * > graphs() const
void setTickPen(const QPen &pen)
void setAutoSubTicks(bool on)
QVector< QString > tickVectorLabels() const
Definition qcustomplot.h:1313
QVector< double > tickVector() const
Definition qcustomplot.h:1312
AxisType
Definition qcustomplot.h:1211
bool autoSubTicks() const
Definition qcustomplot.h:1298
bool tickLabels() const
Definition qcustomplot.h:1300
void setNumberFormat(const QString &formatCode)
double baseLog(double value) const
void setAutoTicks(bool on)
QColor getLabelColor() const
Qt::TimeSpec dateTimeSpec() const
Definition qcustomplot.h:1308
QFont getLabelFont() const
void setSelectedBasePen(const QPen &pen)
void visibleTickBounds(int &lowIndex, int &highIndex) const
void setSubTickPen(const QPen &pen)
int offset() const
double coordToPixel(double value) const
void setTickLabelPadding(int padding)
void ticksRequest()
void setScaleRatio(const QCPAxis *otherAxis, double ratio=1.0)
void setTickStep(double step)
int subTickLengthIn() const
int tickLabelPadding() const
void setTickLengthIn(int inside)
void setRangeLower(double lower)
QPen getTickPen() const
QPen tickPen() const
Definition qcustomplot.h:1320
Definition qcustomplot.h:3222
QCPBarData(double key, double value)
Definition qcustomplot.h:3157
QCPBars * bars(int index) const
double getPixelSpacing(const QCPBars *bars, double keyCoord)
void remove(QCPBars *bars)
void setSpacingType(SpacingType spacingType)
void insert(int i, QCPBars *bars)
double spacing() const
Definition qcustomplot.h:3184
int size() const
Definition qcustomplot.h:3193
SpacingType
Definition qcustomplot.h:3170
QList< QCPBars * > bars() const
Definition qcustomplot.h:3191
void registerBars(QCPBars *bars)
void append(QCPBars *bars)
SpacingType spacingType() const
Definition qcustomplot.h:3183
double keyPixelOffset(const QCPBars *bars, double keyCoord)
QCPBarsGroup(QCustomPlot *parentPlot)
void setSpacing(double spacing)
bool isEmpty() const
Definition qcustomplot.h:3194
void unregisterBars(QCPBars *bars)
bool contains(QCPBars *bars) const
Definition qcustomplot.h:3196
Definition qcustomplot.h:3241
double getStackedBaseValue(double key, bool positive) const
void addData(const QCPBarData &data)
static void connectBars(QCPBars *lower, QCPBars *upper)
QCPBars * barBelow() const
Definition qcustomplot.h:3276
void addData(const QCPBarDataMap &dataMap)
void removeData(double fromKey, double toKey)
double baseValue() const
Definition qcustomplot.h:3275
QCPBarDataMap * data() const
Definition qcustomplot.h:3278
void addData(const QVector< double > &keys, const QVector< double > &values)
virtual void draw(QCPPainter *painter)
QPolygonF getBarPolygon(double key, double value) const
void setData(const QVector< double > &key, const QVector< double > &value)
WidthType widthType() const
Definition qcustomplot.h:3273
void setBaseValue(double baseValue)
QCPBarsGroup * barsGroup() const
Definition qcustomplot.h:3274
WidthType
Definition qcustomplot.h:3258
void addData(double key, double value)
void moveBelow(QCPBars *bars)
virtual QCPRange getValueRange(bool &foundRange, SignDomain inSignDomain=sdBoth) const
void removeData(double key)
void removeDataAfter(double key)
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
void removeDataBefore(double key)
void setData(QCPBarDataMap *data, bool copy=false)
QCPBars * barAbove() const
Definition qcustomplot.h:3277
void moveAbove(QCPBars *bars)
void getPixelWidth(double key, double &lower, double &upper) const
void setWidthType(WidthType widthType)
void getVisibleDataBounds(QCPBarDataMap::const_iterator &lower, QCPBarDataMap::const_iterator &upperEnd) const
virtual void clearData()
void setBarsGroup(QCPBarsGroup *barsGroup)
virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const
virtual QCPRange getKeyRange(bool &foundRange, SignDomain inSignDomain=sdBoth) const
void setWidth(double width)
Definition qcustomplot.h:2192
QRgb color(double position, const QCPRange &range, bool logarithmic=false)
void setLevelCount(int n)
bool periodic() const
Definition qcustomplot.h:2266
void updateColorBuffer()
void setPeriodic(bool enabled)
void setColorStopAt(double position, const QColor &color)
QMap< double, QColor > colorStops() const
Definition qcustomplot.h:2264
void setColorStops(const QMap< double, QColor > &colorStops)
void clearColorStops()
QCPColorGradient inverted() const
void loadPreset(GradientPreset preset)
void setColorInterpolation(ColorInterpolation interpolation)
void colorize(const double *data, const QCPRange &range, QRgb *scanLine, int n, int dataIndexFactor=1, bool logarithmic=false)
ColorInterpolation colorInterpolation() const
Definition qcustomplot.h:2265
int levelCount() const
Definition qcustomplot.h:2263
ColorInterpolation
Definition qcustomplot.h:2201
GradientPreset
Definition qcustomplot.h:2214
Definition qcustomplot.h:3423
void setKeyRange(const QCPRange &keyRange)
void setValueSize(int valueSize)
void setSize(int keySize, int valueSize)
QCPRange keyRange() const
Definition qcustomplot.h:3434
double data(double key, double value)
void fill(double z)
QCPColorMapData(const QCPColorMapData &other)
QCPRange valueRange() const
Definition qcustomplot.h:3435
int valueSize() const
Definition qcustomplot.h:3433
void setCell(int keyIndex, int valueIndex, double z)
QCPColorMapData(int keySize, int valueSize, const QCPRange &keyRange, const QCPRange &valueRange)
void setRange(const QCPRange &keyRange, const QCPRange &valueRange)
void recalculateDataBounds()
QCPRange dataBounds() const
Definition qcustomplot.h:3436
int keySize() const
Definition qcustomplot.h:3432
void setKeySize(int keySize)
void coordToCell(double key, double value, int *keyIndex, int *valueIndex) const
void setValueRange(const QCPRange &valueRange)
bool isEmpty() const
Definition qcustomplot.h:3454
void cellToCoord(int keyIndex, int valueIndex, double *key, double *value) const
double cell(int keyIndex, int valueIndex)
void setData(double key, double value, double z)
QCPColorMapData & operator=(const QCPColorMapData &other)
Definition qcustomplot.h:3473
QCPColorMapData * data() const
Definition qcustomplot.h:3491
QCPColorScale * colorScale() const
Definition qcustomplot.h:3497
virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const
virtual QCPRange getValueRange(bool &foundRange, SignDomain inSignDomain=sdBoth) const
bool interpolate() const
Definition qcustomplot.h:3494
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
Q_SLOT void setDataScaleType(QCPAxis::ScaleType scaleType)
void dataRangeChanged(QCPRange newRange)
void setInterpolate(bool enabled)
virtual void updateMapImage()
bool tightBoundary() const
Definition qcustomplot.h:3495
Q_SLOT void updateLegendIcon(Qt::TransformationMode transformMode=Qt::SmoothTransformation, const QSize &thumbSize=QSize(32, 18))
void setData(QCPColorMapData *data, bool copy=false)
virtual void clearData()
void rescaleDataRange(bool recalculateDataBounds=false)
void dataScaleTypeChanged(QCPAxis::ScaleType scaleType)
QCPColorMap(QCPAxis *keyAxis, QCPAxis *valueAxis)
void setColorScale(QCPColorScale *colorScale)
virtual QCPRange getKeyRange(bool &foundRange, SignDomain inSignDomain=sdBoth) const
QCPAxis::ScaleType dataScaleType() const
Definition qcustomplot.h:3493
void gradientChanged(QCPColorGradient newGradient)
QCPColorGradient gradient() const
Definition qcustomplot.h:3496
Q_SLOT void setGradient(const QCPColorGradient &gradient)
void setTightBoundary(bool enabled)
Q_SLOT void setDataRange(const QCPRange &dataRange)
QCPRange dataRange() const
Definition qcustomplot.h:3492
virtual void draw(QCPPainter *painter)
virtual ~QCPColorMap()
Definition qcustomplot.h:2708
virtual void draw(QCPPainter *painter)
bool mGradientImageInvalidated
Definition qcustomplot.h:2716
QCPColorScale * mParentColorScale
Definition qcustomplot.h:2714
Q_SLOT void axisSelectionChanged(QCPAxis::SelectableParts selectedParts)
Q_SLOT void axisSelectableChanged(QCPAxis::SelectableParts selectableParts)
QCPColorScaleAxisRectPrivate(QCPColorScale *parentColorScale)
QImage mGradientImage
Definition qcustomplot.h:2715
Definition qcustomplot.h:2732
virtual void update(UpdatePhase phase)
void setType(QCPAxis::AxisType type)
virtual void wheelEvent(QWheelEvent *event)
void setRangeDrag(bool enabled)
virtual void mouseMoveEvent(QMouseEvent *event)
void dataRangeChanged(QCPRange newRange)
bool rangeDrag() const
virtual ~QCPColorScale()
QCPColorGradient gradient() const
Definition qcustomplot.h:2756
QCPAxis * axis() const
Definition qcustomplot.h:2752
QString label() const
void rescaleDataRange(bool onlyVisibleMaps)
Q_SLOT void setGradient(const QCPColorGradient &gradient)
QCPRange dataRange() const
Definition qcustomplot.h:2754
QList< QCPColorMap * > colorMaps() const
void dataScaleTypeChanged(QCPAxis::ScaleType scaleType)
virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const
void gradientChanged(QCPColorGradient newGradient)
QCPAxis::AxisType type() const
Definition qcustomplot.h:2753
Q_SLOT void setDataScaleType(QCPAxis::ScaleType scaleType)
void setRangeZoom(bool enabled)
QCPColorScale(QCustomPlot *parentPlot)
void setBarWidth(int width)
Q_SLOT void setDataRange(const QCPRange &dataRange)
QCPAxis::ScaleType dataScaleType() const
Definition qcustomplot.h:2755
bool rangeZoom() const
int barWidth() const
Definition qcustomplot.h:2758
void setLabel(const QString &str)
virtual void mouseReleaseEvent(QMouseEvent *event)
virtual void mousePressEvent(QMouseEvent *event)
Definition qcustomplot.h:3037
QCPCurveData(double t, double key, double value)
Definition qcustomplot.h:3058
void removeDataAfter(double t)
LineStyle lineStyle() const
Definition qcustomplot.h:3081
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
QCPCurveDataMap * data() const
Definition qcustomplot.h:3079
void addData(double t, double key, double value)
virtual void draw(QCPPainter *painter)
LineStyle
Definition qcustomplot.h:3070
void addData(const QVector< double > &ts, const QVector< double > &keys, const QVector< double > &values)
virtual void drawScatterPlot(QCPPainter *painter, const QVector< QPointF > *pointData) const
QVector< QPointF > getOptimizedCornerPoints(int prevRegion, int currentRegion, double prevKey, double prevValue, double key, double value, double rectLeft, double rectTop, double rectRight, double rectBottom) const
void removeData(double t)
int getRegion(double x, double y, double rectLeft, double rectTop, double rectRight, double rectBottom) const
QCPCurve(QCPAxis *keyAxis, QCPAxis *valueAxis)
void getCurveData(QVector< QPointF > *lineData) const
void setLineStyle(LineStyle style)
void addData(const QCPCurveDataMap &dataMap)
void setScatterStyle(const QCPScatterStyle &style)
void getTraverseCornerPoints(int prevRegion, int currentRegion, double rectLeft, double rectTop, double rectRight, double rectBottom, QVector< QPointF > &beforeTraverse, QVector< QPointF > &afterTraverse) const
void setData(QCPCurveDataMap *data, bool copy=false)
virtual ~QCPCurve()
bool getTraverse(double prevKey, double prevValue, double key, double value, double rectLeft, double rectTop, double rectRight, double rectBottom, QPointF &crossA, QPointF &crossB) const
void setData(const QVector< double > &key, const QVector< double > &value)
virtual void clearData()
void addData(const QCPCurveData &data)
void removeData(double fromt, double tot)
void addData(double key, double value)
double pointDistance(const QPointF &pixelPoint) const
QPointF getOptimizedPoint(int prevRegion, double prevKey, double prevValue, double key, double value, double rectLeft, double rectTop, double rectRight, double rectBottom) const
virtual QCPRange getKeyRange(bool &foundRange, SignDomain inSignDomain=sdBoth) const
virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const
bool mayTraverse(int prevRegion, int currentRegion) const
void removeDataBefore(double t)
virtual QCPRange getValueRange(bool &foundRange, SignDomain inSignDomain=sdBoth) const
QCPScatterStyle scatterStyle() const
Definition qcustomplot.h:3080
void setData(const QVector< double > &t, const QVector< double > &key, const QVector< double > &value)
Definition qcustomplot.h:2812
QCPData(double key, double value)
Definition qcustomplot.h:3555
QCPFinancialData(double key, double open, double high, double low, double close)
Definition qcustomplot.h:3576
void removeData(double fromKey, double toKey)
virtual QCPRange getKeyRange(bool &foundRange, SignDomain inSignDomain=sdBoth) const
void removeDataBefore(double key)
ChartStyle
Definition qcustomplot.h:3593
double width() const
Definition qcustomplot.h:3606
void setTwoColored(bool twoColored)
void addData(const QCPFinancialDataMap &dataMap)
QPen penNegative() const
Definition qcustomplot.h:3611
virtual void clearData()
void addData(const QCPFinancialData &data)
void drawOhlcPlot(QCPPainter *painter, const QCPFinancialDataMap::const_iterator &begin, const QCPFinancialDataMap::const_iterator &end)
ChartStyle chartStyle() const
Definition qcustomplot.h:3605
void setChartStyle(ChartStyle style)
void setBrushPositive(const QBrush &brush)
void addData(double key, double open, double high, double low, double close)
double candlestickSelectTest(const QPointF &pos, const QCPFinancialDataMap::const_iterator &begin, const QCPFinancialDataMap::const_iterator &end) const
virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const
void drawCandlestickPlot(QCPPainter *painter, const QCPFinancialDataMap::const_iterator &begin, const QCPFinancialDataMap::const_iterator &end)
virtual QCPRange getValueRange(bool &foundRange, SignDomain inSignDomain=sdBoth) const
void setData(const QVector< double > &key, const QVector< double > &open, const QVector< double > &high, const QVector< double > &low, const QVector< double > &close)
void setBrushNegative(const QBrush &brush)
virtual void draw(QCPPainter *painter)
void setWidth(double width)
double ohlcSelectTest(const QPointF &pos, const QCPFinancialDataMap::const_iterator &begin, const QCPFinancialDataMap::const_iterator &end) const
void removeDataAfter(double key)
void addData(const QVector< double > &key, const QVector< double > &open, const QVector< double > &high, const QVector< double > &low, const QVector< double > &close)
void getVisibleDataBounds(QCPFinancialDataMap::const_iterator &lower, QCPFinancialDataMap::const_iterator &upper) const
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
void setPenPositive(const QPen &pen)
QBrush brushNegative() const
Definition qcustomplot.h:3609
void setData(QCPFinancialDataMap *data, bool copy=false)
void removeData(double key)
QPen penPositive() const
Definition qcustomplot.h:3610
QBrush brushPositive() const
Definition qcustomplot.h:3608
static QCPFinancialDataMap timeSeriesToOhlc(const QVector< double > &time, const QVector< double > &value, double timeBinSize, double timeBinOffset=0)
bool twoColored() const
Definition qcustomplot.h:3607
void setPenNegative(const QPen &pen)
Definition qcustomplot.h:2833
virtual QCPRange getValueRange(bool &foundRange, SignDomain inSignDomain=sdBoth) const
void rescaleKeyAxis(bool onlyEnlarge, bool includeErrorBars) const
void addData(double key, double value)
void setErrorBarSize(double size)
void setScatterStyle(const QCPScatterStyle &style)
bool adaptiveSampling() const
Definition qcustomplot.h:2902
virtual void clearData()
void setData(QCPDataMap *data, bool copy=false)
ErrorType errorType() const
Definition qcustomplot.h:2897
virtual QCPRange getKeyRange(bool &foundRange, SignDomain inSignDomain=sdBoth) const
void setChannelFillGraph(QCPGraph *targetGraph)
QCPScatterStyle scatterStyle() const
Definition qcustomplot.h:2896
void setDataValueError(const QVector< double > &key, const QVector< double > &value, const QVector< double > &valueErrorMinus, const QVector< double > &valueErrorPlus)
void removeData(double fromKey, double toKey)
void removeData(double key)
void setData(const QVector< double > &key, const QVector< double > &value)
void setLineStyle(LineStyle ls)
virtual void drawScatterPlot(QCPPainter *painter, QVector< QCPData > *scatterData) const
void getStepRightPlotData(QVector< QPointF > *linePixelData, QVector< QCPData > *scatterData) const
int findIndexBelowY(const QVector< QPointF > *data, double y) const
double errorBarSize() const
Definition qcustomplot.h:2899
void getPlotData(QVector< QPointF > *lineData, QVector< QCPData > *scatterData) const
virtual QCPRange getValueRange(bool &foundRange, SignDomain inSignDomain, bool includeErrors) const
void getScatterPlotData(QVector< QCPData > *scatterData) const
virtual QCPRange getKeyRange(bool &foundRange, SignDomain inSignDomain, bool includeErrors) const
void getLinePlotData(QVector< QPointF > *linePixelData, QVector< QCPData > *scatterData) const
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
QPointF upperFillBasePoint(double upperKey) const
void addData(const QCPData &data)
bool errorBarSkipSymbol() const
Definition qcustomplot.h:2900
void setDataBothError(const QVector< double > &key, const QVector< double > &value, const QVector< double > &keyError, const QVector< double > &valueError)
int findIndexAboveY(const QVector< QPointF > *data, double y) const
int findIndexBelowX(const QVector< QPointF > *data, double x) const
virtual void drawFill(QCPPainter *painter, QVector< QPointF > *lineData) const
void addFillBasePoints(QVector< QPointF > *lineData) const
void getStepLeftPlotData(QVector< QPointF > *linePixelData, QVector< QCPData > *scatterData) const
double pointDistance(const QPointF &pixelPoint) const
void rescaleAxes(bool onlyEnlarge, bool includeErrorBars) const
void rescaleValueAxis(bool onlyEnlarge, bool includeErrorBars) const
void removeDataBefore(double key)
virtual void drawLinePlot(QCPPainter *painter, QVector< QPointF > *lineData) const
void addData(const QCPDataMap &dataMap)
int findIndexAboveX(const QVector< QPointF > *data, double x) const
void getImpulsePlotData(QVector< QPointF > *linePixelData, QVector< QCPData > *scatterData) const
void setErrorBarSkipSymbol(bool enabled)
void setAdaptiveSampling(bool enabled)
void drawError(QCPPainter *painter, double x, double y, const QCPData &data) const
void addData(const QVector< double > &keys, const QVector< double > &values)
void getStepCenterPlotData(QVector< QPointF > *linePixelData, QVector< QCPData > *scatterData) const
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)
void setDataKeyError(const QVector< double > &key, const QVector< double > &value, const QVector< double > &keyError)
QPen errorPen() const
Definition qcustomplot.h:2898
void setErrorPen(const QPen &pen)
void getVisibleDataBounds(QCPDataMap::const_iterator &lower, QCPDataMap::const_iterator &upper) const
void setDataKeyError(const QVector< double > &key, const QVector< double > &value, const QVector< double > &keyErrorMinus, const QVector< double > &keyErrorPlus)
void setErrorType(ErrorType errorType)
LineStyle lineStyle() const
Definition qcustomplot.h:2895
void setDataValueError(const QVector< double > &key, const QVector< double > &value, const QVector< double > &valueError)
QCPDataMap * data() const
Definition qcustomplot.h:2894
QPointF lowerFillBasePoint(double lowerKey) const
ErrorType
Definition qcustomplot.h:2878
virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const
LineStyle
Definition qcustomplot.h:2854
virtual void drawImpulsePlot(QCPPainter *painter, QVector< QPointF > *lineData) const
const QPolygonF getChannelFillPolygon(const QVector< QPointF > *lineData) const
int countDataInBounds(const QCPDataMap::const_iterator &lower, const QCPDataMap::const_iterator &upper, int maxCount) const
void removeDataAfter(double key)
void getPreparedData(QVector< QCPData > *lineData, QVector< QCPData > *scatterData) const
QCPGraph * channelFillGraph() const
Definition qcustomplot.h:2901
virtual void draw(QCPPainter *painter)
void removeFillBasePoints(QVector< QPointF > *lineData) const
Definition qcustomplot.h:1087
QPen pen() const
Definition qcustomplot.h:1106
void setZeroLinePen(const QPen &pen)
void setAntialiasedZeroLine(bool enabled)
void setAntialiasedSubGrid(bool enabled)
bool antialiasedZeroLine() const
Definition qcustomplot.h:1105
void drawSubGridLines(QCPPainter *painter) const
QPen zeroLinePen() const
Definition qcustomplot.h:1108
void setSubGridPen(const QPen &pen)
void setPen(const QPen &pen)
QCPGrid(QCPAxis *parentAxis)
void setSubGridVisible(bool visible)
virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const
QPen subGridPen() const
Definition qcustomplot.h:1107
void drawGridLines(QCPPainter *painter) const
bool antialiasedSubGrid() const
Definition qcustomplot.h:1104
virtual void draw(QCPPainter *painter)
bool subGridVisible() const
Definition qcustomplot.h:1103
Definition qcustomplot.h:1724
virtual QPointF pixelPoint() const
virtual ~QCPItemAnchor()
void removeChildX(QCPItemPosition *pos)
void removeChildY(QCPItemPosition *pos)
QString name() const
Definition qcustomplot.h:1731
virtual QCPItemPosition * toQCPItemPosition()
Definition qcustomplot.h:1745
QCPItemAnchor(QCustomPlot *parentPlot, QCPAbstractItem *parentItem, const QString name, int anchorId=-1)
void addChildX(QCPItemPosition *pos)
void addChildY(QCPItemPosition *pos)
Definition qcustomplot.h:4206
void setSelectedPen(const QPen &pen)
QCPItemBracket(QCustomPlot *parentPlot)
BracketStyle style() const
Definition qcustomplot.h:4233
QPen pen() const
Definition qcustomplot.h:4230
void setStyle(BracketStyle style)
virtual QPointF anchorPixelPoint(int anchorId) const
BracketStyle
Definition qcustomplot.h:4215
AnchorIndex
Definition qcustomplot.h:4251
virtual void draw(QCPPainter *painter)
virtual ~QCPItemBracket()
void setPen(const QPen &pen)
void setLength(double length)
QPen mainPen() const
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
double length() const
Definition qcustomplot.h:4232
QPen selectedPen() const
Definition qcustomplot.h:4231
Definition qcustomplot.h:3772
void setPen(const QPen &pen)
void setHead(const QCPLineEnding &head)
void setSelectedPen(const QPen &pen)
QPen mainPen() const
QPen selectedPen() const
Definition qcustomplot.h:3786
QCPLineEnding head() const
Definition qcustomplot.h:3787
virtual void draw(QCPPainter *painter)
QCPLineEnding tail() const
Definition qcustomplot.h:3788
void setTail(const QCPLineEnding &tail)
QCPItemCurve(QCustomPlot *parentPlot)
QPen pen() const
Definition qcustomplot.h:3785
virtual ~QCPItemCurve()
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
Definition qcustomplot.h:3980
virtual ~QCPItemEllipse()
AnchorIndex
Definition qcustomplot.h:4021
void setBrush(const QBrush &brush)
QBrush mainBrush() const
virtual QPointF anchorPixelPoint(int anchorId) const
void setSelectedPen(const QPen &pen)
QCPItemEllipse(QCustomPlot *parentPlot)
QPen pen() const
Definition qcustomplot.h:3993
void setSelectedBrush(const QBrush &brush)
QPen selectedPen() const
Definition qcustomplot.h:3994
QPen mainPen() const
QBrush brush() const
Definition qcustomplot.h:3995
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
virtual void draw(QCPPainter *painter)
void setPen(const QPen &pen)
QBrush selectedBrush() const
Definition qcustomplot.h:3996
Definition qcustomplot.h:3727
virtual ~QCPItemLine()
QCPItemLine(QCustomPlot *parentPlot)
void setSelectedPen(const QPen &pen)
void setPen(const QPen &pen)
QCPLineEnding head() const
Definition qcustomplot.h:3742
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
QPen pen() const
Definition qcustomplot.h:3740
QCPLineEnding tail() const
Definition qcustomplot.h:3743
virtual void draw(QCPPainter *painter)
void setTail(const QCPLineEnding &tail)
QPen selectedPen() const
Definition qcustomplot.h:3741
QLineF getRectClippedLine(const QVector2D &start, const QVector2D &end, const QRect &rect) const
void setHead(const QCPLineEnding &head)
QPen mainPen() const
Definition qcustomplot.h:4046
AnchorIndex
Definition qcustomplot.h:4092
virtual ~QCPItemPixmap()
QPen selectedPen() const
Definition qcustomplot.h:4068
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
QRect getFinalRect(bool *flippedHorz=0, bool *flippedVert=0) const
Qt::AspectRatioMode aspectRatioMode() const
Definition qcustomplot.h:4063
QPen pen() const
Definition qcustomplot.h:4067
virtual QPointF anchorPixelPoint(int anchorId) const
void setPixmap(const QPixmap &pixmap)
QPixmap pixmap() const
Definition qcustomplot.h:4061
bool scaled() const
Definition qcustomplot.h:4062
void updateScaledPixmap(QRect finalRect=QRect(), bool flipHorz=false, bool flipVert=false)
QCPItemPixmap(QCustomPlot *parentPlot)
QPen mainPen() const
void setScaled(bool scaled, Qt::AspectRatioMode aspectRatioMode=Qt::KeepAspectRatio, Qt::TransformationMode transformationMode=Qt::SmoothTransformation)
Qt::TransformationMode transformationMode() const
Definition qcustomplot.h:4064
void setPen(const QPen &pen)
virtual void draw(QCPPainter *painter)
void setSelectedPen(const QPen &pen)
Definition qcustomplot.h:1763
QCPItemAnchor * parentAnchor() const
Definition qcustomplot.h:1805
void setAxisRect(QCPAxisRect *axisRect)
PositionType typeX() const
Definition qcustomplot.h:1803
void setTypeX(PositionType type)
void setAxes(QCPAxis *keyAxis, QCPAxis *valueAxis)
QCPItemPosition(QCustomPlot *parentPlot, QCPAbstractItem *parentItem, const QString name)
virtual QPointF pixelPoint() const
QCPItemAnchor * parentAnchorY() const
Definition qcustomplot.h:1807
double key() const
Definition qcustomplot.h:1808
virtual QCPItemPosition * toQCPItemPosition()
Definition qcustomplot.h:1841
void setType(PositionType type)
QPointF coords() const
Definition qcustomplot.h:1810
void setCoords(double key, double value)
QCPAxis * valueAxis() const
Definition qcustomplot.h:1812
PositionType
Definition qcustomplot.h:1771
void setPixelPoint(const QPointF &pixelPoint)
QCPAxis * keyAxis() const
Definition qcustomplot.h:1811
PositionType type() const
Definition qcustomplot.h:1802
bool setParentAnchor(QCPItemAnchor *parentAnchor, bool keepPixelPosition=false)
void setTypeY(PositionType type)
void setCoords(const QPointF &coords)
double value() const
Definition qcustomplot.h:1809
bool setParentAnchorY(QCPItemAnchor *parentAnchor, bool keepPixelPosition=false)
bool setParentAnchorX(QCPItemAnchor *parentAnchor, bool keepPixelPosition=false)
QCPAxisRect * axisRect() const
PositionType typeY() const
Definition qcustomplot.h:1804
virtual ~QCPItemPosition()
QCPItemAnchor * parentAnchorX() const
Definition qcustomplot.h:1806
Definition qcustomplot.h:3817
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
QBrush selectedBrush() const
Definition qcustomplot.h:3833
QPen pen() const
Definition qcustomplot.h:3830
QCPItemRect(QCustomPlot *parentPlot)
void setPen(const QPen &pen)
virtual void draw(QCPPainter *painter)
QBrush brush() const
Definition qcustomplot.h:3832
void setSelectedPen(const QPen &pen)
QBrush mainBrush() const
virtual QPointF anchorPixelPoint(int anchorId) const
virtual ~QCPItemRect()
void setBrush(const QBrush &brush)
void setSelectedBrush(const QBrush &brush)
QPen selectedPen() const
Definition qcustomplot.h:3831
AnchorIndex
Definition qcustomplot.h:3855
QPen mainPen() const
Definition qcustomplot.h:3686
double distToStraightLine(const QVector2D &point1, const QVector2D &vec, const QVector2D &point) const
QCPItemStraightLine(QCustomPlot *parentPlot)
virtual void draw(QCPPainter *painter)
QPen mainPen() const
void setSelectedPen(const QPen &pen)
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
void setPen(const QPen &pen)
QPen pen() const
Definition qcustomplot.h:3697
virtual ~QCPItemStraightLine()
QPen selectedPen() const
Definition qcustomplot.h:3698
QLineF getRectClippedStraightLine(const QVector2D &point1, const QVector2D &vec, const QRect &rect) const
Definition qcustomplot.h:3877
double rotation() const
Definition qcustomplot.h:3912
QColor color() const
Definition qcustomplot.h:3901
void setSelectedFont(const QFont &font)
Qt::Alignment positionAlignment() const
Definition qcustomplot.h:3910
AnchorIndex
Definition qcustomplot.h:3945
void setBrush(const QBrush &brush)
QBrush brush() const
Definition qcustomplot.h:3905
void setSelectedPen(const QPen &pen)
QPen mainPen() const
QBrush selectedBrush() const
Definition qcustomplot.h:3906
void setText(const QString &text)
QFont font() const
Definition qcustomplot.h:3907
void setRotation(double degrees)
QPointF getTextDrawPoint(const QPointF &pos, const QRectF &rect, Qt::Alignment positionAlignment) const
QMargins padding() const
Definition qcustomplot.h:3913
void setSelectedBrush(const QBrush &brush)
virtual QPointF anchorPixelPoint(int anchorId) const
QColor selectedColor() const
Definition qcustomplot.h:3902
QPen pen() const
Definition qcustomplot.h:3903
QFont selectedFont() const
Definition qcustomplot.h:3908
QCPItemText(QCustomPlot *parentPlot)
void setPositionAlignment(Qt::Alignment alignment)
QPen selectedPen() const
Definition qcustomplot.h:3904
void setFont(const QFont &font)
Qt::Alignment textAlignment() const
Definition qcustomplot.h:3911
void setPen(const QPen &pen)
void setColor(const QColor &color)
void setTextAlignment(Qt::Alignment alignment)
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
QColor mainColor() const
virtual void draw(QCPPainter *painter)
QBrush mainBrush() const
QString text() const
Definition qcustomplot.h:3909
virtual ~QCPItemText()
void setSelectedColor(const QColor &color)
void setPadding(const QMargins &padding)
QFont mainFont() const
Definition qcustomplot.h:4121
void setSelectedBrush(const QBrush &brush)
void setBrush(const QBrush &brush)
TracerStyle
Definition qcustomplot.h:4141
void setStyle(TracerStyle style)
double size() const
Definition qcustomplot.h:4162
virtual void draw(QCPPainter *painter)
void updatePosition()
QCPGraph * graph() const
Definition qcustomplot.h:4164
void setGraphKey(double key)
void setInterpolating(bool enabled)
QBrush brush() const
Definition qcustomplot.h:4160
QBrush mainBrush() const
QPen mainPen() const
double graphKey() const
Definition qcustomplot.h:4165
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
QPen selectedPen() const
Definition qcustomplot.h:4159
void setSelectedPen(const QPen &pen)
QBrush selectedBrush() const
Definition qcustomplot.h:4161
void setSize(double size)
bool interpolating() const
Definition qcustomplot.h:4166
void setGraph(QCPGraph *graph)
void setPen(const QPen &pen)
TracerStyle style() const
Definition qcustomplot.h:4163
Definition qcustomplot.h:480
QList< QCPLayerable * > children() const
Definition qcustomplot.h:497
QString name() const
Definition qcustomplot.h:495
void addChild(QCPLayerable *layerable, bool prepend)
QCPLayer(QCustomPlot *parentPlot, const QString &layerName)
QCustomPlot * parentPlot() const
Definition qcustomplot.h:494
void setVisible(bool visible)
void removeChild(QCPLayerable *layerable)
bool visible() const
Definition qcustomplot.h:498
int index() const
Definition qcustomplot.h:496
Definition qcustomplot.h:522
virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged)
virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const =0
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
QCustomPlot * parentPlot() const
Definition qcustomplot.h:538
void setVisible(bool on)
void setAntialiased(bool enabled)
bool antialiased() const
Definition qcustomplot.h:541
QCPLayerable(QCustomPlot *plot, QString targetLayer=QString(), QCPLayerable *parentLayerable=0)
virtual void deselectEvent(bool *selectionStateChanged)
void initializeParentPlot(QCustomPlot *parentPlot)
QCPLayer * layer() const
Definition qcustomplot.h:540
void setParentLayerable(QCPLayerable *parentLayerable)
QCPLayerable * parentLayerable() const
Definition qcustomplot.h:539
bool realVisibility() const
bool setLayer(const QString &layerName)
void layerChanged(QCPLayer *newLayer)
virtual void parentPlotInitialized(QCustomPlot *parentPlot)
void applyAntialiasingHint(QCPPainter *painter, bool localAntialiased, QCP::AntialiasedElement overrideElement) const
virtual void draw(QCPPainter *painter)=0
virtual QCP::Interaction selectionCategory() const
Q_SLOT bool setLayer(QCPLayer *layer)
bool visible() const
Definition qcustomplot.h:537
bool moveToLayer(QCPLayer *layer, bool prepend)
virtual QRect clipRect() const
Definition qcustomplot.h:755
virtual void mousePressEvent(QMouseEvent *event)
Definition qcustomplot.h:835
void setMaximumSize(int width, int height)
void setMinimumMargins(const QMargins &margins)
UpdatePhase
Definition qcustomplot.h:772
virtual void mouseMoveEvent(QMouseEvent *event)
Definition qcustomplot.h:836
QRect rect() const
Definition qcustomplot.h:788
QCP::MarginSides autoMargins() const
Definition qcustomplot.h:792
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
QRect outerRect() const
Definition qcustomplot.h:789
virtual void mouseReleaseEvent(QMouseEvent *event)
Definition qcustomplot.h:837
void setOuterRect(const QRect &rect)
void setMarginGroup(QCP::MarginSides sides, QCPMarginGroup *group)
virtual void draw(QCPPainter *painter)
Definition qcustomplot.h:845
virtual void parentPlotInitialized(QCustomPlot *parentPlot)
void setMinimumSize(const QSize &size)
QMargins minimumMargins() const
Definition qcustomplot.h:791
QSize minimumSize() const
Definition qcustomplot.h:793
void setMaximumSize(const QSize &size)
virtual int calculateAutoMargin(QCP::MarginSide side)
virtual void mouseDoubleClickEvent(QMouseEvent *event)
Definition qcustomplot.h:838
void setMinimumSize(int width, int height)
void setMargins(const QMargins &margins)
virtual QSize maximumSizeHint() const
QCPMarginGroup * marginGroup(QCP::MarginSide side) const
Definition qcustomplot.h:795
virtual QSize minimumSizeHint() const
void setAutoMargins(QCP::MarginSides sides)
QHash< QCP::MarginSide, QCPMarginGroup * > marginGroups() const
Definition qcustomplot.h:798
virtual void wheelEvent(QWheelEvent *event)
Definition qcustomplot.h:839
virtual void update(UpdatePhase phase)
virtual QList< QCPLayoutElement * > elements(bool recursive) const
virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const
Definition qcustomplot.h:842
QMargins margins() const
Definition qcustomplot.h:790
QSize maximumSize() const
Definition qcustomplot.h:794
Definition qcustomplot.h:894
virtual void simplify()
virtual bool take(QCPLayoutElement *element)
int rowCount() const
int columnCount() const
void insertColumn(int newIndex)
void setRowStretchFactors(const QList< double > &factors)
virtual int elementCount() const
QList< double > rowStretchFactors() const
Definition qcustomplot.h:914
void setColumnSpacing(int pixels)
virtual QSize minimumSizeHint() const
void insertRow(int newIndex)
void getMinimumRowColSizes(QVector< int > *minColWidths, QVector< int > *minRowHeights) const
virtual QSize maximumSizeHint() const
int rowSpacing() const
Definition qcustomplot.h:916
QCPLayoutElement * element(int row, int column) const
void setColumnStretchFactors(const QList< double > &factors)
void setRowStretchFactor(int row, double factor)
QList< double > columnStretchFactors() const
Definition qcustomplot.h:913
void expandTo(int newRowCount, int newColumnCount)
virtual QList< QCPLayoutElement * > elements(bool recursive) const
virtual void updateLayout()
void getMaximumRowColSizes(QVector< int > *maxColWidths, QVector< int > *maxRowHeights) const
void setRowSpacing(int pixels)
bool hasElement(int row, int column)
virtual QCPLayoutElement * takeAt(int index)
virtual QCPLayoutElement * elementAt(int index) const
virtual ~QCPLayoutGrid()
int columnSpacing() const
Definition qcustomplot.h:915
bool addElement(int row, int column, QCPLayoutElement *element)
void setColumnStretchFactor(int column, double factor)
Definition qcustomplot.h:962
virtual bool take(QCPLayoutElement *element)
virtual int elementCount() const
virtual void updateLayout()
virtual ~QCPLayoutInset()
virtual QCPLayoutElement * elementAt(int index) const
virtual void simplify()
Definition qcustomplot.h:996
Qt::Alignment insetAlignment(int index) const
void setInsetAlignment(int index, Qt::Alignment alignment)
void setInsetPlacement(int index, InsetPlacement placement)
virtual QCPLayoutElement * takeAt(int index)
InsetPlacement
Definition qcustomplot.h:969
void addElement(QCPLayoutElement *element, const QRectF &rect)
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
void setInsetRect(int index, const QRectF &rect)
QRectF insetRect(int index) const
void addElement(QCPLayoutElement *element, Qt::Alignment alignment)
InsetPlacement insetPlacement(int index) const
Definition qcustomplot.h:856
void clear()
virtual QList< QCPLayoutElement * > elements(bool recursive) const
bool removeAt(int index)
QVector< int > getSectionSizes(QVector< int > maxSizes, QVector< int > minSizes, QVector< double > stretchFactors, int totalSize) const
void releaseElement(QCPLayoutElement *el)
virtual void update(UpdatePhase phase)
bool remove(QCPLayoutElement *element)
virtual QCPLayoutElement * takeAt(int index)=0
virtual QCPLayoutElement * elementAt(int index) const =0
virtual int elementCount() const =0
virtual bool take(QCPLayoutElement *element)=0
virtual void simplify()
void sizeConstraintsChanged() const
void adoptElement(QCPLayoutElement *el)
virtual void updateLayout()
Definition qcustomplot.h:2500
int iconTextPadding() const
Definition qcustomplot.h:2549
QPen getBorderPen() const
void clearItems()
bool removeItem(QCPAbstractLegendItem *item)
SelectableParts selectedParts() const
void setSelectedBorderPen(const QPen &pen)
void setIconBorderPen(const QPen &pen)
bool addItem(QCPAbstractLegendItem *item)
Q_SLOT void setSelectableParts(const SelectableParts &selectableParts)
QFont selectedFont() const
Definition qcustomplot.h:2556
virtual void parentPlotInitialized(QCustomPlot *parentPlot)
virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const
void setBrush(const QBrush &brush)
bool hasItemWithPlottable(const QCPAbstractPlottable *plottable) const
SelectablePart
Definition qcustomplot.h:2529
virtual void draw(QCPPainter *painter)
int itemCount() const
QPen iconBorderPen() const
Definition qcustomplot.h:2550
void setIconTextPadding(int padding)
void setSelectedTextColor(const QColor &color)
QBrush selectedBrush() const
Definition qcustomplot.h:2555
virtual QCP::Interaction selectionCategory() const
void selectionChanged(QCPLegend::SelectableParts parts)
void setBorderPen(const QPen &pen)
void setSelectedBrush(const QBrush &brush)
void selectableChanged(QCPLegend::SelectableParts parts)
void setIconSize(const QSize &size)
QCPPlottableLegendItem * itemWithPlottable(const QCPAbstractPlottable *plottable) const
Q_SLOT void setSelectedParts(const SelectableParts &selectedParts)
void setIconSize(int width, int height)
void setFont(const QFont &font)
QColor textColor() const
Definition qcustomplot.h:2547
QBrush brush() const
Definition qcustomplot.h:2545
QBrush getBrush() const
void setSelectedFont(const QFont &font)
QColor selectedTextColor() const
Definition qcustomplot.h:2557
virtual void deselectEvent(bool *selectionStateChanged)
QList< QCPAbstractLegendItem * > selectedItems() const
bool removeItem(int index)
QCPAbstractLegendItem * item(int index) const
SelectableParts selectableParts() const
Definition qcustomplot.h:2551
bool hasItem(QCPAbstractLegendItem *item) const
virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged)
QPen selectedIconBorderPen() const
Definition qcustomplot.h:2554
QPen selectedBorderPen() const
Definition qcustomplot.h:2553
void setSelectedIconBorderPen(const QPen &pen)
void setTextColor(const QColor &color)
QFont font() const
Definition qcustomplot.h:2546
QSize iconSize() const
Definition qcustomplot.h:2548
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
Definition qcustomplot.h:1015
EndingStyle style() const
Definition qcustomplot.h:1061
void draw(QCPPainter *painter, const QVector2D &pos, const QVector2D &dir) const
double boundingDistance() const
bool inverted() const
Definition qcustomplot.h:1064
void setWidth(double width)
void setStyle(EndingStyle style)
void setInverted(bool inverted)
EndingStyle
Definition qcustomplot.h:1032
void draw(QCPPainter *painter, const QVector2D &pos, double angle) const
QCPLineEnding(EndingStyle style, double width=8, double length=10, bool inverted=false)
double realLength() const
void setLength(double length)
double width() const
Definition qcustomplot.h:1062
double length() const
Definition qcustomplot.h:1063
Definition qcustomplot.h:726
void removeChild(QCP::MarginSide side, QCPLayoutElement *element)
QCPMarginGroup(QCustomPlot *parentPlot)
QList< QCPLayoutElement * > elements(QCP::MarginSide side) const
Definition qcustomplot.h:733
void addChild(QCP::MarginSide side, QCPLayoutElement *element)
bool isEmpty() const
int commonMargin(QCP::MarginSide side) const
Definition qcustomplot.h:414
bool begin(QPaintDevice *device)
void drawLine(const QLineF &line)
PainterMode
Definition qcustomplot.h:422
void setPen(Qt::PenStyle penStyle)
void setPen(const QColor &color)
void setModes(PainterModes modes)
void restore()
void makeNonCosmetic()
void save()
void setAntialiasing(bool enabled)
void drawLine(const QPointF &p1, const QPointF &p2)
Definition qcustomplot.h:461
PainterModes modes() const
Definition qcustomplot.h:448
void setMode(PainterMode mode, bool enabled=true)
void setPen(const QPen &pen)
Definition qcustomplot.h:2635
void setSelectedTextColor(const QColor &color)
void setFont(const QFont &font)
QColor textColor() const
Definition qcustomplot.h:2656
QFont font() const
Definition qcustomplot.h:2655
virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged)
void selectionChanged(bool selected)
QFont selectedFont() const
Definition qcustomplot.h:2657
virtual QSize maximumSizeHint() const
void setSelectedFont(const QFont &font)
QFont mainFont() const
void selectableChanged(bool selectable)
Q_SLOT void setSelected(bool selected)
bool selected() const
Definition qcustomplot.h:2660
void setTextColor(const QColor &color)
Q_SLOT void setSelectable(bool selectable)
virtual QSize minimumSizeHint() const
QCPPlotTitle(QCustomPlot *parentPlot, const QString &text)
QCPPlotTitle(QCustomPlot *parentPlot)
void setText(const QString &text)
QColor mainTextColor() const
QString text() const
Definition qcustomplot.h:2654
bool selectable() const
Definition qcustomplot.h:2659
virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const
virtual void deselectEvent(bool *selectionStateChanged)
QColor selectedTextColor() const
Definition qcustomplot.h:2658
virtual void draw(QCPPainter *painter)
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
Definition qcustomplot.h:2478
virtual QSize minimumSizeHint() const
virtual void draw(QCPPainter *painter)
QColor getTextColor() const
QFont getFont() const
QCPAbstractPlottable * plottable()
Definition qcustomplot.h:2484
QCPPlottableLegendItem(QCPLegend *parent, QCPAbstractPlottable *plottable)
QPen getIconBorderPen() const
Definition qcustomplot.h:593
void expand(const QCPRange &otherRange)
QCPRange(double lower, double upper)
static bool validRange(const QCPRange &range)
QCPRange sanitizedForLogScale() const
bool operator!=(const QCPRange &other) const
Definition qcustomplot.h:603
static bool validRange(double lower, double upper)
QCPRange & operator/=(const double &value)
Definition qcustomplot.h:620
double size() const
QCPRange & operator*=(const double &value)
Definition qcustomplot.h:615
QCPRange sanitizedForLinScale() const
QCPRange & operator-=(const double &value)
Definition qcustomplot.h:610
QCPRange expanded(const QCPRange &otherRange) const
bool operator==(const QCPRange &other) const
Definition qcustomplot.h:600
double lower
Definition qcustomplot.h:595
double upper
Definition qcustomplot.h:595
bool contains(double value) const
double center() const
void normalize()
QCPRange & operator+=(const double &value)
Definition qcustomplot.h:605
Definition qcustomplot.h:305
QCPScatterStyle(ScatterShape shape, double size=6)
double size() const
Definition qcustomplot.h:378
void drawShape(QCPPainter *painter, QPointF pos) const
bool isPenDefined() const
Definition qcustomplot.h:395
void setPixmap(const QPixmap &pixmap)
QCPScatterStyle(const QPixmap &pixmap)
QCPScatterStyle(ScatterShape shape, const QColor &color, const QColor &fill, double size)
bool isNone() const
Definition qcustomplot.h:394
void setBrush(const QBrush &brush)
void setPen(const QPen &pen)
void setShape(ScatterShape shape)
QCPScatterStyle(ScatterShape shape, const QPen &pen, const QBrush &brush, double size)
QCPScatterStyle(const QPainterPath &customPath, const QPen &pen, const QBrush &brush=Qt::NoBrush, double size=6)
void drawShape(QCPPainter *painter, double x, double y) const
void setCustomPath(const QPainterPath &customPath)
QPixmap pixmap() const
Definition qcustomplot.h:382
void setSize(double size)
QPen pen() const
Definition qcustomplot.h:380
ScatterShape
Definition qcustomplot.h:317
QBrush brush() const
Definition qcustomplot.h:381
QPainterPath customPath() const
Definition qcustomplot.h:383
ScatterShape shape() const
Definition qcustomplot.h:379
QCPScatterStyle(ScatterShape shape, const QColor &color, double size)
void applyTo(QCPPainter *painter, const QPen &defaultPen) const
Definition qcustomplot.h:3337
double key() const
Definition qcustomplot.h:3359
virtual QCPRange getKeyRange(bool &foundRange, SignDomain inSignDomain=sdBoth) const
void setWidth(double width)
virtual QCPRange getValueRange(bool &foundRange, SignDomain inSignDomain=sdBoth) const
QPen whiskerBarPen() const
Definition qcustomplot.h:3369
void setWhiskerPen(const QPen &pen)
double maximum() const
Definition qcustomplot.h:3364
void setMedian(double value)
void setUpperQuartile(double value)
QPen whiskerPen() const
Definition qcustomplot.h:3368
void setLowerQuartile(double value)
void setMedianPen(const QPen &pen)
QCPStatisticalBox(QCPAxis *keyAxis, QCPAxis *valueAxis)
virtual void clearData()
virtual void drawOutliers(QCPPainter *painter) const
void setKey(double key)
void setMinimum(double value)
QVector< double > outliers() const
Definition qcustomplot.h:3365
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
virtual void drawMedian(QCPPainter *painter) const
void setWhiskerBarPen(const QPen &pen)
double whiskerWidth() const
Definition qcustomplot.h:3367
double minimum() const
Definition qcustomplot.h:3360
double median() const
Definition qcustomplot.h:3362
void setMaximum(double value)
void setOutlierStyle(const QCPScatterStyle &style)
void setWhiskerWidth(double width)
void setData(double key, double minimum, double lowerQuartile, double median, double upperQuartile, double maximum)
double width() const
Definition qcustomplot.h:3366
virtual void drawWhiskers(QCPPainter *painter) const
virtual void drawQuartileBox(QCPPainter *painter, QRectF *quartileBox=0) const
QCPScatterStyle outlierStyle() const
Definition qcustomplot.h:3371
QPen medianPen() const
Definition qcustomplot.h:3370
virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const
void setOutliers(const QVector< double > &values)
virtual void draw(QCPPainter *painter)
double lowerQuartile() const
Definition qcustomplot.h:3361
double upperQuartile() const
Definition qcustomplot.h:3363
Definition qcustomplot.h:1925
void legendDoubleClick(QCPLegend *legend, QCPAbstractLegendItem *item, QMouseEvent *event)
QCPLayer * currentLayer() const
void drawBackground(QCPPainter *painter)
QCPLayer * layer(const QString &name) const
void beforeReplot()
QCPLayerable * layerableAt(const QPointF &pos, bool onlySelectable, QVariant *selectionDetails=0) const
QList< QCPAxisRect * > axisRects() const
QCPAbstractItem * item() const
void setBackground(const QPixmap &pm)
int itemCount() const
QRect viewport() const
Definition qcustomplot.h:1980
void toPainter(QCPPainter *painter, int width=0, int height=0)
void titleClick(QMouseEvent *event, QCPPlotTitle *title)
bool setCurrentLayer(QCPLayer *layer)
virtual void legendRemoved(QCPLegend *legend)
Qt::KeyboardModifier multiSelectModifier() const
Definition qcustomplot.h:1998
const QCP::Interactions interactions() const
Definition qcustomplot.h:1994
QCPAbstractPlottable * plottable(int index)
void setBackgroundScaled(bool scaled)
Q_SLOT void deselectAll()
void setPlottingHint(QCP::PlottingHint hint, bool enabled=true)
virtual void mouseDoubleClickEvent(QMouseEvent *event)
void setViewport(const QRect &rect)
bool removeLayer(QCPLayer *layer)
void setInteraction(const QCP::Interaction &interaction, bool enabled=true)
virtual void mousePressEvent(QMouseEvent *event)
QCustomPlot(QWidget *parent=0)
RefreshPriority
Definition qcustomplot.h:1963
@ rpHint
Definition qcustomplot.h:1971
bool saveJpg(const QString &fileName, int width=0, int height=0, double scale=1.0, int quality=-1)
void setBackgroundScaledMode(Qt::AspectRatioMode mode)
void setSelectionTolerance(int pixels)
void selectionChangedByUser()
int selectionTolerance() const
Definition qcustomplot.h:1995
virtual void paintEvent(QPaintEvent *event)
void plottableClick(QCPAbstractPlottable *plottable, QMouseEvent *event)
QPixmap background() const
Definition qcustomplot.h:1981
int graphCount() const
void setInteractions(const QCP::Interactions &interactions)
int plottableCount() const
virtual void mouseReleaseEvent(QMouseEvent *event)
QCP::AntialiasedElements antialiasedElements() const
Definition qcustomplot.h:1987
bool savePdf(const QString &fileName, bool noCosmeticPen=false, int width=0, int height=0, const QString &pdfCreator=QString(), const QString &pdfTitle=QString())
bool saveBmp(const QString &fileName, int width=0, int height=0, double scale=1.0)
void axisDoubleClick(QCPAxis *axis, QCPAxis::SelectablePart part, QMouseEvent *event)
virtual ~QCustomPlot()
QCPGraph * graph(int index) const
void afterReplot()
QCPGraph * addGraph(QCPAxis *keyAxis=0, QCPAxis *valueAxis=0)
virtual QSize sizeHint() const
bool hasPlottable(QCPAbstractPlottable *plottable) const
bool setCurrentLayer(const QString &name)
virtual QSize minimumSizeHint() const
void mouseMove(QMouseEvent *event)
QList< QCPAbstractPlottable * > selectedPlottables() const
QCP::AntialiasedElements notAntialiasedElements() const
Definition qcustomplot.h:1990
LayerInsertMode
Definition qcustomplot.h:1950
bool savePng(const QString &fileName, int width=0, int height=0, double scale=1.0, int quality=-1)
void setNoAntialiasingOnDrag(bool enabled)
void legendClick(QCPLegend *legend, QCPAbstractLegendItem *item, QMouseEvent *event)
virtual void wheelEvent(QWheelEvent *event)
QList< QCPAxis * > selectedAxes() const
void updateLayerIndices() const
void setBackground(const QPixmap &pm, bool scaled, Qt::AspectRatioMode mode=Qt::KeepAspectRatioByExpanding)
Q_SLOT void rescaleAxes(bool onlyVisiblePlottables=false)
void setBackground(const QBrush &brush)
virtual void draw(QCPPainter *painter)
int axisRectCount() const
void setMultiSelectModifier(Qt::KeyboardModifier modifier)
virtual void mouseMoveEvent(QMouseEvent *event)
bool removeGraph(QCPGraph *graph)
void setPlottingHints(const QCP::PlottingHints &hints)
bool removeGraph(int index)
int clearPlottables()
void mouseDoubleClick(QMouseEvent *event)
bool addItem(QCPAbstractItem *item)
QPixmap toPixmap(int width=0, int height=0, double scale=1.0)
QCPGraph * graph() const
bool backgroundScaled() const
Definition qcustomplot.h:1982
int clearGraphs()
bool saveRastered(const QString &fileName, int width, int height, double scale, const char *format, int quality=-1)
Q_SLOT void replot(QCustomPlot::RefreshPriority refreshPriority=QCustomPlot::rpHint)
bool addPlottable(QCPAbstractPlottable *plottable)
bool removeItem(int index)
int clearItems()
void axisClick(QCPAxis *axis, QCPAxis::SelectablePart part, QMouseEvent *event)
QCPAbstractItem * item(int index) const
QCPAbstractItem * itemAt(const QPointF &pos, bool onlySelectable=false) const
virtual void resizeEvent(QResizeEvent *event)
bool autoAddPlottableToLegend() const
Definition qcustomplot.h:1993
QCP::PlottingHints plottingHints() const
Definition qcustomplot.h:1997
void mouseWheel(QWheelEvent *event)
void itemDoubleClick(QCPAbstractItem *item, QMouseEvent *event)
QList< QCPLegend * > selectedLegends() const
void mouseRelease(QMouseEvent *event)
bool noAntialiasingOnDrag() const
Definition qcustomplot.h:1996
virtual void axisRemoved(QCPAxis *axis)
void mousePress(QMouseEvent *event)
QCPLayer * layer(int index) const
QCPAbstractPlottable * plottableAt(const QPointF &pos, bool onlySelectable=false) const
QList< QCPGraph * > selectedGraphs() const
void titleDoubleClick(QMouseEvent *event, QCPPlotTitle *title)
bool addLayer(const QString &name, QCPLayer *otherLayer=0, LayerInsertMode insertMode=limAbove)
void setAutoAddPlottableToLegend(bool on)
QCPAbstractPlottable * plottable()
bool removeItem(QCPAbstractItem *item)
void setNotAntialiasedElements(const QCP::AntialiasedElements &notAntialiasedElements)
void itemClick(QCPAbstractItem *item, QMouseEvent *event)
QCPAxisRect * axisRect(int index=0) const
bool moveLayer(QCPLayer *layer, QCPLayer *otherLayer, LayerInsertMode insertMode=limAbove)
void setAntialiasedElement(QCP::AntialiasedElement antialiasedElement, bool enabled=true)
bool hasItem(QCPAbstractItem *item) const
QCPLayoutGrid * plotLayout() const
Definition qcustomplot.h:1986
void plottableDoubleClick(QCPAbstractPlottable *plottable, QMouseEvent *event)
bool removePlottable(QCPAbstractPlottable *plottable)
void setAntialiasedElements(const QCP::AntialiasedElements &antialiasedElements)
Qt::AspectRatioMode backgroundScaledMode() const
Definition qcustomplot.h:1983
int layerCount() const
QCPLayoutElement * layoutElementAt(const QPointF &pos) const
bool removePlottable(int index)
void setNotAntialiasedElement(QCP::AntialiasedElement notAntialiasedElement, bool enabled=true)
QList< QCPAbstractItem * > selectedItems() const
Definition qcustomplot.h:94
bool isInvalidData(double value)
Definition qcustomplot.h:234
int getMarginValue(const QMargins &margins, QCP::MarginSide side)
Definition qcustomplot.h:282
Interaction
Definition qcustomplot.h:195
@ iRangeDrag
Definition qcustomplot.h:196
@ iSelectItems
Definition qcustomplot.h:218
@ iSelectLegend
Definition qcustomplot.h:215
@ iSelectOther
Definition qcustomplot.h:221
@ iSelectAxes
Definition qcustomplot.h:212
@ iSelectPlottables
Definition qcustomplot.h:208
@ iMultiSelect
Definition qcustomplot.h:204
@ iRangeZoom
Definition qcustomplot.h:200
PlottingHint
Definition qcustomplot.h:166
@ phFastPolylines
Definition qcustomplot.h:169
@ phForceRepaint
Definition qcustomplot.h:175
@ phCacheLabels
Definition qcustomplot.h:183
@ phNone
0x000 No hints are set
Definition qcustomplot.h:167
MarginSide
Definition qcustomplot.h:100
@ msTop
0x04 top margin
Definition qcustomplot.h:105
@ msNone
0x00 no margin
Definition qcustomplot.h:111
@ msRight
0x02 right margin
Definition qcustomplot.h:103
@ msAll
0xFF all margins
Definition qcustomplot.h:109
@ msLeft
0x01 left margin
Definition qcustomplot.h:101
@ msBottom
0x08 bottom margin
Definition qcustomplot.h:107
AntialiasedElement
Definition qcustomplot.h:126
@ aeAxes
0x0001 Axis base line and tick marks
Definition qcustomplot.h:127
@ aeItems
0x0040 Main lines of items
Definition qcustomplot.h:141
@ aeScatters
Definition qcustomplot.h:143
@ aeLegendItems
0x0010 Legend items
Definition qcustomplot.h:135
@ aePlottables
0x0020 Main lines of plottables
Definition qcustomplot.h:137
@ aeNone
0x0000 No elements
Definition qcustomplot.h:156
@ aeSubGrid
0x0004 Sub grid lines
Definition qcustomplot.h:131
@ aeFills
Definition qcustomplot.h:148
@ aeErrorBars
0x0100 Error bars
Definition qcustomplot.h:146
@ aeAll
0xFFFF All elements
Definition qcustomplot.h:154
@ aeGrid
0x0002 Grid lines
Definition qcustomplot.h:129
@ aeZeroLine
0x0400 Zero-lines, see QCPGrid::setZeroLinePen
Definition qcustomplot.h:151
@ aeLegend
0x0008 Legend box
Definition qcustomplot.h:133
void setMarginValue(QMargins &margins, QCP::MarginSide side, int value)
Definition qcustomplot.h:253
const QCPRange operator/(const QCPRange &range, double value)
Definition qcustomplot.h:720
const QCPRange operator*(const QCPRange &range, double value)
Definition qcustomplot.h:702
#define QCP_LIB_DECL
Definition qcustomplot.h:87
const QCPRange operator-(const QCPRange &range, double value)
Definition qcustomplot.h:693
Q_DECLARE_TYPEINFO(QCPScatterStyle, Q_MOVABLE_TYPE)
const QCPRange operator+(const QCPRange &range, double value)
Definition qcustomplot.h:675
QMapIterator< double, QCPData > QCPDataMapIterator
Definition qcustomplot.h:2830
QMap< double, QCPData > QCPDataMap
Definition qcustomplot.h:2829
QMap< double, QCPCurveData > QCPCurveDataMap
Definition qcustomplot.h:3053
QMutableMapIterator< double, QCPData > QCPDataMutableMapIterator
Definition qcustomplot.h:2831
QMutableMapIterator< double, QCPBarData > QCPBarDataMutableMapIterator
Definition qcustomplot.h:3239
QMap< double, QCPFinancialData > QCPFinancialDataMap
Definition qcustomplot.h:3571
QMap< double, QCPBarData > QCPBarDataMap
Definition qcustomplot.h:3237
QMutableMapIterator< double, QCPFinancialData > QCPFinancialDataMutableMapIterator
Definition qcustomplot.h:3574
QMapIterator< double, QCPFinancialData > QCPFinancialDataMapIterator
Definition qcustomplot.h:3572
QMutableMapIterator< double, QCPCurveData > QCPCurveDataMutableMapIterator
Definition qcustomplot.h:3056
QMapIterator< double, QCPBarData > QCPBarDataMapIterator
Definition qcustomplot.h:3238
QMapIterator< double, QCPCurveData > QCPCurveDataMapIterator
Definition qcustomplot.h:3054
QPixmap pixmap
Definition qcustomplot.h:1568
QPointF offset
Definition qcustomplot.h:1567
Definition qcustomplot.h:1570
QString expPart
Definition qcustomplot.h:1571
QFont baseFont
Definition qcustomplot.h:1573
QRect expBounds
Definition qcustomplot.h:1572
QRect rotatedTotalBounds
Definition qcustomplot.h:1572
QRect baseBounds
Definition qcustomplot.h:1572
QString basePart
Definition qcustomplot.h:1571
QFont expFont
Definition qcustomplot.h:1573
QRect totalBounds
Definition qcustomplot.h:1572