QCPAbstractPlottable1D
#include <qcustomplot.h>
Public Member Functions | |
QCPAbstractPlottable1D (QCPAxis *keyAxis, QCPAxis *valueAxis) | |
virtual int | dataCount () const override |
virtual double | dataMainKey (int index) const override |
virtual double | dataMainValue (int index) const override |
virtual QPointF | dataPixelPosition (int index) const override |
virtual double | dataSortKey (int index) const override |
virtual QCPRange | dataValueRange (int index) const override |
virtual int | findBegin (double sortKey, bool expandedRange=true) const override |
virtual int | findEnd (double sortKey, bool expandedRange=true) const override |
virtual QCPPlottableInterface1D * | interface1D () override |
virtual double | selectTest (const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const override |
virtual QCPDataSelection | selectTestRect (const QRectF &rect, bool onlySelectable) const override |
virtual bool | sortKeyIsMainKey () const override |
Public Member Functions inherited from QCPAbstractPlottable | |
QCPAbstractPlottable (QCPAxis *keyAxis, QCPAxis *valueAxis) | |
bool | addToLegend () |
bool | addToLegend (QCPLegend *legend) |
bool | antialiasedFill () const |
bool | antialiasedScatters () const |
QBrush | brush () const |
const QPointF | coordsToPixels (double key, double value) const |
void | coordsToPixels (double key, double value, double &x, double &y) const |
virtual QCPRange | getKeyRange (bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth) const =0 |
virtual QCPRange | getValueRange (bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth, const QCPRange &inKeyRange=QCPRange()) const =0 |
QCPAxis * | keyAxis () const |
QString | name () const |
QPen | pen () const |
void | pixelsToCoords (const QPointF &pixelPos, double &key, double &value) const |
void | pixelsToCoords (double x, double y, double &key, double &value) const |
bool | removeFromLegend () const |
bool | removeFromLegend (QCPLegend *legend) const |
void | rescaleAxes (bool onlyEnlarge=false) const |
void | rescaleKeyAxis (bool onlyEnlarge=false) const |
void | rescaleValueAxis (bool onlyEnlarge=false, bool inKeyRange=false) const |
QCP::SelectionType | selectable () const |
bool | selected () const |
QCPDataSelection | selection () const |
QCPSelectionDecorator * | selectionDecorator () const |
void | setAntialiasedFill (bool enabled) |
void | setAntialiasedScatters (bool enabled) |
void | setBrush (const QBrush &brush) |
void | setKeyAxis (QCPAxis *axis) |
void | setName (const QString &name) |
void | setPen (const QPen &pen) |
Q_SLOT void | setSelectable (QCP::SelectionType selectable) |
Q_SLOT void | setSelection (QCPDataSelection selection) |
void | setSelectionDecorator (QCPSelectionDecorator *decorator) |
void | setValueAxis (QCPAxis *axis) |
QCPAxis * | valueAxis () const |
Public Member Functions inherited from QCPLayerable | |
QCPLayerable (QCustomPlot *plot, QString targetLayer=QString(), QCPLayerable *parentLayerable=nullptr) | |
bool | antialiased () const |
QCPLayer * | layer () const |
QCPLayerable * | parentLayerable () const |
QCustomPlot * | parentPlot () const |
bool | realVisibility () const |
void | setAntialiased (bool enabled) |
bool | setLayer (const QString &layerName) |
Q_SLOT bool | setLayer (QCPLayer *layer) |
void | setVisible (bool on) |
bool | visible () const |
Public Member Functions inherited from QObject | |
QObject (QObject *parent) | |
QBindable< QString > | bindableObjectName () |
bool | blockSignals (bool block) |
const QObjectList & | children () const const |
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const |
void | deleteLater () |
void | destroyed (QObject *obj) |
bool | disconnect (const char *signal, const QObject *receiver, const char *method) const const |
bool | disconnect (const QObject *receiver, const char *method) const const |
void | dumpObjectInfo () const const |
void | dumpObjectTree () const const |
QList< QByteArray > | dynamicPropertyNames () const const |
virtual bool | event (QEvent *e) |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
T | findChild (const QString &name, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QString &name, Qt::FindChildOptions options) const const |
QList< T > | findChildren (Qt::FindChildOptions options) const const |
bool | inherits (const char *className) const const |
void | installEventFilter (QObject *filterObj) |
bool | isQuickItemType () const const |
bool | isWidgetType () const const |
bool | isWindowType () const const |
void | killTimer (int id) |
virtual const QMetaObject * | metaObject () const const |
void | moveToThread (QThread *targetThread) |
QString | objectName () const const |
void | objectNameChanged (const QString &objectName) |
QObject * | parent () const const |
QVariant | property (const char *name) const const |
Q_CLASSINFO (Name, Value) | |
Q_EMIT Q_EMIT | |
Q_ENUM (...) | |
Q_ENUM_NS (...) | |
Q_ENUMS (...) | |
Q_FLAG (...) | |
Q_FLAG_NS (...) | |
Q_FLAGS (...) | |
Q_GADGET Q_GADGET | |
Q_GADGET_EXPORT (EXPORT_MACRO) | |
Q_INTERFACES (...) | |
Q_INVOKABLE Q_INVOKABLE | |
Q_MOC_INCLUDE Q_MOC_INCLUDE | |
Q_NAMESPACE Q_NAMESPACE | |
Q_NAMESPACE_EXPORT (EXPORT_MACRO) | |
Q_OBJECT Q_OBJECT | |
Q_PROPERTY (...) | |
Q_REVISION Q_REVISION | |
Q_SET_OBJECT_NAME (Object) | |
Q_SIGNAL Q_SIGNAL | |
Q_SIGNALS Q_SIGNALS | |
Q_SLOT Q_SLOT | |
Q_SLOTS Q_SLOTS | |
T | qobject_cast (const QObject *object) |
T | qobject_cast (QObject *object) |
QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT | |
void | removeEventFilter (QObject *obj) |
void | setObjectName (const QString &name) |
void | setObjectName (QAnyStringView name) |
void | setParent (QObject *parent) |
bool | setProperty (const char *name, const QVariant &value) |
bool | setProperty (const char *name, QVariant &&value) |
bool | signalsBlocked () const const |
int | startTimer (int interval, Qt::TimerType timerType) |
int | startTimer (std::chrono::milliseconds interval, Qt::TimerType timerType) |
QThread * | thread () const const |
Public Member Functions inherited from QCPPlottableInterface1D |
Protected Member Functions | |
void | drawPolyline (QCPPainter *painter, const QVector< QPointF > &lineData) const |
void | getDataSegments (QList< QCPDataRange > &selectedSegments, QList< QCPDataRange > &unselectedSegments) const |
Protected Member Functions inherited from QCPAbstractPlottable | |
void | applyDefaultAntialiasingHint (QCPPainter *painter) const override |
void | applyFillAntialiasingHint (QCPPainter *painter) const |
void | applyScattersAntialiasingHint (QCPPainter *painter) const |
virtual QRect | clipRect () const override |
virtual void | deselectEvent (bool *selectionStateChanged) override |
virtual void | draw (QCPPainter *painter) override=0 |
virtual void | drawLegendIcon (QCPPainter *painter, const QRectF &rect) const =0 |
virtual void | selectEvent (QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) override |
virtual QCP::Interaction | selectionCategory () const override |
Protected Member Functions inherited from QCPLayerable | |
void | applyAntialiasingHint (QCPPainter *painter, bool localAntialiased, QCP::AntialiasedElement overrideElement) const |
void | initializeParentPlot (QCustomPlot *parentPlot) |
virtual void | mouseDoubleClickEvent (QMouseEvent *event, const QVariant &details) |
virtual void | mouseMoveEvent (QMouseEvent *event, const QPointF &startPos) |
virtual void | mousePressEvent (QMouseEvent *event, const QVariant &details) |
virtual void | mouseReleaseEvent (QMouseEvent *event, const QPointF &startPos) |
bool | moveToLayer (QCPLayer *layer, bool prepend) |
virtual void | parentPlotInitialized (QCustomPlot *parentPlot) |
void | setParentLayerable (QCPLayerable *parentLayerable) |
virtual void | wheelEvent (QWheelEvent *event) |
Protected Member Functions inherited from QObject | |
virtual void | childEvent (QChildEvent *event) |
virtual void | connectNotify (const QMetaMethod &signal) |
virtual void | customEvent (QEvent *event) |
virtual void | disconnectNotify (const QMetaMethod &signal) |
bool | isSignalConnected (const QMetaMethod &signal) const const |
int | receivers (const char *signal) const const |
QObject * | sender () const const |
int | senderSignalIndex () const const |
virtual void | timerEvent (QTimerEvent *event) |
Protected Attributes | |
QSharedPointer< QCPDataContainer< DataType > > | mDataContainer |
Protected Attributes inherited from QCPAbstractPlottable | |
bool | mAntialiasedFill |
bool | mAntialiasedScatters |
QBrush | mBrush |
QPointer< QCPAxis > | mKeyAxis |
QString | mName |
QPen | mPen |
QCP::SelectionType | mSelectable |
QCPDataSelection | mSelection |
QCPSelectionDecorator * | mSelectionDecorator |
QPointer< QCPAxis > | mValueAxis |
Protected Attributes inherited from QCPLayerable | |
bool | mAntialiased |
QCPLayer * | mLayer |
QPointer< QCPLayerable > | mParentLayerable |
QCustomPlot * | mParentPlot |
bool | mVisible |
Additional Inherited Members | |
Public Types inherited from QObject | |
typedef | QObjectList |
Properties inherited from QObject | |
objectName | |
Signals inherited from QCPAbstractPlottable | |
void | selectableChanged (QCP::SelectionType selectable) |
void | selectionChanged (bool selected) |
void | selectionChanged (const QCPDataSelection &selection) |
Signals inherited from QCPLayerable | |
void | layerChanged (QCPLayer *newLayer) |
Static Public Member Functions inherited from QObject | |
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, Functor functor) |
bool | disconnect (const QMetaObject::Connection &connection) |
bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method) |
bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method) |
bool | disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method) |
QString | tr (const char *sourceText, const char *disambiguation, int n) |
Detailed Description
class QCPAbstractPlottable1D< DataType >
A template base class for plottables with one-dimensional data.
This template class derives from QCPAbstractPlottable and from the abstract interface QCPPlottableInterface1D. It serves as a base class for all one-dimensional data (i.e. data with one key dimension), such as QCPGraph and QCPCurve.
The template parameter DataType is the type of the data points of this plottable (e.g. QCPGraphData or QCPCurveData). The main purpose of this base class is to provide the member mDataContainer (a shared pointer to a QCPDataContainer<DataType>) and implement the according virtual methods of the QCPPlottableInterface1D, such that most subclassed plottables don't need to worry about this anymore.
Further, it provides a convenience method for retrieving selected/unselected data segments via getDataSegments. This is useful when subclasses implement their draw method and need to draw selected segments with a different pen/brush than unselected segments (also see QCPSelectionDecorator).
This class implements basic functionality of QCPAbstractPlottable::selectTest and QCPPlottableInterface1D::selectTestRect, assuming point-like data points, based on the 1D data interface. In spite of that, most plottable subclasses will want to reimplement those methods again, to provide a more accurate hit test based on their specific data visualization geometry.
Definition at line 4178 of file qcustomplot.h.
Constructor & Destructor Documentation
◆ QCPAbstractPlottable1D()
QCPAbstractPlottable1D< DataType >::QCPAbstractPlottable1D | ( | QCPAxis * | keyAxis, |
QCPAxis * | valueAxis ) |
Forwards keyAxis and valueAxis to the QCPAbstractPlottable constructor and allocates the mDataContainer.
Definition at line 4404 of file qcustomplot.h.
◆ ~QCPAbstractPlottable1D()
|
overridevirtual |
Definition at line 4411 of file qcustomplot.h.
Member Function Documentation
◆ dataCount()
|
overridevirtual |
Returns the number of data points of the plottable.
Implements QCPPlottableInterface1D.
Definition at line 4419 of file qcustomplot.h.
◆ dataMainKey()
|
overridevirtual |
Returns the main key of the data point at the given index.
What the main key is, is defined by the plottable's data type. See the QCPDataContainer DataType documentation for details about this naming convention.
Implements QCPPlottableInterface1D.
Definition at line 4428 of file qcustomplot.h.
◆ dataMainValue()
|
overridevirtual |
Returns the main value of the data point at the given index.
What the main value is, is defined by the plottable's data type. See the QCPDataContainer DataType documentation for details about this naming convention.
Implements QCPPlottableInterface1D.
Definition at line 4460 of file qcustomplot.h.
◆ dataPixelPosition()
|
overridevirtual |
Returns the pixel position on the widget surface at which the data point at the given index appears.
Usually this corresponds to the point of dataMainKey/ dataMainValue, in pixel coordinates. However, depending on the plottable, this might be a different apparent position than just a coord-to-pixel transform of those values. For example, QCPBars apparent data values can be shifted depending on their stacking, bar grouping or configured base value.
Implements QCPPlottableInterface1D.
Reimplemented in QCPBars.
Definition at line 4492 of file qcustomplot.h.
◆ dataSortKey()
|
overridevirtual |
Returns the sort key of the data point at the given index.
What the sort key is, is defined by the plottable's data type. See the QCPDataContainer DataType documentation for details about this naming convention.
Implements QCPPlottableInterface1D.
Definition at line 4444 of file qcustomplot.h.
◆ dataValueRange()
|
overridevirtual |
Returns the value range of the data point at the given index.
What the value range is, is defined by the plottable's data type. See the QCPDataContainer DataType documentation for details about this naming convention.
Implements QCPPlottableInterface1D.
Definition at line 4476 of file qcustomplot.h.
◆ drawPolyline()
|
protected |
A helper method which draws a line with the passed painter, according to the pixel data in lineData. NaN points create gaps in the line, as expected from QCustomPlot's plottables (this is the main difference to QPainter's regular drawPolyline, which handles NaNs by lagging or crashing).
Further it uses a faster line drawing technique based on QCPPainter::drawLine rather than QPainter::drawPolyline
if the configured QCustomPlot::setPlottingHints() and painter style allows.
Definition at line 4688 of file qcustomplot.h.
◆ findBegin()
|
overridevirtual |
Returns the index of the data point with a (sort-)key that is equal to, just below, or just above sortKey. If expandedRange is true, the data point just below sortKey will be considered, otherwise the one just above.
This can be used in conjunction with findEnd to iterate over data points within a given key range, including or excluding the bounding data points that are just beyond the specified range.
If expandedRange is true but there are no data points below sortKey, 0 is returned.
If the container is empty, returns 0 (in that case, findEnd will also return 0, so a loop using these methods will not iterate over the index 0).
- See also
- findEnd, QCPDataContainer::findBegin
Implements QCPPlottableInterface1D.
Definition at line 4571 of file qcustomplot.h.
◆ findEnd()
|
overridevirtual |
Returns the index one after the data point with a (sort-)key that is equal to, just above, or just below sortKey. If expandedRange is true, the data point just above sortKey will be considered, otherwise the one just below.
This can be used in conjunction with findBegin to iterate over data points within a given key range, including the bounding data points that are just below and above the specified range.
If expandedRange is true but there are no data points above sortKey, the index just above the highest data point is returned.
If the container is empty, returns 0.
- See also
- findBegin, QCPDataContainer::findEnd
Implements QCPPlottableInterface1D.
Definition at line 4580 of file qcustomplot.h.
◆ getDataSegments()
|
protected |
Splits all data into selected and unselected segments and outputs them via selectedSegments and unselectedSegments, respectively.
This is useful when subclasses implement their draw method and need to draw selected segments with a different pen/brush than unselected segments (also see QCPSelectionDecorator).
- See also
- setSelection
Definition at line 4658 of file qcustomplot.h.
◆ interface1D()
|
inlineoverridevirtual |
Returns a QCPPlottableInterface1D pointer to this plottable, providing access to its 1D interface.
\seebaseclassmethod
Reimplemented from QCPAbstractPlottable.
Definition at line 4200 of file qcustomplot.h.
◆ selectTest()
|
overridevirtual |
Implements a point-selection algorithm assuming the data (accessed via the 1D data interface) is point-like. Most subclasses will want to reimplement this method again, to provide a more accurate hit test based on the true data visualization geometry.
If details is not 0, it will be set to a QCPDataSelection, describing the closest data point to pos.
\seebaseclassmethod
Implements QCPAbstractPlottable.
Reimplemented in QCPBars, QCPCurve, QCPFinancial, QCPGraph, and QCPStatisticalBox.
Definition at line 4596 of file qcustomplot.h.
◆ selectTestRect()
|
overridevirtual |
Implements a rect-selection algorithm assuming the data (accessed via the 1D data interface) is point-like. Most subclasses will want to reimplement this method again, to provide a more accurate hit test based on the true data visualization geometry.
\seebaseclassmethod
Implements QCPPlottableInterface1D.
Reimplemented in QCPBars, QCPFinancial, and QCPStatisticalBox.
Definition at line 4522 of file qcustomplot.h.
◆ sortKeyIsMainKey()
|
overridevirtual |
Returns whether the sort key (dataSortKey) is identical to the main key (dataMainKey).
What the sort and main keys are, is defined by the plottable's data type. See the QCPDataContainer DataType documentation for details about this naming convention.
Implements QCPPlottableInterface1D.
Definition at line 4509 of file qcustomplot.h.
Member Data Documentation
◆ mDataContainer
|
protected |
Definition at line 4204 of file qcustomplot.h.
The documentation for this class was generated from the following file:
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:16:42 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.