qcustomplot.h
Go to the documentation of this file.
/***************************************************************************
** **
** QCustomPlot, an easy to use, modern plotting widget for Qt **
** Copyright (C) 2011, 2012, 2013 Emanuel Eichhammer **
** **
** This program is free software: you can redistribute it and/or modify **
** it under the terms of the GNU General Public License as published by **
** the Free Software Foundation, either version 3 of the License, or **
** (at your option) any later version. **
** **
** This program is distributed in the hope that it will be useful, **
** but WITHOUT ANY WARRANTY; without even the implied warranty of **
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the **
** GNU General Public License for more details. **
** **
** You should have received a copy of the GNU General Public License **
** along with this program. If not, see http://www.gnu.org/licenses/. **
** **
****************************************************************************
** Author: Emanuel Eichhammer **
** Website/Contact: http://www.qcustomplot.com/ **
** Date: 04.11.13 **
** Version: 1.1.0 **
****************************************************************************/
#ifndef QCUSTOMPLOT_H
#define QCUSTOMPLOT_H
#include <QObject>
#include <QPointer>
#include <QWidget>
#include <QPainter>
#include <QPaintEvent>
#include <QMouseEvent>
#include <QPixmap>
#include <QVector>
#include <QString>
#include <QDateTime>
#include <QMultiMap>
#include <QFlags>
#include <QDebug>
#include <QVector2D>
#include <QStack>
#include <QCache>
#include <QMargins>
#include <qmath.h>
#include <limits>
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
# include <qnumeric.h>
# include <QPrinter>
#else
# include <QtNumeric>
# include <QtPrintSupport>
#endif
class QCPPainter;
class QCustomPlot;
class QCPLayerable;
class QCPLayoutElement;
class QCPLayout;
class QCPAxis;
class QCPAxisRect;
class QCPAbstractPlottable;
class QCPGraph;
class QCPAbstractItem;
class QCPItemPosition;
class QCPLayer;
class QCPPlotTitle;
class QCPLegend;
class QCPAbstractLegendItem;
// decl definitions for shared library compilation/usage:
#if defined(QCUSTOMPLOT_COMPILE_LIBRARY)
# define QCP_LIB_DECL Q_DECL_EXPORT
#elif defined(QCUSTOMPLOT_USE_LIBRARY)
# define QCP_LIB_DECL Q_DECL_IMPORT
#else
# define QCP_LIB_DECL
#endif
namespace QCP
{
enum MarginSide { msLeft = 0x01
,msRight = 0x02
,msTop = 0x04
,msBottom = 0x08
,msAll = 0xFF
,msNone = 0x00
};
Q_DECLARE_FLAGS(MarginSides, MarginSide)
enum AntialiasedElement { aeAxes = 0x0001
,aeGrid = 0x0002
,aeSubGrid = 0x0004
,aeLegend = 0x0008
,aeLegendItems = 0x0010
,aePlottables = 0x0020
,aeItems = 0x0040
,aeScatters = 0x0080
,aeErrorBars = 0x0100
,aeFills = 0x0200
,aeZeroLine = 0x0400
,aeAll = 0xFFFF
,aeNone = 0x0000
};
Q_DECLARE_FLAGS(AntialiasedElements, AntialiasedElement)
enum PlottingHint { phNone = 0x000
,phFastPolylines = 0x001
,phForceRepaint = 0x002
,phCacheLabels = 0x004
};
Q_DECLARE_FLAGS(PlottingHints, PlottingHint)
enum Interaction { iRangeDrag = 0x001
,iRangeZoom = 0x002
,iMultiSelect = 0x004
,iSelectPlottables = 0x008
,iSelectAxes = 0x010
,iSelectLegend = 0x020
,iSelectItems = 0x040
,iSelectOther = 0x080
};
Q_DECLARE_FLAGS(Interactions, Interaction)
inline bool isInvalidData(double value)
{
return qIsNaN(value) || qIsInf(value);
}
inline bool isInvalidData(double value1, double value2)
{
return isInvalidData(value1) || isInvalidData(value2);
}
inline void setMarginValue(QMargins &margins, QCP::MarginSide side, int value)
{
switch (side)
{
case QCP::msLeft: margins.setLeft(value); break;
case QCP::msRight: margins.setRight(value); break;
case QCP::msTop: margins.setTop(value); break;
case QCP::msBottom: margins.setBottom(value); break;
case QCP::msAll: margins = QMargins(value, value, value, value); break;
default: break;
}
}
inline int getMarginValue(const QMargins &margins, QCP::MarginSide side)
{
switch (side)
{
case QCP::msLeft: return margins.left();
case QCP::msRight: return margins.right();
case QCP::msTop: return margins.top();
case QCP::msBottom: return margins.bottom();
default: break;
}
return 0;
}
} // end of namespace QCP
Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::AntialiasedElements)
Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::PlottingHints)
Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::MarginSides)
Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::Interactions)
class QCP_LIB_DECL QCPScatterStyle
{
Q_GADGET
public:
Q_ENUMS(ScatterShape)
enum ScatterShape { ssNone
,ssDot
,ssCross
,ssPlus
,ssCircle
,ssDisc
,ssSquare
,ssDiamond
,ssStar
,ssTriangle
,ssTriangleInverted
,ssCrossSquare
,ssPlusSquare
,ssCrossCircle
,ssPlusCircle
,ssPeace
,ssPixmap
,ssCustom
};
QCPScatterStyle();
QCPScatterStyle(ScatterShape shape, double size=6);
QCPScatterStyle(ScatterShape shape, const QColor &color, double size);
QCPScatterStyle(ScatterShape shape, const QColor &color, const QColor &fill, double size);
QCPScatterStyle(ScatterShape shape, const QPen &pen, const QBrush &brush, double size);
QCPScatterStyle(const QPixmap &pixmap);
QCPScatterStyle(const QPainterPath &customPath, const QPen &pen, const QBrush &brush=Qt::NoBrush, double size=6);
// getters:
double size() const { return mSize; }
ScatterShape shape() const { return mShape; }
QPen pen() const { return mPen; }
QBrush brush() const { return mBrush; }
QPixmap pixmap() const { return mPixmap; }
QPainterPath customPath() const { return mCustomPath; }
// setters:
void setSize(double size);
void setShape(ScatterShape shape);
void setPen(const QPen &pen);
void setBrush(const QBrush &brush);
void setPixmap(const QPixmap &pixmap);
void setCustomPath(const QPainterPath &customPath);
// non-property methods:
bool isNone() const { return mShape == ssNone; }
bool isPenDefined() const { return mPenDefined; }
void applyTo(QCPPainter *painter, const QPen &defaultPen) const;
void drawShape(QCPPainter *painter, QPointF pos) const;
void drawShape(QCPPainter *painter, double x, double y) const;
protected:
// property members:
double mSize;
ScatterShape mShape;
QPen mPen;
QBrush mBrush;
QPixmap mPixmap;
QPainterPath mCustomPath;
// non-property members:
bool mPenDefined;
};
Q_DECLARE_TYPEINFO(QCPScatterStyle, Q_MOVABLE_TYPE);
class QCP_LIB_DECL QCPPainter : public QPainter
{
Q_GADGET
public:
enum PainterMode {pmDefault = 0x00
,pmVectorized = 0x01
,pmNoCaching = 0x02
,pmNonCosmetic = 0x04
};
Q_FLAGS(PainterMode PainterModes)
Q_DECLARE_FLAGS(PainterModes, PainterMode)
QCPPainter();
QCPPainter(QPaintDevice *device);
~QCPPainter();
// getters:
bool antialiasing() const { return testRenderHint(QPainter::Antialiasing); }
PainterModes modes() const { return mModes; }
// setters:
void setAntialiasing(bool enabled);
void setMode(PainterMode mode, bool enabled=true);
void setModes(PainterModes modes);
// methods hiding non-virtual base class functions (QPainter bug workarounds):
bool begin(QPaintDevice *device);
void setPen(const QPen &pen);
void setPen(const QColor &color);
void setPen(Qt::PenStyle penStyle);
void drawLine(const QLineF &line);
void drawLine(const QPointF &p1, const QPointF &p2) {drawLine(QLineF(p1, p2));}
void save();
void restore();
// non-virtual methods:
void makeNonCosmetic();
protected:
// property members:
PainterModes mModes;
bool mIsAntialiasing;
// non-property members:
QStack<bool> mAntialiasingStack;
};
Q_DECLARE_OPERATORS_FOR_FLAGS(QCPPainter::PainterModes)
class QCP_LIB_DECL QCPLayer : public QObject
{
Q_OBJECT
Q_PROPERTY(QCustomPlot* parentPlot READ parentPlot)
Q_PROPERTY(QString name READ name)
Q_PROPERTY(int index READ index)
Q_PROPERTY(QList<QCPLayerable*> children READ children)
public:
QCPLayer(QCustomPlot* parentPlot, const QString &layerName);
~QCPLayer();
// getters:
QCustomPlot *parentPlot() const { return mParentPlot; }
QString name() const { return mName; }
int index() const { return mIndex; }
QList<QCPLayerable*> children() const { return mChildren; }
protected:
// property members:
QCustomPlot *mParentPlot;
QString mName;
int mIndex;
QList<QCPLayerable*> mChildren;
// non-virtual methods:
void addChild(QCPLayerable *layerable, bool prepend);
void removeChild(QCPLayerable *layerable);
private:
Q_DISABLE_COPY(QCPLayer)
friend class QCustomPlot;
friend class QCPLayerable;
};
class QCP_LIB_DECL QCPLayerable : public QObject
{
Q_OBJECT
Q_PROPERTY(bool visible READ visible WRITE setVisible)
Q_PROPERTY(QCustomPlot* parentPlot READ parentPlot)
Q_PROPERTY(QCPLayerable* parentLayerable READ parentLayerable)
Q_PROPERTY(QCPLayer* layer READ layer WRITE setLayer)
Q_PROPERTY(bool antialiased READ antialiased WRITE setAntialiased)
public:
QCPLayerable(QCustomPlot *plot, QString targetLayer="", QCPLayerable *parentLayerable=0);
~QCPLayerable();
// getters:
bool visible() const { return mVisible; }
QCustomPlot *parentPlot() const { return mParentPlot; }
QCPLayerable *parentLayerable() const { return mParentLayerable.data(); }
QCPLayer *layer() const { return mLayer; }
bool antialiased() const { return mAntialiased; }
// setters:
void setVisible(bool on);
bool setLayer(QCPLayer *layer);
bool setLayer(const QString &layerName);
void setAntialiased(bool enabled);
// introduced virtual methods:
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;
// non-property methods:
bool realVisibility() const;
protected:
// property members:
bool mVisible;
QCustomPlot *mParentPlot;
QPointer<QCPLayerable> mParentLayerable;
QCPLayer *mLayer;
bool mAntialiased;
// introduced virtual methods:
virtual void parentPlotInitialized(QCustomPlot *parentPlot);
virtual QCP::Interaction selectionCategory() const;
virtual QRect clipRect() const;
virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const = 0;
virtual void draw(QCPPainter *painter) = 0;
// events:
virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged);
virtual void deselectEvent(bool *selectionStateChanged);
// non-property methods:
void initializeParentPlot(QCustomPlot *parentPlot);
void setParentLayerable(QCPLayerable* parentLayerable);
bool moveToLayer(QCPLayer *layer, bool prepend);
void applyAntialiasingHint(QCPPainter *painter, bool localAntialiased, QCP::AntialiasedElement overrideElement) const;
private:
Q_DISABLE_COPY(QCPLayerable)
friend class QCustomPlot;
friend class QCPAxisRect;
};
class QCP_LIB_DECL QCPRange
{
public:
double lower, upper;
QCPRange();
QCPRange(double lower, double upper);
double size() const;
double center() const;
void normalize();
void expand(const QCPRange &otherRange);
QCPRange expanded(const QCPRange &otherRange) const;
QCPRange sanitizedForLogScale() const;
QCPRange sanitizedForLinScale() const;
bool contains(double value) const;
static bool validRange(double lower, double upper);
static bool validRange(const QCPRange &range);
static const double minRange; //1e-280;
static const double maxRange; //1e280;
};
Q_DECLARE_TYPEINFO(QCPRange, Q_MOVABLE_TYPE);
class QCP_LIB_DECL QCPMarginGroup : public QObject
{
Q_OBJECT
public:
QCPMarginGroup(QCustomPlot *parentPlot);
~QCPMarginGroup();
// non-virtual methods:
QList<QCPLayoutElement*> elements(QCP::MarginSide side) const { return mChildren.value(side); }
bool isEmpty() const;
void clear();
protected:
// non-property members:
QCustomPlot *mParentPlot;
QHash<QCP::MarginSide, QList<QCPLayoutElement*> > mChildren;
// non-virtual methods:
int commonMargin(QCP::MarginSide side) const;
void addChild(QCP::MarginSide side, QCPLayoutElement *element);
void removeChild(QCP::MarginSide side, QCPLayoutElement *element);
private:
Q_DISABLE_COPY(QCPMarginGroup)
friend class QCPLayoutElement;
};
class QCP_LIB_DECL QCPLayoutElement : public QCPLayerable
{
Q_OBJECT
Q_PROPERTY(QCPLayout* layout READ layout)
Q_PROPERTY(QRect rect READ rect)
Q_PROPERTY(QRect outerRect READ outerRect WRITE setOuterRect)
Q_PROPERTY(QMargins margins READ margins WRITE setMargins)
Q_PROPERTY(QMargins minimumMargins READ minimumMargins WRITE setMinimumMargins)
Q_PROPERTY(QSize minimumSize READ minimumSize WRITE setMinimumSize)
Q_PROPERTY(QSize maximumSize READ maximumSize WRITE setMaximumSize)
public:
explicit QCPLayoutElement(QCustomPlot *parentPlot=0);
virtual ~QCPLayoutElement();
// getters:
QCPLayout *layout() const { return mParentLayout; }
QRect rect() const { return mRect; }
QRect outerRect() const { return mOuterRect; }
QMargins margins() const { return mMargins; }
QMargins minimumMargins() const { return mMinimumMargins; }
QCP::MarginSides autoMargins() const { return mAutoMargins; }
QSize minimumSize() const { return mMinimumSize; }
QSize maximumSize() const { return mMaximumSize; }
QCPMarginGroup *marginGroup(QCP::MarginSide side) const { return mMarginGroups.value(side, (QCPMarginGroup*)0); }
QHash<QCP::MarginSide, QCPMarginGroup*> marginGroups() const { return mMarginGroups; }
// setters:
void setOuterRect(const QRect &rect);
void setMargins(const QMargins &margins);
void setMinimumMargins(const QMargins &margins);
void setAutoMargins(QCP::MarginSides sides);
void setMinimumSize(const QSize &size);
void setMinimumSize(int width, int height);
void setMaximumSize(const QSize &size);
void setMaximumSize(int width, int height);
void setMarginGroup(QCP::MarginSides sides, QCPMarginGroup *group);
// introduced virtual methods:
virtual void update();
virtual QSize minimumSizeHint() const;
virtual QSize maximumSizeHint() const;
virtual QList<QCPLayoutElement*> elements(bool recursive) const;
// reimplemented virtual methods:
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;
protected:
// property members:
QCPLayout *mParentLayout;
QSize mMinimumSize, mMaximumSize;
QRect mRect, mOuterRect;
QMargins mMargins, mMinimumMargins;
QCP::MarginSides mAutoMargins;
QHash<QCP::MarginSide, QCPMarginGroup*> mMarginGroups;
// introduced virtual methods:
virtual int calculateAutoMargin(QCP::MarginSide side);
// events:
virtual void mousePressEvent(QMouseEvent *event) {Q_UNUSED(event)}
virtual void mouseMoveEvent(QMouseEvent *event) {Q_UNUSED(event)}
virtual void mouseReleaseEvent(QMouseEvent *event) {Q_UNUSED(event)}
virtual void mouseDoubleClickEvent(QMouseEvent *event) {Q_UNUSED(event)}
virtual void wheelEvent(QWheelEvent *event) {Q_UNUSED(event)}
// reimplemented virtual methods:
virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const { Q_UNUSED(painter) }
virtual void draw(QCPPainter *painter) { Q_UNUSED(painter) }
virtual void parentPlotInitialized(QCustomPlot *parentPlot);
private:
Q_DISABLE_COPY(QCPLayoutElement)
friend class QCustomPlot;
friend class QCPLayout;
friend class QCPMarginGroup;
};
class QCP_LIB_DECL QCPLayout : public QCPLayoutElement
{
Q_OBJECT
public:
explicit QCPLayout();
// reimplemented virtual methods:
virtual void update();
virtual QList<QCPLayoutElement*> elements(bool recursive) const;
// introduced virtual methods:
virtual int elementCount() const = 0;
virtual QCPLayoutElement* elementAt(int index) const = 0;
virtual QCPLayoutElement* takeAt(int index) = 0;
virtual bool take(QCPLayoutElement* element) = 0;
virtual void simplify();
// non-virtual methods:
bool removeAt(int index);
bool remove(QCPLayoutElement* element);
void clear();
protected:
// introduced virtual methods:
virtual void updateLayout();
// non-virtual methods:
void sizeConstraintsChanged() const;
void adoptElement(QCPLayoutElement *el);
void releaseElement(QCPLayoutElement *el);
QVector<int> getSectionSizes(QVector<int> maxSizes, QVector<int> minSizes, QVector<double> stretchFactors, int totalSize) const;
private:
Q_DISABLE_COPY(QCPLayout)
friend class QCPLayoutElement;
};
class QCP_LIB_DECL QCPLayoutGrid : public QCPLayout
{
Q_OBJECT
Q_PROPERTY(int rowCount READ rowCount)
Q_PROPERTY(int columnCount READ columnCount)
Q_PROPERTY(QList<double> columnStretchFactors READ columnStretchFactors WRITE setColumnStretchFactors)
Q_PROPERTY(QList<double> rowStretchFactors READ rowStretchFactors WRITE setRowStretchFactors)
Q_PROPERTY(int columnSpacing READ columnSpacing WRITE setColumnSpacing)
Q_PROPERTY(int rowSpacing READ rowSpacing WRITE setRowSpacing)
public:
explicit QCPLayoutGrid();
virtual ~QCPLayoutGrid();
// getters:
int rowCount() const;
int columnCount() const;
QList<double> columnStretchFactors() const { return mColumnStretchFactors; }
QList<double> rowStretchFactors() const { return mRowStretchFactors; }
int columnSpacing() const { return mColumnSpacing; }
int rowSpacing() const { return mRowSpacing; }
// setters:
void setColumnStretchFactor(int column, double factor);
void setColumnStretchFactors(const QList<double> &factors);
void setRowStretchFactor(int row, double factor);
void setRowStretchFactors(const QList<double> &factors);
void setColumnSpacing(int pixels);
void setRowSpacing(int pixels);
// reimplemented virtual methods:
virtual void updateLayout();
virtual int elementCount() const;
virtual QCPLayoutElement* elementAt(int index) const;
virtual QCPLayoutElement* takeAt(int index);
virtual bool take(QCPLayoutElement* element);
virtual QList<QCPLayoutElement*> elements(bool recursive) const;
virtual void simplify();
virtual QSize minimumSizeHint() const;
virtual QSize maximumSizeHint() const;
// non-virtual methods:
QCPLayoutElement *element(int row, int column) const;
bool addElement(int row, int column, QCPLayoutElement *element);
bool hasElement(int row, int column);
void expandTo(int newRowCount, int newColumnCount);
void insertRow(int newIndex);
void insertColumn(int newIndex);
protected:
// property members:
QList<QList<QCPLayoutElement*> > mElements;
QList<double> mColumnStretchFactors;
QList<double> mRowStretchFactors;
int mColumnSpacing, mRowSpacing;
// non-virtual methods:
void getMinimumRowColSizes(QVector<int> *minColWidths, QVector<int> *minRowHeights) const;
void getMaximumRowColSizes(QVector<int> *maxColWidths, QVector<int> *maxRowHeights) const;
private:
Q_DISABLE_COPY(QCPLayoutGrid)
};
class QCP_LIB_DECL QCPLayoutInset : public QCPLayout
{
Q_OBJECT
public:
enum InsetPlacement {ipFree
,ipBorderAligned
};
explicit QCPLayoutInset();
virtual ~QCPLayoutInset();
// getters:
InsetPlacement insetPlacement(int index) const;
Qt::Alignment insetAlignment(int index) const;
QRectF insetRect(int index) const;
// setters:
void setInsetPlacement(int index, InsetPlacement placement);
void setInsetAlignment(int index, Qt::Alignment alignment);
void setInsetRect(int index, const QRectF &rect);
// reimplemented virtual methods:
virtual void updateLayout();
virtual int elementCount() const;
virtual QCPLayoutElement* elementAt(int index) const;
virtual QCPLayoutElement* takeAt(int index);
virtual bool take(QCPLayoutElement* element);
virtual void simplify() {}
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;
// non-virtual methods:
void addElement(QCPLayoutElement *element, Qt::Alignment alignment);
void addElement(QCPLayoutElement *element, const QRectF &rect);
protected:
// property members:
QList<QCPLayoutElement*> mElements;
QList<InsetPlacement> mInsetPlacement;
QList<Qt::Alignment> mInsetAlignment;
QList<QRectF> mInsetRect;
private:
Q_DISABLE_COPY(QCPLayoutInset)
};
class QCP_LIB_DECL QCPLineEnding
{
Q_GADGET
public:
Q_ENUMS(EndingStyle)
enum EndingStyle { esNone
,esFlatArrow
,esSpikeArrow
,esLineArrow
,esDisc
,esSquare
,esDiamond
,esBar
,esHalfBar
,esSkewedBar
};
QCPLineEnding();
QCPLineEnding(EndingStyle style, double width=8, double length=10, bool inverted=false);
// getters:
EndingStyle style() const { return mStyle; }
double width() const { return mWidth; }
double length() const { return mLength; }
bool inverted() const { return mInverted; }
// setters:
void setStyle(EndingStyle style);
void setWidth(double width);
void setLength(double length);
void setInverted(bool inverted);
// non-property methods:
double boundingDistance() const;
double realLength() const;
void draw(QCPPainter *painter, const QVector2D &pos, const QVector2D &dir) const;
void draw(QCPPainter *painter, const QVector2D &pos, double angle) const;
protected:
// property members:
EndingStyle mStyle;
double mWidth, mLength;
bool mInverted;
};
Q_DECLARE_TYPEINFO(QCPLineEnding, Q_MOVABLE_TYPE);
class QCP_LIB_DECL QCPGrid :public QCPLayerable
{
Q_OBJECT
Q_PROPERTY(bool subGridVisible READ subGridVisible WRITE setSubGridVisible)
Q_PROPERTY(bool antialiasedSubGrid READ antialiasedSubGrid WRITE setAntialiasedSubGrid)
Q_PROPERTY(bool antialiasedZeroLine READ antialiasedZeroLine WRITE setAntialiasedZeroLine)
Q_PROPERTY(QPen pen READ pen WRITE setPen)
Q_PROPERTY(QPen subGridPen READ subGridPen WRITE setSubGridPen)
Q_PROPERTY(QPen zeroLinePen READ zeroLinePen WRITE setZeroLinePen)
public:
QCPGrid(QCPAxis *parentAxis);
// getters:
bool subGridVisible() const { return mSubGridVisible; }
bool antialiasedSubGrid() const { return mAntialiasedSubGrid; }
bool antialiasedZeroLine() const { return mAntialiasedZeroLine; }
QPen pen() const { return mPen; }
QPen subGridPen() const { return mSubGridPen; }
QPen zeroLinePen() const { return mZeroLinePen; }
// setters:
void setSubGridVisible(bool visible);
void setAntialiasedSubGrid(bool enabled);
void setAntialiasedZeroLine(bool enabled);
void setPen(const QPen &pen);
void setSubGridPen(const QPen &pen);
void setZeroLinePen(const QPen &pen);
protected:
// property members:
bool mSubGridVisible;
bool mAntialiasedSubGrid, mAntialiasedZeroLine;
QPen mPen, mSubGridPen, mZeroLinePen;
// non-property members:
QCPAxis *mParentAxis;
// reimplemented virtual methods:
virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const;
virtual void draw(QCPPainter *painter);
// non-virtual methods:
void drawGridLines(QCPPainter *painter) const;
void drawSubGridLines(QCPPainter *painter) const;
friend class QCPAxis;
};
class QCP_LIB_DECL QCPAxis : public QCPLayerable
{
Q_OBJECT
Q_PROPERTY(AxisType axisType READ axisType)
Q_PROPERTY(QCPAxisRect* axisRect READ axisRect)
Q_PROPERTY(ScaleType scaleType READ scaleType WRITE setScaleType)
Q_PROPERTY(double scaleLogBase READ scaleLogBase WRITE setScaleLogBase)
Q_PROPERTY(QCPRange range READ range WRITE setRange)
Q_PROPERTY(bool rangeReversed READ rangeReversed WRITE setRangeReversed)
Q_PROPERTY(bool autoTicks READ autoTicks WRITE setAutoTicks)
Q_PROPERTY(int autoTickCount READ autoTickCount WRITE setAutoTickCount)
Q_PROPERTY(bool autoTickLabels READ autoTickLabels WRITE setAutoTickLabels)
Q_PROPERTY(bool autoTickStep READ autoTickStep WRITE setAutoTickStep)
Q_PROPERTY(bool autoSubTicks READ autoSubTicks WRITE setAutoSubTicks)
Q_PROPERTY(bool ticks READ ticks WRITE setTicks)
Q_PROPERTY(bool tickLabels READ tickLabels WRITE setTickLabels)
Q_PROPERTY(int tickLabelPadding READ tickLabelPadding WRITE setTickLabelPadding)
Q_PROPERTY(LabelType tickLabelType READ tickLabelType WRITE setTickLabelType)
Q_PROPERTY(QFont tickLabelFont READ tickLabelFont WRITE setTickLabelFont)
Q_PROPERTY(QColor tickLabelColor READ tickLabelColor WRITE setTickLabelColor)
Q_PROPERTY(double tickLabelRotation READ tickLabelRotation WRITE setTickLabelRotation)
Q_PROPERTY(QString dateTimeFormat READ dateTimeFormat WRITE setDateTimeFormat)
Q_PROPERTY(QString numberFormat READ numberFormat WRITE setNumberFormat)
Q_PROPERTY(int numberPrecision READ numberPrecision WRITE setNumberPrecision)
Q_PROPERTY(double tickStep READ tickStep WRITE setTickStep)
Q_PROPERTY(QVector<double> tickVector READ tickVector WRITE setTickVector)
Q_PROPERTY(QVector<QString> tickVectorLabels READ tickVectorLabels WRITE setTickVectorLabels)
Q_PROPERTY(int tickLengthIn READ tickLengthIn WRITE setTickLengthIn)
Q_PROPERTY(int tickLengthOut READ tickLengthOut WRITE setTickLengthOut)
Q_PROPERTY(int subTickCount READ subTickCount WRITE setSubTickCount)
Q_PROPERTY(int subTickLengthIn READ subTickLengthIn WRITE setSubTickLengthIn)
Q_PROPERTY(int subTickLengthOut READ subTickLengthOut WRITE setSubTickLengthOut)
Q_PROPERTY(QPen basePen READ basePen WRITE setBasePen)
Q_PROPERTY(QPen tickPen READ tickPen WRITE setTickPen)
Q_PROPERTY(QPen subTickPen READ subTickPen WRITE setSubTickPen)
Q_PROPERTY(QFont labelFont READ labelFont WRITE setLabelFont)
Q_PROPERTY(QColor labelColor READ labelColor WRITE setLabelColor)
Q_PROPERTY(QString label READ label WRITE setLabel)
Q_PROPERTY(int labelPadding READ labelPadding WRITE setLabelPadding)
Q_PROPERTY(int padding READ padding WRITE setPadding)
Q_PROPERTY(int offset READ offset WRITE setOffset)
Q_PROPERTY(SelectableParts selectedParts READ selectedParts WRITE setSelectedParts)
Q_PROPERTY(SelectableParts selectableParts READ selectableParts WRITE setSelectableParts)
Q_PROPERTY(QFont selectedTickLabelFont READ selectedTickLabelFont WRITE setSelectedTickLabelFont)
Q_PROPERTY(QFont selectedLabelFont READ selectedLabelFont WRITE setSelectedLabelFont)
Q_PROPERTY(QColor selectedTickLabelColor READ selectedTickLabelColor WRITE setSelectedTickLabelColor)
Q_PROPERTY(QColor selectedLabelColor READ selectedLabelColor WRITE setSelectedLabelColor)
Q_PROPERTY(QPen selectedBasePen READ selectedBasePen WRITE setSelectedBasePen)
Q_PROPERTY(QPen selectedTickPen READ selectedTickPen WRITE setSelectedTickPen)
Q_PROPERTY(QPen selectedSubTickPen READ selectedSubTickPen WRITE setSelectedSubTickPen)
Q_PROPERTY(QCPLineEnding lowerEnding READ lowerEnding WRITE setLowerEnding)
Q_PROPERTY(QCPLineEnding upperEnding READ upperEnding WRITE setUpperEnding)
Q_PROPERTY(QCPGrid* grid READ grid)
public:
enum AxisType { atLeft = 0x01
,atRight = 0x02
,atTop = 0x04
,atBottom = 0x08
};
Q_FLAGS(AxisType AxisTypes)
Q_DECLARE_FLAGS(AxisTypes, AxisType)
enum LabelType { ltNumber
,ltDateTime
};
Q_ENUMS(LabelType)
enum ScaleType { stLinear
,stLogarithmic
};
Q_ENUMS(ScaleType)
enum SelectablePart { spNone = 0
,spAxis = 0x001
,spTickLabels = 0x002
,spAxisLabel = 0x004
};
Q_FLAGS(SelectablePart SelectableParts)
Q_DECLARE_FLAGS(SelectableParts, SelectablePart)
explicit QCPAxis(QCPAxisRect *parent, AxisType type);
// getters:
AxisType axisType() const { return mAxisType; }
QCPAxisRect *axisRect() const { return mAxisRect; }
ScaleType scaleType() const { return mScaleType; }
double scaleLogBase() const { return mScaleLogBase; }
const QCPRange range() const { return mRange; }
bool rangeReversed() const { return mRangeReversed; }
bool autoTicks() const { return mAutoTicks; }
int autoTickCount() const { return mAutoTickCount; }
bool autoTickLabels() const { return mAutoTickLabels; }
bool autoTickStep() const { return mAutoTickStep; }
bool autoSubTicks() const { return mAutoSubTicks; }
bool ticks() const { return mTicks; }
bool tickLabels() const { return mTickLabels; }
int tickLabelPadding() const { return mTickLabelPadding; }
LabelType tickLabelType() const { return mTickLabelType; }
QFont tickLabelFont() const { return mTickLabelFont; }
QColor tickLabelColor() const { return mTickLabelColor; }
double tickLabelRotation() const { return mTickLabelRotation; }
QString dateTimeFormat() const { return mDateTimeFormat; }
Qt::TimeSpec dateTimeSpec() const { return mDateTimeSpec; }
QString numberFormat() const;
int numberPrecision() const { return mNumberPrecision; }
double tickStep() const { return mTickStep; }
QVector<double> tickVector() const { return mTickVector; }
QVector<QString> tickVectorLabels() const { return mTickVectorLabels; }
int tickLengthIn() const { return mTickLengthIn; }
int tickLengthOut() const { return mTickLengthOut; }
int subTickCount() const { return mSubTickCount; }
int subTickLengthIn() const { return mSubTickLengthIn; }
int subTickLengthOut() const { return mSubTickLengthOut; }
QPen basePen() const { return mBasePen; }
QPen tickPen() const { return mTickPen; }
QPen subTickPen() const { return mSubTickPen; }
QFont labelFont() const { return mLabelFont; }
QColor labelColor() const { return mLabelColor; }
QString label() const { return mLabel; }
int labelPadding() const { return mLabelPadding; }
int padding() const { return mPadding; }
int offset() const { return mOffset; }
SelectableParts selectedParts() const { return mSelectedParts; }
SelectableParts selectableParts() const { return mSelectableParts; }
QFont selectedTickLabelFont() const { return mSelectedTickLabelFont; }
QFont selectedLabelFont() const { return mSelectedLabelFont; }
QColor selectedTickLabelColor() const { return mSelectedTickLabelColor; }
QColor selectedLabelColor() const { return mSelectedLabelColor; }
QPen selectedBasePen() const { return mSelectedBasePen; }
QPen selectedTickPen() const { return mSelectedTickPen; }
QPen selectedSubTickPen() const { return mSelectedSubTickPen; }
QCPLineEnding lowerEnding() const { return mLowerEnding; }
QCPLineEnding upperEnding() const { return mUpperEnding; }
QCPGrid *grid() const { return mGrid; }
// setters:
void setScaleType(ScaleType type);
void setScaleLogBase(double base);
Q_SLOT void setRange(const QCPRange &range);
void setRange(double lower, double upper);
void setRange(double position, double size, Qt::AlignmentFlag alignment);
void setRangeLower(double lower);
void setRangeUpper(double upper);
void setRangeReversed(bool reversed);
void setAutoTicks(bool on);
void setAutoTickCount(int approximateCount);
void setAutoTickLabels(bool on);
void setAutoTickStep(bool on);
void setAutoSubTicks(bool on);
void setTicks(bool show);
void setTickLabels(bool show);
void setTickLabelPadding(int padding);
void setTickLabelType(LabelType type);
void setTickLabelFont(const QFont &font);
void setTickLabelColor(const QColor &color);
void setTickLabelRotation(double degrees);
void setDateTimeFormat(const QString &format);
void setDateTimeSpec(const Qt::TimeSpec &timeSpec);
void setNumberFormat(const QString &formatCode);
void setNumberPrecision(int precision);
void setTickStep(double step);
void setTickVector(const QVector<double> &vec);
void setTickVectorLabels(const QVector<QString> &vec);
void setTickLength(int inside, int outside=0);
void setTickLengthIn(int inside);
void setTickLengthOut(int outside);
void setSubTickCount(int count);
void setSubTickLength(int inside, int outside=0);
void setSubTickLengthIn(int inside);
void setSubTickLengthOut(int outside);
void setBasePen(const QPen &pen);
void setTickPen(const QPen &pen);
void setSubTickPen(const QPen &pen);
void setLabelFont(const QFont &font);
void setLabelColor(const QColor &color);
void setLabel(const QString &str);
void setLabelPadding(int padding);
void setPadding(int padding);
void setOffset(int offset);
void setSelectedTickLabelFont(const QFont &font);
void setSelectedLabelFont(const QFont &font);
void setSelectedTickLabelColor(const QColor &color);
void setSelectedLabelColor(const QColor &color);
void setSelectedBasePen(const QPen &pen);
void setSelectedTickPen(const QPen &pen);
void setSelectedSubTickPen(const QPen &pen);
Q_SLOT void setSelectableParts(const QCPAxis::SelectableParts &selectableParts);
Q_SLOT void setSelectedParts(const QCPAxis::SelectableParts &selectedParts);
void setLowerEnding(const QCPLineEnding &ending);
void setUpperEnding(const QCPLineEnding &ending);
// reimplemented virtual methods:
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;
// non-virtual methods:
Qt::Orientation orientation() const { return mOrientation; }
void moveRange(double diff);
void scaleRange(double factor, double center);
void setScaleRatio(const QCPAxis *otherAxis, double ratio=1.0);
void rescale(bool onlyVisiblePlottables=false);
double pixelToCoord(double value) const;
double coordToPixel(double value) const;
SelectablePart getPartAt(const QPointF &pos) const;
QList<QCPAbstractPlottable*> plottables() const;
QList<QCPGraph*> graphs() const;
QList<QCPAbstractItem*> items() const;
static AxisType marginSideToAxisType(QCP::MarginSide side);
signals:
void ticksRequest();
void rangeChanged(const QCPRange &newRange);
void rangeChanged(const QCPRange &newRange, const QCPRange &oldRange);
void selectionChanged(const QCPAxis::SelectableParts &parts);
protected:
struct CachedLabel
{
QPointF offset;
QPixmap pixmap;
};
struct TickLabelData
{
QString basePart, expPart;
QRect baseBounds, expBounds, totalBounds, rotatedTotalBounds;
QFont baseFont, expFont;
};
// property members:
// axis base:
AxisType mAxisType;
QCPAxisRect *mAxisRect;
int mOffset, mPadding;
Qt::Orientation mOrientation;
SelectableParts mSelectableParts, mSelectedParts;
QPen mBasePen, mSelectedBasePen;
QCPLineEnding mLowerEnding, mUpperEnding;
// axis label:
int mLabelPadding;
QString mLabel;
QFont mLabelFont, mSelectedLabelFont;
QColor mLabelColor, mSelectedLabelColor;
// tick labels:
int mTickLabelPadding;
bool mTickLabels, mAutoTickLabels;
double mTickLabelRotation;
LabelType mTickLabelType;
QFont mTickLabelFont, mSelectedTickLabelFont;
QColor mTickLabelColor, mSelectedTickLabelColor;
QString mDateTimeFormat;
Qt::TimeSpec mDateTimeSpec;
int mNumberPrecision;
char mNumberFormatChar;
bool mNumberBeautifulPowers;
bool mNumberMultiplyCross;
// ticks and subticks:
bool mTicks;
double mTickStep;
int mSubTickCount, mAutoTickCount;
bool mAutoTicks, mAutoTickStep, mAutoSubTicks;
int mTickLengthIn, mTickLengthOut, mSubTickLengthIn, mSubTickLengthOut;
QPen mTickPen, mSelectedTickPen;
QPen mSubTickPen, mSelectedSubTickPen;
// scale and range:
QCPRange mRange;
bool mRangeReversed;
ScaleType mScaleType;
double mScaleLogBase, mScaleLogBaseLogInv;
// non-property members:
QCPGrid *mGrid;
QCache<QString, CachedLabel> mLabelCache;
int mLowestVisibleTick, mHighestVisibleTick;
QChar mExponentialChar, mPositiveSignChar;
QVector<double> mTickVector;
QVector<QString> mTickVectorLabels;
QVector<double> mSubTickVector;
QRect mAxisSelectionBox, mTickLabelsSelectionBox, mLabelSelectionBox;
bool mCachedMarginValid;
int mCachedMargin;
// introduced virtual methods:
virtual void setupTickVectors();
virtual void generateAutoTicks();
virtual int calculateAutoSubTickCount(double tickStep) const;
virtual int calculateMargin();
// tick label drawing/caching:
virtual void placeTickLabel(QCPPainter *painter, double position, int distanceToAxis, const QString &text, QSize *tickLabelsSize);
virtual void drawTickLabel(QCPPainter *painter, double x, double y, const TickLabelData &labelData) const;
virtual TickLabelData getTickLabelData(const QFont &font, const QString &text) const;
virtual QPointF getTickLabelDrawOffset(const TickLabelData &labelData) const;
virtual void getMaxTickLabelSize(const QFont &font, const QString &text, QSize *tickLabelsSize) const;
// reimplemented virtual methods:
virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const;
virtual void draw(QCPPainter *painter);
virtual QCP::Interaction selectionCategory() const;
// events:
virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged);
virtual void deselectEvent(bool *selectionStateChanged);
// non-virtual methods:
void visibleTickBounds(int &lowIndex, int &highIndex) const;
double baseLog(double value) const;
double basePow(double value) const;
QPen getBasePen() const;
QPen getTickPen() const;
QPen getSubTickPen() const;
QFont getTickLabelFont() const;
QFont getLabelFont() const;
QColor getTickLabelColor() const;
QColor getLabelColor() const;
private:
Q_DISABLE_COPY(QCPAxis)
friend class QCustomPlot;
friend class QCPGrid;
friend class QCPAxisRect;
};
Q_DECLARE_OPERATORS_FOR_FLAGS(QCPAxis::SelectableParts)
Q_DECLARE_OPERATORS_FOR_FLAGS(QCPAxis::AxisTypes)
Q_DECLARE_METATYPE(QCPAxis::SelectablePart)
class QCP_LIB_DECL QCPAbstractPlottable : public QCPLayerable
{
Q_OBJECT
Q_PROPERTY(QString name READ name WRITE setName)
Q_PROPERTY(bool antialiasedFill READ antialiasedFill WRITE setAntialiasedFill)
Q_PROPERTY(bool antialiasedScatters READ antialiasedScatters WRITE setAntialiasedScatters)
Q_PROPERTY(bool antialiasedErrorBars READ antialiasedErrorBars WRITE setAntialiasedErrorBars)
Q_PROPERTY(QPen pen READ pen WRITE setPen)
Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
Q_PROPERTY(QCPAxis* keyAxis READ keyAxis WRITE setKeyAxis)
Q_PROPERTY(QCPAxis* valueAxis READ valueAxis WRITE setValueAxis)
Q_PROPERTY(bool selectable READ selectable WRITE setSelectable)
Q_PROPERTY(bool selected READ selected WRITE setSelected)
public:
QCPAbstractPlottable(QCPAxis *keyAxis, QCPAxis *valueAxis);
// getters:
QString name() const { return mName; }
bool antialiasedFill() const { return mAntialiasedFill; }
bool antialiasedScatters() const { return mAntialiasedScatters; }
bool antialiasedErrorBars() const { return mAntialiasedErrorBars; }
QPen pen() const { return mPen; }
QPen selectedPen() const { return mSelectedPen; }
QBrush brush() const { return mBrush; }
QBrush selectedBrush() const { return mSelectedBrush; }
QCPAxis *keyAxis() const { return mKeyAxis.data(); }
QCPAxis *valueAxis() const { return mValueAxis.data(); }
bool selectable() const { return mSelectable; }
bool selected() const { return mSelected; }
// setters:
void setName(const QString &name);
void setAntialiasedFill(bool enabled);
void setAntialiasedScatters(bool enabled);
void setAntialiasedErrorBars(bool enabled);
void setPen(const QPen &pen);
void setSelectedPen(const QPen &pen);
void setBrush(const QBrush &brush);
void setSelectedBrush(const QBrush &brush);
void setKeyAxis(QCPAxis *axis);
void setValueAxis(QCPAxis *axis);
Q_SLOT void setSelectable(bool selectable);
Q_SLOT void setSelected(bool selected);
// introduced virtual methods:
virtual void clearData() = 0;
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const = 0;
virtual bool addToLegend();
virtual bool removeFromLegend() const;
// non-property methods:
void rescaleAxes(bool onlyEnlarge=false) const;
void rescaleKeyAxis(bool onlyEnlarge=false) const;
void rescaleValueAxis(bool onlyEnlarge=false) const;
signals:
void selectionChanged(bool selected);
protected:
enum SignDomain { sdNegative
,sdBoth
,sdPositive
};
// property members:
QString mName;
bool mAntialiasedFill, mAntialiasedScatters, mAntialiasedErrorBars;
QPen mPen, mSelectedPen;
QBrush mBrush, mSelectedBrush;
QPointer<QCPAxis> mKeyAxis, mValueAxis;
bool mSelectable, mSelected;
// reimplemented virtual methods:
virtual QRect clipRect() const;
virtual void draw(QCPPainter *painter) = 0;
virtual QCP::Interaction selectionCategory() const;
void applyDefaultAntialiasingHint(QCPPainter *painter) const;
// events:
virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged);
virtual void deselectEvent(bool *selectionStateChanged);
// introduced virtual methods:
virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const = 0;
virtual QCPRange getKeyRange(bool &validRange, SignDomain inSignDomain=sdBoth) const = 0;
virtual QCPRange getValueRange(bool &validRange, SignDomain inSignDomain=sdBoth) const = 0;
// non-virtual methods:
void coordsToPixels(double key, double value, double &x, double &y) const;
const QPointF coordsToPixels(double key, double value) const;
void pixelsToCoords(double x, double y, double &key, double &value) const;
void pixelsToCoords(const QPointF &pixelPos, double &key, double &value) const;
QPen mainPen() const;
QBrush mainBrush() const;
void applyFillAntialiasingHint(QCPPainter *painter) const;
void applyScattersAntialiasingHint(QCPPainter *painter) const;
void applyErrorBarsAntialiasingHint(QCPPainter *painter) const;
double distSqrToLine(const QPointF &start, const QPointF &end, const QPointF &point) const;
private:
Q_DISABLE_COPY(QCPAbstractPlottable)
friend class QCustomPlot;
friend class QCPAxis;
friend class QCPPlottableLegendItem;
};
class QCP_LIB_DECL QCPItemAnchor
{
public:
QCPItemAnchor(QCustomPlot *parentPlot, QCPAbstractItem *parentItem, const QString name, int anchorId=-1);
virtual ~QCPItemAnchor();
// getters:
QString name() const { return mName; }
virtual QPointF pixelPoint() const;
protected:
// property members:
QString mName;
// non-property members:
QCustomPlot *mParentPlot;
QCPAbstractItem *mParentItem;
int mAnchorId;
QSet<QCPItemPosition*> mChildren;
// introduced virtual methods:
virtual QCPItemPosition *toQCPItemPosition() { return 0; }
// non-virtual methods:
void addChild(QCPItemPosition* pos); // called from pos when this anchor is set as parent
void removeChild(QCPItemPosition *pos); // called from pos when its parent anchor is reset or pos deleted
private:
Q_DISABLE_COPY(QCPItemAnchor)
friend class QCPItemPosition;
};
class QCP_LIB_DECL QCPItemPosition : public QCPItemAnchor
{
public:
enum PositionType { ptAbsolute
,ptViewportRatio
,ptAxisRectRatio
,ptPlotCoords
};
QCPItemPosition(QCustomPlot *parentPlot, QCPAbstractItem *parentItem, const QString name);
virtual ~QCPItemPosition();
// getters:
PositionType type() const { return mPositionType; }
QCPItemAnchor *parentAnchor() const { return mParentAnchor; }
double key() const { return mKey; }
double value() const { return mValue; }
QPointF coords() const { return QPointF(mKey, mValue); }
QCPAxis *keyAxis() const { return mKeyAxis.data(); }
QCPAxis *valueAxis() const { return mValueAxis.data(); }
QCPAxisRect *axisRect() const;
virtual QPointF pixelPoint() const;
// setters:
void setType(PositionType type);
bool setParentAnchor(QCPItemAnchor *parentAnchor, bool keepPixelPosition=false);
void setCoords(double key, double value);
void setCoords(const QPointF &coords);
void setAxes(QCPAxis* keyAxis, QCPAxis* valueAxis);
void setAxisRect(QCPAxisRect *axisRect);
void setPixelPoint(const QPointF &pixelPoint);
protected:
// property members:
PositionType mPositionType;
QPointer<QCPAxis> mKeyAxis, mValueAxis;
QPointer<QCPAxisRect> mAxisRect;
double mKey, mValue;
QCPItemAnchor *mParentAnchor;
// reimplemented virtual methods:
virtual QCPItemPosition *toQCPItemPosition() { return this; }
private:
Q_DISABLE_COPY(QCPItemPosition)
};
class QCP_LIB_DECL QCPAbstractItem : public QCPLayerable
{
Q_OBJECT
Q_PROPERTY(bool clipToAxisRect READ clipToAxisRect WRITE setClipToAxisRect)
Q_PROPERTY(QCPAxisRect* clipAxisRect READ clipAxisRect WRITE setClipAxisRect)
Q_PROPERTY(bool selectable READ selectable WRITE setSelectable)
Q_PROPERTY(bool selected READ selected WRITE setSelected)
public:
QCPAbstractItem(QCustomPlot *parentPlot);
virtual ~QCPAbstractItem();
// getters:
bool clipToAxisRect() const { return mClipToAxisRect; }
QCPAxisRect *clipAxisRect() const;
bool selectable() const { return mSelectable; }
bool selected() const { return mSelected; }
// setters:
void setClipToAxisRect(bool clip);
void setClipAxisRect(QCPAxisRect *rect);
void setSelectable(bool selectable);
void setSelected(bool selected);
// reimplemented virtual methods:
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const = 0;
// non-virtual methods:
QList<QCPItemPosition*> positions() const { return mPositions; }
QList<QCPItemAnchor*> anchors() const { return mAnchors; }
QCPItemPosition *position(const QString &name) const;
QCPItemAnchor *anchor(const QString &name) const;
bool hasAnchor(const QString &name) const;
signals:
void selectionChanged(bool selected);
protected:
// property members:
bool mClipToAxisRect;
QPointer<QCPAxisRect> mClipAxisRect;
QList<QCPItemPosition*> mPositions;
QList<QCPItemAnchor*> mAnchors;
bool mSelectable, mSelected;
// reimplemented virtual methods:
virtual QCP::Interaction selectionCategory() const;
virtual QRect clipRect() const;
virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const;
virtual void draw(QCPPainter *painter) = 0;
// events:
virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged);
virtual void deselectEvent(bool *selectionStateChanged);
// introduced virtual methods:
virtual QPointF anchorPixelPoint(int anchorId) const;
// non-virtual methods:
double distSqrToLine(const QPointF &start, const QPointF &end, const QPointF &point) const;
double rectSelectTest(const QRectF &rect, const QPointF &pos, bool filledRect) const;
QCPItemPosition *createPosition(const QString &name);
QCPItemAnchor *createAnchor(const QString &name, int anchorId);
private:
Q_DISABLE_COPY(QCPAbstractItem)
friend class QCustomPlot;
friend class QCPItemAnchor;
};
class QCP_LIB_DECL QCustomPlot : public QWidget
{
Q_OBJECT
Q_PROPERTY(QRect viewport READ viewport WRITE setViewport)
Q_PROPERTY(QPixmap background READ background WRITE setBackground)
Q_PROPERTY(bool backgroundScaled READ backgroundScaled WRITE setBackgroundScaled)
Q_PROPERTY(Qt::AspectRatioMode backgroundScaledMode READ backgroundScaledMode WRITE setBackgroundScaledMode)
Q_PROPERTY(QCPLayoutGrid* plotLayout READ plotLayout)
Q_PROPERTY(bool autoAddPlottableToLegend READ autoAddPlottableToLegend WRITE setAutoAddPlottableToLegend)
Q_PROPERTY(int selectionTolerance READ selectionTolerance WRITE setSelectionTolerance)
Q_PROPERTY(bool noAntialiasingOnDrag READ noAntialiasingOnDrag WRITE setNoAntialiasingOnDrag)
Q_PROPERTY(Qt::KeyboardModifier multiSelectModifier READ multiSelectModifier WRITE setMultiSelectModifier)
public:
enum LayerInsertMode { limBelow
,limAbove
};
Q_ENUMS(LayerInsertMode)
explicit QCustomPlot(QWidget *parent = 0);
virtual ~QCustomPlot();
// getters:
QRect viewport() const { return mViewport; }
QPixmap background() const { return mBackgroundPixmap; }
bool backgroundScaled() const { return mBackgroundScaled; }
Qt::AspectRatioMode backgroundScaledMode() const { return mBackgroundScaledMode; }
QCPLayoutGrid *plotLayout() const { return mPlotLayout; }
QCP::AntialiasedElements antialiasedElements() const { return mAntialiasedElements; }
QCP::AntialiasedElements notAntialiasedElements() const { return mNotAntialiasedElements; }
bool autoAddPlottableToLegend() const { return mAutoAddPlottableToLegend; }
const QCP::Interactions interactions() const { return mInteractions; }
int selectionTolerance() const { return mSelectionTolerance; }
bool noAntialiasingOnDrag() const { return mNoAntialiasingOnDrag; }
QCP::PlottingHints plottingHints() const { return mPlottingHints; }
Qt::KeyboardModifier multiSelectModifier() const { return mMultiSelectModifier; }
// setters:
void setViewport(const QRect &rect);
void setBackground(const QPixmap &pm);
void setBackground(const QPixmap &pm, bool scaled, Qt::AspectRatioMode mode=Qt::KeepAspectRatioByExpanding);
void setBackground(const QBrush &brush);
void setBackgroundScaled(bool scaled);
void setBackgroundScaledMode(Qt::AspectRatioMode mode);
void setAntialiasedElements(const QCP::AntialiasedElements &antialiasedElements);
void setAntialiasedElement(QCP::AntialiasedElement antialiasedElement, bool enabled=true);
void setNotAntialiasedElements(const QCP::AntialiasedElements &notAntialiasedElements);
void setNotAntialiasedElement(QCP::AntialiasedElement notAntialiasedElement, bool enabled=true);
void setAutoAddPlottableToLegend(bool on);
void setInteractions(const QCP::Interactions &interactions);
void setInteraction(const QCP::Interaction &interaction, bool enabled=true);
void setSelectionTolerance(int pixels);
void setNoAntialiasingOnDrag(bool enabled);
void setPlottingHints(const QCP::PlottingHints &hints);
void setPlottingHint(QCP::PlottingHint hint, bool enabled=true);
void setMultiSelectModifier(Qt::KeyboardModifier modifier);
// non-property methods:
// plottable interface:
QCPAbstractPlottable *plottable(int index);
QCPAbstractPlottable *plottable();
bool addPlottable(QCPAbstractPlottable *plottable);
bool removePlottable(QCPAbstractPlottable *plottable);
bool removePlottable(int index);
int clearPlottables();
int plottableCount() const;
QList<QCPAbstractPlottable*> selectedPlottables() const;
QCPAbstractPlottable *plottableAt(const QPointF &pos, bool onlySelectable=false) const;
bool hasPlottable(QCPAbstractPlottable *plottable) const;
// specialized interface for QCPGraph:
QCPGraph *graph(int index) const;
QCPGraph *graph() const;
QCPGraph *addGraph(QCPAxis *keyAxis=0, QCPAxis *valueAxis=0);
bool removeGraph(QCPGraph *graph);
bool removeGraph(int index);
int clearGraphs();
int graphCount() const;
QList<QCPGraph*> selectedGraphs() const;
// item interface:
QCPAbstractItem *item(int index) const;
QCPAbstractItem *item() const;
bool addItem(QCPAbstractItem* item);
bool removeItem(QCPAbstractItem *item);
bool removeItem(int index);
int clearItems();
int itemCount() const;
QList<QCPAbstractItem*> selectedItems() const;
QCPAbstractItem *itemAt(const QPointF &pos, bool onlySelectable=false) const;
bool hasItem(QCPAbstractItem *item) const;
// layer interface:
QCPLayer *layer(const QString &name) const;
QCPLayer *layer(int index) const;
QCPLayer *currentLayer() const;
bool setCurrentLayer(const QString &name);
bool setCurrentLayer(QCPLayer *layer);
int layerCount() const;
bool addLayer(const QString &name, QCPLayer *otherLayer=0, LayerInsertMode insertMode=limAbove);
bool removeLayer(QCPLayer *layer);
bool moveLayer(QCPLayer *layer, QCPLayer *otherLayer, LayerInsertMode insertMode=limAbove);
// axis rect/layout interface:
int axisRectCount() const;
QCPAxisRect* axisRect(int index=0) const;
QList<QCPAxisRect*> axisRects() const;
QCPLayoutElement* layoutElementAt(const QPointF &pos) const;
Q_SLOT void rescaleAxes(bool onlyVisiblePlottables=false);
QList<QCPAxis*> selectedAxes() const;
QList<QCPLegend*> selectedLegends() const;
Q_SLOT void deselectAll();
bool savePdf(const QString &fileName, bool noCosmeticPen=false, int width=0, int height=0);
bool savePng(const QString &fileName, int width=0, int height=0, double scale=1.0, int quality=-1);
bool saveJpg(const QString &fileName, int width=0, int height=0, double scale=1.0, int quality=-1);
bool saveBmp(const QString &fileName, int width=0, int height=0, double scale=1.0);
bool saveRastered(const QString &fileName, int width, int height, double scale, const char *format, int quality=-1);
QPixmap toPixmap(int width=0, int height=0, double scale=1.0);
void toPainter(QCPPainter *painter, int width=0, int height=0);
Q_SLOT void replot();
QCPAxis *xAxis, *yAxis, *xAxis2, *yAxis2;
QCPLegend *legend;
signals:
void mouseDoubleClick(QMouseEvent *event);
void mousePress(QMouseEvent *event);
void mouseMove(QMouseEvent *event);
void mouseRelease(QMouseEvent *event);
void mouseWheel(QWheelEvent *event);
void plottableClick(QCPAbstractPlottable *plottable, QMouseEvent *event);
void plottableDoubleClick(QCPAbstractPlottable *plottable, QMouseEvent *event);
void itemClick(QCPAbstractItem *item, QMouseEvent *event);
void itemDoubleClick(QCPAbstractItem *item, QMouseEvent *event);
void axisClick(QCPAxis *axis, QCPAxis::SelectablePart part, QMouseEvent *event);
void axisDoubleClick(QCPAxis *axis, QCPAxis::SelectablePart part, QMouseEvent *event);
void legendClick(QCPLegend *legend, QCPAbstractLegendItem *item, QMouseEvent *event);
void legendDoubleClick(QCPLegend *legend, QCPAbstractLegendItem *item, QMouseEvent *event);
void titleClick(QMouseEvent *event, QCPPlotTitle *title);
void titleDoubleClick(QMouseEvent *event, QCPPlotTitle *title);
void selectionChangedByUser();
void beforeReplot();
void afterReplot();
protected:
// property members:
QRect mViewport;
QCPLayoutGrid *mPlotLayout;
bool mAutoAddPlottableToLegend;
QList<QCPAbstractPlottable*> mPlottables;
QList<QCPGraph*> mGraphs; // extra list of plottables also in mPlottables that are of type QCPGraph
QList<QCPAbstractItem*> mItems;
QList<QCPLayer*> mLayers;
QCP::AntialiasedElements mAntialiasedElements, mNotAntialiasedElements;
QCP::Interactions mInteractions;
int mSelectionTolerance;
bool mNoAntialiasingOnDrag;
QBrush mBackgroundBrush;
QPixmap mBackgroundPixmap;
QPixmap mScaledBackgroundPixmap;
bool mBackgroundScaled;
Qt::AspectRatioMode mBackgroundScaledMode;
QCPLayer *mCurrentLayer;
QCP::PlottingHints mPlottingHints;
Qt::KeyboardModifier mMultiSelectModifier;
// non-property members:
QPixmap mPaintBuffer;
QPoint mMousePressPos;
QCPLayoutElement *mMouseEventElement;
bool mReplotting;
// reimplemented virtual methods:
virtual QSize minimumSizeHint() const;
virtual QSize sizeHint() const;
virtual void paintEvent(QPaintEvent *event);
virtual void resizeEvent(QResizeEvent *event);
virtual void mouseDoubleClickEvent(QMouseEvent *event);
virtual void mousePressEvent(QMouseEvent *event);
virtual void mouseMoveEvent(QMouseEvent *event);
virtual void mouseReleaseEvent(QMouseEvent *event);
virtual void wheelEvent(QWheelEvent *event);
// introduced virtual methods:
virtual void draw(QCPPainter *painter);
virtual void axisRemoved(QCPAxis *axis);
virtual void legendRemoved(QCPLegend *legend);
// non-virtual methods:
void updateLayerIndices() const;
QCPLayerable *layerableAt(const QPointF &pos, bool onlySelectable, QVariant *selectionDetails=0) const;
void drawBackground(QCPPainter *painter);
friend class QCPLegend;
friend class QCPAxis;
friend class QCPLayer;
friend class QCPAxisRect;
};
class QCP_LIB_DECL QCPData
{
public:
QCPData();
QCPData(double key, double value);
double key, value;
double keyErrorPlus, keyErrorMinus;
double valueErrorPlus, valueErrorMinus;
};
Q_DECLARE_TYPEINFO(QCPData, Q_MOVABLE_TYPE);
typedef QMap<double, QCPData> QCPDataMap;
typedef QMapIterator<double, QCPData> QCPDataMapIterator;
typedef QMutableMapIterator<double, QCPData> QCPDataMutableMapIterator;
class QCP_LIB_DECL QCPGraph : public QCPAbstractPlottable
{
Q_OBJECT
Q_PROPERTY(LineStyle lineStyle READ lineStyle WRITE setLineStyle)
Q_PROPERTY(QCPScatterStyle scatterStyle READ scatterStyle WRITE setScatterStyle)
Q_PROPERTY(ErrorType errorType READ errorType WRITE setErrorType)
Q_PROPERTY(QPen errorPen READ errorPen WRITE setErrorPen)
Q_PROPERTY(double errorBarSize READ errorBarSize WRITE setErrorBarSize)
Q_PROPERTY(bool errorBarSkipSymbol READ errorBarSkipSymbol WRITE setErrorBarSkipSymbol)
Q_PROPERTY(QCPGraph* channelFillGraph READ channelFillGraph WRITE setChannelFillGraph)
public:
enum LineStyle { lsNone
,lsLine
,lsStepLeft
,lsStepRight
,lsStepCenter
,lsImpulse
};
Q_ENUMS(LineStyle)
enum ErrorType { etNone
,etKey
,etValue
,etBoth
};
Q_ENUMS(ErrorType)
explicit QCPGraph(QCPAxis *keyAxis, QCPAxis *valueAxis);
virtual ~QCPGraph();
// getters:
const QCPDataMap *data() const { return mData; }
LineStyle lineStyle() const { return mLineStyle; }
QCPScatterStyle scatterStyle() const { return mScatterStyle; }
ErrorType errorType() const { return mErrorType; }
QPen errorPen() const { return mErrorPen; }
double errorBarSize() const { return mErrorBarSize; }
bool errorBarSkipSymbol() const { return mErrorBarSkipSymbol; }
QCPGraph *channelFillGraph() const { return mChannelFillGraph.data(); }
// setters:
void setData(QCPDataMap *data, bool copy=false);
void setData(const QVector<double> &key, const QVector<double> &value);
void setDataKeyError(const QVector<double> &key, const QVector<double> &value, const QVector<double> &keyError);
void setDataKeyError(const QVector<double> &key, const QVector<double> &value, const QVector<double> &keyErrorMinus, const QVector<double> &keyErrorPlus);
void setDataValueError(const QVector<double> &key, const QVector<double> &value, const QVector<double> &valueError);
void setDataValueError(const QVector<double> &key, const QVector<double> &value, const QVector<double> &valueErrorMinus, const QVector<double> &valueErrorPlus);
void setDataBothError(const QVector<double> &key, const QVector<double> &value, const QVector<double> &keyError, const QVector<double> &valueError);
void setDataBothError(const QVector<double> &key, const QVector<double> &value, const QVector<double> &keyErrorMinus, const QVector<double> &keyErrorPlus, const QVector<double> &valueErrorMinus, const QVector<double> &valueErrorPlus);
void setLineStyle(LineStyle ls);
void setScatterStyle(const QCPScatterStyle &style);
void setErrorType(ErrorType errorType);
void setErrorPen(const QPen &pen);
void setErrorBarSize(double size);
void setErrorBarSkipSymbol(bool enabled);
void setChannelFillGraph(QCPGraph *targetGraph);
// non-property methods:
void addData(const QCPDataMap &dataMap);
void addData(const QCPData &data);
void addData(double key, double value);
void addData(const QVector<double> &keys, const QVector<double> &values);
void removeDataBefore(double key);
void removeDataAfter(double key);
void removeData(double fromKey, double toKey);
void removeData(double key);
// reimplemented virtual methods:
virtual void clearData();
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;
using QCPAbstractPlottable::rescaleAxes;
using QCPAbstractPlottable::rescaleKeyAxis;
using QCPAbstractPlottable::rescaleValueAxis;
void rescaleAxes(bool onlyEnlarge, bool includeErrorBars) const; // overloads base class interface
void rescaleKeyAxis(bool onlyEnlarge, bool includeErrorBars) const; // overloads base class interface
void rescaleValueAxis(bool onlyEnlarge, bool includeErrorBars) const; // overloads base class interface
protected:
// property members:
QCPDataMap *mData;
QPen mErrorPen;
LineStyle mLineStyle;
QCPScatterStyle mScatterStyle;
ErrorType mErrorType;
double mErrorBarSize;
bool mErrorBarSkipSymbol;
QPointer<QCPGraph> mChannelFillGraph;
// reimplemented virtual methods:
virtual void draw(QCPPainter *painter);
virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const;
virtual QCPRange getKeyRange(bool &validRange, SignDomain inSignDomain=sdBoth) const;
virtual QCPRange getValueRange(bool &validRange, SignDomain inSignDomain=sdBoth) const;
virtual QCPRange getKeyRange(bool &validRange, SignDomain inSignDomain, bool includeErrors) const; // overloads base class interface
virtual QCPRange getValueRange(bool &validRange, SignDomain inSignDomain, bool includeErrors) const; // overloads base class interface
// introduced virtual methods:
virtual void drawFill(QCPPainter *painter, QVector<QPointF> *lineData) const;
virtual void drawScatterPlot(QCPPainter *painter, QVector<QCPData> *pointData) const;
virtual void drawLinePlot(QCPPainter *painter, QVector<QPointF> *lineData) const;
virtual void drawImpulsePlot(QCPPainter *painter, QVector<QPointF> *lineData) const;
// non-virtual methods:
void getPlotData(QVector<QPointF> *lineData, QVector<QCPData> *pointData) const;
void getScatterPlotData(QVector<QCPData> *pointData) const;
void getLinePlotData(QVector<QPointF> *lineData, QVector<QCPData> *pointData) const;
void getStepLeftPlotData(QVector<QPointF> *lineData, QVector<QCPData> *pointData) const;
void getStepRightPlotData(QVector<QPointF> *lineData, QVector<QCPData> *pointData) const;
void getStepCenterPlotData(QVector<QPointF> *lineData, QVector<QCPData> *pointData) const;
void getImpulsePlotData(QVector<QPointF> *lineData, QVector<QCPData> *pointData) const;
void drawError(QCPPainter *painter, double x, double y, const QCPData &data) const;
void getVisibleDataBounds(QCPDataMap::const_iterator &lower, QCPDataMap::const_iterator &upper, int &count) const;
void addFillBasePoints(QVector<QPointF> *lineData) const;
void removeFillBasePoints(QVector<QPointF> *lineData) const;
QPointF lowerFillBasePoint(double lowerKey) const;
QPointF upperFillBasePoint(double upperKey) const;
const QPolygonF getChannelFillPolygon(const QVector<QPointF> *lineData) const;
int findIndexBelowX(const QVector<QPointF> *data, double x) const;
int findIndexAboveX(const QVector<QPointF> *data, double x) const;
int findIndexBelowY(const QVector<QPointF> *data, double y) const;
int findIndexAboveY(const QVector<QPointF> *data, double y) const;
double pointDistance(const QPointF &pixelPoint) const;
friend class QCustomPlot;
friend class QCPLegend;
};
class QCP_LIB_DECL QCPCurveData
{
public:
QCPCurveData();
QCPCurveData(double t, double key, double value);
double t, key, value;
};
Q_DECLARE_TYPEINFO(QCPCurveData, Q_MOVABLE_TYPE);
typedef QMap<double, QCPCurveData> QCPCurveDataMap;
typedef QMapIterator<double, QCPCurveData> QCPCurveDataMapIterator;
typedef QMutableMapIterator<double, QCPCurveData> QCPCurveDataMutableMapIterator;
class QCP_LIB_DECL QCPCurve : public QCPAbstractPlottable
{
Q_OBJECT
Q_PROPERTY(QCPScatterStyle scatterStyle READ scatterStyle WRITE setScatterStyle)
Q_PROPERTY(LineStyle lineStyle READ lineStyle WRITE setLineStyle)
public:
enum LineStyle { lsNone,
lsLine
};
explicit QCPCurve(QCPAxis *keyAxis, QCPAxis *valueAxis);
virtual ~QCPCurve();
// getters:
QCPCurveDataMap *data() const { return mData; }
QCPScatterStyle scatterStyle() const { return mScatterStyle; }
LineStyle lineStyle() const { return mLineStyle; }
// setters:
void setData(QCPCurveDataMap *data, bool copy=false);
void setData(const QVector<double> &t, const QVector<double> &key, const QVector<double> &value);
void setData(const QVector<double> &key, const QVector<double> &value);
void setScatterStyle(const QCPScatterStyle &style);
void setLineStyle(LineStyle style);
// non-property methods:
void addData(const QCPCurveDataMap &dataMap);
void addData(const QCPCurveData &data);
void addData(double t, double key, double value);
void addData(double key, double value);
void addData(const QVector<double> &ts, const QVector<double> &keys, const QVector<double> &values);
void removeDataBefore(double t);
void removeDataAfter(double t);
void removeData(double fromt, double tot);
void removeData(double t);
// reimplemented virtual methods:
virtual void clearData();
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;
protected:
// property members:
QCPCurveDataMap *mData;
QCPScatterStyle mScatterStyle;
LineStyle mLineStyle;
// reimplemented virtual methods:
virtual void draw(QCPPainter *painter);
virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const;
virtual QCPRange getKeyRange(bool &validRange, SignDomain inSignDomain=sdBoth) const;
virtual QCPRange getValueRange(bool &validRange, SignDomain inSignDomain=sdBoth) const;
// introduced virtual methods:
virtual void drawScatterPlot(QCPPainter *painter, const QVector<QPointF> *pointData) const;
// non-virtual methods:
void getCurveData(QVector<QPointF> *lineData) const;
double pointDistance(const QPointF &pixelPoint) const;
QPointF outsideCoordsToPixels(double key, double value, int region, QRect axisRect) const;
friend class QCustomPlot;
friend class QCPLegend;
};
class QCP_LIB_DECL QCPBarData
{
public:
QCPBarData();
QCPBarData(double key, double value);
double key, value;
};
Q_DECLARE_TYPEINFO(QCPBarData, Q_MOVABLE_TYPE);
typedef QMap<double, QCPBarData> QCPBarDataMap;
typedef QMapIterator<double, QCPBarData> QCPBarDataMapIterator;
typedef QMutableMapIterator<double, QCPBarData> QCPBarDataMutableMapIterator;
class QCP_LIB_DECL QCPBars : public QCPAbstractPlottable
{
Q_OBJECT
Q_PROPERTY(double width READ width WRITE setWidth)
Q_PROPERTY(QCPBars* barBelow READ barBelow)
Q_PROPERTY(QCPBars* barAbove READ barAbove)
public:
explicit QCPBars(QCPAxis *keyAxis, QCPAxis *valueAxis);
virtual ~QCPBars();
// getters:
double width() const { return mWidth; }
QCPBars *barBelow() const { return mBarBelow.data(); }
QCPBars *barAbove() const { return mBarAbove.data(); }
QCPBarDataMap *data() const { return mData; }
// setters:
void setWidth(double width);
void setData(QCPBarDataMap *data, bool copy=false);
void setData(const QVector<double> &key, const QVector<double> &value);
// non-property methods:
void moveBelow(QCPBars *bars);
void moveAbove(QCPBars *bars);
void addData(const QCPBarDataMap &dataMap);
void addData(const QCPBarData &data);
void addData(double key, double value);
void addData(const QVector<double> &keys, const QVector<double> &values);
void removeDataBefore(double key);
void removeDataAfter(double key);
void removeData(double fromKey, double toKey);
void removeData(double key);
// reimplemented virtual methods:
virtual void clearData();
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;
protected:
// property members:
QCPBarDataMap *mData;
double mWidth;
QPointer<QCPBars> mBarBelow, mBarAbove;
// reimplemented virtual methods:
virtual void draw(QCPPainter *painter);
virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const;
virtual QCPRange getKeyRange(bool &validRange, SignDomain inSignDomain=sdBoth) const;
virtual QCPRange getValueRange(bool &validRange, SignDomain inSignDomain=sdBoth) const;
// non-virtual methods:
QPolygonF getBarPolygon(double key, double value) const;
double getBaseValue(double key, bool positive) const;
static void connectBars(QCPBars* lower, QCPBars* upper);
friend class QCustomPlot;
friend class QCPLegend;
};
class QCP_LIB_DECL QCPStatisticalBox : public QCPAbstractPlottable
{
Q_OBJECT
Q_PROPERTY(double key READ key WRITE setKey)
Q_PROPERTY(double minimum READ minimum WRITE setMinimum)
Q_PROPERTY(double lowerQuartile READ lowerQuartile WRITE setLowerQuartile)
Q_PROPERTY(double median READ median WRITE setMedian)
Q_PROPERTY(double upperQuartile READ upperQuartile WRITE setUpperQuartile)
Q_PROPERTY(double maximum READ maximum WRITE setMaximum)
Q_PROPERTY(QVector<double> outliers READ outliers WRITE setOutliers)
Q_PROPERTY(double width READ width WRITE setWidth)
Q_PROPERTY(double whiskerWidth READ whiskerWidth WRITE setWhiskerWidth)
Q_PROPERTY(QPen whiskerPen READ whiskerPen WRITE setWhiskerPen)
Q_PROPERTY(QPen whiskerBarPen READ whiskerBarPen WRITE setWhiskerBarPen)
Q_PROPERTY(QPen medianPen READ medianPen WRITE setMedianPen)
Q_PROPERTY(QCPScatterStyle outlierStyle READ outlierStyle WRITE setOutlierStyle)
public:
explicit QCPStatisticalBox(QCPAxis *keyAxis, QCPAxis *valueAxis);
// getters:
double key() const { return mKey; }
double minimum() const { return mMinimum; }
double lowerQuartile() const { return mLowerQuartile; }
double median() const { return mMedian; }
double upperQuartile() const { return mUpperQuartile; }
double maximum() const { return mMaximum; }
QVector<double> outliers() const { return mOutliers; }
double width() const { return mWidth; }
double whiskerWidth() const { return mWhiskerWidth; }
QPen whiskerPen() const { return mWhiskerPen; }
QPen whiskerBarPen() const { return mWhiskerBarPen; }
QPen medianPen() const { return mMedianPen; }
QCPScatterStyle outlierStyle() const { return mOutlierStyle; }
// setters:
void setKey(double key);
void setMinimum(double value);
void setLowerQuartile(double value);
void setMedian(double value);
void setUpperQuartile(double value);
void setMaximum(double value);
void setOutliers(const QVector<double> &values);
void setData(double key, double minimum, double lowerQuartile, double median, double upperQuartile, double maximum);
void setWidth(double width);
void setWhiskerWidth(double width);
void setWhiskerPen(const QPen &pen);
void setWhiskerBarPen(const QPen &pen);
void setMedianPen(const QPen &pen);
void setOutlierStyle(const QCPScatterStyle &style);
// non-property methods:
virtual void clearData();
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;
protected:
// property members:
QVector<double> mOutliers;
double mKey, mMinimum, mLowerQuartile, mMedian, mUpperQuartile, mMaximum;
double mWidth;
double mWhiskerWidth;
QPen mWhiskerPen, mWhiskerBarPen, mMedianPen;
QCPScatterStyle mOutlierStyle;
// reimplemented virtual methods:
virtual void draw(QCPPainter *painter);
virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const;
virtual QCPRange getKeyRange(bool &validRange, SignDomain inSignDomain=sdBoth) const;
virtual QCPRange getValueRange(bool &validRange, SignDomain inSignDomain=sdBoth) const;
// introduced virtual methods:
virtual void drawQuartileBox(QCPPainter *painter, QRectF *quartileBox=0) const;
virtual void drawMedian(QCPPainter *painter) const;
virtual void drawWhiskers(QCPPainter *painter) const;
virtual void drawOutliers(QCPPainter *painter) const;
friend class QCustomPlot;
friend class QCPLegend;
};
class QCP_LIB_DECL QCPItemStraightLine : public QCPAbstractItem
{
Q_OBJECT
Q_PROPERTY(QPen pen READ pen WRITE setPen)
Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
public:
QCPItemStraightLine(QCustomPlot *parentPlot);
virtual ~QCPItemStraightLine();
// getters:
QPen pen() const { return mPen; }
QPen selectedPen() const { return mSelectedPen; }
// setters;
void setPen(const QPen &pen);
void setSelectedPen(const QPen &pen);
// reimplemented virtual methods:
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;
QCPItemPosition * const point1;
QCPItemPosition * const point2;
protected:
// property members:
QPen mPen, mSelectedPen;
// reimplemented virtual methods:
virtual void draw(QCPPainter *painter);
// non-virtual methods:
double distToStraightLine(const QVector2D &point1, const QVector2D &vec, const QVector2D &point) const;
QLineF getRectClippedStraightLine(const QVector2D &point1, const QVector2D &vec, const QRect &rect) const;
QPen mainPen() const;
};
class QCP_LIB_DECL QCPItemLine : public QCPAbstractItem
{
Q_OBJECT
Q_PROPERTY(QPen pen READ pen WRITE setPen)
Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
Q_PROPERTY(QCPLineEnding head READ head WRITE setHead)
Q_PROPERTY(QCPLineEnding tail READ tail WRITE setTail)
public:
QCPItemLine(QCustomPlot *parentPlot);
virtual ~QCPItemLine();
// getters:
QPen pen() const { return mPen; }
QPen selectedPen() const { return mSelectedPen; }
QCPLineEnding head() const { return mHead; }
QCPLineEnding tail() const { return mTail; }
// setters;
void setPen(const QPen &pen);
void setSelectedPen(const QPen &pen);
void setHead(const QCPLineEnding &head);
void setTail(const QCPLineEnding &tail);
// reimplemented virtual methods:
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;
QCPItemPosition * const start;
QCPItemPosition * const end;
protected:
// property members:
QPen mPen, mSelectedPen;
QCPLineEnding mHead, mTail;
// reimplemented virtual methods:
virtual void draw(QCPPainter *painter);
// non-virtual methods:
QLineF getRectClippedLine(const QVector2D &start, const QVector2D &end, const QRect &rect) const;
QPen mainPen() const;
};
class QCP_LIB_DECL QCPItemCurve : public QCPAbstractItem
{
Q_OBJECT
Q_PROPERTY(QPen pen READ pen WRITE setPen)
Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
Q_PROPERTY(QCPLineEnding head READ head WRITE setHead)
Q_PROPERTY(QCPLineEnding tail READ tail WRITE setTail)
public:
QCPItemCurve(QCustomPlot *parentPlot);
virtual ~QCPItemCurve();
// getters:
QPen pen() const { return mPen; }
QPen selectedPen() const { return mSelectedPen; }
QCPLineEnding head() const { return mHead; }
QCPLineEnding tail() const { return mTail; }
// setters;
void setPen(const QPen &pen);
void setSelectedPen(const QPen &pen);
void setHead(const QCPLineEnding &head);
void setTail(const QCPLineEnding &tail);
// reimplemented virtual methods:
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;
QCPItemPosition * const start;
QCPItemPosition * const startDir;
QCPItemPosition * const endDir;
QCPItemPosition * const end;
protected:
// property members:
QPen mPen, mSelectedPen;
QCPLineEnding mHead, mTail;
// reimplemented virtual methods:
virtual void draw(QCPPainter *painter);
// non-virtual methods:
QPen mainPen() const;
};
class QCP_LIB_DECL QCPItemRect : public QCPAbstractItem
{
Q_OBJECT
Q_PROPERTY(QPen pen READ pen WRITE setPen)
Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
public:
QCPItemRect(QCustomPlot *parentPlot);
virtual ~QCPItemRect();
// getters:
QPen pen() const { return mPen; }
QPen selectedPen() const { return mSelectedPen; }
QBrush brush() const { return mBrush; }
QBrush selectedBrush() const { return mSelectedBrush; }
// setters;
void setPen(const QPen &pen);
void setSelectedPen(const QPen &pen);
void setBrush(const QBrush &brush);
void setSelectedBrush(const QBrush &brush);
// reimplemented virtual methods:
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;
QCPItemPosition * const topLeft;
QCPItemPosition * const bottomRight;
QCPItemAnchor * const top;
QCPItemAnchor * const topRight;
QCPItemAnchor * const right;
QCPItemAnchor * const bottom;
QCPItemAnchor * const bottomLeft;
QCPItemAnchor * const left;
protected:
enum AnchorIndex {aiTop, aiTopRight, aiRight, aiBottom, aiBottomLeft, aiLeft};
// property members:
QPen mPen, mSelectedPen;
QBrush mBrush, mSelectedBrush;
// reimplemented virtual methods:
virtual void draw(QCPPainter *painter);
virtual QPointF anchorPixelPoint(int anchorId) const;
// non-virtual methods:
QPen mainPen() const;
QBrush mainBrush() const;
};
class QCP_LIB_DECL QCPItemText : public QCPAbstractItem
{
Q_OBJECT
Q_PROPERTY(QColor color READ color WRITE setColor)
Q_PROPERTY(QColor selectedColor READ selectedColor WRITE setSelectedColor)
Q_PROPERTY(QPen pen READ pen WRITE setPen)
Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
Q_PROPERTY(QFont font READ font WRITE setFont)
Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont)
Q_PROPERTY(QString text READ text WRITE setText)
Q_PROPERTY(Qt::Alignment positionAlignment READ positionAlignment WRITE setPositionAlignment)
Q_PROPERTY(Qt::Alignment textAlignment READ textAlignment WRITE setTextAlignment)
Q_PROPERTY(double rotation READ rotation WRITE setRotation)
Q_PROPERTY(QMargins padding READ padding WRITE setPadding)
public:
QCPItemText(QCustomPlot *parentPlot);
virtual ~QCPItemText();
// getters:
QColor color() const { return mColor; }
QColor selectedColor() const { return mSelectedColor; }
QPen pen() const { return mPen; }
QPen selectedPen() const { return mSelectedPen; }
QBrush brush() const { return mBrush; }
QBrush selectedBrush() const { return mSelectedBrush; }
QFont font() const { return mFont; }
QFont selectedFont() const { return mSelectedFont; }
QString text() const { return mText; }
Qt::Alignment positionAlignment() const { return mPositionAlignment; }
Qt::Alignment textAlignment() const { return mTextAlignment; }
double rotation() const { return mRotation; }
QMargins padding() const { return mPadding; }
// setters;
void setColor(const QColor &color);
void setSelectedColor(const QColor &color);
void setPen(const QPen &pen);
void setSelectedPen(const QPen &pen);
void setBrush(const QBrush &brush);
void setSelectedBrush(const QBrush &brush);
void setFont(const QFont &font);
void setSelectedFont(const QFont &font);
void setText(const QString &text);
void setPositionAlignment(Qt::Alignment alignment);
void setTextAlignment(Qt::Alignment alignment);
void setRotation(double degrees);
void setPadding(const QMargins &padding);
// reimplemented virtual methods:
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;
QCPItemPosition * const position;
QCPItemAnchor * const topLeft;
QCPItemAnchor * const top;
QCPItemAnchor * const topRight;
QCPItemAnchor * const right;
QCPItemAnchor * const bottomRight;
QCPItemAnchor * const bottom;
QCPItemAnchor * const bottomLeft;
QCPItemAnchor * const left;
protected:
enum AnchorIndex {aiTopLeft, aiTop, aiTopRight, aiRight, aiBottomRight, aiBottom, aiBottomLeft, aiLeft};
// property members:
QColor mColor, mSelectedColor;
QPen mPen, mSelectedPen;
QBrush mBrush, mSelectedBrush;
QFont mFont, mSelectedFont;
QString mText;
Qt::Alignment mPositionAlignment;
Qt::Alignment mTextAlignment;
double mRotation;
QMargins mPadding;
// reimplemented virtual methods:
virtual void draw(QCPPainter *painter);
virtual QPointF anchorPixelPoint(int anchorId) const;
// non-virtual methods:
QPointF getTextDrawPoint(const QPointF &pos, const QRectF &rect, Qt::Alignment positionAlignment) const;
QFont mainFont() const;
QColor mainColor() const;
QPen mainPen() const;
QBrush mainBrush() const;
};
class QCP_LIB_DECL QCPItemEllipse : public QCPAbstractItem
{
Q_OBJECT
Q_PROPERTY(QPen pen READ pen WRITE setPen)
Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
public:
QCPItemEllipse(QCustomPlot *parentPlot);
virtual ~QCPItemEllipse();
// getters:
QPen pen() const { return mPen; }
QPen selectedPen() const { return mSelectedPen; }
QBrush brush() const { return mBrush; }
QBrush selectedBrush() const { return mSelectedBrush; }
// setters;
void setPen(const QPen &pen);
void setSelectedPen(const QPen &pen);
void setBrush(const QBrush &brush);
void setSelectedBrush(const QBrush &brush);
// reimplemented virtual methods:
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;
QCPItemPosition * const topLeft;
QCPItemPosition * const bottomRight;
QCPItemAnchor * const topLeftRim;
QCPItemAnchor * const top;
QCPItemAnchor * const topRightRim;
QCPItemAnchor * const right;
QCPItemAnchor * const bottomRightRim;
QCPItemAnchor * const bottom;
QCPItemAnchor * const bottomLeftRim;
QCPItemAnchor * const left;
QCPItemAnchor * const center;
protected:
enum AnchorIndex {aiTopLeftRim, aiTop, aiTopRightRim, aiRight, aiBottomRightRim, aiBottom, aiBottomLeftRim, aiLeft, aiCenter};
// property members:
QPen mPen, mSelectedPen;
QBrush mBrush, mSelectedBrush;
// reimplemented virtual methods:
virtual void draw(QCPPainter *painter);
virtual QPointF anchorPixelPoint(int anchorId) const;
// non-virtual methods:
QPen mainPen() const;
QBrush mainBrush() const;
};
class QCP_LIB_DECL QCPItemPixmap : public QCPAbstractItem
{
Q_OBJECT
Q_PROPERTY(QPixmap pixmap READ pixmap WRITE setPixmap)
Q_PROPERTY(bool scaled READ scaled WRITE setScaled)
Q_PROPERTY(Qt::AspectRatioMode aspectRatioMode READ aspectRatioMode)
Q_PROPERTY(QPen pen READ pen WRITE setPen)
Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
public:
QCPItemPixmap(QCustomPlot *parentPlot);
virtual ~QCPItemPixmap();
// getters:
QPixmap pixmap() const { return mPixmap; }
bool scaled() const { return mScaled; }
Qt::AspectRatioMode aspectRatioMode() const { return mAspectRatioMode; }
QPen pen() const { return mPen; }
QPen selectedPen() const { return mSelectedPen; }
// setters;
void setPixmap(const QPixmap &pixmap);
void setScaled(bool scaled, Qt::AspectRatioMode aspectRatioMode=Qt::KeepAspectRatio);
void setPen(const QPen &pen);
void setSelectedPen(const QPen &pen);
// reimplemented virtual methods:
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;
QCPItemPosition * const topLeft;
QCPItemPosition * const bottomRight;
QCPItemAnchor * const top;
QCPItemAnchor * const topRight;
QCPItemAnchor * const right;
QCPItemAnchor * const bottom;
QCPItemAnchor * const bottomLeft;
QCPItemAnchor * const left;
protected:
enum AnchorIndex {aiTop, aiTopRight, aiRight, aiBottom, aiBottomLeft, aiLeft};
// property members:
QPixmap mPixmap;
QPixmap mScaledPixmap;
bool mScaled;
Qt::AspectRatioMode mAspectRatioMode;
QPen mPen, mSelectedPen;
// reimplemented virtual methods:
virtual void draw(QCPPainter *painter);
virtual QPointF anchorPixelPoint(int anchorId) const;
// non-virtual methods:
void updateScaledPixmap(QRect finalRect=QRect(), bool flipHorz=false, bool flipVert=false);
QRect getFinalRect(bool *flippedHorz=0, bool *flippedVert=0) const;
QPen mainPen() const;
};
class QCP_LIB_DECL QCPItemTracer : public QCPAbstractItem
{
Q_OBJECT
Q_PROPERTY(QPen pen READ pen WRITE setPen)
Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
Q_PROPERTY(double size READ size WRITE setSize)
Q_PROPERTY(TracerStyle style READ style WRITE setStyle)
Q_PROPERTY(QCPGraph* graph READ graph WRITE setGraph)
Q_PROPERTY(double graphKey READ graphKey WRITE setGraphKey)
Q_PROPERTY(bool interpolating READ interpolating WRITE setInterpolating)
public:
enum TracerStyle { tsNone
,tsPlus
,tsCrosshair
,tsCircle
,tsSquare
};
Q_ENUMS(TracerStyle)
QCPItemTracer(QCustomPlot *parentPlot);
virtual ~QCPItemTracer();
// getters:
QPen pen() const { return mPen; }
QPen selectedPen() const { return mSelectedPen; }
QBrush brush() const { return mBrush; }
QBrush selectedBrush() const { return mSelectedBrush; }
double size() const { return mSize; }
TracerStyle style() const { return mStyle; }
QCPGraph *graph() const { return mGraph; }
double graphKey() const { return mGraphKey; }
bool interpolating() const { return mInterpolating; }
// setters;
void setPen(const QPen &pen);
void setSelectedPen(const QPen &pen);
void setBrush(const QBrush &brush);
void setSelectedBrush(const QBrush &brush);
void setSize(double size);
void setStyle(TracerStyle style);
void setGraph(QCPGraph *graph);
void setGraphKey(double key);
void setInterpolating(bool enabled);
// reimplemented virtual methods:
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;
// non-virtual methods:
void updatePosition();
QCPItemPosition * const position;
protected:
// property members:
QPen mPen, mSelectedPen;
QBrush mBrush, mSelectedBrush;
double mSize;
TracerStyle mStyle;
QCPGraph *mGraph;
double mGraphKey;
bool mInterpolating;
// reimplemented virtual methods:
virtual void draw(QCPPainter *painter);
// non-virtual methods:
QPen mainPen() const;
QBrush mainBrush() const;
};
class QCP_LIB_DECL QCPItemBracket : public QCPAbstractItem
{
Q_OBJECT
Q_PROPERTY(QPen pen READ pen WRITE setPen)
Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)
Q_PROPERTY(double length READ length WRITE setLength)
Q_PROPERTY(BracketStyle style READ style WRITE setStyle)
public:
enum BracketStyle { bsSquare
,bsRound
,bsCurly
,bsCalligraphic
};
QCPItemBracket(QCustomPlot *parentPlot);
virtual ~QCPItemBracket();
// getters:
QPen pen() const { return mPen; }
QPen selectedPen() const { return mSelectedPen; }
double length() const { return mLength; }
BracketStyle style() const { return mStyle; }
// setters;
void setPen(const QPen &pen);
void setSelectedPen(const QPen &pen);
void setLength(double length);
void setStyle(BracketStyle style);
// reimplemented virtual methods:
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;
QCPItemPosition * const left;
QCPItemPosition * const right;
QCPItemAnchor * const center;
protected:
// property members:
enum AnchorIndex {aiCenter};
QPen mPen, mSelectedPen;
double mLength;
BracketStyle mStyle;
// reimplemented virtual methods:
virtual void draw(QCPPainter *painter);
virtual QPointF anchorPixelPoint(int anchorId) const;
// non-virtual methods:
QPen mainPen() const;
};
class QCP_LIB_DECL QCPAxisRect : public QCPLayoutElement
{
Q_OBJECT
Q_PROPERTY(QPixmap background READ background WRITE setBackground)
Q_PROPERTY(bool backgroundScaled READ backgroundScaled WRITE setBackgroundScaled)
Q_PROPERTY(Qt::AspectRatioMode backgroundScaledMode READ backgroundScaledMode WRITE setBackgroundScaledMode)
Q_PROPERTY(Qt::Orientations rangeDrag READ rangeDrag WRITE setRangeDrag)
Q_PROPERTY(Qt::Orientations rangeZoom READ rangeZoom WRITE setRangeZoom)
public:
explicit QCPAxisRect(QCustomPlot *parentPlot, bool setupDefaultAxes=true);
virtual ~QCPAxisRect();
// getters:
QPixmap background() const { return mBackgroundPixmap; }
bool backgroundScaled() const { return mBackgroundScaled; }
Qt::AspectRatioMode backgroundScaledMode() const { return mBackgroundScaledMode; }
Qt::Orientations rangeDrag() const { return mRangeDrag; }
Qt::Orientations rangeZoom() const { return mRangeZoom; }
QCPAxis *rangeDragAxis(Qt::Orientation orientation);
QCPAxis *rangeZoomAxis(Qt::Orientation orientation);
double rangeZoomFactor(Qt::Orientation orientation);
// setters:
void setBackground(const QPixmap &pm);
void setBackground(const QPixmap &pm, bool scaled, Qt::AspectRatioMode mode=Qt::KeepAspectRatioByExpanding);
void setBackground(const QBrush &brush);
void setBackgroundScaled(bool scaled);
void setBackgroundScaledMode(Qt::AspectRatioMode mode);
void setRangeDrag(Qt::Orientations orientations);
void setRangeZoom(Qt::Orientations orientations);
void setRangeDragAxes(QCPAxis *horizontal, QCPAxis *vertical);
void setRangeZoomAxes(QCPAxis *horizontal, QCPAxis *vertical);
void setRangeZoomFactor(double horizontalFactor, double verticalFactor);
void setRangeZoomFactor(double factor);
// non-property methods:
int axisCount(QCPAxis::AxisType type) const;
QCPAxis *axis(QCPAxis::AxisType type, int index=0) const;
QList<QCPAxis*> axes(QCPAxis::AxisTypes types) const;
QList<QCPAxis*> axes() const;
QCPAxis *addAxis(QCPAxis::AxisType type);
QList<QCPAxis*> addAxes(QCPAxis::AxisTypes types);
bool removeAxis(QCPAxis *axis);
QCPLayoutInset *insetLayout() const { return mInsetLayout; }
void setupFullAxesBox(bool connectRanges=false);
QList<QCPAbstractPlottable*> plottables() const;
QList<QCPGraph*> graphs() const;
QList<QCPAbstractItem*> items() const;
// read-only interface imitating a QRect:
int left() const { return mRect.left(); }
int right() const { return mRect.right(); }
int top() const { return mRect.top(); }
int bottom() const { return mRect.bottom(); }
int width() const { return mRect.width(); }
int height() const { return mRect.height(); }
QSize size() const { return mRect.size(); }
QPoint topLeft() const { return mRect.topLeft(); }
QPoint topRight() const { return mRect.topRight(); }
QPoint bottomLeft() const { return mRect.bottomLeft(); }
QPoint bottomRight() const { return mRect.bottomRight(); }
QPoint center() const { return mRect.center(); }
// reimplemented virtual methods:
virtual void update();
virtual QList<QCPLayoutElement*> elements(bool recursive) const;
protected:
// property members:
QBrush mBackgroundBrush;
QPixmap mBackgroundPixmap;
QPixmap mScaledBackgroundPixmap;
bool mBackgroundScaled;
Qt::AspectRatioMode mBackgroundScaledMode;
QCPLayoutInset *mInsetLayout;
Qt::Orientations mRangeDrag, mRangeZoom;
QPointer<QCPAxis> mRangeDragHorzAxis, mRangeDragVertAxis, mRangeZoomHorzAxis, mRangeZoomVertAxis;
double mRangeZoomFactorHorz, mRangeZoomFactorVert;
// non-property members:
QCPRange mDragStartHorzRange, mDragStartVertRange;
QCP::AntialiasedElements mAADragBackup, mNotAADragBackup;
QPoint mDragStart;
bool mDragging;
QHash<QCPAxis::AxisType, QList<QCPAxis*> > mAxes;
// reimplemented virtual methods:
virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const;
virtual void draw(QCPPainter *painter);
virtual int calculateAutoMargin(QCP::MarginSide side);
// events:
virtual void mousePressEvent(QMouseEvent *event);
virtual void mouseMoveEvent(QMouseEvent *event);
virtual void mouseReleaseEvent(QMouseEvent *event);
virtual void wheelEvent(QWheelEvent *event);
// non-property methods:
void drawBackground(QCPPainter *painter);
void updateAxesOffset(QCPAxis::AxisType type);
private:
Q_DISABLE_COPY(QCPAxisRect)
friend class QCustomPlot;
};
class QCP_LIB_DECL QCPAbstractLegendItem : public QCPLayoutElement
{
Q_OBJECT
Q_PROPERTY(QCPLegend* parentLegend READ parentLegend)
Q_PROPERTY(QFont font READ font WRITE setFont)
Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor)
Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont)
Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE setSelectedTextColor)
Q_PROPERTY(bool selectable READ selectable WRITE setSelectable)
Q_PROPERTY(bool selected READ selected WRITE setSelected)
public:
explicit QCPAbstractLegendItem(QCPLegend *parent);
// getters:
QCPLegend *parentLegend() const { return mParentLegend; }
QFont font() const { return mFont; }
QColor textColor() const { return mTextColor; }
QFont selectedFont() const { return mSelectedFont; }
QColor selectedTextColor() const { return mSelectedTextColor; }
bool selectable() const { return mSelectable; }
bool selected() const { return mSelected; }
// setters:
void setFont(const QFont &font);
void setTextColor(const QColor &color);
void setSelectedFont(const QFont &font);
void setSelectedTextColor(const QColor &color);
void setSelectable(bool selectable);
void setSelected(bool selected);
// reimplemented virtual methods:
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;
signals:
void selectionChanged(bool selected);
protected:
// property members:
QCPLegend *mParentLegend;
QFont mFont;
QColor mTextColor;
QFont mSelectedFont;
QColor mSelectedTextColor;
bool mSelectable, mSelected;
// reimplemented virtual methods:
virtual QCP::Interaction selectionCategory() const;
virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const;
virtual QRect clipRect() const;
virtual void draw(QCPPainter *painter) = 0;
// events:
virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged);
virtual void deselectEvent(bool *selectionStateChanged);
private:
Q_DISABLE_COPY(QCPAbstractLegendItem)
friend class QCPLegend;
};
class QCP_LIB_DECL QCPPlottableLegendItem : public QCPAbstractLegendItem
{
Q_OBJECT
public:
QCPPlottableLegendItem(QCPLegend *parent, QCPAbstractPlottable *plottable);
// getters:
QCPAbstractPlottable *plottable() { return mPlottable; }
protected:
// property members:
QCPAbstractPlottable *mPlottable;
// reimplemented virtual methods:
virtual void draw(QCPPainter *painter);
virtual QSize minimumSizeHint() const;
// non-virtual methods:
QPen getIconBorderPen() const;
QColor getTextColor() const;
QFont getFont() const;
};
class QCP_LIB_DECL QCPLegend : public QCPLayoutGrid
{
Q_OBJECT
Q_PROPERTY(QPen borderPen READ borderPen WRITE setBorderPen)
Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
Q_PROPERTY(QFont font READ font WRITE setFont)
Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor)
Q_PROPERTY(QSize iconSize READ iconSize WRITE setIconSize)
Q_PROPERTY(int iconTextPadding READ iconTextPadding WRITE setIconTextPadding)
Q_PROPERTY(QPen iconBorderPen READ iconBorderPen WRITE setIconBorderPen)
Q_PROPERTY(SelectableParts selectableParts READ selectableParts WRITE setSelectableParts)
Q_PROPERTY(SelectableParts selectedParts READ selectedParts WRITE setSelectedParts)
Q_PROPERTY(QPen selectedBorderPen READ selectedBorderPen WRITE setSelectedBorderPen)
Q_PROPERTY(QPen selectedIconBorderPen READ selectedIconBorderPen WRITE setSelectedIconBorderPen)
Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont)
Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE setSelectedTextColor)
public:
enum SelectablePart { spNone = 0x000
,spLegendBox = 0x001
,spItems = 0x002
};
Q_FLAGS(SelectablePart SelectableParts)
Q_DECLARE_FLAGS(SelectableParts, SelectablePart)
explicit QCPLegend();
virtual ~QCPLegend();
// getters:
QPen borderPen() const { return mBorderPen; }
QBrush brush() const { return mBrush; }
QFont font() const { return mFont; }
QColor textColor() const { return mTextColor; }
QSize iconSize() const { return mIconSize; }
int iconTextPadding() const { return mIconTextPadding; }
QPen iconBorderPen() const { return mIconBorderPen; }
SelectableParts selectableParts() const { return mSelectableParts; }
SelectableParts selectedParts() const;
QPen selectedBorderPen() const { return mSelectedBorderPen; }
QPen selectedIconBorderPen() const { return mSelectedIconBorderPen; }
QBrush selectedBrush() const { return mSelectedBrush; }
QFont selectedFont() const { return mSelectedFont; }
QColor selectedTextColor() const { return mSelectedTextColor; }
// setters:
void setBorderPen(const QPen &pen);
void setBrush(const QBrush &brush);
void setFont(const QFont &font);
void setTextColor(const QColor &color);
void setIconSize(const QSize &size);
void setIconSize(int width, int height);
void setIconTextPadding(int padding);
void setIconBorderPen(const QPen &pen);
void setSelectableParts(const SelectableParts &selectableParts);
void setSelectedParts(const SelectableParts &selectedParts);
void setSelectedBorderPen(const QPen &pen);
void setSelectedIconBorderPen(const QPen &pen);
void setSelectedBrush(const QBrush &brush);
void setSelectedFont(const QFont &font);
void setSelectedTextColor(const QColor &color);
// reimplemented virtual methods:
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;
// non-virtual methods:
QCPAbstractLegendItem *item(int index) const;
QCPPlottableLegendItem *itemWithPlottable(const QCPAbstractPlottable *plottable) const;
int itemCount() const;
bool hasItem(QCPAbstractLegendItem *item) const;
bool hasItemWithPlottable(const QCPAbstractPlottable *plottable) const;
bool addItem(QCPAbstractLegendItem *item);
bool removeItem(int index);
bool removeItem(QCPAbstractLegendItem *item);
void clearItems();
QList<QCPAbstractLegendItem*> selectedItems() const;
signals:
void selectionChanged(QCPLegend::SelectableParts selection);
protected:
// property members:
QPen mBorderPen, mIconBorderPen;
QBrush mBrush;
QFont mFont;
QColor mTextColor;
QSize mIconSize;
int mIconTextPadding;
SelectableParts mSelectedParts, mSelectableParts;
QPen mSelectedBorderPen, mSelectedIconBorderPen;
QBrush mSelectedBrush;
QFont mSelectedFont;
QColor mSelectedTextColor;
// reimplemented virtual methods:
virtual void parentPlotInitialized(QCustomPlot *parentPlot);
virtual QCP::Interaction selectionCategory() const;
virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const;
virtual void draw(QCPPainter *painter);
// events:
virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged);
virtual void deselectEvent(bool *selectionStateChanged);
// non-virtual methods:
QPen getBorderPen() const;
QBrush getBrush() const;
private:
Q_DISABLE_COPY(QCPLegend)
friend class QCustomPlot;
friend class QCPAbstractLegendItem;
};
Q_DECLARE_OPERATORS_FOR_FLAGS(QCPLegend::SelectableParts)
Q_DECLARE_METATYPE(QCPLegend::SelectablePart)
class QCP_LIB_DECL QCPPlotTitle : public QCPLayoutElement
{
Q_OBJECT
Q_PROPERTY(QString text READ text WRITE setText)
Q_PROPERTY(QFont font READ font WRITE setFont)
Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor)
Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont)
Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE setSelectedTextColor)
Q_PROPERTY(bool selectable READ selectable WRITE setSelectable)
Q_PROPERTY(bool selected READ selected WRITE setSelected)
public:
explicit QCPPlotTitle(QCustomPlot *parentPlot);
explicit QCPPlotTitle(QCustomPlot *parentPlot, const QString &text);
// getters:
QString text() const { return mText; }
QFont font() const { return mFont; }
QColor textColor() const { return mTextColor; }
QFont selectedFont() const { return mSelectedFont; }
QColor selectedTextColor() const { return mSelectedTextColor; }
bool selectable() const { return mSelectable; }
bool selected() const { return mSelected; }
// setters:
void setText(const QString &text);
void setFont(const QFont &font);
void setTextColor(const QColor &color);
void setSelectedFont(const QFont &font);
void setSelectedTextColor(const QColor &color);
void setSelectable(bool selectable);
void setSelected(bool selected);
// reimplemented virtual methods:
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;
signals:
void selectionChanged(bool selected);
protected:
// property members:
QString mText;
QFont mFont;
QColor mTextColor;
QFont mSelectedFont;
QColor mSelectedTextColor;
QRect mTextBoundingRect;
bool mSelectable, mSelected;
// reimplemented virtual methods:
virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const;
virtual void draw(QCPPainter *painter);
virtual QSize minimumSizeHint() const;
virtual QSize maximumSizeHint() const;
// events:
virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged);
virtual void deselectEvent(bool *selectionStateChanged);
// non-virtual methods:
QFont mainFont() const;
QColor mainTextColor() const;
private:
Q_DISABLE_COPY(QCPPlotTitle)
};
#endif // QCUSTOMPLOT_H
QCPAxis::AxisType
AxisType
Definition: qcustomplot.h:917
QCustomPlot::plotLayout
QCPLayoutGrid * plotLayout() const
Definition: qcustomplot.h:1508
QCPItemBracket
A bracket for referencing/highlighting certain parts in the plot.
Definition: qcustomplot.h:2592
QCPAbstractItem::position
QCPItemPosition * position(const QString &name) const
Definition: qcustomplot.cpp:7964
QCPMarginGroup
A margin group allows synchronization of margin sides if working with multiple layout elements...
Definition: qcustomplot.h:487
QCPItemPixmap
An arbitrary pixmap.
Definition: qcustomplot.h:2452
QCP::aeAll
0xFFFF All elements
Definition: qcustomplot.h:124
QCPMarginGroup::elements
QList< QCPLayoutElement * > elements(QCP::MarginSide side) const
Definition: qcustomplot.h:495
QCustomPlot::LayerInsertMode
LayerInsertMode
Definition: qcustomplot.h:1495
QCPRange::maxRange
static const double maxRange
Definition: qcustomplot.h:482
QCP::msBottom
0x08 bottom margin
Definition: qcustomplot.h:98
QCPDataMap
QMap< double, QCPData > QCPDataMap
Definition: qcustomplot.h:1707
QCPCurveData
Holds the data of one single data point for QCPCurve.
Definition: qcustomplot.h:1854
QCPCurve::lsNone
No line is drawn between data points (e.g. only scatters)
Definition: qcustomplot.h:1889
QCPAbstractPlottable::rescaleKeyAxis
void rescaleKeyAxis(bool onlyEnlarge=false) const
Definition: qcustomplot.cpp:6798
QCPPlottableLegendItem
A legend item representing a plottable with an icon and the plottable name.
Definition: qcustomplot.h:2818
QCPAxis::ScaleType
ScaleType
Definition: qcustomplot.h:938
QCPLayoutElement::elements
virtual QList< QCPLayoutElement * > elements(bool recursive) const
Definition: qcustomplot.cpp:2075
QCPPainter::PainterMode
PainterMode
Definition: qcustomplot.h:315
QCP::phForceRepaint
Definition: qcustomplot.h:137
QCPLayoutElement::mouseMoveEvent
virtual void mouseMoveEvent(QMouseEvent *event)
Definition: qcustomplot.h:577
QCPAxisRect::bottom
int bottom() const
Definition: qcustomplot.h:2702
QCPAbstractLegendItem
The abstract base class for all entries in a QCPLegend.
Definition: qcustomplot.h:2755
QCPLayout::elementCount
virtual int elementCount() const =0
QCP::aeAxes
0x0001 Axis base line and tick marks
Definition: qcustomplot.h:113
QCP::aeLegend
0x0008 Legend box
Definition: qcustomplot.h:116
QCPGrid
Responsible for drawing the grid of a QCPAxis.
Definition: qcustomplot.h:807
QCP::iRangeDrag
0x001 Axis ranges are draggable (see QCPAxisRect::setRangeDrag, QCPAxisRect::setRangeDragAxes) ...
Definition: qcustomplot.h:150
QCPLineEnding::EndingStyle
EndingStyle
Definition: qcustomplot.h:765
QCP::msNone
0x00 no margin
Definition: qcustomplot.h:100
QCP::msTop
0x04 top margin
Definition: qcustomplot.h:97
QCPItemAnchor
An anchor of an item to which positions can be attached to.
Definition: qcustomplot.h:1313
QCP::aeSubGrid
0x0004 Sub grid lines
Definition: qcustomplot.h:115
QCPLayout::elements
virtual QList< QCPLayoutElement * > elements(bool recursive) const
Definition: qcustomplot.cpp:2246
QCP::aeGrid
0x0002 Grid lines
Definition: qcustomplot.h:114
QCP::msLeft
0x01 left margin
Definition: qcustomplot.h:95
QCPLayerable
Base class for all drawable objects.
Definition: qcustomplot.h:397
QCPItemTracer::TracerStyle
TracerStyle
Definition: qcustomplot.h:2532
QCPBars
A plottable representing a bar chart in a plot.
Definition: qcustomplot.h:1972
QCP::iSelectOther
0x080 All other objects are selectable (e.g. your own derived layerables, the plot title...
Definition: qcustomplot.h:157
QCPItemCurve
A curved line from one point to another.
Definition: qcustomplot.h:2203
QCP::aeScatters
0x0080 Scatter symbols of plottables (excluding scatter symbols of type ssPixmap) ...
Definition: qcustomplot.h:120
QCPLayer::children
QList< QCPLayerable * > children() const
Definition: qcustomplot.h:377
QCPLayoutGrid
A layout that arranges child elements in a grid.
Definition: qcustomplot.h:634
QCPAxis::CachedLabel
Definition: qcustomplot.h:1090
QCPLayout::takeAt
virtual QCPLayoutElement * takeAt(int index)=0
QCPGraph::ErrorType
ErrorType
Definition: qcustomplot.h:1742
QCPAxisRect::bottomLeft
QPoint bottomLeft() const
Definition: qcustomplot.h:2708
QCPLayoutGrid::minimumSizeHint
virtual QSize minimumSizeHint() const
Definition: qcustomplot.cpp:3039
QCP::aeItems
0x0040 Main lines of items
Definition: qcustomplot.h:119
QCPAbstractPlottable
The abstract base class for all data representing objects in a plot.
Definition: qcustomplot.h:1199
QCPScatterStyle::ScatterShape
ScatterShape
Definition: qcustomplot.h:241
QCPStatisticalBox
A plottable representing a single statistical box in a plot.
Definition: qcustomplot.h:2037
QCPAbstractItem::selectTest
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const =0
QCP::iSelectPlottables
0x008 Plottables are selectable (e.g. graphs, curves, bars,... see QCPAbstractPlottable) ...
Definition: qcustomplot.h:153
QCPLayoutElement::minimumSizeHint
virtual QSize minimumSizeHint() const
Definition: qcustomplot.cpp:2051
QCPAbstractPlottable::selectTest
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const =0
QCP::phFastPolylines
Definition: qcustomplot.h:135
QCPLayoutElement::update
virtual void update()
Definition: qcustomplot.cpp:2019
QCPGraph
A plottable representing a graph in a plot.
Definition: qcustomplot.h:1712
QCPAbstractItem
The abstract base class for all items in a plot.
Definition: qcustomplot.h:1403
QCP::phCacheLabels
0x004 axis (tick) labels will be cached as pixmaps, increasing replot performance.
Definition: qcustomplot.h:139
QCPItemTracer
Item that sticks to QCPGraph data points.
Definition: qcustomplot.h:2512
QCPLayoutElement::maximumSizeHint
virtual QSize maximumSizeHint() const
Definition: qcustomplot.cpp:2063
QCustomPlot
The central class of the library. This is the QWidget which displays the plot and interacts with the ...
Definition: qcustomplot.h:1475
QCP::iSelectItems
0x040 Items are selectable (Rectangles, Arrows, Textitems, etc. see QCPAbstractItem) ...
Definition: qcustomplot.h:156
QCPLayoutElement::wheelEvent
virtual void wheelEvent(QWheelEvent *event)
Definition: qcustomplot.h:580
QCPAxis
Manages a single axis inside a QCustomPlot.
Definition: qcustomplot.h:857
QCPAbstractItem::anchors
QList< QCPItemAnchor * > anchors() const
Definition: qcustomplot.h:1433
QCPScatterStyle::isPenDefined
bool isPenDefined() const
Definition: qcustomplot.h:287
QCPScatterStyle
Represents the visual appearance of scatter points.
Definition: qcustomplot.h:229
QCPLayer::index
int index() const
Definition: qcustomplot.h:376
QCPLegend
Manages a legend inside a QCustomPlot.
Definition: qcustomplot.h:2842
QCPAbstractItem::positions
QList< QCPItemPosition * > positions() const
Definition: qcustomplot.h:1432
QCPLayerable::parentLayerable
QCPLayerable * parentLayerable() const
Definition: qcustomplot.h:414
QCPLayout::take
virtual bool take(QCPLayoutElement *element)=0
QCP::aeFills
0x0200 Borders of fills (e.g. under or between graphs)
Definition: qcustomplot.h:122
QCP::iMultiSelect
0x004 The user can select multiple objects by holding the modifier set by QCustomPlot::setMultiSelect...
Definition: qcustomplot.h:152
QCPAbstractPlottable::clearData
virtual void clearData()=0
QCPLayoutElement::selectTest
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
Definition: qcustomplot.cpp:2092
QCPAxisRect::height
int height() const
Definition: qcustomplot.h:2704
QCPLayer
A layer that may contain objects, to control the rendering order.
Definition: qcustomplot.h:360
QCPAxis::orientation
Qt::Orientation orientation() const
Definition: qcustomplot.h:1069
QCPItemRect
A rectangle.
Definition: qcustomplot.h:2249
QCPLayoutElement
The abstract base class for all objects that form the layout system.
Definition: qcustomplot.h:516
QCP::PlottingHint
PlottingHint
Definition: qcustomplot.h:134
QCPItemStraightLine
A straight line that spans infinitely in both directions.
Definition: qcustomplot.h:2119
QCPBarDataMap
QMap< double, QCPBarData > QCPBarDataMap
Definition: qcustomplot.h:1967
QCPLegend::SelectablePart
SelectablePart
Definition: qcustomplot.h:2867
QCPLayoutInset
A layout that places child elements aligned to the border or arbitrarily positioned.
Definition: qcustomplot.h:700
QCP::iSelectLegend
0x020 Legends are selectable (or their child items, see QCPLegend::setSelectableParts) ...
Definition: qcustomplot.h:155
QCPLineEnding
Handles the different ending decorations for line-like items.
Definition: qcustomplot.h:749
QCPAxisRect::center
QPoint center() const
Definition: qcustomplot.h:2710
QCPData
Holds the data of one single data point for QCPGraph.
Definition: qcustomplot.h:1689
QCPAxis::TickLabelData
Definition: qcustomplot.h:1095
QCPItemAnchor::toQCPItemPosition
virtual QCPItemPosition * toQCPItemPosition()
Definition: qcustomplot.h:1334
QCPPainter
QPainter subclass used internally.
Definition: qcustomplot.h:307
QCPGraph::LineStyle
LineStyle
Definition: qcustomplot.h:1730
QCPCurve::LineStyle
LineStyle
Definition: qcustomplot.h:1889
QCPAxisRect::left
int left() const
Definition: qcustomplot.h:2699
QCP::aeErrorBars
0x0100 Error bars
Definition: qcustomplot.h:121
QCPAbstractPlottable::SignDomain
SignDomain
Definition: qcustomplot.h:1265
QCPRange::minRange
static const double minRange
Definition: qcustomplot.h:481
QCPScatterStyle::isNone
bool isNone() const
Definition: qcustomplot.h:286
QCPItemBracket::BracketStyle
BracketStyle
Definition: qcustomplot.h:2602
QCPAbstractPlottable::rescaleAxes
void rescaleAxes(bool onlyEnlarge=false) const
Definition: qcustomplot.cpp:6787
QCP::aePlottables
0x0020 Main lines of plottables (excluding error bars, see element aeErrorBars)
Definition: qcustomplot.h:118
QCP::Interaction
Interaction
Definition: qcustomplot.h:150
QCPBars::barBelow
QCPBars * barBelow() const
Definition: qcustomplot.h:1986
QCPAxisRect::top
int top() const
Definition: qcustomplot.h:2701
QCP::phNone
0x000 No hints are set
Definition: qcustomplot.h:134
QCPItemPosition::toQCPItemPosition
virtual QCPItemPosition * toQCPItemPosition()
Definition: qcustomplot.h:1395
QCPCurve
A plottable representing a parametric curve in a plot.
Definition: qcustomplot.h:1876
QCPLayout::elementAt
virtual QCPLayoutElement * elementAt(int index) const =0
QCPLayoutElement::layout
QCPLayout * layout() const
Definition: qcustomplot.h:533
QCP::aeNone
0x0000 No elements
Definition: qcustomplot.h:125
QCPAbstractPlottable::rescaleValueAxis
void rescaleValueAxis(bool onlyEnlarge=false) const
Definition: qcustomplot.cpp:6825
QCPPlotTitle
A layout element displaying a plot title text.
Definition: qcustomplot.h:2965
QCP::msRight
0x02 right margin
Definition: qcustomplot.h:96
QCPAxisRect::insetLayout
QCPLayoutInset * insetLayout() const
Definition: qcustomplot.h:2691
QCPItemEllipse
An ellipse.
Definition: qcustomplot.h:2395
QCPAxisRect::topLeft
QPoint topLeft() const
Definition: qcustomplot.h:2706
QCPLayout::simplify
virtual void simplify()
Definition: qcustomplot.cpp:2273
QCPLayoutElement::mouseDoubleClickEvent
virtual void mouseDoubleClickEvent(QMouseEvent *event)
Definition: qcustomplot.h:579
QCPLayoutElement::rect
QRect rect() const
Definition: qcustomplot.h:534
QCPAxis::SelectablePart
SelectablePart
Definition: qcustomplot.h:946
QCP::iRangeZoom
0x002 Axis ranges are zoomable with the mouse wheel (see QCPAxisRect::setRangeZoom, QCPAxisRect::setRangeZoomAxes)
Definition: qcustomplot.h:151
QCP::aeLegendItems
0x0010 Legend items
Definition: qcustomplot.h:117
QCPLayout
The abstract base class for layouts.
Definition: qcustomplot.h:596
QCPItemText
A text label.
Definition: qcustomplot.h:2303
QCPBars::barAbove
QCPBars * barAbove() const
Definition: qcustomplot.h:1987
QCPAxisRect::size
QSize size() const
Definition: qcustomplot.h:2705
QCPLayoutElement::mousePressEvent
virtual void mousePressEvent(QMouseEvent *event)
Definition: qcustomplot.h:576
QCPItemPosition::PositionType
PositionType
Definition: qcustomplot.h:1357
QCPAxisRect::bottomRight
QPoint bottomRight() const
Definition: qcustomplot.h:2709
QCPAxisRect::topRight
QPoint topRight() const
Definition: qcustomplot.h:2707
QCPItemLine
A line from one point to another.
Definition: qcustomplot.h:2158
QCP
Definition: qcustomplot.h:88
QCPLayoutGrid::maximumSizeHint
virtual QSize maximumSizeHint() const
Definition: qcustomplot.cpp:3054
QCP::aeZeroLine
0x0400 Zero-lines, see QCPGrid::setZeroLinePen
Definition: qcustomplot.h:123
QCPItemPosition
Manages the position of an item.
Definition: qcustomplot.h:1348
QCPAxis::grid
QCPGrid * grid() const
Definition: qcustomplot.h:1007
QCPRange
Represents the range an axis is encompassing.
Definition: qcustomplot.h:462
QCP::iSelectAxes
0x010 Axes are selectable (or parts of them, see QCPAxis::setSelectableParts)
Definition: qcustomplot.h:154
QCPLayerable::selectTest
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
Definition: qcustomplot.cpp:1039
QCP::msAll
0xFF all margins
Definition: qcustomplot.h:99
QCPAxisRect
Holds multiple axes and arranges them in a rectangular shape.
Definition: qcustomplot.h:2646
QCPAxisRect::width
int width() const
Definition: qcustomplot.h:2703
QCPLayoutInset::InsetPlacement
InsetPlacement
Definition: qcustomplot.h:707
QCPLayoutInset::simplify
virtual void simplify()
Definition: qcustomplot.h:730
QCPCurveDataMap
QMap< double, QCPCurveData > QCPCurveDataMap
Definition: qcustomplot.h:1871
QCP::MarginSide
MarginSide
Definition: qcustomplot.h:95
QCP::AntialiasedElement
AntialiasedElement
Definition: qcustomplot.h:113
QCPAxis::LabelType
LabelType
Definition: qcustomplot.h:930
QCPLayoutElement::mouseReleaseEvent
virtual void mouseReleaseEvent(QMouseEvent *event)
Definition: qcustomplot.h:578
QCPAxisRect::right
int right() const
Definition: qcustomplot.h:2700
QCPBarData
Holds the data of one single data point (one bar) for QCPBars.
Definition: qcustomplot.h:1951