rock_widget_collection  0.1
qcustomplot.h
Go to the documentation of this file.
1 /***************************************************************************
2 ** **
3 ** QCustomPlot, a simple to use, modern plotting widget for Qt **
4 ** Copyright (C) 2012 Emanuel Eichhammer **
5 ** **
6 ** This program is free software: you can redistribute it and/or modify **
7 ** it under the terms of the GNU General Public License as published by **
8 ** the Free Software Foundation, either version 3 of the License, or **
9 ** (at your option) any later version. **
10 ** **
11 ** This program is distributed in the hope that it will be useful, **
12 ** but WITHOUT ANY WARRANTY; without even the implied warranty of **
13 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the **
14 ** GNU General Public License for more details. **
15 ** **
16 ** You should have received a copy of the GNU General Public License **
17 ** along with this program. If not, see http://www.gnu.org/licenses/. **
18 ** **
19 ****************************************************************************
20 ** Author: Emanuel Eichhammer **
21 ** Website/Contact: http://www.WorksLikeClockwork.com/ **
22 ** Date: 02.02.12 **
23 ****************************************************************************/
24 
27 #ifndef QCUSTOMPLOT_H
28 #define QCUSTOMPLOT_H
29 
30 #include <QObject>
31 #include <QWidget>
32 #include <QPainter>
33 #include <QPaintEvent>
34 #include <QPixmap>
35 #include <QVector>
36 #include <QString>
37 #include <QPrinter>
38 #include <QDateTime>
39 #include <QMultiMap>
40 #include <QFlags>
41 #include <QDebug>
42 #include <cmath>
43 
44 // define FUNCNAME macro to mean the function name for debug output on different compilers:
45 #if defined(Q_CC_GNU)
46 # define FUNCNAME __PRETTY_FUNCTION__
47 #elif defined(Q_CC_MSVC)
48 # define FUNCNAME __FUNCSIG__
49 #else
50 # define FUNCNAME __func__
51 #endif
52 
53 class QCustomPlot;
54 class QCPLegend;
55 class QCPRange;
56 class QCPAxis;
57 class QCPData;
58 //class QCPCurveData;
59 //class QCPBarData;
60 
61 class QCPData
62 {
63 public:
64  QCPData();
65  double key, value;
68 };
69 
75 typedef QMap<double, QCPData> QCPDataMap;
76 typedef QMapIterator<double, QCPData> QCPDataMapIterator;
77 typedef QMutableMapIterator<double, QCPData> QCPDataMutableMapIterator;
78 
80 {
81 public:
82  QCPCurveData();
83  double t, key, value;
84 };
85 
92 typedef QMap<double, QCPCurveData> QCPCurveDataMap;
93 typedef QMapIterator<double, QCPCurveData> QCPCurveDataMapIterator;
94 typedef QMutableMapIterator<double, QCPCurveData> QCPCurveDataMutableMapIterator;
95 
97 {
98 public:
99  QCPBarData();
100  double key, value;
101 };
102 
108 typedef QMap<double, QCPBarData> QCPBarDataMap;
109 typedef QMapIterator<double, QCPBarData> QCPBarDataMapIterator;
110 typedef QMutableMapIterator<double, QCPBarData> QCPBarDataMutableMapIterator;
111 
112 class QCPAbstractPlottable : public QObject
113 {
114  Q_OBJECT
115 public:
116  QCPAbstractPlottable(QCPAxis *keyAxis, QCPAxis *valueAxis);
118 
119  // getters:
120  public slots:
121  QCustomPlot *parentPlot() const { return mParentPlot; }
122  QString name() const { return mName; }
123  bool visible() const { return mVisible; }
124  QPen pen() const { return mPen; }
125  QBrush brush() const { return mBrush; }
126  QCPAxis *keyAxis() const { return mKeyAxis; }
127  QCPAxis *valueAxis() const { return mValueAxis; }
128 
129  // setters:
130  void setName(const QString &name);
131  void setVisible(bool visible);
132  void setPen(const QPen &pen);
133  void setBrush(const QBrush &brush);
134  void setKeyAxis(QCPAxis *axis);
135  void setValueAxis(QCPAxis *axis);
136 
137  // non-property methods:
138  void rescaleAxes(bool onlyEnlarge=false) const;
139  void rescaleKeyAxis(bool onlyEnlarge=false) const;
140  void rescaleValueAxis(bool onlyEnlarge=false) const;
141  virtual void clearData() = 0;
142  virtual bool addToLegend() const;
143  virtual bool removeFromLegend() const;
144 
145 protected:
149  enum SignDomain {SDNegative,
151  SDPositive
152  };
154  QString mName;
155  bool mVisible;
156  QPen mPen;
157  QBrush mBrush;
158  QCPAxis *mKeyAxis, *mValueAxis;
159 
160  virtual void draw(QPainter *painter) const = 0;
161  virtual void drawLegendIcon(QPainter *painter, const QRect &rect) const = 0;
162  virtual QCPRange getKeyRange(bool &validRange, SignDomain inSignDomain=SDBoth) const = 0;
163  virtual QCPRange getValueRange(bool &validRange, SignDomain inSignDomain=SDBoth) const = 0;
164  void coordsToPixels(double key, double value, double &x, double &y) const;
165  const QPointF coordsToPixels(double key, double value) const;
166 
167  friend class QCustomPlot;
169 };
170 
172 {
173  Q_OBJECT
174 public:
180  enum LineStyle {LSNone,
181  LSLine,
186  LSImpulse
187  };
188  Q_ENUMS(LineStyle)
210  SSPixmap
211  };
212  Q_ENUMS(ScatterStyle)
219  ETBoth
220  };
221  //Q_ENUMS(ErrorType)
222 
223  explicit QCPGraph(QCPAxis *keyAxis, QCPAxis *valueAxis);
224  virtual ~QCPGraph();
225 
226  // getters:
227 public slots:
228  const QCPDataMap *data() const { return mData; }
229  LineStyle lineStyle() const { return mLineStyle; }
230  ScatterStyle scatterStyle() const { return mScatterStyle; }
231  double scatterSize() const { return mScatterSize; }
232  const QPixmap scatterPixmap() const { return mScatterPixmap; }
233  ErrorType errorType() const { return mErrorType; }
234  QPen errorPen() const { return mErrorPen; }
235  double errorBarSize() const { return mErrorBarSize; }
236  bool errorBarSkipSymbol() const { return mErrorBarSkipSymbol; }
237  QCPGraph *channelFillGraph() const { return mChannelFillGraph; }
238 
239  // setters:
240  void setData(QCPDataMap *data, bool copy=false);
241  void setData(const QVector<double> &key, const QVector<double> &value);
242  void setDataKeyError(const QVector<double> &key, const QVector<double> &value, const QVector<double> &keyError);
243  void setDataKeyError(const QVector<double> &key, const QVector<double> &value, const QVector<double> &keyErrorMinus, const QVector<double> &keyErrorPlus);
244  void setDataValueError(const QVector<double> &key, const QVector<double> &value, const QVector<double> &valueError);
245  void setDataValueError(const QVector<double> &key, const QVector<double> &value, const QVector<double> &valueErrorMinus, const QVector<double> &valueErrorPlus);
246  void setDataBothError(const QVector<double> &key, const QVector<double> &value, const QVector<double> &keyError, const QVector<double> &valueError);
247  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);
248  void setLineStyle(int ls);
249  void setScatterStyle(int ss);
250  void setScatterSize(double size);
251  void setScatterPixmap(const QPixmap &pixmap);
252  void setErrorType(ErrorType errorType);
253  void setErrorPen(const QPen &pen);
254  void setErrorBarSize(double size);
255  void setErrorBarSkipSymbol(bool enabled);
256  void setChannelFillGraph(QCPGraph *targetGraph);
257 
258  // non-property methods:
259  void addData(const QCPDataMap &dataMap);
260  void addData(const QCPData &data);
261  void addData(double key, double value);
262  void addData(const QVector<double> &keys, const QVector<double> &values);
263  void removeDataBefore(double key);
264  void removeDataAfter(double key);
265  void removeData(double fromKey, double toKey);
266  void removeData(double key);
267  virtual void clearData();
268 
269 public:
273  virtual void rescaleAxes(bool onlyEnlarge, bool includeErrorBars) const; // overloads base class interface
274  virtual void rescaleKeyAxis(bool onlyEnlarge, bool includeErrorBars) const; // overloads base class interface
275  virtual void rescaleValueAxis(bool onlyEnlarge, bool includeErrorBars) const; // overloads base class interface
276 
277 protected:
279  QPen mErrorPen;
282  double mScatterSize;
283  QPixmap mScatterPixmap;
288 
289  virtual void draw(QPainter *painter) const;
290  virtual void drawLegendIcon(QPainter *painter, const QRect &rect) const;
291 
292  // functions to generate plot data points in pixel coordinates:
293  void getPlotData(QVector<QPointF> *lineData, QVector<QCPData> *pointData) const;
294  // plot style specific functions to generate plot data, used by getPlotData:
295  void getScatterPlotData(QVector<QCPData> *pointData) const;
296  void getLinePlotData(QVector<QPointF> *lineData, QVector<QCPData> *pointData) const;
297  void getStepLeftPlotData(QVector<QPointF> *lineData, QVector<QCPData> *pointData) const;
298  void getStepRightPlotData(QVector<QPointF> *lineData, QVector<QCPData> *pointData) const;
299  void getStepCenterPlotData(QVector<QPointF> *lineData, QVector<QCPData> *pointData) const;
300  void getImpulsePlotData(QVector<QPointF> *lineData, QVector<QCPData> *pointData) const;
301 
302  // helper functions for drawing:
303  void drawFill(QPainter *painter, QVector<QPointF> *lineData) const;
304  void drawScatterPlot(QPainter *painter, QVector<QCPData> *pointData) const;
305  void drawLinePlot(QPainter *painter, QVector<QPointF> *lineData) const;
306  void drawImpulsePlot(QPainter *painter, QVector<QPointF> *lineData) const;
307  void drawScatter(QPainter *painter, double x, double y, ScatterStyle style) const;
308  void drawError(QPainter *painter, double x, double y, const QCPData &data) const;
309 
310  // helper functions:
311  void getVisibleDataBounds(QCPDataMap::const_iterator &lower, QCPDataMap::const_iterator &upper, int &count) const;
312  void addFillBasePoints(QVector<QPointF> *lineData) const;
313  void removeFillBasePoints(QVector<QPointF> *lineData) const;
314  QPointF lowerFillBasePoint(double lowerKey) const;
315  QPointF upperFillBasePoint(double upperKey) const;
316  const QPolygonF getChannelFillPolygon(const QVector<QPointF> *lineData) const;
317  int findIndexBelowX(const QVector<QPointF> *data, double x) const;
318  int findIndexAboveX(const QVector<QPointF> *data, double x) const;
319  int findIndexBelowY(const QVector<QPointF> *data, double y) const;
320  int findIndexAboveY(const QVector<QPointF> *data, double y) const;
321  virtual QCPRange getKeyRange(bool &validRange, SignDomain inSignDomain=SDBoth) const;
322  virtual QCPRange getValueRange(bool &validRange, SignDomain inSignDomain=SDBoth) const;
323  virtual QCPRange getKeyRange(bool &validRange, SignDomain inSignDomain, bool includeErrors) const; // overloads base class interface
324  virtual QCPRange getValueRange(bool &validRange, SignDomain inSignDomain, bool includeErrors) const; // overloads base class interface
325 
326  friend class QCustomPlot;
327  friend class QCPLegend;
328 };
329 
331 {
332  Q_OBJECT
333 public:
334  explicit QCPCurve(QCPAxis *keyAxis, QCPAxis *valueAxis);
335  virtual ~QCPCurve();
336 
337  // getters:
338  const QCPCurveDataMap *data() const { return mData; }
339 
340  // setters:
341  void setData(QCPCurveDataMap *data, bool copy=false);
342  void setData(const QVector<double> &t, const QVector<double> &key, const QVector<double> &value);
343  void setData(const QVector<double> &key, const QVector<double> &value);
344 
345  // non-property methods:
346  void addData(const QCPCurveDataMap &dataMap);
347  void addData(const QCPCurveData &data);
348  void addData(double t, double key, double value);
349  void addData(double key, double value);
350  void addData(const QVector<double> &ts, const QVector<double> &keys, const QVector<double> &values);
351  void removeDataBefore(double t);
352  void removeDataAfter(double t);
353  void removeData(double fromt, double tot);
354  void removeData(double t);
355  virtual void clearData();
356 
357 protected:
359 
360  virtual void draw(QPainter *painter) const;
361  virtual void drawLegendIcon(QPainter *painter, const QRect &rect) const;
362 
363  void getCurveData(QVector<QPointF> *lineData) const;
364  QPointF outsideCoordsToPixels(double key, double value, int region) const;
365  virtual QCPRange getKeyRange(bool &validRange, SignDomain inSignDomain=SDBoth) const;
366  virtual QCPRange getValueRange(bool &validRange, SignDomain inSignDomain=SDBoth) const;
367 
368  friend class QCustomPlot;
369  friend class QCPLegend;
370 };
371 
373 {
374  Q_OBJECT
375 public:
376  explicit QCPBars(QCPAxis *keyAxis, QCPAxis *valueAxis);
377  virtual ~QCPBars();
378 
379 public slots:
380  // getters:
381  double width() const { return mWidth; }
382  QCPBars *barBelow() const { return mBarBelow; }
383  QCPBars *barAbove() const { return mBarAbove; }
384  const QCPBarDataMap *data() const { return mData; }
385 
386  // setters:
387  void setWidth(double width);
388  void setData(QCPBarDataMap *data, bool copy=false);
389  void setData(const QVector<double> &key, const QVector<double> &value);
390 
391  // non-property methods:
392  void moveBelow(QCPBars *bars);
393  void moveAbove(QCPBars *bars);
394  void addData(const QCPBarDataMap &dataMap);
395  void addData(const QCPBarData &data);
396  void addData(double key, double value);
397  void addData(const QVector<double> &keys, const QVector<double> &values);
398  void removeDataBefore(double key);
399  void removeDataAfter(double key);
400  void removeData(double fromKey, double toKey);
401  void removeData(double key);
402  virtual void clearData();
403 
404 protected:
406  double mWidth;
407  QCPBars *mBarBelow, *mBarAbove;
408 
409  virtual void draw(QPainter *painter) const;
410  virtual void drawLegendIcon(QPainter *painter, const QRect &rect) const;
411 
412  QPolygonF getBarPolygon(double key, double value) const;
413  double getBaseValue(double key, bool positive) const;
414  static void connectBars(QCPBars* lower, QCPBars* upper);
415  virtual QCPRange getKeyRange(bool &validRange, SignDomain inSignDomain=SDBoth) const;
416  virtual QCPRange getValueRange(bool &validRange, SignDomain inSignDomain=SDBoth) const;
417 
418  friend class QCustomPlot;
419  friend class QCPLegend;
420 };
421 
423 {
424  Q_OBJECT
425 public:
426  explicit QCPStatisticalBox(QCPAxis *keyAxis, QCPAxis *valueAxis);
427  virtual ~QCPStatisticalBox();
428 
429  // getters:
430 public slots:
431  double key() const { return mKey; }
432  double minimum() const { return mMinimum; }
433  double lowerQuartile() const { return mLowerQuartile; }
434  double median() const { return mMedian; }
435  double upperQuartile() const { return mUpperQuartile; }
436  double maximum() const { return mMaximum; }
437  QVector<double> outliers() const { return mOutliers; }
438  double width() const { return mWidth; }
439  double whiskerWidth() const { return mWhiskerWidth; }
440  QPen whiskerPen() const { return mWhiskerPen; }
441  QPen whiskerBarPen() const { return mWhiskerBarPen; }
442  QPen medianPen() const { return mMedianPen; }
443  double outlierSize() const { return mOutlierSize; }
444  QPen outlierPen() const { return mOutlierPen; }
445  QBrush outlierBrush() const { return mOutlierBrush; }
446 
447  // setters:
448  void setKey(double key);
449  void setMinimum(double value);
450  void setLowerQuartile(double value);
451  void setMedian(double value);
452  void setUpperQuartile(double value);
453  void setMaximum(double value);
454  void setOutliers(const QVector<double> &values);
455  void setData(double key, double minimum, double lowerQuartile, double median, double upperQuartile, double maximum);
456  void setWidth(double width);
457  void setWhiskerWidth(double width);
458  void setWhiskerPen(const QPen &pen);
459  void setWhiskerBarPen(const QPen &pen);
460  void setMedianPen(const QPen &pen);
461  void setOutlierSize(double pixels);
462  void setOutlierPen(const QPen &pen);
463  void setOutlierBrush(const QBrush &brush);
464 
465  // non-property methods:
466  virtual void clearData();
467 
468 protected:
469  QVector<double> mOutliers;
470  double mKey, mMinimum, mLowerQuartile, mMedian, mUpperQuartile, mMaximum;
471  double mWidth;
473  double mOutlierSize;
474  QPen mWhiskerPen, mWhiskerBarPen, mOutlierPen, mMedianPen;
476 
477  virtual void draw(QPainter *painter) const;
478  virtual void drawLegendIcon(QPainter *painter, const QRect &rect) const;
479 
480  virtual void drawQuartileBox(QPainter *painter) const;
481  virtual void drawMedian(QPainter *painter) const;
482  virtual void drawWhiskers(QPainter *painter) const;
483  virtual void drawOutliers(QPainter *painter) const;
484  virtual QCPRange getKeyRange(bool &validRange, SignDomain inSignDomain=SDBoth) const;
485  virtual QCPRange getValueRange(bool &validRange, SignDomain inSignDomain=SDBoth) const;
486 
487  friend class QCustomPlot;
488  friend class QCPLegend;
489 };
490 
491 class QCPRange
492 {
493 public:
494  double lower, upper;
495  QCPRange();
496  QCPRange(double lower, double upper);
497 
498 public:
499  double size() const;
500  double center() const;
501  void normalize();
502  QCPRange sanitizedForLogScale() const;
503  QCPRange sanitizedForLinScale() const;
504 
505  static bool validRange(double lower, double upper);
506  static bool validRange(const QCPRange &range);
507 public:
508  static const double minRange; //1e-280;
509  static const double maxRange; //1e280;
510 };
511 
513 {
514 public:
517  // getters:
518  public:
519  QFont font() const { return mFont; }
520  // setters:
521  void setFont(const QFont &font);
522 
523 protected:
525  QFont mFont;
526 
527  virtual void draw(QPainter *painter, const QRect &rect) const = 0;
528  virtual QSize size(const QSize &targetSize) const = 0;
529 
530  friend class QCPLegend;
531 };
532 
534 {
535 public:
536  QCPPlottableLegendItem(QCPLegend *parent, const QCPAbstractPlottable *plottable);
538 public:
539  const QCPAbstractPlottable *plottable() const { return mPlottable; }
540  void setTextWrap(bool wrap);
541  bool textWrap() const { return mTextWrap; }
542 
543 protected:
545  QSize mIconSize;
548  bool mTextWrap;
549 
550  virtual void draw(QPainter *painter, const QRect &rect) const;
551  virtual QSize size(const QSize &targetSize) const;
552 };
553 
554 class QCPLegend : public QObject
555 {
556  Q_OBJECT
557 public:
569  PSLeft
570  };
571  //Q_ENUMS(PositionStyle)
572 
573  explicit QCPLegend(QCustomPlot *parentPlot);
574  virtual ~QCPLegend();
575 
576  // getters:
577 public slots:
578  QPen borderPen() const { return mBorderPen; }
579  QBrush brush() const { return mBrush; }
580  QFont font() const { return mFont; }
581  PositionStyle positionStyle() const { return mPositionStyle; }
582  QPoint position() const { return mPosition; }
583  bool autoSize() const { return mAutoSize; }
584  QSize size() const { return mSize; }
585  QSize minimumSize() const { return mMinimumSize; }
586  bool visible() const { return mVisible; }
587  int paddingLeft() const { return mPaddingLeft; }
588  int paddingRight() const { return mPaddingRight; }
589  int paddingTop() const { return mPaddingTop; }
590  int paddingBottom() const { return mPaddingBottom; }
591  int marginLeft() const { return mMarginLeft; }
592  int marginRight() const { return mMarginRight; }
593  int marginTop() const { return mMarginTop; }
594  int marginBottom() const { return mMarginBottom; }
595  int itemSpacing() const { return mItemSpacing; }
596  QSize iconSize() const { return mIconSize; }
597  int iconTextPadding() const { return mIconTextPadding; }
598  QPen iconBorderPen() const { return mIconBorderPen; }
599  int getItemIndex(const QPoint *point);
600 
601  // setters:
602  void setBorderPen(const QPen &pen);
603  void setBrush(const QBrush &brush);
604  void setFont(const QFont &font);
605  void setPositionStyle(PositionStyle legendPositionStyle);
606  void setPosition(const QPoint &pixelPosition);
607  void setAutoSize(bool on);
608  void setSize(const QSize &size);
609  void setSize(int width, int height);
610  void setMinimumSize(const QSize &size);
611  void setMinimumSize(int width, int height);
612  void setVisible(bool on);
613  void setPaddingLeft(int padding);
614  void setPaddingRight(int padding);
615  void setPaddingTop(int padding);
616  void setPaddingBottom(int padding);
617  void setPadding(int left, int right, int top, int bottom);
618  void setMarginLeft(int margin);
619  void setMarginRight(int margin);
620  void setMarginTop(int margin);
621  void setMarginBottom(int margin);
622  void setMargin(int left, int right, int top, int bottom);
623  void setItemSpacing(int spacing);
624  void setIconSize(const QSize &size);
625  void setIconSize(int width, int height);
626  void setIconTextPadding(int padding);
627  void setIconBorderPen(const QPen &pen);
628 
629  // non-property methods:
630  QCPAbstractLegendItem *item(int index) const;
631  QCPPlottableLegendItem *itemWithPlottable(const QCPAbstractPlottable *plottable) const;
632  int itemCount() const;
633  bool hasItem(QCPAbstractLegendItem *item) const;
634  bool hasItemWithPlottable(const QCPAbstractPlottable *plottable) const;
635  bool addItem(QCPAbstractLegendItem *item);
636  bool removeItem(int index);
637  bool removeItem(QCPAbstractLegendItem *item);
638  void clearItems();
639 
640  void reArrange();
641 
642 protected:
643  // simple properties with getters and setters:
644  QPen mBorderPen, mIconBorderPen;
645  QBrush mBrush;
646  QFont mFont;
647  QPoint mPosition;
648  QSize mSize, mMinimumSize, mIconSize;
650  bool mAutoSize, mVisible;
651  int mPaddingLeft, mPaddingRight, mPaddingTop, mPaddingBottom;
652  int mMarginLeft, mMarginRight, mMarginTop, mMarginBottom;
653  int mItemSpacing, mIconTextPadding;
654 
655  // internal or not explicitly exposed properties:
657  QList<QCPAbstractLegendItem*> mItems;
658 
659  // introduced methods:
660  virtual void draw(QPainter *painter);
661  virtual void calculateAutoSize();
662  virtual void calculateAutoPosition();
663 
664  friend class QCustomPlot;
665 };
666 
667 class QCPAxis : public QObject
668 {
669  Q_OBJECT
671  Q_PROPERTY(AxisType axisType READ axisType WRITE setAxisType)
672  Q_PROPERTY(ScaleType scaleType READ scaleType WRITE setScaleType)
673  Q_PROPERTY(double scaleLogBase READ scaleLogBase WRITE setScaleLogBase)
674  Q_PROPERTY(QRect axisRect READ axisRect WRITE setAxisRect)
675  Q_PROPERTY(QCPRange range READ range WRITE setRange)
676  Q_PROPERTY(bool visible READ visible WRITE setVisible)
677  Q_PROPERTY(bool grid READ grid WRITE setGrid)
678  Q_PROPERTY(bool subGrid READ subGrid WRITE setSubGrid)
679  Q_PROPERTY(bool autoTicks READ autoTicks WRITE setAutoTicks)
680  Q_PROPERTY(int autoTickCount READ autoTickCount WRITE setAutoTickCount)
681  Q_PROPERTY(bool autoTickLabels READ autoTickLabels WRITE setAutoTickLabels)
682  Q_PROPERTY(bool autoTickStep READ autoTickStep WRITE setAutoTickStep)
683  Q_PROPERTY(bool autoSubTicks READ autoSubTicks WRITE setAutoSubTicks)
684  Q_PROPERTY(bool ticks READ ticks WRITE setTicks)
685  Q_PROPERTY(bool tickLabels READ tickLabels WRITE setTickLabels)
686  Q_PROPERTY(int tickLabelPadding READ tickLabelPadding WRITE setTickLabelPadding)
687  Q_PROPERTY(LabelType tickLabelType READ tickLabelType WRITE setTickLabelType)
688  Q_PROPERTY(QFont tickLabelFont READ tickLabelFont WRITE setTickLabelFont)
689  Q_PROPERTY(double tickLabelRotation READ tickLabelRotation WRITE setTickLabelRotation)
690  Q_PROPERTY(QString dateTimeFormat READ dateTimeFormat WRITE setDateTimeFormat)
691  Q_PROPERTY(QString numberFormat READ numberFormat WRITE setNumberFormat)
692  Q_PROPERTY(double tickStep READ tickStep WRITE setTickStep)
693  Q_PROPERTY(QVector<double>* tickVector READ tickVector WRITE setTickVector)
694  Q_PROPERTY(QVector<QString>* tickVectorLabels READ tickVectorLabels WRITE setTickVectorLabels)
695  Q_PROPERTY(int subTickCount READ subTickCount WRITE setSubTickCount)
696  Q_PROPERTY(QPen basePen READ basePen WRITE setBasePen)
697  Q_PROPERTY(QPen gridPen READ gridPen WRITE setGridPen)
698  Q_PROPERTY(QPen subGridPen READ subGridPen WRITE setSubGridPen)
699  Q_PROPERTY(QPen tickPen READ tickPen WRITE setTickPen)
700  Q_PROPERTY(QPen subTickPen READ subTickPen WRITE setSubTickPen)
701  Q_PROPERTY(QFont labelFont READ labelFont WRITE setLabelFont)
702  Q_PROPERTY(QString label READ label WRITE setLabel)
703  Q_PROPERTY(int labelPadding READ labelPadding WRITE setLabelPadding)
705 public:
711  enum AxisType {ATLeft,
714  ATBottom
715  };
716  //Q_ENUMS(AxisType)
724  LTDateTime
725  };
726  //Q_ENUMS(LabelType)
732  STLogarithmic
733  };
734  //Q_ENUMS(ScaleType)
735 
736  explicit QCPAxis(QCustomPlot *parentPlot, AxisType type);
737  virtual ~QCPAxis();
738 
739  // getters:
740 public slots:
741  QCustomPlot *parentPlot() const { return mParentPlot; }
742  AxisType axisType() const { return mAxisType; }
743  QRect axisRect() const { return mAxisRect; }
744  ScaleType scaleType() const { return mScaleType; }
745  double scaleLogBase() const { return mScaleLogBase; }
746  const QCPRange range() const { return mRange; }
747  bool rangeReversed() const { return mRangeReversed; }
748  bool visible() const { return mVisible; }
749  bool grid() const { return mGrid; }
750  bool subGrid() const { return mSubGrid; }
751  bool autoTicks() const { return mAutoTicks; }
752  int autoTickCount() const { return mAutoTickCount; }
753  bool autoTickLabels() const { return mAutoTickLabels; }
754  bool autoTickStep() const { return mAutoTickStep; }
755  bool autoSubTicks() const { return mAutoSubTicks; }
756  bool ticks() const { return mTicks; }
757  bool tickLabels() const { return mTickLabels; }
758  int tickLabelPadding() const { return mTickLabelPadding; }
759  LabelType tickLabelType() const { return mTickLabelType; }
760  QFont tickLabelFont() const { return mTickLabelFont; }
761  double tickLabelRotation() const { return mTickLabelRotation; }
762  QString dateTimeFormat() const { return mDateTimeFormat; }
763  QString numberFormat() const;
764  int numberPrecision() const { return mNumberPrecision; }
765  double tickStep() const { return mTickStep; }
766  QVector<double> *tickVector() const { return mTickVector; }
767  QVector<QString> *tickVectorLabels() const { return mTickVectorLabels; }
768  int tickLengthIn() const { return mTickLengthIn; }
769  int tickLengthOut() const { return mTickLengthOut; }
770  int subTickCount() const { return mSubTickCount; }
771  int subTickLengthIn() const { return mSubTickLengthIn; }
772  int subTickLengthOut() const { return mSubTickLengthOut; }
773  QPen basePen() const { return mBasePen; }
774  QPen gridPen() const { return mGridPen; }
775  QPen subGridPen() const { return mSubGridPen; }
776  QPen zeroLinePen() const { return mZeroLinePen; }
777  QPen tickPen() const { return mTickPen; }
778  QPen subTickPen() const { return mSubTickPen; }
779  QFont labelFont() const { return mLabelFont; }
780  QString label() const { return mLabel; }
781  int labelPadding() const { return mLabelPadding; }
782  int padding() const { return mPadding; }
783 
784  // setters:
785  void setScaleType(ScaleType type);
786  void setScaleLogBase(double base);
787  void setRange(double lower, double upper);
788  void setRange(double position, double size, Qt::AlignmentFlag alignment);
789  void setRangeLower(double lower);
790  void setRangeUpper(double upper);
791  void setRangeReversed(bool reversed);
792  void setVisible(bool on);
793  void setGrid(bool show);
794  void setSubGrid(bool show);
795  void setAutoTicks(bool on);
796  void setAutoTickCount(int approximateCount);
797  void setAutoTickLabels(bool on);
798  void setAutoTickStep(bool on);
799  void setAutoSubTicks(bool on);
800  void setTicks(bool show);
801  void setTickLabels(bool show);
802  void setTickLabelPadding(int padding);
803  void setTickLabelType(LabelType type);
804  void setTickLabelFont(const QFont &font);
805  void setTickLabelRotation(double degrees);
806  void setDateTimeFormat(const QString &format);
807  void setNumberFormat(const QString &formatCode);
808  void setNumberPrecision(int precision);
809  void setTickStep(double step);
810  void setTickVector(QVector<double> *vec, bool copy=false);
811  void setTickVectorLabels(QVector<QString> *vec, bool copy=false);
812  void setTickLength(int inside, int outside=0);
813  void setSubTickCount(int count);
814  void setSubTickLength(int inside, int outside=0);
815  void setBasePen(const QPen &pen);
816  void setGridPen(const QPen &pen);
817  void setSubGridPen(const QPen &pen);
818  void setZeroLinePen(const QPen &pen);
819  void setTickPen(const QPen &pen);
820  void setSubTickPen(const QPen &pen);
821  void setLabelFont(const QFont &font);
822  void setLabel(const QString &str);
823  void setLabelPadding(int padding);
824  void setPadding(int padding);
825 
826  // non-property methods:
827  Qt::Orientation orientation() const { return mOrientation; }
828  void moveRange(double diff);
829  void scaleRange(double factor, double center);
830  void setScaleRatio(const QCPAxis *otherAxis, double ratio=1.0);
831  double pixelToCoord(double value) const;
832  double coordToPixel(double value) const;
833 
834  // slot setters:
835  void setRange(const QCPRange &range);
836 
837 protected:
838  // simple properties with getters and setters:
839  QVector<double> *mTickVector;
840  QVector<QString> *mTickVectorLabels;
843  QString mLabel;
844  QRect mAxisRect;
845  QPen mBasePen, mGridPen, mSubGridPen, mZeroLinePen, mTickPen, mSubTickPen;
846  QFont mTickLabelFont, mLabelFont;
850  double mTickStep;
851  double mScaleLogBase, mScaleLogBaseLogInv;
852  int mSubTickCount, mTickLengthIn, mTickLengthOut, mSubTickLengthIn, mSubTickLengthOut;
854  int mTickLabelPadding, mLabelPadding, mPadding;
856  bool mVisible, mGrid, mSubGrid, mTicks, mTickLabels, mAutoTicks, mAutoTickLabels, mAutoTickStep, mAutoSubTicks;
858 
859  // internal or not explicitly exposed properties:
861  QVector<double> *mSubTickVector;
862  QChar mExponentialChar, mPositiveSignChar;
865  bool mNumberBeautifulPowers, mNumberMultiplyCross;
866  Qt::Orientation mOrientation;
867 
868  // internal setters:
869  void setAxisType(AxisType type);
870  void setAxisRect(const QRect &rect);
871 
872  // introduced methods:
873  virtual void generateTickVectors();
874  virtual void generateAutoTicks();
875  virtual int calculateAutoSubTickCount(double tickStep) const;
876  virtual int calculateMargin() const;
877  virtual void drawGrid(QPainter *painter);
878  virtual void drawSubGrid(QPainter *painter);
879  virtual void drawAxis(QPainter *painter);
880  virtual void drawTickLabel(QPainter *painter, double position, int distanceToAxis, const QString &text, QSize *tickLabelsSize);
881  virtual void getMaxTickLabelSize(const QFont &font, const QString &text, QSize *tickLabelsSize) const;
882 
883  // basic non virtual helpers:
884  void visibleTickBounds(int &lowIndex, int &highIndex) const;
885  double baseLog(double value) const;
886  double basePow(double value) const;
887 
888 signals:
889  void ticksRequest();
890  void rangeChanged(const QCPRange &newRange);
891 
892  friend class QCustomPlot;
893 };
894 
895 class QCustomPlot : public QWidget
896 {
897  Q_OBJECT
899  Q_PROPERTY(QString title READ title WRITE setTitle)
900  Q_PROPERTY(QRect axisRect READ axisRect WRITE setAxisRect)
901  Q_PROPERTY(int marginLeft READ marginLeft WRITE setMarginLeft)
902  Q_PROPERTY(int marginRight READ marginRight WRITE setMarginRight)
903  Q_PROPERTY(int marginTop READ marginTop WRITE setMarginTop)
904  Q_PROPERTY(int marginBottom READ marginBottom WRITE setMarginBottom)
905  Q_PROPERTY(int autoMargin READ autoMargin WRITE setAutoMargin)
906  Q_PROPERTY(QColor color READ color WRITE setColor)
907  Q_PROPERTY(Qt::Orientations rangeDrag READ rangeDrag WRITE setRangeDrag)
908  Q_PROPERTY(Qt::Orientations rangeZoom READ rangeZoom WRITE setRangeZoom)
909 
910 public:
912 
918  enum AntialiasedElement {AEAxes = 0x001,
919  AEGrid = 0x002,
920  AESubGrid = 0x004,
921  AEGraphs = 0x008,
922  AEScatters = 0x010,
923  AEErrorBars = 0x020,
924  AEFills = 0x040,
925  AEZeroLine = 0x080
926  };
927  Q_ENUMS(AntialiasedElement)
928  Q_DECLARE_FLAGS(AntialiasedElements, AntialiasedElement)
929 
930  explicit QCustomPlot(QWidget *parent = 0);
931  virtual ~QCustomPlot();
932 
933 public slots:
934  // getters:
935  QString title() const { return mTitle; }
936  QFont titleFont() const { return mTitleFont; }
937  QRect axisRect() const { return mAxisRect; }
938  int marginLeft() const { return mMarginLeft; }
939  int marginRight() const { return mMarginRight; }
940  int marginTop() const { return mMarginTop; }
941  int marginBottom() const { return mMarginBottom; }
942  bool autoMargin() const { return mAutoMargin; }
943  QColor color() const { return mColor; }
944  Qt::Orientations rangeDrag() const { return mRangeDrag; }
945  Qt::Orientations rangeZoom() const { return mRangeZoom; }
946  QCPAxis *rangeDragAxis(Qt::Orientation orientation);
947  QCPAxis *rangeZoomAxis(Qt::Orientation orientation);
948  double rangeZoomFactor(Qt::Orientation orientation);
949  const AntialiasedElements antialiasedElements() const { return mAntialiasedElements; }
950  bool autoAddPlottableToLegend() const { return mAutoAddPlottableToLegend; }
951  QPixmap axisBackground() const { return mAxisBackground; }
952  bool axisBackgroundScaled() const { return mAxisBackgroundScaled; }
953  Qt::AspectRatioMode axisBackgroundScaledMode() const { return mAxisBackgroundScaledMode; }
954 
955  // setters:
956  void setTitle(const QString &title);
957  void setTitleFont(const QFont &font);
958  void setAxisRect(const QRect &arect);
959  void setMarginLeft(int margin);
960  void setMarginRight(int margin);
961  void setMarginTop(int margin);
962  void setMarginBottom(int margin);
963  void setMargin(int left, int right, int top, int bottom);
964  void setAutoMargin(bool enabled);
965  void setColor(const QColor &color);
966  void setRangeDrag(Qt::Orientations orientations);
967  void setRangeZoom(Qt::Orientations orientations);
968  void setRangeDragAxes(QCPAxis *horizontal, QCPAxis *vertical);
969  void setRangeZoomAxes(QCPAxis *horizontal, QCPAxis *vertical);
970  void setRangeZoomFactor(double horizontalFactor, double verticalFactor);
971  void setRangeZoomFactor(double factor);
972  void setAntialiasedElements(const AntialiasedElements &antialiasedElements);
973  void setAntialiasedElement(AntialiasedElement antialiasedElement, bool enabled);
974  void setAutoAddPlottableToLegend(bool on);
975  void setAxisBackground(const QPixmap &pm);
976  void setAxisBackground(const QPixmap &pm, bool scaled, Qt::AspectRatioMode mode=Qt::KeepAspectRatioByExpanding);
977  void setAxisBackgroundScaled(bool scaled);
978  void setAxisBackgroundScaledMode(Qt::AspectRatioMode mode);
979 
980 
981  // non-property methods:
982  QCPAbstractPlottable *plottable(int index);
983  QCPAbstractPlottable *plottable();
984  bool addPlottable(QCPAbstractPlottable *plottable);
985  bool removePlottable(QCPAbstractPlottable *plottable);
986  bool removePlottable(int index);
987  int clearPlottables();
988  int plottableCount() const;
989 
990  QCPGraph *graph(int index) const;
991  QCPGraph *graph() const;
992  QCPGraph *addGraph(QCPAxis *keyAxis=0, QCPAxis *valueAxis=0);
993  bool removeGraph(QCPGraph *graph);
994  bool removeGraph(int index);
995  int clearGraphs();
996  int graphCount() const;
997  void replot();
998  void setupFullAxesBox();
999  void rescaleAxes();
1000  void savePdf(const QString &fileName, bool noCosmeticPen=false, int width=0, int height=0);
1001  //void saveSvg(const QString &fileName);
1002  void savePng(const QString &fileName, int width=0, int height=0);
1003  void savePngScaled(const QString &fileName, double scale, int width=0, int height=0);
1004 
1005 public:
1006  QCPAxis *xAxis, *yAxis, *xAxis2, *yAxis2;
1008 
1009 protected:
1010  QPixmap buffer;
1011  QString mTitle;
1012  QFont mTitleFont;
1013  QRect mViewport;
1014  QRect mAxisRect;
1015  int mMarginLeft, mMarginRight, mMarginTop, mMarginBottom;
1016  bool mAutoMargin, mAutoAddPlottableToLegend;
1017  QColor mColor;
1018  QList<QCPAbstractPlottable*> mPlottables;
1019  QList<QCPGraph*> mGraphs; // extra list of items also in mPlottables that are of type QCPGraph
1020  Qt::Orientations mRangeDrag, mRangeZoom;
1021  QCPAxis *mRangeDragHorzAxis, *mRangeDragVertAxis, *mRangeZoomHorzAxis, *mRangeZoomVertAxis;
1022  double mRangeZoomFactorHorz, mRangeZoomFactorVert;
1024  QPoint mDragStart;
1025  QCPRange mDragStartHorzRange, mDragStartVertRange;
1026  QFlags<AntialiasedElement> mAntialiasedElements;
1027  QPixmap mAxisBackground, mScaledAxisBackground;
1029  Qt::AspectRatioMode mAxisBackgroundScaledMode;
1030 
1031  // reimplemented methods:
1032  virtual void paintEvent(QPaintEvent *event);
1033  virtual void resizeEvent(QResizeEvent *event);
1034  virtual void mouseDoubleClickEvent(QMouseEvent *event);
1035  virtual void mousePressEvent(QMouseEvent *event);
1036  virtual void mouseMoveEvent(QMouseEvent *event);
1037  virtual void mouseReleaseEvent(QMouseEvent *event);
1038  virtual void wheelEvent(QWheelEvent *event);
1039 
1040  // introduced methods:
1041  virtual void draw(QPainter *painter);
1042  virtual void drawAxisBackground(QPainter *painter);
1043 
1044  // helpers:
1045  void updateAxisRect();
1046 
1047 signals:
1048  void mouseDoubleClick(QMouseEvent *event);
1049  void mousePress(QMouseEvent *event);
1050  void mousePressOnLegendItem(QMouseEvent *event, QVariant itemIdx);
1051  void mousePressOnPlotArea(QMouseEvent *event);
1052  void mouseMove(QMouseEvent *event);
1053  void mouseRelease(QMouseEvent *event);
1054  void mouseWheel(QWheelEvent *event);
1055 
1056 public slots:
1057 
1058  friend class QCPLegend;
1059  friend class QCPAxis;
1060 };
1061 Q_DECLARE_OPERATORS_FOR_FLAGS(QCustomPlot::AntialiasedElements)
1062 
1063 #endif // QCUSTOMPLOT_H
a square which is not filled, with a plus inside
Definition: qcustomplot.h:206
QPen basePen() const
Definition: qcustomplot.h:773
Error bars for the key dimension of the data point are shown.
Definition: qcustomplot.h:217
QList< QCPGraph * > mGraphs
Definition: qcustomplot.h:1019
double scatterSize() const
Definition: qcustomplot.h:231
Position is not changed automatically. Set manually via setPosition.
Definition: qcustomplot.h:561
Legend is positioned in the bottom right corner of the axis rect with distance to the border correspo...
Definition: qcustomplot.h:566
static const double maxRange
Definition: qcustomplot.h:509
Axis is vertical and on the right side of the axis rect of the parent QCustomPlot.
Definition: qcustomplot.h:712
line is drawn as steps where the step height is the value of the right data point ...
Definition: qcustomplot.h:184
QVector< double > * tickVector() const
Definition: qcustomplot.h:766
QFont mTitleFont
Definition: qcustomplot.h:1012
QPoint mDragStart
Definition: qcustomplot.h:1024
QPen whiskerBarPen() const
Definition: qcustomplot.h:441
QPen mErrorPen
Definition: qcustomplot.h:279
QVector< double > * mSubTickVector
Definition: qcustomplot.h:861
Legend is horizontally centered at the top of the axis rect with distance to the border corresponding...
Definition: qcustomplot.h:563
QMap< double, QCPData > QCPDataMap
Definition: qcustomplot.h:75
line is drawn as steps where the step is in between two data points
Definition: qcustomplot.h:185
int padding() const
Definition: qcustomplot.h:782
A class holding the data of one single data point for QCPCurve.
Definition: qcustomplot.h:79
void rescaleKeyAxis(bool onlyEnlarge=false) const
A legend item representing a plottable with an icon and the plottable name.
Definition: qcustomplot.h:533
QCPGraph * mChannelFillGraph
Definition: qcustomplot.h:287
int numberPrecision() const
Definition: qcustomplot.h:764
double mErrorBarSize
Definition: qcustomplot.h:285
QFont font() const
Definition: qcustomplot.h:580
a square which is not filled, with a cross inside
Definition: qcustomplot.h:205
QPen zeroLinePen() const
Definition: qcustomplot.h:776
ScatterStyle scatterStyle() const
Definition: qcustomplot.h:230
double maximum() const
Definition: qcustomplot.h:436
a circle which is filled with the color of the graph&#39;s pen (not the brush!)
Definition: qcustomplot.h:200
double key
Definition: qcustomplot.h:65
double errorBarSize() const
Definition: qcustomplot.h:235
The abstract base class for all items in a QCPLegend.
Definition: qcustomplot.h:512
const QCPDataMap * data() const
Definition: qcustomplot.h:228
bool mNumberMultiplyCross
Definition: qcustomplot.h:865
QRect axisRect() const
Definition: qcustomplot.h:743
const QCPRange range() const
Definition: qcustomplot.h:746
Qt::AspectRatioMode axisBackgroundScaledMode() const
Definition: qcustomplot.h:953
int paddingTop() const
Definition: qcustomplot.h:589
double value
Definition: qcustomplot.h:65
QFlags< AntialiasedElement > mAntialiasedElements
Definition: qcustomplot.h:1026
double mScatterSize
Definition: qcustomplot.h:282
bool mAxisBackgroundScaled
Definition: qcustomplot.h:1028
int labelPadding() const
Definition: qcustomplot.h:781
double width() const
Definition: qcustomplot.h:438
QString mTitle
Definition: qcustomplot.h:1011
QSize minimumSize() const
Definition: qcustomplot.h:585
double tickLabelRotation() const
Definition: qcustomplot.h:761
int marginLeft() const
Definition: qcustomplot.h:591
QBrush mBrush
Definition: qcustomplot.h:645
A plottable representing a bar chart in a plot.
Definition: qcustomplot.h:372
QCPBars * mBarBelow
Definition: qcustomplot.h:407
QFont mFont
Definition: qcustomplot.h:646
QPen subTickPen() const
Definition: qcustomplot.h:778
QCustomPlot * parentPlot() const
Definition: qcustomplot.h:741
QCustomPlot * mParentPlot
Definition: qcustomplot.h:153
QString mDateTimeFormat
Definition: qcustomplot.h:842
a cross (x)
Definition: qcustomplot.h:197
double value
Definition: qcustomplot.h:83
QRect mAxisRect
Definition: qcustomplot.h:1014
QPen mIconBorderPen
Definition: qcustomplot.h:644
int marginRight() const
Definition: qcustomplot.h:592
QPen subGridPen() const
Definition: qcustomplot.h:775
double mTickLabelRotation
Definition: qcustomplot.h:855
Legend is positioned in the top left corner of the axis rect with distance to the border correspondin...
Definition: qcustomplot.h:562
double valueErrorPlus
Definition: qcustomplot.h:67
QBrush brush() const
Definition: qcustomplot.h:579
The abstract base class for all data representing objects in a plot.
Definition: qcustomplot.h:112
QPoint mPosition
Definition: qcustomplot.h:647
A plottable representing a single statistical box in a plot.
Definition: qcustomplot.h:422
QPen borderPen() const
Definition: qcustomplot.h:578
QPen medianPen() const
Definition: qcustomplot.h:442
Both sign domains, including zero, i.e. all (rational) numbers.
Definition: qcustomplot.h:150
an equilateral triangle which is not filled, standing on corner
Definition: qcustomplot.h:204
bool autoAddPlottableToLegend() const
Definition: qcustomplot.h:950
No error bars are shown.
Definition: qcustomplot.h:216
bool errorBarSkipSymbol() const
Definition: qcustomplot.h:236
int paddingLeft() const
Definition: qcustomplot.h:587
double valueErrorMinus
Definition: qcustomplot.h:67
QMutableMapIterator< double, QCPBarData > QCPBarDataMutableMapIterator
Definition: qcustomplot.h:110
QChar mPositiveSignChar
Definition: qcustomplot.h:862
double minimum() const
Definition: qcustomplot.h:432
int subTickLengthIn() const
Definition: qcustomplot.h:771
Normal linear scaling.
Definition: qcustomplot.h:731
int tickLengthOut() const
Definition: qcustomplot.h:769
PositionStyle mPositionStyle
Definition: qcustomplot.h:649
A plottable representing a graph in a plot.
Definition: qcustomplot.h:171
int iconTextPadding() const
Definition: qcustomplot.h:597
QCPCurveDataMap * mData
Definition: qcustomplot.h:358
QCPLegend * mParentLegend
Definition: qcustomplot.h:524
bool mVisible
Definition: qcustomplot.h:856
The central class which is also the QWidget which displays the plot and interacts with the user...
Definition: qcustomplot.h:895
Qt::AspectRatioMode mAxisBackgroundScaledMode
Definition: qcustomplot.h:1029
Manages a single axis inside a QCustomPlot.
Definition: qcustomplot.h:667
double upperQuartile() const
Definition: qcustomplot.h:435
double lowerQuartile() const
Definition: qcustomplot.h:433
double width() const
Definition: qcustomplot.h:381
Legend is positioned in the top right corner of the axis rect with distance to the border correspondi...
Definition: qcustomplot.h:564
Manages a legend inside a QCustomPlot.
Definition: qcustomplot.h:554
QCPRange mDragStartVertRange
Definition: qcustomplot.h:1025
a circle which is not filled, with one vertical and two downward diagonal lines
Definition: qcustomplot.h:209
int mTickLengthOut
Definition: qcustomplot.h:852
virtual ~QCPAbstractLegendItem()
Definition: qcustomplot.h:516
QPen tickPen() const
Definition: qcustomplot.h:777
bool grid() const
Definition: qcustomplot.h:749
a circle which is not filled
Definition: qcustomplot.h:199
Qt::Orientation orientation() const
Definition: qcustomplot.h:827
QString label() const
Definition: qcustomplot.h:780
ScatterStyle mScatterStyle
Definition: qcustomplot.h:281
Legend is horizontally centered at the bottom of the axis rect with distance to the border correspond...
Definition: qcustomplot.h:567
an equilateral triangle which is not filled, standing on baseline
Definition: qcustomplot.h:203
QCPAxis * keyAxis() const
Definition: qcustomplot.h:126
int mAutoTickCount
Definition: qcustomplot.h:853
QString mLabel
Definition: qcustomplot.h:843
bool visible() const
Definition: qcustomplot.h:748
const QCPBarDataMap * data() const
Definition: qcustomplot.h:384
QFont titleFont() const
Definition: qcustomplot.h:936
QMap< double, QCPBarData > QCPBarDataMap
Definition: qcustomplot.h:108
a square which is not filled
Definition: qcustomplot.h:201
QFont tickLabelFont() const
Definition: qcustomplot.h:760
bool autoSubTicks() const
Definition: qcustomplot.h:755
double scaleLogBase() const
Definition: qcustomplot.h:745
A class holding the data of one single data point for QCPGraph.
Definition: qcustomplot.h:61
QPen errorPen() const
Definition: qcustomplot.h:234
QList< QCPAbstractPlottable * > mPlottables
Definition: qcustomplot.h:1018
QPen pen() const
Definition: qcustomplot.h:124
ScaleType mScaleType
Definition: qcustomplot.h:848
QMutableMapIterator< double, QCPData > QCPDataMutableMapIterator
Definition: qcustomplot.h:77
double outlierSize() const
Definition: qcustomplot.h:443
line is drawn as steps where the step height is the value of the left data point
Definition: qcustomplot.h:183
bool autoTicks() const
Definition: qcustomplot.h:751
Legend is vertically centered at the right of the axis rect with distance to the border corresponding...
Definition: qcustomplot.h:565
QVector< double > outliers() const
Definition: qcustomplot.h:437
double median() const
Definition: qcustomplot.h:434
bool visible() const
Definition: qcustomplot.h:123
QCPAxis * yAxis2
Definition: qcustomplot.h:1006
QPixmap mScaledAxisBackground
Definition: qcustomplot.h:1027
const QCPCurveDataMap * data() const
Definition: qcustomplot.h:338
Qt::Orientation mOrientation
Definition: qcustomplot.h:866
QPixmap buffer
Definition: qcustomplot.h:1010
static const double minRange
Definition: qcustomplot.h:508
double keyErrorPlus
Definition: qcustomplot.h:66
QVector< double > mOutliers
Definition: qcustomplot.h:469
void rescaleAxes(bool onlyEnlarge=false) const
bool autoTickStep() const
Definition: qcustomplot.h:754
LabelType tickLabelType() const
Definition: qcustomplot.h:759
bool rangeReversed() const
Definition: qcustomplot.h:747
QCPBars * barBelow() const
Definition: qcustomplot.h:382
bool mVisible
Definition: qcustomplot.h:650
QFont labelFont() const
Definition: qcustomplot.h:779
int marginTop() const
Definition: qcustomplot.h:593
int mTickLabelPadding
Definition: qcustomplot.h:854
A plottable representing a parametric curve in a plot.
Definition: qcustomplot.h:330
QCustomPlot * parentPlot() const
Definition: qcustomplot.h:121
bool mErrorBarSkipSymbol
Definition: qcustomplot.h:286
LabelType mTickLabelType
Definition: qcustomplot.h:847
void rescaleValueAxis(bool onlyEnlarge=false) const
QMapIterator< double, QCPBarData > QCPBarDataMapIterator
Definition: qcustomplot.h:109
Qt::Orientations mRangeZoom
Definition: qcustomplot.h:1020
bool mAutoMargin
Definition: qcustomplot.h:1016
bool autoSize() const
Definition: qcustomplot.h:583
char mNumberFormatChar
Definition: qcustomplot.h:864
int mItemSpacing
Definition: qcustomplot.h:653
virtual ~QCPAbstractPlottable()
Definition: qcustomplot.h:117
int paddingRight() const
Definition: qcustomplot.h:588
QString name() const
Definition: qcustomplot.h:122
Axis is horizontal and on the top side of the axis rect of the parent QCustomPlot.
Definition: qcustomplot.h:713
int mNumberPrecision
Definition: qcustomplot.h:863
QString title() const
Definition: qcustomplot.h:935
QSize size() const
Definition: qcustomplot.h:584
PositionStyle positionStyle() const
Definition: qcustomplot.h:581
QSize iconSize() const
Definition: qcustomplot.h:596
const AntialiasedElements antialiasedElements() const
Definition: qcustomplot.h:949
QPen gridPen() const
Definition: qcustomplot.h:774
int mPaddingTop
Definition: qcustomplot.h:651
bool visible() const
Definition: qcustomplot.h:586
QVector< double > * mTickVector
Definition: qcustomplot.h:839
double mScaleLogBaseLogInv
Definition: qcustomplot.h:851
double tickStep() const
Definition: qcustomplot.h:765
int itemSpacing() const
Definition: qcustomplot.h:595
Error bars for the value dimension of the data point are shown.
Definition: qcustomplot.h:218
LineStyle lineStyle() const
Definition: qcustomplot.h:229
ErrorType mErrorType
Definition: qcustomplot.h:284
double keyErrorMinus
Definition: qcustomplot.h:66
int marginBottom() const
Definition: qcustomplot.h:941
int marginRight() const
Definition: qcustomplot.h:939
const QPixmap scatterPixmap() const
Definition: qcustomplot.h:232
QMapIterator< double, QCPData > QCPDataMapIterator
Definition: qcustomplot.h:76
QSize mSize
Definition: qcustomplot.h:648
ErrorType errorType() const
Definition: qcustomplot.h:233
QCPLegend * legend
Definition: qcustomplot.h:1007
QPen whiskerPen() const
Definition: qcustomplot.h:440
int mMarginTop
Definition: qcustomplot.h:652
QCustomPlot * mParentPlot
Definition: qcustomplot.h:656
int autoTickCount() const
Definition: qcustomplot.h:752
QPen mZeroLinePen
Definition: qcustomplot.h:845
Tick coordinate is regarded as normal number and will be displayed as such. (see setNumberFormat) ...
Definition: qcustomplot.h:723
QCPDataMap * mData
Definition: qcustomplot.h:278
a circle which is not filled, with a plus inside
Definition: qcustomplot.h:208
bool autoMargin() const
Definition: qcustomplot.h:942
QRect mAxisRect
Definition: qcustomplot.h:844
a plus (+)
Definition: qcustomplot.h:198
double mRangeZoomFactorVert
Definition: qcustomplot.h:1022
QCPBars * barAbove() const
Definition: qcustomplot.h:383
Qt::Orientations rangeZoom() const
Definition: qcustomplot.h:945
QCPBarDataMap * mData
Definition: qcustomplot.h:405
Qt::Orientations rangeDrag() const
Definition: qcustomplot.h:944
QCPAxis * valueAxis() const
Definition: qcustomplot.h:127
QString dateTimeFormat() const
Definition: qcustomplot.h:762
int tickLabelPadding() const
Definition: qcustomplot.h:758
int subTickLengthOut() const
Definition: qcustomplot.h:772
bool ticks() const
Definition: qcustomplot.h:756
QRect mViewport
Definition: qcustomplot.h:1013
int paddingBottom() const
Definition: qcustomplot.h:590
QFont mTickLabelFont
Definition: qcustomplot.h:846
virtual ~QCPPlottableLegendItem()
Definition: qcustomplot.h:537
int marginTop() const
Definition: qcustomplot.h:940
int subTickCount() const
Definition: qcustomplot.h:770
double mTickStep
Definition: qcustomplot.h:850
double key() const
Definition: qcustomplot.h:431
bool autoTickLabels() const
Definition: qcustomplot.h:753
double whiskerWidth() const
Definition: qcustomplot.h:439
QBrush outlierBrush() const
Definition: qcustomplot.h:445
bool subGrid() const
Definition: qcustomplot.h:750
const QCPAbstractPlottable * plottable() const
Definition: qcustomplot.h:539
QColor mColor
Definition: qcustomplot.h:1017
QPen iconBorderPen() const
Definition: qcustomplot.h:598
QPixmap mScatterPixmap
Definition: qcustomplot.h:283
double upper
Definition: qcustomplot.h:494
int tickLengthIn() const
Definition: qcustomplot.h:768
Represents the range an axis is encompassing.
Definition: qcustomplot.h:491
bool tickLabels() const
Definition: qcustomplot.h:757
QRect axisRect() const
Definition: qcustomplot.h:937
QPen outlierPen() const
Definition: qcustomplot.h:444
const QCPAbstractPlottable * mPlottable
Definition: qcustomplot.h:544
no scatter symbols are drawn (e.g. data only represented with lines, see setLineStyle) ...
Definition: qcustomplot.h:195
QMutableMapIterator< double, QCPCurveData > QCPCurveDataMutableMapIterator
Definition: qcustomplot.h:94
QFont font() const
Definition: qcustomplot.h:519
bool axisBackgroundScaled() const
Definition: qcustomplot.h:952
ScaleType scaleType() const
Definition: qcustomplot.h:744
QCPAxis * mRangeZoomVertAxis
Definition: qcustomplot.h:1021
bool mRangeReversed
Definition: qcustomplot.h:857
bool textWrap() const
Definition: qcustomplot.h:541
a star with eight arms, i.e. a combination of cross and plus
Definition: qcustomplot.h:202
QList< QCPAbstractLegendItem * > mItems
Definition: qcustomplot.h:657
int marginBottom() const
Definition: qcustomplot.h:594
QCPRange mRange
Definition: qcustomplot.h:841
QColor color() const
Definition: qcustomplot.h:943
QCustomPlot * mParentPlot
Definition: qcustomplot.h:860
AxisType mAxisType
Definition: qcustomplot.h:849
QMap< double, QCPCurveData > QCPCurveDataMap
Definition: qcustomplot.h:92
QVector< QString > * tickVectorLabels() const
Definition: qcustomplot.h:767
LineStyle mLineStyle
Definition: qcustomplot.h:280
QBrush brush() const
Definition: qcustomplot.h:125
QPixmap axisBackground() const
Definition: qcustomplot.h:951
QVector< QString > * mTickVectorLabels
Definition: qcustomplot.h:840
a single pixel, setScatterSize has no influence on its size.
Definition: qcustomplot.h:196
a circle which is not filled, with a cross inside
Definition: qcustomplot.h:207
AxisType axisType() const
Definition: qcustomplot.h:742
double mWidth
Definition: qcustomplot.h:406
double value
Definition: qcustomplot.h:100
QCPGraph * channelFillGraph() const
Definition: qcustomplot.h:237
Legend is positioned in the bottom left corner of the axis rect with distance to the border correspon...
Definition: qcustomplot.h:568
int marginLeft() const
Definition: qcustomplot.h:938
QMapIterator< double, QCPCurveData > QCPCurveDataMapIterator
Definition: qcustomplot.h:93
QPoint position() const
Definition: qcustomplot.h:582
A class holding the data of one single data point (one bar) for QCPBars.
Definition: qcustomplot.h:96