35 #include <QPaintEvent> 36 #include <QMouseEvent> 50 #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) 51 # include <qnumeric.h> 53 # include <QPrintEngine> 56 # include <QtPrintSupport> 84 #if defined(QCUSTOMPLOT_COMPILE_LIBRARY) 85 # define QCP_LIB_DECL Q_DECL_EXPORT 86 #elif defined(QCUSTOMPLOT_USE_LIBRARY) 87 # define QCP_LIB_DECL Q_DECL_IMPORT 174 inline
bool isInvalidData(
double value)
176 return qIsNaN(value) || qIsInf(value);
184 inline bool isInvalidData(
double value1,
double value2)
186 return isInvalidData(value1) || isInvalidData(value2);
195 inline void setMarginValue(QMargins &margins,
QCP::MarginSide side,
int value)
201 case QCP::msTop: margins.setTop(value);
break;
203 case QCP::msAll: margins = QMargins(value, value, value, value);
break;
215 inline int getMarginValue(
const QMargins &margins,
QCP::MarginSide side)
230 Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::AntialiasedElements)
231 Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::PlottingHints)
232 Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::MarginSides)
233 Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::Interactions)
274 QCPScatterStyle(
const QPainterPath &customPath,
const QPen &pen,
const QBrush &brush=Qt::NoBrush,
double size=6);
277 double size()
const {
return mSize; }
279 QPen pen()
const {
return mPen; }
280 QBrush brush()
const {
return mBrush; }
281 QPixmap pixmap()
const {
return mPixmap; }
282 QPainterPath customPath()
const {
return mCustomPath; }
285 void setSize(
double size);
287 void setPen(
const QPen &pen);
288 void setBrush(
const QBrush &brush);
289 void setPixmap(
const QPixmap &pixmap);
290 void setCustomPath(
const QPainterPath &customPath);
293 bool isNone()
const {
return mShape == ssNone; }
295 void applyTo(
QCPPainter *painter,
const QPen &defaultPen)
const;
296 void drawShape(
QCPPainter *painter, QPointF pos)
const;
297 void drawShape(
QCPPainter *painter,
double x,
double y)
const;
306 QPainterPath mCustomPath;
325 ,pmNonCosmetic = 0x04
331 QCPPainter(QPaintDevice *device);
335 bool antialiasing()
const {
return testRenderHint(QPainter::Antialiasing); }
336 PainterModes modes()
const {
return mModes; }
339 void setAntialiasing(
bool enabled);
341 void setModes(PainterModes modes);
344 bool begin(QPaintDevice *device);
345 void setPen(
const QPen &pen);
346 void setPen(
const QColor &color);
347 void setPen(Qt::PenStyle penStyle);
348 void drawLine(
const QLineF &line);
349 void drawLine(
const QPointF &p1,
const QPointF &p2) {drawLine(QLineF(p1, p2));}
354 void makeNonCosmetic();
359 bool mIsAntialiasing;
362 QStack<bool> mAntialiasingStack;
364 Q_DECLARE_OPERATORS_FOR_FLAGS(QCPPainter::PainterModes)
371 Q_PROPERTY(
QCustomPlot* parentPlot READ parentPlot)
372 Q_PROPERTY(QString name READ name)
373 Q_PROPERTY(
int index READ index)
374 Q_PROPERTY(QList<QCPLayerable*> children READ children)
375 Q_PROPERTY(
bool visible READ visible WRITE setVisible)
382 QCustomPlot *parentPlot()
const {
return mParentPlot; }
383 QString name()
const {
return mName; }
384 int index()
const {
return mIndex; }
385 QList<QCPLayerable*>
children()
const {
return mChildren; }
386 bool visible()
const {
return mVisible; }
389 void setVisible(
bool visible);
396 QList<QCPLayerable*> mChildren;
414 Q_PROPERTY(
bool visible READ visible WRITE setVisible)
415 Q_PROPERTY(
QCustomPlot* parentPlot READ parentPlot)
416 Q_PROPERTY(
QCPLayerable* parentLayerable READ parentLayerable)
417 Q_PROPERTY(
QCPLayer* layer READ layer WRITE setLayer NOTIFY layerChanged)
418 Q_PROPERTY(
bool antialiased READ antialiased WRITE setAntialiased)
425 bool visible()
const {
return mVisible; }
426 QCustomPlot *parentPlot()
const {
return mParentPlot; }
428 QCPLayer *layer()
const {
return mLayer; }
429 bool antialiased()
const {
return mAntialiased; }
432 void setVisible(
bool on);
433 Q_SLOT
bool setLayer(
QCPLayer *layer);
434 bool setLayer(
const QString &layerName);
435 void setAntialiased(
bool enabled);
438 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0)
const;
441 bool realVisibility()
const;
444 void layerChanged(
QCPLayer *newLayer);
450 QPointer<QCPLayerable> mParentLayerable;
455 virtual void parentPlotInitialized(
QCustomPlot *parentPlot);
457 virtual QRect clipRect()
const;
458 virtual void applyDefaultAntialiasingHint(
QCPPainter *painter)
const = 0;
461 virtual void selectEvent(QMouseEvent *event,
bool additive,
const QVariant &details,
bool *selectionStateChanged);
462 virtual void deselectEvent(
bool *selectionStateChanged);
465 void initializeParentPlot(
QCustomPlot *parentPlot);
467 bool moveToLayer(
QCPLayer *layer,
bool prepend);
484 QCPRange(
double lower,
double upper);
486 bool operator==(
const QCPRange& other)
const {
return lower == other.lower && upper == other.upper; }
487 bool operator!=(
const QCPRange& other)
const {
return !(*
this == other); }
501 double center()
const;
503 void expand(
const QCPRange &otherRange);
505 QCPRange sanitizedForLogScale()
const;
506 QCPRange sanitizedForLinScale()
const;
507 bool contains(
double value)
const;
509 static bool validRange(
double lower,
double upper);
510 static bool validRange(
const QCPRange &range);
515 Q_DECLARE_TYPEINFO(
QCPRange, Q_MOVABLE_TYPE);
611 bool isEmpty()
const;
617 QHash<QCP::MarginSide, QList<QCPLayoutElement*> > mChildren;
635 Q_PROPERTY(
QCPLayout* layout READ layout)
636 Q_PROPERTY(QRect rect READ rect)
637 Q_PROPERTY(QRect outerRect READ outerRect WRITE setOuterRect)
638 Q_PROPERTY(QMargins margins READ margins WRITE setMargins)
639 Q_PROPERTY(QMargins minimumMargins READ minimumMargins WRITE setMinimumMargins)
640 Q_PROPERTY(QSize minimumSize READ minimumSize WRITE setMinimumSize)
641 Q_PROPERTY(QSize maximumSize READ maximumSize WRITE setMaximumSize)
659 QRect
rect()
const {
return mRect; }
660 QRect outerRect()
const {
return mOuterRect; }
661 QMargins margins()
const {
return mMargins; }
662 QMargins minimumMargins()
const {
return mMinimumMargins; }
663 QCP::MarginSides autoMargins()
const {
return mAutoMargins; }
664 QSize minimumSize()
const {
return mMinimumSize; }
665 QSize maximumSize()
const {
return mMaximumSize; }
667 QHash<QCP::MarginSide, QCPMarginGroup*> marginGroups()
const {
return mMarginGroups; }
670 void setOuterRect(
const QRect &rect);
671 void setMargins(
const QMargins &margins);
672 void setMinimumMargins(
const QMargins &margins);
673 void setAutoMargins(QCP::MarginSides sides);
674 void setMinimumSize(
const QSize &size);
675 void setMinimumSize(
int width,
int height);
676 void setMaximumSize(
const QSize &size);
677 void setMaximumSize(
int width,
int height);
678 void setMarginGroup(QCP::MarginSides sides,
QCPMarginGroup *group);
682 virtual QSize minimumSizeHint()
const;
683 virtual QSize maximumSizeHint()
const;
684 virtual QList<QCPLayoutElement*> elements(
bool recursive)
const;
687 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0)
const;
692 QSize mMinimumSize, mMaximumSize;
693 QRect mRect, mOuterRect;
694 QMargins mMargins, mMinimumMargins;
695 QCP::MarginSides mAutoMargins;
696 QHash<QCP::MarginSide, QCPMarginGroup*> mMarginGroups;
708 virtual void applyDefaultAntialiasingHint(
QCPPainter * )
const { }
710 virtual void parentPlotInitialized(
QCustomPlot *parentPlot);
729 virtual QList<QCPLayoutElement*> elements(
bool recursive)
const;
732 virtual int elementCount()
const = 0;
736 virtual void simplify();
739 bool removeAt(
int index);
745 virtual void updateLayout();
748 void sizeConstraintsChanged()
const;
751 QVector<int> getSectionSizes(QVector<int> maxSizes, QVector<int> minSizes, QVector<double> stretchFactors,
int totalSize)
const;
763 Q_PROPERTY(
int rowCount READ rowCount)
764 Q_PROPERTY(
int columnCount READ columnCount)
765 Q_PROPERTY(QList<double> columnStretchFactors READ columnStretchFactors WRITE setColumnStretchFactors)
766 Q_PROPERTY(QList<double> rowStretchFactors READ rowStretchFactors WRITE setRowStretchFactors)
767 Q_PROPERTY(
int columnSpacing READ columnSpacing WRITE setColumnSpacing)
768 Q_PROPERTY(
int rowSpacing READ rowSpacing WRITE setRowSpacing)
775 int rowCount()
const;
776 int columnCount()
const;
777 QList<double> columnStretchFactors()
const {
return mColumnStretchFactors; }
778 QList<double> rowStretchFactors()
const {
return mRowStretchFactors; }
779 int columnSpacing()
const {
return mColumnSpacing; }
780 int rowSpacing()
const {
return mRowSpacing; }
783 void setColumnStretchFactor(
int column,
double factor);
784 void setColumnStretchFactors(
const QList<double> &factors);
785 void setRowStretchFactor(
int row,
double factor);
786 void setRowStretchFactors(
const QList<double> &factors);
787 void setColumnSpacing(
int pixels);
788 void setRowSpacing(
int pixels);
791 virtual void updateLayout();
792 virtual int elementCount()
const;
796 virtual QList<QCPLayoutElement*> elements(
bool recursive)
const;
797 virtual void simplify();
798 virtual QSize minimumSizeHint()
const;
799 virtual QSize maximumSizeHint()
const;
804 bool hasElement(
int row,
int column);
805 void expandTo(
int newRowCount,
int newColumnCount);
806 void insertRow(
int newIndex);
807 void insertColumn(
int newIndex);
811 QList<QList<QCPLayoutElement*> > mElements;
812 QList<double> mColumnStretchFactors;
813 QList<double> mRowStretchFactors;
814 int mColumnSpacing, mRowSpacing;
817 void getMinimumRowColSizes(QVector<int> *minColWidths, QVector<int> *minRowHeights)
const;
818 void getMaximumRowColSizes(QVector<int> *maxColWidths, QVector<int> *maxRowHeights)
const;
841 Qt::Alignment insetAlignment(
int index)
const;
842 QRectF insetRect(
int index)
const;
846 void setInsetAlignment(
int index, Qt::Alignment alignment);
847 void setInsetRect(
int index,
const QRectF &rect);
850 virtual void updateLayout();
851 virtual int elementCount()
const;
856 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0)
const;
864 QList<QCPLayoutElement*> mElements;
865 QList<InsetPlacement> mInsetPlacement;
866 QList<Qt::Alignment> mInsetAlignment;
867 QList<QRectF> mInsetRect;
907 double width()
const {
return mWidth; }
908 double length()
const {
return mLength; }
909 bool inverted()
const {
return mInverted; }
913 void setWidth(
double width);
914 void setLength(
double length);
915 void setInverted(
bool inverted);
918 double boundingDistance()
const;
919 double realLength()
const;
920 void draw(
QCPPainter *painter,
const QVector2D &pos,
const QVector2D &dir)
const;
921 void draw(
QCPPainter *painter,
const QVector2D &pos,
double angle)
const;
926 double mWidth, mLength;
936 Q_PROPERTY(
bool subGridVisible READ subGridVisible WRITE setSubGridVisible)
937 Q_PROPERTY(
bool antialiasedSubGrid READ antialiasedSubGrid WRITE setAntialiasedSubGrid)
938 Q_PROPERTY(
bool antialiasedZeroLine READ antialiasedZeroLine WRITE setAntialiasedZeroLine)
939 Q_PROPERTY(QPen pen READ pen WRITE setPen)
940 Q_PROPERTY(QPen subGridPen READ subGridPen WRITE setSubGridPen)
941 Q_PROPERTY(QPen zeroLinePen READ zeroLinePen WRITE setZeroLinePen)
947 bool subGridVisible()
const {
return mSubGridVisible; }
948 bool antialiasedSubGrid()
const {
return mAntialiasedSubGrid; }
949 bool antialiasedZeroLine()
const {
return mAntialiasedZeroLine; }
950 QPen pen()
const {
return mPen; }
951 QPen subGridPen()
const {
return mSubGridPen; }
952 QPen zeroLinePen()
const {
return mZeroLinePen; }
955 void setSubGridVisible(
bool visible);
956 void setAntialiasedSubGrid(
bool enabled);
957 void setAntialiasedZeroLine(
bool enabled);
958 void setPen(
const QPen &pen);
959 void setSubGridPen(
const QPen &pen);
960 void setZeroLinePen(
const QPen &pen);
964 bool mSubGridVisible;
965 bool mAntialiasedSubGrid, mAntialiasedZeroLine;
966 QPen mPen, mSubGridPen, mZeroLinePen;
971 virtual void applyDefaultAntialiasingHint(
QCPPainter *painter)
const;
975 void drawGridLines(
QCPPainter *painter)
const;
976 void drawSubGridLines(
QCPPainter *painter)
const;
986 Q_PROPERTY(
AxisType axisType READ axisType)
988 Q_PROPERTY(
ScaleType scaleType READ scaleType WRITE setScaleType NOTIFY scaleTypeChanged)
989 Q_PROPERTY(
double scaleLogBase READ scaleLogBase WRITE setScaleLogBase)
990 Q_PROPERTY(
QCPRange range READ range WRITE setRange NOTIFY rangeChanged)
991 Q_PROPERTY(
bool rangeReversed READ rangeReversed WRITE setRangeReversed)
992 Q_PROPERTY(
bool autoTicks READ autoTicks WRITE setAutoTicks)
993 Q_PROPERTY(
int autoTickCount READ autoTickCount WRITE setAutoTickCount)
994 Q_PROPERTY(
bool autoTickLabels READ autoTickLabels WRITE setAutoTickLabels)
995 Q_PROPERTY(
bool autoTickStep READ autoTickStep WRITE setAutoTickStep)
996 Q_PROPERTY(
bool autoSubTicks READ autoSubTicks WRITE setAutoSubTicks)
997 Q_PROPERTY(
bool ticks READ ticks WRITE setTicks)
998 Q_PROPERTY(
bool tickLabels READ tickLabels WRITE setTickLabels)
999 Q_PROPERTY(
int tickLabelPadding READ tickLabelPadding WRITE setTickLabelPadding)
1000 Q_PROPERTY(
LabelType tickLabelType READ tickLabelType WRITE setTickLabelType)
1001 Q_PROPERTY(QFont tickLabelFont READ tickLabelFont WRITE setTickLabelFont)
1002 Q_PROPERTY(QColor tickLabelColor READ tickLabelColor WRITE setTickLabelColor)
1003 Q_PROPERTY(
double tickLabelRotation READ tickLabelRotation WRITE setTickLabelRotation)
1004 Q_PROPERTY(
LabelSide tickLabelSide READ tickLabelSide WRITE setTickLabelSide)
1005 Q_PROPERTY(QString dateTimeFormat READ dateTimeFormat WRITE setDateTimeFormat)
1006 Q_PROPERTY(Qt::TimeSpec dateTimeSpec READ dateTimeSpec WRITE setDateTimeSpec)
1007 Q_PROPERTY(QString numberFormat READ numberFormat WRITE setNumberFormat)
1008 Q_PROPERTY(
int numberPrecision READ numberPrecision WRITE setNumberPrecision)
1009 Q_PROPERTY(
double tickStep READ tickStep WRITE setTickStep)
1010 Q_PROPERTY(QVector<double> tickVector READ tickVector WRITE setTickVector)
1011 Q_PROPERTY(QVector<QString> tickVectorLabels READ tickVectorLabels WRITE setTickVectorLabels)
1012 Q_PROPERTY(
int tickLengthIn READ tickLengthIn WRITE setTickLengthIn)
1013 Q_PROPERTY(
int tickLengthOut READ tickLengthOut WRITE setTickLengthOut)
1014 Q_PROPERTY(
int subTickCount READ subTickCount WRITE setSubTickCount)
1015 Q_PROPERTY(
int subTickLengthIn READ subTickLengthIn WRITE setSubTickLengthIn)
1016 Q_PROPERTY(
int subTickLengthOut READ subTickLengthOut WRITE setSubTickLengthOut)
1017 Q_PROPERTY(QPen basePen READ basePen WRITE setBasePen)
1018 Q_PROPERTY(QPen tickPen READ tickPen WRITE setTickPen)
1019 Q_PROPERTY(QPen subTickPen READ subTickPen WRITE setSubTickPen)
1020 Q_PROPERTY(QFont labelFont READ labelFont WRITE setLabelFont)
1021 Q_PROPERTY(QColor labelColor READ labelColor WRITE setLabelColor)
1022 Q_PROPERTY(QString label READ label WRITE setLabel)
1023 Q_PROPERTY(
int labelPadding READ labelPadding WRITE setLabelPadding)
1024 Q_PROPERTY(
int padding READ padding WRITE setPadding)
1025 Q_PROPERTY(
int offset READ offset WRITE setOffset)
1026 Q_PROPERTY(SelectableParts selectedParts READ selectedParts WRITE setSelectedParts NOTIFY selectionChanged)
1027 Q_PROPERTY(SelectableParts selectableParts READ selectableParts WRITE setSelectableParts NOTIFY selectableChanged)
1028 Q_PROPERTY(QFont selectedTickLabelFont READ selectedTickLabelFont WRITE setSelectedTickLabelFont)
1029 Q_PROPERTY(QFont selectedLabelFont READ selectedLabelFont WRITE setSelectedLabelFont)
1030 Q_PROPERTY(QColor selectedTickLabelColor READ selectedTickLabelColor WRITE setSelectedTickLabelColor)
1031 Q_PROPERTY(QColor selectedLabelColor READ selectedLabelColor WRITE setSelectedLabelColor)
1032 Q_PROPERTY(QPen selectedBasePen READ selectedBasePen WRITE setSelectedBasePen)
1033 Q_PROPERTY(QPen selectedTickPen READ selectedTickPen WRITE setSelectedTickPen)
1034 Q_PROPERTY(QPen selectedSubTickPen READ selectedSubTickPen WRITE setSelectedSubTickPen)
1035 Q_PROPERTY(
QCPLineEnding lowerEnding READ lowerEnding WRITE setLowerEnding)
1036 Q_PROPERTY(
QCPLineEnding upperEnding READ upperEnding WRITE setUpperEnding)
1037 Q_PROPERTY(
QCPGrid* grid READ grid)
1050 Q_DECLARE_FLAGS(AxisTypes,
AxisType)
1084 ,spTickLabels = 0x002
1085 ,spAxisLabel = 0x004
1094 AxisType axisType()
const {
return mAxisType; }
1095 QCPAxisRect *axisRect()
const {
return mAxisRect; }
1096 ScaleType scaleType()
const {
return mScaleType; }
1097 double scaleLogBase()
const {
return mScaleLogBase; }
1098 const QCPRange range()
const {
return mRange; }
1099 bool rangeReversed()
const {
return mRangeReversed; }
1100 bool autoTicks()
const {
return mAutoTicks; }
1101 int autoTickCount()
const {
return mAutoTickCount; }
1102 bool autoTickLabels()
const {
return mAutoTickLabels; }
1103 bool autoTickStep()
const {
return mAutoTickStep; }
1104 bool autoSubTicks()
const {
return mAutoSubTicks; }
1105 bool ticks()
const {
return mTicks; }
1106 bool tickLabels()
const {
return mTickLabels; }
1107 int tickLabelPadding()
const;
1108 LabelType tickLabelType()
const {
return mTickLabelType; }
1109 QFont tickLabelFont()
const {
return mTickLabelFont; }
1110 QColor tickLabelColor()
const {
return mTickLabelColor; }
1111 double tickLabelRotation()
const;
1113 QString dateTimeFormat()
const {
return mDateTimeFormat; }
1114 Qt::TimeSpec dateTimeSpec()
const {
return mDateTimeSpec; }
1115 QString numberFormat()
const;
1116 int numberPrecision()
const {
return mNumberPrecision; }
1117 double tickStep()
const {
return mTickStep; }
1118 QVector<double> tickVector()
const {
return mTickVector; }
1119 QVector<QString> tickVectorLabels()
const {
return mTickVectorLabels; }
1120 int tickLengthIn()
const;
1121 int tickLengthOut()
const;
1122 int subTickCount()
const {
return mSubTickCount; }
1123 int subTickLengthIn()
const;
1124 int subTickLengthOut()
const;
1125 QPen basePen()
const {
return mBasePen; }
1126 QPen tickPen()
const {
return mTickPen; }
1127 QPen subTickPen()
const {
return mSubTickPen; }
1128 QFont labelFont()
const {
return mLabelFont; }
1129 QColor labelColor()
const {
return mLabelColor; }
1130 QString label()
const {
return mLabel; }
1131 int labelPadding()
const;
1132 int padding()
const {
return mPadding; }
1134 SelectableParts selectedParts()
const {
return mSelectedParts; }
1135 SelectableParts selectableParts()
const {
return mSelectableParts; }
1136 QFont selectedTickLabelFont()
const {
return mSelectedTickLabelFont; }
1137 QFont selectedLabelFont()
const {
return mSelectedLabelFont; }
1138 QColor selectedTickLabelColor()
const {
return mSelectedTickLabelColor; }
1139 QColor selectedLabelColor()
const {
return mSelectedLabelColor; }
1140 QPen selectedBasePen()
const {
return mSelectedBasePen; }
1141 QPen selectedTickPen()
const {
return mSelectedTickPen; }
1142 QPen selectedSubTickPen()
const {
return mSelectedSubTickPen; }
1149 void setScaleLogBase(
double base);
1150 Q_SLOT
void setRange(
const QCPRange &range);
1151 void setRange(
double lower,
double upper);
1152 void setRange(
double position,
double size, Qt::AlignmentFlag alignment);
1153 void setRangeLower(
double lower);
1154 void setRangeUpper(
double upper);
1155 void setRangeReversed(
bool reversed);
1156 void setAutoTicks(
bool on);
1157 void setAutoTickCount(
int approximateCount);
1158 void setAutoTickLabels(
bool on);
1159 void setAutoTickStep(
bool on);
1160 void setAutoSubTicks(
bool on);
1161 void setTicks(
bool show);
1162 void setTickLabels(
bool show);
1163 void setTickLabelPadding(
int padding);
1165 void setTickLabelFont(
const QFont &font);
1166 void setTickLabelColor(
const QColor &color);
1167 void setTickLabelRotation(
double degrees);
1169 void setDateTimeFormat(
const QString &format);
1170 void setDateTimeSpec(
const Qt::TimeSpec &timeSpec);
1171 void setNumberFormat(
const QString &formatCode);
1172 void setNumberPrecision(
int precision);
1173 void setTickStep(
double step);
1174 void setTickVector(
const QVector<double> &vec);
1175 void setTickVectorLabels(
const QVector<QString> &vec);
1176 void setTickLength(
int inside,
int outside=0);
1177 void setTickLengthIn(
int inside);
1178 void setTickLengthOut(
int outside);
1179 void setSubTickCount(
int count);
1180 void setSubTickLength(
int inside,
int outside=0);
1181 void setSubTickLengthIn(
int inside);
1182 void setSubTickLengthOut(
int outside);
1183 void setBasePen(
const QPen &pen);
1184 void setTickPen(
const QPen &pen);
1185 void setSubTickPen(
const QPen &pen);
1186 void setLabelFont(
const QFont &font);
1187 void setLabelColor(
const QColor &color);
1188 void setLabel(
const QString &str);
1189 void setLabelPadding(
int padding);
1190 void setPadding(
int padding);
1191 void setOffset(
int offset);
1192 void setSelectedTickLabelFont(
const QFont &font);
1193 void setSelectedLabelFont(
const QFont &font);
1194 void setSelectedTickLabelColor(
const QColor &color);
1195 void setSelectedLabelColor(
const QColor &color);
1196 void setSelectedBasePen(
const QPen &pen);
1197 void setSelectedTickPen(
const QPen &pen);
1198 void setSelectedSubTickPen(
const QPen &pen);
1199 Q_SLOT
void setSelectableParts(
const QCPAxis::SelectableParts &selectableParts);
1200 Q_SLOT
void setSelectedParts(
const QCPAxis::SelectableParts &selectedParts);
1205 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0)
const;
1209 void moveRange(
double diff);
1210 void scaleRange(
double factor,
double center);
1211 void setScaleRatio(
const QCPAxis *otherAxis,
double ratio=1.0);
1212 void rescale(
bool onlyVisiblePlottables=
false);
1213 double pixelToCoord(
double value)
const;
1214 double coordToPixel(
double value)
const;
1216 QList<QCPAbstractPlottable*> plottables()
const;
1217 QList<QCPGraph*> graphs()
const;
1218 QList<QCPAbstractItem*> items()
const;
1221 static Qt::Orientation
orientation(
AxisType type) {
return type==atBottom||type==atTop ? Qt::Horizontal : Qt::Vertical; }
1225 void ticksRequest();
1226 void rangeChanged(
const QCPRange &newRange);
1229 void selectionChanged(
const QCPAxis::SelectableParts &parts);
1230 void selectableChanged(
const QCPAxis::SelectableParts &parts);
1239 Qt::Orientation mOrientation;
1240 SelectableParts mSelectableParts, mSelectedParts;
1241 QPen mBasePen, mSelectedBasePen;
1246 QFont mLabelFont, mSelectedLabelFont;
1247 QColor mLabelColor, mSelectedLabelColor;
1250 bool mTickLabels, mAutoTickLabels;
1253 QFont mTickLabelFont, mSelectedTickLabelFont;
1254 QColor mTickLabelColor, mSelectedTickLabelColor;
1255 QString mDateTimeFormat;
1256 Qt::TimeSpec mDateTimeSpec;
1257 int mNumberPrecision;
1258 QLatin1Char mNumberFormatChar;
1259 bool mNumberBeautifulPowers;
1264 int mSubTickCount, mAutoTickCount;
1265 bool mAutoTicks, mAutoTickStep, mAutoSubTicks;
1267 QPen mTickPen, mSelectedTickPen;
1268 QPen mSubTickPen, mSelectedSubTickPen;
1271 bool mRangeReversed;
1273 double mScaleLogBase, mScaleLogBaseLogInv;
1278 int mLowestVisibleTick, mHighestVisibleTick;
1279 QVector<double> mTickVector;
1280 QVector<QString> mTickVectorLabels;
1281 QVector<double> mSubTickVector;
1282 bool mCachedMarginValid;
1286 virtual void setupTickVectors();
1287 virtual void generateAutoTicks();
1288 virtual int calculateAutoSubTickCount(
double tickStep)
const;
1289 virtual int calculateMargin();
1292 virtual void applyDefaultAntialiasingHint(
QCPPainter *painter)
const;
1296 virtual void selectEvent(QMouseEvent *event,
bool additive,
const QVariant &details,
bool *selectionStateChanged);
1297 virtual void deselectEvent(
bool *selectionStateChanged);
1300 void visibleTickBounds(
int &lowIndex,
int &highIndex)
const;
1301 double baseLog(
double value)
const;
1302 double basePow(
double value)
const;
1303 QPen getBasePen()
const;
1304 QPen getTickPen()
const;
1305 QPen getSubTickPen()
const;
1306 QFont getTickLabelFont()
const;
1307 QFont getLabelFont()
const;
1308 QColor getTickLabelColor()
const;
1309 QColor getLabelColor()
const;
1318 Q_DECLARE_OPERATORS_FOR_FLAGS(QCPAxis::SelectableParts)
1319 Q_DECLARE_OPERATORS_FOR_FLAGS(QCPAxis::AxisTypes)
1330 virtual int size()
const;
1333 QRect axisSelectionBox()
const {
return mAxisSelectionBox; }
1334 QRect tickLabelsSelectionBox()
const {
return mTickLabelsSelectionBox; }
1335 QRect labelSelectionBox()
const {
return mLabelSelectionBox; }
1345 int tickLabelPadding;
1346 double tickLabelRotation;
1348 bool substituteExponent;
1349 bool numberMultiplyCross;
1350 int tickLengthIn, tickLengthOut, subTickLengthIn, subTickLengthOut;
1351 QPen tickPen, subTickPen;
1352 QFont tickLabelFont;
1353 QColor tickLabelColor;
1354 QRect axisRect, viewportRect;
1356 bool abbreviateDecimalPowers;
1357 bool reversedEndings;
1359 QVector<double> subTickPositions;
1360 QVector<double> tickPositions;
1361 QVector<QString> tickLabels;
1371 QString basePart, expPart;
1372 QRect baseBounds, expBounds, totalBounds, rotatedTotalBounds;
1373 QFont baseFont, expFont;
1376 QByteArray mLabelParameterHash;
1377 QCache<QString, CachedLabel> mLabelCache;
1378 QRect mAxisSelectionBox, mTickLabelsSelectionBox, mLabelSelectionBox;
1380 virtual QByteArray generateLabelParameterHash()
const;
1382 virtual void placeTickLabel(
QCPPainter *painter,
double position,
int distanceToAxis,
const QString &text, QSize *tickLabelsSize);
1384 virtual TickLabelData getTickLabelData(
const QFont &font,
const QString &text)
const;
1385 virtual QPointF getTickLabelDrawOffset(
const TickLabelData &labelData)
const;
1386 virtual void getMaxTickLabelSize(
const QFont &font,
const QString &text, QSize *tickLabelsSize)
const;
1394 Q_PROPERTY(QString name READ name WRITE setName)
1395 Q_PROPERTY(
bool antialiasedFill READ antialiasedFill WRITE setAntialiasedFill)
1396 Q_PROPERTY(
bool antialiasedScatters READ antialiasedScatters WRITE setAntialiasedScatters)
1397 Q_PROPERTY(
bool antialiasedErrorBars READ antialiasedErrorBars WRITE setAntialiasedErrorBars)
1398 Q_PROPERTY(QPen pen READ pen WRITE setPen)
1399 Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
1400 Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
1401 Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
1402 Q_PROPERTY(
QCPAxis* keyAxis READ keyAxis WRITE setKeyAxis)
1403 Q_PROPERTY(
QCPAxis* valueAxis READ valueAxis WRITE setValueAxis)
1404 Q_PROPERTY(
bool selectable READ selectable WRITE setSelectable NOTIFY selectableChanged)
1405 Q_PROPERTY(
bool selected READ selected WRITE setSelected NOTIFY selectionChanged)
1411 QString name()
const {
return mName; }
1412 bool antialiasedFill()
const {
return mAntialiasedFill; }
1413 bool antialiasedScatters()
const {
return mAntialiasedScatters; }
1414 bool antialiasedErrorBars()
const {
return mAntialiasedErrorBars; }
1415 QPen pen()
const {
return mPen; }
1416 QPen selectedPen()
const {
return mSelectedPen; }
1417 QBrush brush()
const {
return mBrush; }
1418 QBrush selectedBrush()
const {
return mSelectedBrush; }
1419 QCPAxis *keyAxis()
const {
return mKeyAxis.data(); }
1420 QCPAxis *valueAxis()
const {
return mValueAxis.data(); }
1421 bool selectable()
const {
return mSelectable; }
1422 bool selected()
const {
return mSelected; }
1425 void setName(
const QString &name);
1426 void setAntialiasedFill(
bool enabled);
1427 void setAntialiasedScatters(
bool enabled);
1428 void setAntialiasedErrorBars(
bool enabled);
1429 void setPen(
const QPen &pen);
1430 void setSelectedPen(
const QPen &pen);
1431 void setBrush(
const QBrush &brush);
1432 void setSelectedBrush(
const QBrush &brush);
1433 void setKeyAxis(
QCPAxis *axis);
1434 void setValueAxis(
QCPAxis *axis);
1435 Q_SLOT
void setSelectable(
bool selectable);
1436 Q_SLOT
void setSelected(
bool selected);
1439 virtual void clearData() = 0;
1440 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0)
const = 0;
1441 virtual bool addToLegend();
1442 virtual bool removeFromLegend()
const;
1445 void rescaleAxes(
bool onlyEnlarge=
false)
const;
1446 void rescaleKeyAxis(
bool onlyEnlarge=
false)
const;
1447 void rescaleValueAxis(
bool onlyEnlarge=
false)
const;
1450 void selectionChanged(
bool selected);
1451 void selectableChanged(
bool selectable);
1464 bool mAntialiasedFill, mAntialiasedScatters, mAntialiasedErrorBars;
1465 QPen mPen, mSelectedPen;
1466 QBrush mBrush, mSelectedBrush;
1467 QPointer<QCPAxis> mKeyAxis, mValueAxis;
1468 bool mSelectable, mSelected;
1471 virtual QRect clipRect()
const;
1474 void applyDefaultAntialiasingHint(
QCPPainter *painter)
const;
1476 virtual void selectEvent(QMouseEvent *event,
bool additive,
const QVariant &details,
bool *selectionStateChanged);
1477 virtual void deselectEvent(
bool *selectionStateChanged);
1480 virtual void drawLegendIcon(
QCPPainter *painter,
const QRectF &rect)
const = 0;
1481 virtual QCPRange getKeyRange(
bool &foundRange,
SignDomain inSignDomain=sdBoth)
const = 0;
1482 virtual QCPRange getValueRange(
bool &foundRange,
SignDomain inSignDomain=sdBoth)
const = 0;
1485 void coordsToPixels(
double key,
double value,
double &x,
double &y)
const;
1486 const QPointF coordsToPixels(
double key,
double value)
const;
1487 void pixelsToCoords(
double x,
double y,
double &key,
double &value)
const;
1488 void pixelsToCoords(
const QPointF &pixelPos,
double &key,
double &value)
const;
1489 QPen mainPen()
const;
1490 QBrush mainBrush()
const;
1491 void applyFillAntialiasingHint(
QCPPainter *painter)
const;
1492 void applyScattersAntialiasingHint(
QCPPainter *painter)
const;
1493 void applyErrorBarsAntialiasingHint(
QCPPainter *painter)
const;
1494 double distSqrToLine(
const QPointF &start,
const QPointF &end,
const QPointF &point)
const;
1508 QCPItemAnchor(QCustomPlot *parentPlot,
QCPAbstractItem *parentItem,
const QString name,
int anchorId=-1);
1509 virtual ~QCPItemAnchor();
1512 QString name()
const {
return mName; }
1513 virtual QPointF pixelPoint()
const;
1520 QCustomPlot *mParentPlot;
1523 QSet<QCPItemPosition*> mChildrenX, mChildrenY;
1535 Q_DISABLE_COPY(QCPItemAnchor)
1569 QCPItemAnchor *parentAnchorX()
const {
return mParentAnchorX; }
1570 QCPItemAnchor *parentAnchorY()
const {
return mParentAnchorY; }
1571 double key()
const {
return mKey; }
1572 double value()
const {
return mValue; }
1573 QPointF coords()
const {
return QPointF(mKey, mValue); }
1574 QCPAxis *keyAxis()
const {
return mKeyAxis.data(); }
1575 QCPAxis *valueAxis()
const {
return mValueAxis.data(); }
1577 virtual QPointF pixelPoint()
const;
1583 bool setParentAnchor(
QCPItemAnchor *parentAnchor,
bool keepPixelPosition=
false);
1584 bool setParentAnchorX(
QCPItemAnchor *parentAnchor,
bool keepPixelPosition=
false);
1585 bool setParentAnchorY(
QCPItemAnchor *parentAnchor,
bool keepPixelPosition=
false);
1586 void setCoords(
double key,
double value);
1587 void setCoords(
const QPointF &coords);
1590 void setPixelPoint(
const QPointF &pixelPoint);
1595 QPointer<QCPAxis> mKeyAxis, mValueAxis;
1596 QPointer<QCPAxisRect> mAxisRect;
1597 double mKey, mValue;
1613 Q_PROPERTY(
bool clipToAxisRect READ clipToAxisRect WRITE setClipToAxisRect)
1614 Q_PROPERTY(
QCPAxisRect* clipAxisRect READ clipAxisRect WRITE setClipAxisRect)
1615 Q_PROPERTY(
bool selectable READ selectable WRITE setSelectable NOTIFY selectableChanged)
1616 Q_PROPERTY(
bool selected READ selected WRITE setSelected NOTIFY selectionChanged)
1623 bool clipToAxisRect()
const {
return mClipToAxisRect; }
1625 bool selectable()
const {
return mSelectable; }
1626 bool selected()
const {
return mSelected; }
1629 void setClipToAxisRect(
bool clip);
1631 Q_SLOT
void setSelectable(
bool selectable);
1632 Q_SLOT
void setSelected(
bool selected);
1635 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0)
const = 0;
1638 QList<QCPItemPosition*>
positions()
const {
return mPositions; }
1639 QList<QCPItemAnchor*>
anchors()
const {
return mAnchors; }
1642 bool hasAnchor(
const QString &name)
const;
1645 void selectionChanged(
bool selected);
1646 void selectableChanged(
bool selectable);
1650 bool mClipToAxisRect;
1651 QPointer<QCPAxisRect> mClipAxisRect;
1652 QList<QCPItemPosition*> mPositions;
1653 QList<QCPItemAnchor*> mAnchors;
1654 bool mSelectable, mSelected;
1658 virtual QRect clipRect()
const;
1659 virtual void applyDefaultAntialiasingHint(
QCPPainter *painter)
const;
1662 virtual void selectEvent(QMouseEvent *event,
bool additive,
const QVariant &details,
bool *selectionStateChanged);
1663 virtual void deselectEvent(
bool *selectionStateChanged);
1666 virtual QPointF anchorPixelPoint(
int anchorId)
const;
1669 double distSqrToLine(
const QPointF &start,
const QPointF &end,
const QPointF &point)
const;
1670 double rectSelectTest(
const QRectF &rect,
const QPointF &pos,
bool filledRect)
const;
1672 QCPItemAnchor *createAnchor(
const QString &name,
int anchorId);
1686 Q_PROPERTY(QRect viewport READ viewport WRITE setViewport)
1687 Q_PROPERTY(QPixmap background READ background WRITE setBackground)
1688 Q_PROPERTY(
bool backgroundScaled READ backgroundScaled WRITE setBackgroundScaled)
1689 Q_PROPERTY(Qt::AspectRatioMode backgroundScaledMode READ backgroundScaledMode WRITE setBackgroundScaledMode)
1691 Q_PROPERTY(
bool autoAddPlottableToLegend READ autoAddPlottableToLegend WRITE setAutoAddPlottableToLegend)
1692 Q_PROPERTY(
int selectionTolerance READ selectionTolerance WRITE setSelectionTolerance)
1693 Q_PROPERTY(
bool noAntialiasingOnDrag READ noAntialiasingOnDrag WRITE setNoAntialiasingOnDrag)
1694 Q_PROPERTY(Qt::KeyboardModifier multiSelectModifier READ multiSelectModifier WRITE setMultiSelectModifier)
1722 QPixmap background()
const {
return mBackgroundPixmap; }
1723 bool backgroundScaled()
const {
return mBackgroundScaled; }
1724 Qt::AspectRatioMode backgroundScaledMode()
const {
return mBackgroundScaledMode; }
1726 QCP::AntialiasedElements antialiasedElements()
const {
return mAntialiasedElements; }
1727 QCP::AntialiasedElements notAntialiasedElements()
const {
return mNotAntialiasedElements; }
1728 bool autoAddPlottableToLegend()
const {
return mAutoAddPlottableToLegend; }
1729 const QCP::Interactions interactions()
const {
return mInteractions; }
1730 int selectionTolerance()
const {
return mSelectionTolerance; }
1731 bool noAntialiasingOnDrag()
const {
return mNoAntialiasingOnDrag; }
1732 QCP::PlottingHints plottingHints()
const {
return mPlottingHints; }
1733 Qt::KeyboardModifier multiSelectModifier()
const {
return mMultiSelectModifier; }
1736 void setViewport(
const QRect &rect);
1737 void setBackground(
const QPixmap &pm);
1738 void setBackground(
const QPixmap &pm,
bool scaled, Qt::AspectRatioMode mode=Qt::KeepAspectRatioByExpanding);
1739 void setBackground(
const QBrush &brush);
1740 void setBackgroundScaled(
bool scaled);
1741 void setBackgroundScaledMode(Qt::AspectRatioMode mode);
1742 void setAntialiasedElements(
const QCP::AntialiasedElements &antialiasedElements);
1744 void setNotAntialiasedElements(
const QCP::AntialiasedElements ¬AntialiasedElements);
1746 void setAutoAddPlottableToLegend(
bool on);
1747 void setInteractions(
const QCP::Interactions &interactions);
1748 void setInteraction(
const QCP::Interaction &interaction,
bool enabled=
true);
1749 void setSelectionTolerance(
int pixels);
1750 void setNoAntialiasingOnDrag(
bool enabled);
1751 void setPlottingHints(
const QCP::PlottingHints &hints);
1753 void setMultiSelectModifier(Qt::KeyboardModifier modifier);
1761 bool removePlottable(
int index);
1762 int clearPlottables();
1763 int plottableCount()
const;
1764 QList<QCPAbstractPlottable*> selectedPlottables()
const;
1773 bool removeGraph(
int index);
1775 int graphCount()
const;
1776 QList<QCPGraph*> selectedGraphs()
const;
1783 bool removeItem(
int index);
1785 int itemCount()
const;
1786 QList<QCPAbstractItem*> selectedItems()
const;
1787 QCPAbstractItem *itemAt(
const QPointF &pos,
bool onlySelectable=
false)
const;
1791 QCPLayer *layer(
const QString &name)
const;
1794 bool setCurrentLayer(
const QString &name);
1795 bool setCurrentLayer(
QCPLayer *layer);
1796 int layerCount()
const;
1802 int axisRectCount()
const;
1804 QList<QCPAxisRect*> axisRects()
const;
1806 Q_SLOT
void rescaleAxes(
bool onlyVisiblePlottables=
false);
1808 QList<QCPAxis*> selectedAxes()
const;
1809 QList<QCPLegend*> selectedLegends()
const;
1810 Q_SLOT
void deselectAll();
1812 bool savePdf(
const QString &fileName,
bool noCosmeticPen=
false,
int width=0,
int height=0,
const QString &pdfCreator=QString(),
const QString &pdfTitle=QString());
1813 bool savePng(
const QString &fileName,
int width=0,
int height=0,
double scale=1.0,
int quality=-1);
1814 bool saveJpg(
const QString &fileName,
int width=0,
int height=0,
double scale=1.0,
int quality=-1);
1815 bool saveBmp(
const QString &fileName,
int width=0,
int height=0,
double scale=1.0);
1816 bool saveRastered(
const QString &fileName,
int width,
int height,
double scale,
const char *format,
int quality=-1);
1817 QPixmap toPixmap(
int width=0,
int height=0,
double scale=1.0);
1818 void toPainter(
QCPPainter *painter,
int width=0,
int height=0);
1825 void mouseDoubleClick(QMouseEvent *event);
1826 void mousePress(QMouseEvent *event);
1827 void mouseMove(QMouseEvent *event);
1828 void mouseRelease(QMouseEvent *event);
1829 void mouseWheel(QWheelEvent *event);
1839 void titleClick(QMouseEvent *event,
QCPPlotTitle *title);
1840 void titleDoubleClick(QMouseEvent *event,
QCPPlotTitle *title);
1842 void selectionChangedByUser();
1843 void beforeReplot();
1850 bool mAutoAddPlottableToLegend;
1851 QList<QCPAbstractPlottable*> mPlottables;
1852 QList<QCPGraph*> mGraphs;
1853 QList<QCPAbstractItem*> mItems;
1854 QList<QCPLayer*> mLayers;
1855 QCP::AntialiasedElements mAntialiasedElements, mNotAntialiasedElements;
1856 QCP::Interactions mInteractions;
1857 int mSelectionTolerance;
1858 bool mNoAntialiasingOnDrag;
1859 QBrush mBackgroundBrush;
1860 QPixmap mBackgroundPixmap;
1861 QPixmap mScaledBackgroundPixmap;
1862 bool mBackgroundScaled;
1863 Qt::AspectRatioMode mBackgroundScaledMode;
1865 QCP::PlottingHints mPlottingHints;
1866 Qt::KeyboardModifier mMultiSelectModifier;
1869 QPixmap mPaintBuffer;
1870 QPoint mMousePressPos;
1871 QPointer<QCPLayoutElement> mMouseEventElement;
1875 virtual QSize minimumSizeHint()
const;
1876 virtual QSize sizeHint()
const;
1877 virtual void paintEvent(QPaintEvent *event);
1878 virtual void resizeEvent(QResizeEvent *event);
1879 virtual void mouseDoubleClickEvent(QMouseEvent *event);
1880 virtual void mousePressEvent(QMouseEvent *event);
1881 virtual void mouseMoveEvent(QMouseEvent *event);
1882 virtual void mouseReleaseEvent(QMouseEvent *event);
1883 virtual void wheelEvent(QWheelEvent *event);
1887 virtual void axisRemoved(
QCPAxis *axis);
1888 virtual void legendRemoved(
QCPLegend *legend);
1891 void updateLayerIndices()
const;
1892 QCPLayerable *layerableAt(
const QPointF &pos,
bool onlySelectable, QVariant *selectionDetails=0)
const;
1937 bool operator!=(const
QCPColorGradient &other)
const {
return !(*
this == other); }
1940 int levelCount()
const {
return mLevelCount; }
1941 QMap<double, QColor> colorStops()
const {
return mColorStops; }
1943 bool periodic()
const {
return mPeriodic; }
1946 void setLevelCount(
int n);
1947 void setColorStops(
const QMap<double, QColor> &colorStops);
1948 void setColorStopAt(
double position,
const QColor &color);
1950 void setPeriodic(
bool enabled);
1953 void colorize(
const double *data,
const QCPRange &range, QRgb *scanLine,
int n,
int dataIndexFactor=1,
bool logarithmic=
false);
1954 QRgb color(
double position,
const QCPRange &range,
bool logarithmic=
false);
1956 void clearColorStops();
1960 void updateColorBuffer();
1964 QMap<double, QColor> mColorStops;
1969 QVector<QRgb> mColorBuffer;
1970 bool mColorBufferInvalidated;
1978 Q_PROPERTY(QPixmap background READ background WRITE setBackground)
1979 Q_PROPERTY(
bool backgroundScaled READ backgroundScaled WRITE setBackgroundScaled)
1980 Q_PROPERTY(Qt::AspectRatioMode backgroundScaledMode READ backgroundScaledMode WRITE setBackgroundScaledMode)
1981 Q_PROPERTY(Qt::Orientations rangeDrag READ rangeDrag WRITE setRangeDrag)
1982 Q_PROPERTY(Qt::Orientations rangeZoom READ rangeZoom WRITE setRangeZoom)
1989 QPixmap background()
const {
return mBackgroundPixmap; }
1990 bool backgroundScaled()
const {
return mBackgroundScaled; }
1991 Qt::AspectRatioMode backgroundScaledMode()
const {
return mBackgroundScaledMode; }
1992 Qt::Orientations rangeDrag()
const {
return mRangeDrag; }
1993 Qt::Orientations rangeZoom()
const {
return mRangeZoom; }
1994 QCPAxis *rangeDragAxis(Qt::Orientation orientation);
1995 QCPAxis *rangeZoomAxis(Qt::Orientation orientation);
1996 double rangeZoomFactor(Qt::Orientation orientation);
1999 void setBackground(
const QPixmap &pm);
2000 void setBackground(
const QPixmap &pm,
bool scaled, Qt::AspectRatioMode mode=Qt::KeepAspectRatioByExpanding);
2001 void setBackground(
const QBrush &brush);
2002 void setBackgroundScaled(
bool scaled);
2003 void setBackgroundScaledMode(Qt::AspectRatioMode mode);
2004 void setRangeDrag(Qt::Orientations orientations);
2005 void setRangeZoom(Qt::Orientations orientations);
2008 void setRangeZoomFactor(
double horizontalFactor,
double verticalFactor);
2009 void setRangeZoomFactor(
double factor);
2014 QList<QCPAxis*> axes(QCPAxis::AxisTypes types)
const;
2015 QList<QCPAxis*> axes()
const;
2017 QList<QCPAxis*> addAxes(QCPAxis::AxisTypes types);
2018 bool removeAxis(
QCPAxis *axis);
2021 void setupFullAxesBox(
bool connectRanges=
false);
2022 QList<QCPAbstractPlottable*> plottables()
const;
2023 QList<QCPGraph*> graphs()
const;
2024 QList<QCPAbstractItem*> items()
const;
2027 int left()
const {
return mRect.left(); }
2028 int right()
const {
return mRect.right(); }
2029 int top()
const {
return mRect.top(); }
2030 int bottom()
const {
return mRect.bottom(); }
2031 int width()
const {
return mRect.width(); }
2032 int height()
const {
return mRect.height(); }
2033 QSize
size()
const {
return mRect.size(); }
2034 QPoint
topLeft()
const {
return mRect.topLeft(); }
2038 QPoint
center()
const {
return mRect.center(); }
2042 virtual QList<QCPLayoutElement*> elements(
bool recursive)
const;
2046 QBrush mBackgroundBrush;
2047 QPixmap mBackgroundPixmap;
2048 QPixmap mScaledBackgroundPixmap;
2049 bool mBackgroundScaled;
2050 Qt::AspectRatioMode mBackgroundScaledMode;
2052 Qt::Orientations mRangeDrag, mRangeZoom;
2053 QPointer<QCPAxis> mRangeDragHorzAxis, mRangeDragVertAxis, mRangeZoomHorzAxis, mRangeZoomVertAxis;
2054 double mRangeZoomFactorHorz, mRangeZoomFactorVert;
2056 QCPRange mDragStartHorzRange, mDragStartVertRange;
2057 QCP::AntialiasedElements mAADragBackup, mNotAADragBackup;
2060 QHash<QCPAxis::AxisType, QList<QCPAxis*> > mAxes;
2063 virtual void applyDefaultAntialiasingHint(
QCPPainter *painter)
const;
2067 virtual void mousePressEvent(QMouseEvent *event);
2068 virtual void mouseMoveEvent(QMouseEvent *event);
2069 virtual void mouseReleaseEvent(QMouseEvent *event);
2070 virtual void wheelEvent(QWheelEvent *event);
2087 Q_PROPERTY(
QCPLegend* parentLegend READ parentLegend)
2088 Q_PROPERTY(QFont font READ font WRITE setFont)
2089 Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor)
2090 Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont)
2091 Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE setSelectedTextColor)
2092 Q_PROPERTY(
bool selectable READ selectable WRITE setSelectable NOTIFY selectionChanged)
2093 Q_PROPERTY(
bool selected READ selected WRITE setSelected NOTIFY selectableChanged)
2099 QCPLegend *parentLegend()
const {
return mParentLegend; }
2100 QFont font()
const {
return mFont; }
2101 QColor textColor()
const {
return mTextColor; }
2102 QFont selectedFont()
const {
return mSelectedFont; }
2103 QColor selectedTextColor()
const {
return mSelectedTextColor; }
2104 bool selectable()
const {
return mSelectable; }
2105 bool selected()
const {
return mSelected; }
2108 void setFont(
const QFont &font);
2109 void setTextColor(
const QColor &color);
2110 void setSelectedFont(
const QFont &font);
2111 void setSelectedTextColor(
const QColor &color);
2112 Q_SLOT
void setSelectable(
bool selectable);
2113 Q_SLOT
void setSelected(
bool selected);
2116 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0)
const;
2119 void selectionChanged(
bool selected);
2120 void selectableChanged(
bool selectable);
2127 QFont mSelectedFont;
2128 QColor mSelectedTextColor;
2129 bool mSelectable, mSelected;
2133 virtual void applyDefaultAntialiasingHint(
QCPPainter *painter)
const;
2134 virtual QRect clipRect()
const;
2137 virtual void selectEvent(QMouseEvent *event,
bool additive,
const QVariant &details,
bool *selectionStateChanged);
2138 virtual void deselectEvent(
bool *selectionStateChanged);
2162 virtual QSize minimumSizeHint()
const;
2165 QPen getIconBorderPen()
const;
2166 QColor getTextColor()
const;
2167 QFont getFont()
const;
2175 Q_PROPERTY(QPen borderPen READ borderPen WRITE setBorderPen)
2176 Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
2177 Q_PROPERTY(QFont font READ font WRITE setFont)
2178 Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor)
2179 Q_PROPERTY(QSize iconSize READ iconSize WRITE setIconSize)
2180 Q_PROPERTY(
int iconTextPadding READ iconTextPadding WRITE setIconTextPadding)
2181 Q_PROPERTY(QPen iconBorderPen READ iconBorderPen WRITE setIconBorderPen)
2182 Q_PROPERTY(SelectableParts selectableParts READ selectableParts WRITE setSelectableParts NOTIFY selectionChanged)
2183 Q_PROPERTY(SelectableParts selectedParts READ selectedParts WRITE setSelectedParts NOTIFY selectableChanged)
2184 Q_PROPERTY(QPen selectedBorderPen READ selectedBorderPen WRITE setSelectedBorderPen)
2185 Q_PROPERTY(QPen selectedIconBorderPen READ selectedIconBorderPen WRITE setSelectedIconBorderPen)
2186 Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
2187 Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont)
2188 Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE setSelectedTextColor)
2197 ,spLegendBox = 0x001
2204 virtual ~QCPLegend();
2207 QPen borderPen()
const {
return mBorderPen; }
2208 QBrush brush()
const {
return mBrush; }
2209 QFont font()
const {
return mFont; }
2210 QColor textColor()
const {
return mTextColor; }
2211 QSize iconSize()
const {
return mIconSize; }
2212 int iconTextPadding()
const {
return mIconTextPadding; }
2213 QPen iconBorderPen()
const {
return mIconBorderPen; }
2214 SelectableParts selectableParts()
const {
return mSelectableParts; }
2215 SelectableParts selectedParts()
const;
2216 QPen selectedBorderPen()
const {
return mSelectedBorderPen; }
2217 QPen selectedIconBorderPen()
const {
return mSelectedIconBorderPen; }
2218 QBrush selectedBrush()
const {
return mSelectedBrush; }
2219 QFont selectedFont()
const {
return mSelectedFont; }
2220 QColor selectedTextColor()
const {
return mSelectedTextColor; }
2223 void setBorderPen(
const QPen &pen);
2224 void setBrush(
const QBrush &brush);
2225 void setFont(
const QFont &font);
2226 void setTextColor(
const QColor &color);
2227 void setIconSize(
const QSize &size);
2228 void setIconSize(
int width,
int height);
2229 void setIconTextPadding(
int padding);
2230 void setIconBorderPen(
const QPen &pen);
2231 Q_SLOT
void setSelectableParts(
const SelectableParts &selectableParts);
2232 Q_SLOT
void setSelectedParts(
const SelectableParts &selectedParts);
2233 void setSelectedBorderPen(
const QPen &pen);
2234 void setSelectedIconBorderPen(
const QPen &pen);
2235 void setSelectedBrush(
const QBrush &brush);
2236 void setSelectedFont(
const QFont &font);
2237 void setSelectedTextColor(
const QColor &color);
2240 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0)
const;
2245 int itemCount()
const;
2249 bool removeItem(
int index);
2252 QList<QCPAbstractLegendItem*> selectedItems()
const;
2255 void selectionChanged(QCPLegend::SelectableParts parts);
2256 void selectableChanged(QCPLegend::SelectableParts parts);
2260 QPen mBorderPen, mIconBorderPen;
2265 int mIconTextPadding;
2266 SelectableParts mSelectedParts, mSelectableParts;
2267 QPen mSelectedBorderPen, mSelectedIconBorderPen;
2268 QBrush mSelectedBrush;
2269 QFont mSelectedFont;
2270 QColor mSelectedTextColor;
2273 virtual void parentPlotInitialized(
QCustomPlot *parentPlot);
2275 virtual void applyDefaultAntialiasingHint(
QCPPainter *painter)
const;
2278 virtual void selectEvent(QMouseEvent *event,
bool additive,
const QVariant &details,
bool *selectionStateChanged);
2279 virtual void deselectEvent(
bool *selectionStateChanged);
2282 QPen getBorderPen()
const;
2283 QBrush getBrush()
const;
2291 Q_DECLARE_OPERATORS_FOR_FLAGS(QCPLegend::SelectableParts)
2299 Q_PROPERTY(QString text READ text WRITE setText)
2300 Q_PROPERTY(QFont font READ font WRITE
setFont)
2301 Q_PROPERTY(QColor textColor READ textColor WRITE
setTextColor)
2302 Q_PROPERTY(QFont selectedFont READ selectedFont WRITE
setSelectedFont)
2304 Q_PROPERTY(
bool selectable READ selectable WRITE setSelectable NOTIFY selectableChanged)
2305 Q_PROPERTY(
bool selected READ selected WRITE setSelected NOTIFY selectionChanged)
2312 QString text()
const {
return mText; }
2313 QFont font()
const {
return mFont; }
2314 QColor textColor()
const {
return mTextColor; }
2315 QFont selectedFont()
const {
return mSelectedFont; }
2316 QColor selectedTextColor()
const {
return mSelectedTextColor; }
2317 bool selectable()
const {
return mSelectable; }
2318 bool selected()
const {
return mSelected; }
2321 void setText(
const QString &text);
2322 void setFont(
const QFont &font);
2330 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0)
const;
2334 void selectableChanged(
bool selectable);
2341 QFont mSelectedFont;
2342 QColor mSelectedTextColor;
2343 QRect mTextBoundingRect;
2344 bool mSelectable, mSelected;
2347 virtual void applyDefaultAntialiasingHint(
QCPPainter *painter)
const;
2352 virtual void selectEvent(QMouseEvent *event,
bool additive,
const QVariant &details,
bool *selectionStateChanged);
2353 virtual void deselectEvent(
bool *selectionStateChanged);
2356 QFont mainFont()
const;
2357 QColor mainTextColor()
const;
2371 QImage mGradientImage;
2372 bool mGradientImageInvalidated;
2374 using QCPAxisRect::calculateAutoMargin;
2381 void updateGradientImage();
2382 Q_SLOT
void axisSelectionChanged(QCPAxis::SelectableParts selectedParts);
2383 Q_SLOT
void axisSelectableChanged(QCPAxis::SelectableParts selectableParts);
2393 Q_PROPERTY(
QCPRange dataRange READ dataRange WRITE setDataRange NOTIFY dataRangeChanged)
2394 Q_PROPERTY(
QCPAxis::ScaleType dataScaleType READ dataScaleType WRITE setDataScaleType NOTIFY dataScaleTypeChanged)
2395 Q_PROPERTY(
QCPColorGradient gradient READ gradient WRITE setGradient NOTIFY gradientChanged)
2396 Q_PROPERTY(QString label READ label WRITE setLabel)
2397 Q_PROPERTY(
int barWidth READ barWidth WRITE setBarWidth)
2398 Q_PROPERTY(
bool rangeDrag READ rangeDrag WRITE setRangeDrag)
2399 Q_PROPERTY(
bool rangeZoom READ rangeZoom WRITE setRangeZoom)
2408 QCPRange dataRange()
const {
return mDataRange; }
2411 QString label()
const;
2412 int barWidth ()
const {
return mBarWidth; }
2413 bool rangeDrag()
const;
2414 bool rangeZoom()
const;
2418 Q_SLOT
void setDataRange(
const QCPRange &dataRange);
2421 void setLabel(
const QString &str);
2422 void setBarWidth(
int width);
2423 void setRangeDrag(
bool enabled);
2424 void setRangeZoom(
bool enabled);
2427 QList<QCPColorMap*> colorMaps()
const;
2428 void rescaleDataRange(
bool onlyVisibleMaps);
2434 void dataRangeChanged(
QCPRange newRange);
2447 QPointer<QCPColorScaleAxisRectPrivate> mAxisRect;
2448 QPointer<QCPAxis> mColorAxis;
2451 virtual void applyDefaultAntialiasingHint(
QCPPainter *painter)
const;
2453 virtual void mousePressEvent(QMouseEvent *event);
2454 virtual void mouseMoveEvent(QMouseEvent *event);
2455 virtual void mouseReleaseEvent(QMouseEvent *event);
2456 virtual void wheelEvent(QWheelEvent *event);
2473 QCPData(
double key,
double value);
2475 double keyErrorPlus, keyErrorMinus;
2476 double valueErrorPlus, valueErrorMinus;
2478 Q_DECLARE_TYPEINFO(
QCPData, Q_MOVABLE_TYPE);
2488 typedef QMapIterator<double, QCPData> QCPDataMapIterator;
2489 typedef QMutableMapIterator<double, QCPData> QCPDataMutableMapIterator;
2496 Q_PROPERTY(
LineStyle lineStyle READ lineStyle WRITE setLineStyle)
2497 Q_PROPERTY(
QCPScatterStyle scatterStyle READ scatterStyle WRITE setScatterStyle)
2498 Q_PROPERTY(
ErrorType errorType READ errorType WRITE setErrorType)
2499 Q_PROPERTY(QPen errorPen READ errorPen WRITE setErrorPen)
2500 Q_PROPERTY(
double errorBarSize READ errorBarSize WRITE setErrorBarSize)
2501 Q_PROPERTY(
bool errorBarSkipSymbol READ errorBarSkipSymbol WRITE setErrorBarSkipSymbol)
2502 Q_PROPERTY(
QCPGraph* channelFillGraph READ channelFillGraph WRITE setChannelFillGraph)
2503 Q_PROPERTY(
bool adaptiveSampling READ adaptiveSampling WRITE setAdaptiveSampling)
2535 LineStyle lineStyle()
const {
return mLineStyle; }
2537 ErrorType errorType()
const {
return mErrorType; }
2538 QPen errorPen()
const {
return mErrorPen; }
2539 double errorBarSize()
const {
return mErrorBarSize; }
2540 bool errorBarSkipSymbol()
const {
return mErrorBarSkipSymbol; }
2541 QCPGraph *channelFillGraph()
const {
return mChannelFillGraph.
data(); }
2542 bool adaptiveSampling()
const {
return mAdaptiveSampling; }
2545 void setData(
QCPDataMap *data,
bool copy=
false);
2546 void setData(
const QVector<double> &key,
const QVector<double> &value);
2547 void setDataKeyError(
const QVector<double> &key,
const QVector<double> &value,
const QVector<double> &keyError);
2548 void setDataKeyError(
const QVector<double> &key,
const QVector<double> &value,
const QVector<double> &keyErrorMinus,
const QVector<double> &keyErrorPlus);
2549 void setDataValueError(
const QVector<double> &key,
const QVector<double> &value,
const QVector<double> &valueError);
2550 void setDataValueError(
const QVector<double> &key,
const QVector<double> &value,
const QVector<double> &valueErrorMinus,
const QVector<double> &valueErrorPlus);
2551 void setDataBothError(
const QVector<double> &key,
const QVector<double> &value,
const QVector<double> &keyError,
const QVector<double> &valueError);
2552 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);
2556 void setErrorPen(
const QPen &pen);
2557 void setErrorBarSize(
double size);
2558 void setErrorBarSkipSymbol(
bool enabled);
2559 void setChannelFillGraph(
QCPGraph *targetGraph);
2560 void setAdaptiveSampling(
bool enabled);
2564 void addData(
const QCPData &data);
2565 void addData(
double key,
double value);
2566 void addData(
const QVector<double> &keys,
const QVector<double> &values);
2567 void removeDataBefore(
double key);
2568 void removeDataAfter(
double key);
2569 void removeData(
double fromKey,
double toKey);
2570 void removeData(
double key);
2573 virtual void clearData();
2574 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0)
const;
2578 void rescaleAxes(
bool onlyEnlarge,
bool includeErrorBars)
const;
2579 void rescaleKeyAxis(
bool onlyEnlarge,
bool includeErrorBars)
const;
2580 void rescaleValueAxis(
bool onlyEnlarge,
bool includeErrorBars)
const;
2589 double mErrorBarSize;
2590 bool mErrorBarSkipSymbol;
2591 QPointer<QCPGraph> mChannelFillGraph;
2592 bool mAdaptiveSampling;
2596 virtual void drawLegendIcon(
QCPPainter *painter,
const QRectF &rect)
const;
2597 virtual QCPRange getKeyRange(
bool &foundRange,
SignDomain inSignDomain=sdBoth)
const;
2598 virtual QCPRange getValueRange(
bool &foundRange,
SignDomain inSignDomain=sdBoth)
const;
2599 virtual QCPRange getKeyRange(
bool &foundRange,
SignDomain inSignDomain,
bool includeErrors)
const;
2600 virtual QCPRange getValueRange(
bool &foundRange,
SignDomain inSignDomain,
bool includeErrors)
const;
2603 virtual void drawFill(
QCPPainter *painter, QVector<QPointF> *lineData)
const;
2604 virtual void drawScatterPlot(
QCPPainter *painter, QVector<QCPData> *scatterData)
const;
2605 virtual void drawLinePlot(
QCPPainter *painter, QVector<QPointF> *lineData)
const;
2606 virtual void drawImpulsePlot(
QCPPainter *painter, QVector<QPointF> *lineData)
const;
2609 void getPreparedData(QVector<QCPData> *lineData, QVector<QCPData> *scatterData)
const;
2610 void getPlotData(QVector<QPointF> *lineData, QVector<QCPData> *scatterData)
const;
2611 void getScatterPlotData(QVector<QCPData> *scatterData)
const;
2612 void getLinePlotData(QVector<QPointF> *linePixelData, QVector<QCPData> *scatterData)
const;
2613 void getStepLeftPlotData(QVector<QPointF> *linePixelData, QVector<QCPData> *scatterData)
const;
2614 void getStepRightPlotData(QVector<QPointF> *linePixelData, QVector<QCPData> *scatterData)
const;
2615 void getStepCenterPlotData(QVector<QPointF> *linePixelData, QVector<QCPData> *scatterData)
const;
2616 void getImpulsePlotData(QVector<QPointF> *linePixelData, QVector<QCPData> *scatterData)
const;
2617 void drawError(
QCPPainter *painter,
double x,
double y,
const QCPData &data)
const;
2618 void getVisibleDataBounds(QCPDataMap::const_iterator &lower, QCPDataMap::const_iterator &upper)
const;
2619 int countDataInBounds(
const QCPDataMap::const_iterator &lower,
const QCPDataMap::const_iterator &upper,
int maxCount)
const;
2620 void addFillBasePoints(QVector<QPointF> *lineData)
const;
2621 void removeFillBasePoints(QVector<QPointF> *lineData)
const;
2622 QPointF lowerFillBasePoint(
double lowerKey)
const;
2623 QPointF upperFillBasePoint(
double upperKey)
const;
2624 const QPolygonF getChannelFillPolygon(
const QVector<QPointF> *lineData)
const;
2625 int findIndexBelowX(
const QVector<QPointF> *data,
double x)
const;
2626 int findIndexAboveX(
const QVector<QPointF> *data,
double x)
const;
2627 int findIndexBelowY(
const QVector<QPointF> *data,
double y)
const;
2628 int findIndexAboveY(
const QVector<QPointF> *data,
double y)
const;
2629 double pointDistance(
const QPointF &pixelPoint)
const;
2645 double t, key, value;
2658 typedef QMapIterator<double, QCPCurveData> QCPCurveDataMapIterator;
2659 typedef QMutableMapIterator<double, QCPCurveData> QCPCurveDataMutableMapIterator;
2666 Q_PROPERTY(
QCPScatterStyle scatterStyle READ scatterStyle WRITE setScatterStyle)
2667 Q_PROPERTY(
LineStyle lineStyle READ lineStyle WRITE setLineStyle)
2684 LineStyle lineStyle()
const {
return mLineStyle; }
2688 void setData(
const QVector<double> &t,
const QVector<double> &key,
const QVector<double> &value);
2689 void setData(
const QVector<double> &key,
const QVector<double> &value);
2696 void addData(
double t,
double key,
double value);
2697 void addData(
double key,
double value);
2698 void addData(
const QVector<double> &ts,
const QVector<double> &keys,
const QVector<double> &values);
2699 void removeDataBefore(
double t);
2700 void removeDataAfter(
double t);
2701 void removeData(
double fromt,
double tot);
2702 void removeData(
double t);
2705 virtual void clearData();
2706 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0)
const;
2716 virtual void drawLegendIcon(
QCPPainter *painter,
const QRectF &rect)
const;
2717 virtual QCPRange getKeyRange(
bool &foundRange,
SignDomain inSignDomain=sdBoth)
const;
2718 virtual QCPRange getValueRange(
bool &foundRange,
SignDomain inSignDomain=sdBoth)
const;
2721 virtual void drawScatterPlot(
QCPPainter *painter,
const QVector<QPointF> *pointData)
const;
2724 void getCurveData(QVector<QPointF> *lineData)
const;
2725 int getRegion(
double x,
double y,
double rectLeft,
double rectTop,
double rectRight,
double rectBottom)
const;
2726 QPointF getOptimizedPoint(
int prevRegion,
double prevKey,
double prevValue,
double key,
double value,
double rectLeft,
double rectTop,
double rectRight,
double rectBottom)
const;
2727 QVector<QPointF> getOptimizedCornerPoints(
int prevRegion,
int currentRegion,
double prevKey,
double prevValue,
double key,
double value,
double rectLeft,
double rectTop,
double rectRight,
double rectBottom)
const;
2728 bool mayTraverse(
int prevRegion,
int currentRegion)
const;
2729 bool getTraverse(
double prevKey,
double prevValue,
double key,
double value,
double rectLeft,
double rectTop,
double rectRight,
double rectBottom, QPointF &crossA, QPointF &crossB)
const;
2730 void getTraverseCornerPoints(
int prevRegion,
int currentRegion,
double rectLeft,
double rectTop,
double rectRight,
double rectBottom, QVector<QPointF> &beforeTraverse, QVector<QPointF> &afterTraverse)
const;
2731 double pointDistance(
const QPointF &pixelPoint)
const;
2746 Q_PROPERTY(
SpacingType spacingType READ spacingType WRITE setSpacingType)
2747 Q_PROPERTY(
double spacing READ spacing WRITE setSpacing)
2764 SpacingType spacingType()
const {
return mSpacingType; }
2765 double spacing()
const {
return mSpacing; }
2769 void setSpacing(
double spacing);
2772 QList<QCPBars*>
bars()
const {
return mBars; }
2773 QCPBars* bars(
int index)
const;
2774 int size()
const {
return mBars.size(); }
2779 void insert(
int i,
QCPBars *bars);
2787 QList<QCPBars*> mBars;
2790 void registerBars(
QCPBars *bars);
2791 void unregisterBars(
QCPBars *bars);
2794 double keyPixelOffset(
const QCPBars *bars,
double keyCoord);
2795 double getPixelSpacing(
const QCPBars *bars,
double keyCoord);
2811 Q_DECLARE_TYPEINFO(
QCPBarData, Q_MOVABLE_TYPE);
2821 typedef QMapIterator<double, QCPBarData> QCPBarDataMapIterator;
2822 typedef QMutableMapIterator<double, QCPBarData> QCPBarDataMutableMapIterator;
2829 Q_PROPERTY(
double width READ width WRITE setWidth)
2830 Q_PROPERTY(
WidthType widthType READ widthType WRITE setWidthType)
2831 Q_PROPERTY(
QCPBarsGroup* barsGroup READ barsGroup WRITE setBarsGroup)
2832 Q_PROPERTY(
double baseValue READ baseValue WRITE setBaseValue)
2833 Q_PROPERTY(
QCPBars* barBelow READ barBelow)
2834 Q_PROPERTY(
QCPBars* barAbove READ barAbove)
2853 double width()
const {
return mWidth; }
2854 WidthType widthType()
const {
return mWidthType; }
2856 double baseValue()
const {
return mBaseValue; }
2862 void setWidth(
double width);
2865 void setBaseValue(
double baseValue);
2867 void setData(
const QVector<double> &key,
const QVector<double> &value);
2870 void moveBelow(
QCPBars *bars);
2871 void moveAbove(
QCPBars *bars);
2874 void addData(
double key,
double value);
2875 void addData(
const QVector<double> &keys,
const QVector<double> &values);
2876 void removeDataBefore(
double key);
2877 void removeDataAfter(
double key);
2878 void removeData(
double fromKey,
double toKey);
2879 void removeData(
double key);
2882 virtual void clearData();
2883 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0)
const;
2892 QPointer<QCPBars> mBarBelow, mBarAbove;
2896 virtual void drawLegendIcon(
QCPPainter *painter,
const QRectF &rect)
const;
2897 virtual QCPRange getKeyRange(
bool &foundRange,
SignDomain inSignDomain=sdBoth)
const;
2898 virtual QCPRange getValueRange(
bool &foundRange,
SignDomain inSignDomain=sdBoth)
const;
2901 void getVisibleDataBounds(QCPBarDataMap::const_iterator &lower, QCPBarDataMap::const_iterator &upperEnd)
const;
2902 QPolygonF getBarPolygon(
double key,
double value)
const;
2903 void getPixelWidth(
double key,
double &lower,
double &upper)
const;
2904 double getStackedBaseValue(
double key,
bool positive)
const;
2921 Q_PROPERTY(
double key READ key WRITE setKey)
2922 Q_PROPERTY(
double minimum READ minimum WRITE setMinimum)
2923 Q_PROPERTY(
double lowerQuartile READ lowerQuartile WRITE setLowerQuartile)
2924 Q_PROPERTY(
double median READ median WRITE setMedian)
2925 Q_PROPERTY(
double upperQuartile READ upperQuartile WRITE setUpperQuartile)
2926 Q_PROPERTY(
double maximum READ maximum WRITE setMaximum)
2927 Q_PROPERTY(QVector<double> outliers READ outliers WRITE setOutliers)
2928 Q_PROPERTY(
double width READ width WRITE setWidth)
2929 Q_PROPERTY(
double whiskerWidth READ whiskerWidth WRITE setWhiskerWidth)
2930 Q_PROPERTY(QPen whiskerPen READ whiskerPen WRITE setWhiskerPen)
2931 Q_PROPERTY(QPen whiskerBarPen READ whiskerBarPen WRITE setWhiskerBarPen)
2932 Q_PROPERTY(QPen medianPen READ medianPen WRITE setMedianPen)
2933 Q_PROPERTY(
QCPScatterStyle outlierStyle READ outlierStyle WRITE setOutlierStyle)
2939 double key()
const {
return mKey; }
2940 double minimum()
const {
return mMinimum; }
2941 double lowerQuartile()
const {
return mLowerQuartile; }
2942 double median()
const {
return mMedian; }
2943 double upperQuartile()
const {
return mUpperQuartile; }
2944 double maximum()
const {
return mMaximum; }
2945 QVector<double> outliers()
const {
return mOutliers; }
2946 double width()
const {
return mWidth; }
2947 double whiskerWidth()
const {
return mWhiskerWidth; }
2948 QPen whiskerPen()
const {
return mWhiskerPen; }
2949 QPen whiskerBarPen()
const {
return mWhiskerBarPen; }
2950 QPen medianPen()
const {
return mMedianPen; }
2954 void setKey(
double key);
2955 void setMinimum(
double value);
2956 void setLowerQuartile(
double value);
2957 void setMedian(
double value);
2958 void setUpperQuartile(
double value);
2959 void setMaximum(
double value);
2960 void setOutliers(
const QVector<double> &values);
2961 void setData(
double key,
double minimum,
double lowerQuartile,
double median,
double upperQuartile,
double maximum);
2962 void setWidth(
double width);
2963 void setWhiskerWidth(
double width);
2964 void setWhiskerPen(
const QPen &pen);
2965 void setWhiskerBarPen(
const QPen &pen);
2966 void setMedianPen(
const QPen &pen);
2970 virtual void clearData();
2971 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0)
const;
2975 QVector<double> mOutliers;
2976 double mKey, mMinimum, mLowerQuartile, mMedian, mUpperQuartile, mMaximum;
2978 double mWhiskerWidth;
2979 QPen mWhiskerPen, mWhiskerBarPen, mMedianPen;
2984 virtual void drawLegendIcon(
QCPPainter *painter,
const QRectF &rect)
const;
2985 virtual QCPRange getKeyRange(
bool &foundRange,
SignDomain inSignDomain=sdBoth)
const;
2986 virtual QCPRange getValueRange(
bool &foundRange,
SignDomain inSignDomain=sdBoth)
const;
2989 virtual void drawQuartileBox(
QCPPainter *painter, QRectF *quartileBox=0)
const;
2990 virtual void drawMedian(
QCPPainter *painter)
const;
2991 virtual void drawWhiskers(
QCPPainter *painter)
const;
2992 virtual void drawOutliers(
QCPPainter *painter)
const;
3008 int keySize()
const {
return mKeySize; }
3009 int valueSize()
const {
return mValueSize; }
3010 QCPRange keyRange()
const {
return mKeyRange; }
3011 QCPRange valueRange()
const {
return mValueRange; }
3012 QCPRange dataBounds()
const {
return mDataBounds; }
3013 double data(
double key,
double value);
3014 double cell(
int keyIndex,
int valueIndex);
3017 void setSize(
int keySize,
int valueSize);
3018 void setKeySize(
int keySize);
3019 void setValueSize(
int valueSize);
3021 void setKeyRange(
const QCPRange &keyRange);
3022 void setValueRange(
const QCPRange &valueRange);
3023 void setData(
double key,
double value,
double z);
3024 void setCell(
int keyIndex,
int valueIndex,
double z);
3027 void recalculateDataBounds();
3029 void fill(
double z);
3031 void coordToCell(
double key,
double value,
int *keyIndex,
int *valueIndex)
const;
3032 void cellToCoord(
int keyIndex,
int valueIndex,
double *key,
double *value)
const;
3036 int mKeySize, mValueSize;
3052 Q_PROPERTY(
QCPRange dataRange READ dataRange WRITE setDataRange NOTIFY dataRangeChanged)
3053 Q_PROPERTY(
QCPAxis::ScaleType dataScaleType READ dataScaleType WRITE setDataScaleType NOTIFY dataScaleTypeChanged)
3054 Q_PROPERTY(
QCPColorGradient gradient READ gradient WRITE setGradient NOTIFY gradientChanged)
3055 Q_PROPERTY(
bool interpolate READ interpolate WRITE setInterpolate)
3056 Q_PROPERTY(
bool tightBoundary READ tightBoundary WRITE setTightBoundary)
3057 Q_PROPERTY(
QCPColorScale* colorScale READ colorScale WRITE setColorScale)
3065 QCPRange dataRange()
const {
return mDataRange; }
3067 bool interpolate()
const {
return mInterpolate; }
3068 bool tightBoundary()
const {
return mTightBoundary; }
3070 QCPColorScale *colorScale()
const {
return mColorScale.data(); }
3074 Q_SLOT
void setDataRange(
const QCPRange &dataRange);
3077 void setInterpolate(
bool enabled);
3078 void setTightBoundary(
bool enabled);
3082 void rescaleDataRange(
bool recalculateDataBounds=
false);
3083 Q_SLOT
void updateLegendIcon(Qt::TransformationMode transformMode=Qt::SmoothTransformation,
const QSize &thumbSize=QSize(32, 18));
3086 virtual void clearData();
3087 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0)
const;
3090 void dataRangeChanged(
QCPRange newRange);
3101 bool mTightBoundary;
3102 QPointer<QCPColorScale> mColorScale;
3105 QPixmap mLegendIcon;
3106 bool mMapImageInvalidated;
3109 virtual void updateMapImage();
3113 virtual void drawLegendIcon(
QCPPainter *painter,
const QRectF &rect)
const;
3114 virtual QCPRange getKeyRange(
bool &foundRange,
SignDomain inSignDomain=sdBoth)
const;
3115 virtual QCPRange getValueRange(
bool &foundRange,
SignDomain inSignDomain=sdBoth)
const;
3130 QCPFinancialData(
double key,
double open,
double high,
double low,
double close);
3131 double key, open, high, low, close;
3143 typedef QMapIterator<double, QCPFinancialData> QCPFinancialDataMapIterator;
3144 typedef QMutableMapIterator<double, QCPFinancialData> QCPFinancialDataMutableMapIterator;
3151 Q_PROPERTY(
ChartStyle chartStyle READ chartStyle WRITE setChartStyle)
3152 Q_PROPERTY(
double width READ width WRITE setWidth)
3153 Q_PROPERTY(
bool twoColored READ twoColored WRITE setTwoColored)
3154 Q_PROPERTY(QBrush brushPositive READ brushPositive WRITE setBrushPositive)
3155 Q_PROPERTY(QBrush brushNegative READ brushNegative WRITE setBrushNegative)
3156 Q_PROPERTY(QPen penPositive READ penPositive WRITE setPenPositive)
3157 Q_PROPERTY(QPen penNegative READ penNegative WRITE setPenNegative)
3175 ChartStyle chartStyle()
const {
return mChartStyle; }
3176 double width()
const {
return mWidth; }
3177 bool twoColored()
const {
return mTwoColored; }
3178 QBrush brushPositive()
const {
return mBrushPositive; }
3179 QBrush brushNegative()
const {
return mBrushNegative; }
3180 QPen penPositive()
const {
return mPenPositive; }
3181 QPen penNegative()
const {
return mPenNegative; }
3186 void setData(
const QVector<double> &key,
const QVector<double> &open,
const QVector<double> &high,
const QVector<double> &low,
const QVector<double> &close);
3188 void setWidth(
double width);
3189 void setTwoColored(
bool twoColored);
3190 void setBrushPositive(
const QBrush &brush);
3191 void setBrushNegative(
const QBrush &brush);
3192 void setPenPositive(
const QPen &pen);
3193 void setPenNegative(
const QPen &pen);
3198 void addData(
double key,
double open,
double high,
double low,
double close);
3199 void addData(
const QVector<double> &key,
const QVector<double> &open,
const QVector<double> &high,
const QVector<double> &low,
const QVector<double> &close);
3200 void removeDataBefore(
double key);
3201 void removeDataAfter(
double key);
3202 void removeData(
double fromKey,
double toKey);
3203 void removeData(
double key);
3206 virtual void clearData();
3207 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0)
const;
3210 static QCPFinancialDataMap timeSeriesToOhlc(
const QVector<double> &time,
const QVector<double> &value,
double timeBinSize,
double timeBinOffset = 0);
3218 QBrush mBrushPositive, mBrushNegative;
3219 QPen mPenPositive, mPenNegative;
3223 virtual void drawLegendIcon(
QCPPainter *painter,
const QRectF &rect)
const;
3224 virtual QCPRange getKeyRange(
bool &foundRange,
SignDomain inSignDomain=sdBoth)
const;
3225 virtual QCPRange getValueRange(
bool &foundRange,
SignDomain inSignDomain=sdBoth)
const;
3228 void drawOhlcPlot(
QCPPainter *painter,
const QCPFinancialDataMap::const_iterator &begin,
const QCPFinancialDataMap::const_iterator &end);
3229 void drawCandlestickPlot(
QCPPainter *painter,
const QCPFinancialDataMap::const_iterator &begin,
const QCPFinancialDataMap::const_iterator &end);
3230 double ohlcSelectTest(
const QPointF &pos,
const QCPFinancialDataMap::const_iterator &begin,
const QCPFinancialDataMap::const_iterator &end)
const;
3231 double candlestickSelectTest(
const QPointF &pos,
const QCPFinancialDataMap::const_iterator &begin,
const QCPFinancialDataMap::const_iterator &end)
const;
3232 void getVisibleDataBounds(QCPFinancialDataMap::const_iterator &lower, QCPFinancialDataMap::const_iterator &upper)
const;
3243 Q_PROPERTY(QPen pen READ pen WRITE setPen)
3244 Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
3251 QPen pen()
const {
return mPen; }
3252 QPen selectedPen()
const {
return mSelectedPen; }
3255 void setPen(
const QPen &pen);
3256 void setSelectedPen(
const QPen &pen);
3259 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0)
const;
3266 QPen mPen, mSelectedPen;
3272 double distToStraightLine(
const QVector2D &point1,
const QVector2D &vec,
const QVector2D &point)
const;
3273 QLineF getRectClippedStraightLine(
const QVector2D &point1,
const QVector2D &vec,
const QRect &rect)
const;
3274 QPen mainPen()
const;
3282 Q_PROPERTY(QPen pen READ pen WRITE setPen)
3283 Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
3292 QPen pen()
const {
return mPen; }
3293 QPen selectedPen()
const {
return mSelectedPen; }
3298 void setPen(
const QPen &pen);
3299 void setSelectedPen(
const QPen &pen);
3304 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0)
const;
3311 QPen mPen, mSelectedPen;
3318 QLineF getRectClippedLine(
const QVector2D &start,
const QVector2D &end,
const QRect &rect)
const;
3319 QPen mainPen()
const;
3327 Q_PROPERTY(QPen pen READ pen WRITE setPen)
3328 Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
3337 QPen pen()
const {
return mPen; }
3338 QPen selectedPen()
const {
return mSelectedPen; }
3343 void setPen(
const QPen &pen);
3344 void setSelectedPen(
const QPen &pen);
3349 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0)
const;
3358 QPen mPen, mSelectedPen;
3365 QPen mainPen()
const;
3373 Q_PROPERTY(QPen pen READ pen WRITE setPen)
3374 Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
3375 Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
3376 Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
3383 QPen pen()
const {
return mPen; }
3384 QPen selectedPen()
const {
return mSelectedPen; }
3385 QBrush brush()
const {
return mBrush; }
3386 QBrush selectedBrush()
const {
return mSelectedBrush; }
3389 void setPen(
const QPen &pen);
3390 void setSelectedPen(
const QPen &pen);
3391 void setBrush(
const QBrush &brush);
3392 void setSelectedBrush(
const QBrush &brush);
3395 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0)
const;
3407 enum AnchorIndex {aiTop, aiTopRight, aiRight, aiBottom, aiBottomLeft, aiLeft};
3410 QPen mPen, mSelectedPen;
3411 QBrush mBrush, mSelectedBrush;
3415 virtual QPointF anchorPixelPoint(
int anchorId)
const;
3418 QPen mainPen()
const;
3419 QBrush mainBrush()
const;
3427 Q_PROPERTY(QColor color READ color WRITE setColor)
3428 Q_PROPERTY(QColor selectedColor READ selectedColor WRITE setSelectedColor)
3429 Q_PROPERTY(QPen pen READ pen WRITE setPen)
3430 Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
3431 Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
3432 Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
3433 Q_PROPERTY(QFont font READ font WRITE setFont)
3434 Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont)
3435 Q_PROPERTY(QString text READ text WRITE setText)
3436 Q_PROPERTY(Qt::Alignment positionAlignment READ positionAlignment WRITE setPositionAlignment)
3437 Q_PROPERTY(Qt::Alignment textAlignment READ textAlignment WRITE setTextAlignment)
3438 Q_PROPERTY(
double rotation READ rotation WRITE setRotation)
3439 Q_PROPERTY(QMargins padding READ padding WRITE setPadding)
3446 QColor color()
const {
return mColor; }
3447 QColor selectedColor()
const {
return mSelectedColor; }
3448 QPen pen()
const {
return mPen; }
3449 QPen selectedPen()
const {
return mSelectedPen; }
3450 QBrush brush()
const {
return mBrush; }
3451 QBrush selectedBrush()
const {
return mSelectedBrush; }
3452 QFont font()
const {
return mFont; }
3453 QFont selectedFont()
const {
return mSelectedFont; }
3454 QString text()
const {
return mText; }
3455 Qt::Alignment positionAlignment()
const {
return mPositionAlignment; }
3456 Qt::Alignment textAlignment()
const {
return mTextAlignment; }
3457 double rotation()
const {
return mRotation; }
3458 QMargins padding()
const {
return mPadding; }
3461 void setColor(
const QColor &color);
3462 void setSelectedColor(
const QColor &color);
3463 void setPen(
const QPen &pen);
3464 void setSelectedPen(
const QPen &pen);
3465 void setBrush(
const QBrush &brush);
3466 void setSelectedBrush(
const QBrush &brush);
3467 void setFont(
const QFont &font);
3468 void setSelectedFont(
const QFont &font);
3469 void setText(
const QString &text);
3470 void setPositionAlignment(Qt::Alignment alignment);
3471 void setTextAlignment(Qt::Alignment alignment);
3472 void setRotation(
double degrees);
3473 void setPadding(
const QMargins &padding);
3476 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0)
const;
3489 enum AnchorIndex {aiTopLeft, aiTop, aiTopRight, aiRight, aiBottomRight, aiBottom, aiBottomLeft, aiLeft};
3492 QColor mColor, mSelectedColor;
3493 QPen mPen, mSelectedPen;
3494 QBrush mBrush, mSelectedBrush;
3495 QFont mFont, mSelectedFont;
3497 Qt::Alignment mPositionAlignment;
3498 Qt::Alignment mTextAlignment;
3504 virtual QPointF anchorPixelPoint(
int anchorId)
const;
3507 QPointF getTextDrawPoint(
const QPointF &pos,
const QRectF &rect, Qt::Alignment positionAlignment)
const;
3508 QFont mainFont()
const;
3509 QColor mainColor()
const;
3510 QPen mainPen()
const;
3511 QBrush mainBrush()
const;
3519 Q_PROPERTY(QPen pen READ pen WRITE setPen)
3520 Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
3521 Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
3522 Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
3529 QPen pen()
const {
return mPen; }
3530 QPen selectedPen()
const {
return mSelectedPen; }
3531 QBrush brush()
const {
return mBrush; }
3532 QBrush selectedBrush()
const {
return mSelectedBrush; }
3535 void setPen(
const QPen &pen);
3536 void setSelectedPen(
const QPen &pen);
3537 void setBrush(
const QBrush &brush);
3538 void setSelectedBrush(
const QBrush &brush);
3541 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0)
const;
3556 enum AnchorIndex {aiTopLeftRim, aiTop, aiTopRightRim, aiRight, aiBottomRightRim, aiBottom, aiBottomLeftRim, aiLeft, aiCenter};
3559 QPen mPen, mSelectedPen;
3560 QBrush mBrush, mSelectedBrush;
3564 virtual QPointF anchorPixelPoint(
int anchorId)
const;
3567 QPen mainPen()
const;
3568 QBrush mainBrush()
const;
3576 Q_PROPERTY(QPixmap pixmap READ pixmap WRITE setPixmap)
3577 Q_PROPERTY(
bool scaled READ scaled WRITE setScaled)
3578 Q_PROPERTY(Qt::AspectRatioMode aspectRatioMode READ aspectRatioMode)
3579 Q_PROPERTY(Qt::TransformationMode transformationMode READ transformationMode)
3580 Q_PROPERTY(QPen pen READ pen WRITE setPen)
3581 Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
3588 QPixmap pixmap()
const {
return mPixmap; }
3589 bool scaled()
const {
return mScaled; }
3590 Qt::AspectRatioMode aspectRatioMode()
const {
return mAspectRatioMode; }
3591 Qt::TransformationMode transformationMode()
const {
return mTransformationMode; }
3592 QPen pen()
const {
return mPen; }
3593 QPen selectedPen()
const {
return mSelectedPen; }
3596 void setPixmap(
const QPixmap &pixmap);
3597 void setScaled(
bool scaled, Qt::AspectRatioMode aspectRatioMode=Qt::KeepAspectRatio, Qt::TransformationMode transformationMode=Qt::SmoothTransformation);
3598 void setPen(
const QPen &pen);
3599 void setSelectedPen(
const QPen &pen);
3602 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0)
const;
3614 enum AnchorIndex {aiTop, aiTopRight, aiRight, aiBottom, aiBottomLeft, aiLeft};
3618 QPixmap mScaledPixmap;
3620 Qt::AspectRatioMode mAspectRatioMode;
3621 Qt::TransformationMode mTransformationMode;
3622 QPen mPen, mSelectedPen;
3626 virtual QPointF anchorPixelPoint(
int anchorId)
const;
3629 void updateScaledPixmap(QRect finalRect=QRect(),
bool flipHorz=
false,
bool flipVert=
false);
3630 QRect getFinalRect(
bool *flippedHorz=0,
bool *flippedVert=0)
const;
3631 QPen mainPen()
const;
3639 Q_PROPERTY(QPen pen READ pen WRITE setPen)
3640 Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
3641 Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
3642 Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
3643 Q_PROPERTY(
double size READ size WRITE setSize)
3644 Q_PROPERTY(
TracerStyle style READ style WRITE setStyle)
3645 Q_PROPERTY(
QCPGraph* graph READ graph WRITE setGraph)
3646 Q_PROPERTY(
double graphKey READ graphKey WRITE setGraphKey)
3647 Q_PROPERTY(
bool interpolating READ interpolating WRITE setInterpolating)
3667 QPen pen()
const {
return mPen; }
3668 QPen selectedPen()
const {
return mSelectedPen; }
3669 QBrush brush()
const {
return mBrush; }
3670 QBrush selectedBrush()
const {
return mSelectedBrush; }
3671 double size()
const {
return mSize; }
3673 QCPGraph *graph()
const {
return mGraph; }
3674 double graphKey()
const {
return mGraphKey; }
3675 bool interpolating()
const {
return mInterpolating; }
3678 void setPen(
const QPen &pen);
3679 void setSelectedPen(
const QPen &pen);
3680 void setBrush(
const QBrush &brush);
3681 void setSelectedBrush(
const QBrush &brush);
3682 void setSize(
double size);
3685 void setGraphKey(
double key);
3686 void setInterpolating(
bool enabled);
3689 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0)
const;
3692 void updatePosition();
3698 QPen mPen, mSelectedPen;
3699 QBrush mBrush, mSelectedBrush;
3704 bool mInterpolating;
3710 QPen mainPen()
const;
3711 QBrush mainBrush()
const;
3719 Q_PROPERTY(QPen pen READ pen WRITE setPen)
3720 Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
3721 Q_PROPERTY(
double length READ length WRITE setLength)
3722 Q_PROPERTY(
BracketStyle style READ style WRITE setStyle)
3735 QPen pen()
const {
return mPen; }
3736 QPen selectedPen()
const {
return mSelectedPen; }
3737 double length()
const {
return mLength; }
3741 void setPen(
const QPen &pen);
3742 void setSelectedPen(
const QPen &pen);
3743 void setLength(
double length);
3747 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0)
const;
3755 enum AnchorIndex {aiCenter};
3756 QPen mPen, mSelectedPen;
3762 virtual QPointF anchorPixelPoint(
int anchorId)
const;
3765 QPen mainPen()
const;
3778 QString text()
const;
3779 void setText(
const QString& strText);
3783 virtual QSize minimumSizeHint()
const;
3789 #endif // QCUSTOMPLOT_H AxisType
Definition: qcustomplot.h:1044
QCPLayoutGrid * plotLayout() const
Definition: qcustomplot.h:1725
A bracket for referencing/highlighting certain parts in the plot.
Definition: qcustomplot.h:3715
A margin group allows synchronization of margin sides if working with multiple layout elements...
Definition: qcustomplot.h:602
An arbitrary pixmap.
Definition: qcustomplot.h:3572
0xFFFF All elements
Definition: qcustomplot.h:131
QList< QCPLayoutElement * > elements(QCP::MarginSide side) const
Definition: qcustomplot.h:610
LayerInsertMode
Definition: qcustomplot.h:1702
static const double maxRange
Definition: qcustomplot.h:512
Whether to use immediate repaint or queued update depends on whether the plotting hint QCP::phForceRe...
Definition: qcustomplot.h:1714
0x08 bottom margin
Definition: qcustomplot.h:105
Definition: qcustomplot.h:3771
QMap< double, QCPData > QCPDataMap
Definition: qcustomplot.h:2487
Holds the data of one single data point for QCPCurve.
Definition: qcustomplot.h:2640
void rescaleKeyAxis(bool onlyEnlarge=false) const
Definition: qcustomplot.cpp:7057
A legend item representing a plottable with an icon and the plottable name.
Definition: qcustomplot.h:2147
ScaleType
Definition: qcustomplot.h:1074
void selectionChanged(bool selected)
Definition: moc_qcustomplot.cpp:3324
PainterMode
Definition: qcustomplot.h:322
ChartStyle
Definition: qcustomplot.h:3165
Definition: qcustomplot.h:144
int bottom() const
Definition: qcustomplot.h:2030
bool isEmpty() const
Definition: qcustomplot.h:2775
The abstract base class for all entries in a QCPLegend.
Definition: qcustomplot.h:2083
virtual void mousePressEvent(QMouseEvent *)
Definition: qcustomplot.h:701
0x0001 Axis base line and tick marks
Definition: qcustomplot.h:120
0x0008 Legend box
Definition: qcustomplot.h:123
Responsible for drawing the grid of a QCPAxis.
Definition: qcustomplot.h:932
0x001 Axis ranges are draggable (see QCPAxisRect::setRangeDrag, QCPAxisRect::setRangeDragAxes) ...
Definition: qcustomplot.h:157
QCPItemAnchor * parentAnchor() const
Definition: qcustomplot.h:1568
EndingStyle
Definition: qcustomplot.h:890
0x00 no margin
Definition: qcustomplot.h:107
0x04 top margin
Definition: qcustomplot.h:104
QCPColorMapData * data() const
Definition: qcustomplot.h:3064
An anchor of an item to which positions can be attached to.
Definition: qcustomplot.h:1505
0x0004 Sub grid lines
Definition: qcustomplot.h:122
virtual void mouseReleaseEvent(QMouseEvent *event)
Definition: qcustomplot.cpp:12585
0x0002 Grid lines
Definition: qcustomplot.h:121
0x01 left margin
Definition: qcustomplot.h:102
QCPRange & operator*=(const double &value)
Definition: qcustomplot.h:491
Base class for all drawable objects.
Definition: qcustomplot.h:410
TracerStyle
Definition: qcustomplot.h:3655
A plottable representing a bar chart in a plot.
Definition: qcustomplot.h:2825
QCPRange & operator+=(const double &value)
Definition: qcustomplot.h:489
0x080 All other objects are selectable (e.g. your own derived layerables, the plot title...
Definition: qcustomplot.h:164
A curved line from one point to another.
Definition: qcustomplot.h:3323
0x0080 Scatter symbols of plottables (excluding scatter symbols of type ssPixmap) ...
Definition: qcustomplot.h:127
Q_SLOT void setSelectable(bool selectable)
Definition: qcustomplot.cpp:12739
QList< QCPLayerable * > children() const
Definition: qcustomplot.h:385
A layout that arranges child elements in a grid.
Definition: qcustomplot.h:759
virtual void mousePressEvent(QMouseEvent *event)
Definition: qcustomplot.cpp:12510
void setFont(const QFont &font)
Definition: qcustomplot.cpp:12697
ErrorType
Definition: qcustomplot.h:2523
QPoint bottomLeft() const
Definition: qcustomplot.h:2036
0x0040 Main lines of items
Definition: qcustomplot.h:126
The abstract base class for all data representing objects in a plot.
Definition: qcustomplot.h:1390
ScatterShape
Definition: qcustomplot.h:248
A plottable representing a single statistical box in a plot.
Definition: qcustomplot.h:2917
QList< QCPBars * > bars() const
Definition: qcustomplot.h:2772
0x008 Plottables are selectable (e.g. graphs, curves, bars,... see QCPAbstractPlottable) ...
Definition: qcustomplot.h:160
virtual QSize minimumSizeHint() const
Definition: qcustomplot.cpp:1972
Definition: qcustomplot.h:142
Definition: qcustomplot.h:1364
SpacingType
Definition: qcustomplot.h:2756
Definition: qcustomplot.h:2364
Definition: qcustomplot.h:1369
void setTextColor(const QColor &color)
Definition: qcustomplot.cpp:12707
A plottable representing a graph in a plot.
Definition: qcustomplot.h:2492
The abstract base class for all items in a plot.
Definition: qcustomplot.h:1609
0x004 axis (tick) labels will be cached as pixmaps, increasing replot performance.
Definition: qcustomplot.h:146
Item that sticks to QCPGraph data points.
Definition: qcustomplot.h:3635
virtual QSize maximumSizeHint() const
Definition: qcustomplot.cpp:1984
The central class of the library. This is the QWidget which displays the plot and interacts with the ...
Definition: qcustomplot.h:1682
int size() const
Definition: qcustomplot.h:2774
LabelSide
Definition: qcustomplot.h:1066
0x040 Items are selectable (Rectangles, Arrows, Textitems, etc. see QCPAbstractItem) ...
Definition: qcustomplot.h:163
Manages a single axis inside a QCustomPlot.
Definition: qcustomplot.h:982
QList< QCPItemAnchor * > anchors() const
Definition: qcustomplot.h:1639
bool isPenDefined() const
Definition: qcustomplot.h:294
PositionType type() const
Definition: qcustomplot.h:1565
Represents the visual appearance of scatter points.
Definition: qcustomplot.h:236
int index() const
Definition: qcustomplot.h:384
Manages a legend inside a QCustomPlot.
Definition: qcustomplot.h:2171
QList< QCPItemPosition * > positions() const
Definition: qcustomplot.h:1638
QCPLayerable * parentLayerable() const
Definition: qcustomplot.h:427
virtual void mouseReleaseEvent(QMouseEvent *)
Definition: qcustomplot.h:703
0x0200 Borders of fills (e.g. under or between graphs)
Definition: qcustomplot.h:129
0x004 The user can select multiple objects by holding the modifier set by QCustomPlot::setMultiSelect...
Definition: qcustomplot.h:159
bool isEmpty() const
Definition: qcustomplot.h:3030
int height() const
Definition: qcustomplot.h:2032
A layer that may contain objects, to control the rendering order.
Definition: qcustomplot.h:367
Qt::Orientation orientation() const
Definition: qcustomplot.h:1208
A rectangle.
Definition: qcustomplot.h:3369
The abstract base class for all objects that form the layout system.
Definition: qcustomplot.h:631
PlottingHint
Definition: qcustomplot.h:141
A straight line that spans infinitely in both directions.
Definition: qcustomplot.h:3239
QMap< double, QCPBarData > QCPBarDataMap
Definition: qcustomplot.h:2820
SelectablePart
Definition: qcustomplot.h:2196
A layout that places child elements aligned to the border or arbitrarily positioned.
Definition: qcustomplot.h:825
0x020 Legends are selectable (or their child items, see QCPLegend::setSelectableParts) ...
Definition: qcustomplot.h:162
Handles the different ending decorations for line-like items.
Definition: qcustomplot.h:874
A color scale for use with color coding data such as QCPColorMap.
Definition: qcustomplot.h:2388
QCPDataMap * data() const
Definition: qcustomplot.h:2534
QPoint center() const
Definition: qcustomplot.h:2038
Holds the data of one single data point for QCPGraph.
Definition: qcustomplot.h:2469
virtual QCPItemPosition * toQCPItemPosition()
Definition: qcustomplot.h:1526
QPainter subclass used internally.
Definition: qcustomplot.h:314
Q_SLOT void setSelected(bool selected)
Definition: qcustomplot.cpp:12756
LineStyle
Definition: qcustomplot.h:2511
LineStyle
Definition: qcustomplot.h:2675
int left() const
Definition: qcustomplot.h:2027
Definition: qcustomplot.h:1323
0x0100 Error bars
Definition: qcustomplot.h:128
virtual void mouseMoveEvent(QMouseEvent *event)
Definition: qcustomplot.cpp:12540
QCPAxis * yAxis2
Definition: qcustomplot.h:1821
SignDomain
Definition: qcustomplot.h:1457
QCPRange & operator/=(const double &value)
Definition: qcustomplot.h:492
static const double minRange
Definition: qcustomplot.h:511
bool isNone() const
Definition: qcustomplot.h:293
BracketStyle
Definition: qcustomplot.h:3725
void rescaleAxes(bool onlyEnlarge=false) const
Definition: qcustomplot.cpp:7046
0x0020 Main lines of plottables (excluding error bars, see element aeErrorBars)
Definition: qcustomplot.h:125
Interaction
Definition: qcustomplot.h:157
QCPBars * barBelow() const
Definition: qcustomplot.h:2857
int top() const
Definition: qcustomplot.h:2029
0x000 No hints are set
Definition: qcustomplot.h:141
virtual QCPItemPosition * toQCPItemPosition()
Definition: qcustomplot.h:1601
A plottable representing a parametric curve in a plot.
Definition: qcustomplot.h:2662
QMap< double, QCPFinancialData > QCPFinancialDataMap
Definition: qcustomplot.h:3142
0x0000 No elements
Definition: qcustomplot.h:132
void rescaleValueAxis(bool onlyEnlarge=false) const
Definition: qcustomplot.cpp:7097
virtual void wheelEvent(QWheelEvent *)
Definition: qcustomplot.h:705
A layout element displaying a plot title text.
Definition: qcustomplot.h:2295
0x02 right margin
Definition: qcustomplot.h:103
QCPLayoutInset * insetLayout() const
Definition: qcustomplot.h:2019
UpdatePhase
Definition: qcustomplot.h:648
An ellipse.
Definition: qcustomplot.h:3515
QPoint topLeft() const
Definition: qcustomplot.h:2034
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
Definition: qcustomplot.cpp:12766
void setSelectedFont(const QFont &font)
Definition: qcustomplot.cpp:12718
QRect rect() const
Definition: qcustomplot.h:659
GradientPreset
Definition: qcustomplot.h:1920
SelectablePart
Definition: qcustomplot.h:1082
Holds the two-dimensional data of a QCPColorMap plottable.
Definition: qcustomplot.h:2999
virtual void update(UpdatePhase phase)
Definition: qcustomplot.cpp:12160
0x002 Axis ranges are zoomable with the mouse wheel (see QCPAxisRect::setRangeZoom, QCPAxisRect::setRangeZoomAxes)
Definition: qcustomplot.h:158
A plottable representing a financial stock chart.
Definition: qcustomplot.h:3147
0x0010 Legend items
Definition: qcustomplot.h:124
The abstract base class for layouts.
Definition: qcustomplot.h:721
Holds the data of one single data point for QCPFinancial.
Definition: qcustomplot.h:3126
A text label.
Definition: qcustomplot.h:3423
QCPAxis * axis() const
Definition: qcustomplot.h:2406
QCPBars * barAbove() const
Definition: qcustomplot.h:2858
QSize size() const
Definition: qcustomplot.h:2033
A plottable representing a two-dimensional color map in a plot.
Definition: qcustomplot.h:3048
virtual void mouseDoubleClickEvent(QMouseEvent *)
Definition: qcustomplot.h:704
QRect viewport() const
Definition: qcustomplot.h:1721
PositionType
Definition: qcustomplot.h:1551
QPoint bottomRight() const
Definition: qcustomplot.h:2037
QPoint topRight() const
Definition: qcustomplot.h:2035
void setSelectedTextColor(const QColor &color)
Definition: qcustomplot.cpp:12729
A line from one point to another.
Definition: qcustomplot.h:3278
bool contains(QCPBars *bars) const
Definition: qcustomplot.h:2777
const QCPRange operator*(const QCPRange &range, double value)
Definition: qcustomplot.h:574
Definition: qcustomplot.h:95
0x0400 Zero-lines, see QCPGrid::setZeroLinePen
Definition: qcustomplot.h:130
Manages the position of an item.
Definition: qcustomplot.h:1542
ColorInterpolation
Definition: qcustomplot.h:1911
Defines a color gradient for use with e.g. QCPColorMap.
Definition: qcustomplot.h:1902
QCPGrid * grid() const
Definition: qcustomplot.h:1145
static Qt::Orientation orientation(AxisType type)
Definition: qcustomplot.h:1221
Represents the range an axis is encompassing.
Definition: qcustomplot.h:478
virtual void mouseMoveEvent(QMouseEvent *)
Definition: qcustomplot.h:702
Groups multiple QCPBars together so they appear side by side.
Definition: qcustomplot.h:2742
0x010 Axes are selectable (or parts of them, see QCPAxis::setSelectableParts)
Definition: qcustomplot.h:161
WidthType
Definition: qcustomplot.h:2843
0xFF all margins
Definition: qcustomplot.h:106
Holds multiple axes and arranges them in a rectangular shape.
Definition: qcustomplot.h:1974
int width() const
Definition: qcustomplot.h:2031
const QCPRange operator-(const QCPRange &range, double value)
Definition: qcustomplot.h:564
InsetPlacement
Definition: qcustomplot.h:832
virtual void simplify()
Definition: qcustomplot.h:855
QCPLegend * legend
Definition: qcustomplot.h:1822
QMap< double, QCPCurveData > QCPCurveDataMap
Definition: qcustomplot.h:2657
QCPRange & operator-=(const double &value)
Definition: qcustomplot.h:490
const QCPRange operator/(const QCPRange &range, double value)
Definition: qcustomplot.h:594
MarginSide
Definition: qcustomplot.h:102
AntialiasedElement
Definition: qcustomplot.h:120
const QCPRange operator+(const QCPRange &range, double value)
Definition: qcustomplot.h:544
LabelType
Definition: qcustomplot.h:1057
RefreshPriority
Definition: qcustomplot.h:1712
virtual void wheelEvent(QWheelEvent *event)
Definition: qcustomplot.cpp:12609
int right() const
Definition: qcustomplot.h:2028
Holds the data of one single data point (one bar) for QCPBars.
Definition: qcustomplot.h:2804