|
rock_widget_collection
0.1
|
The abstract base class for all data representing objects in a plot. More...
#include <qcustomplot.h>
Inherits QObject.
Inherited by QCPBars, QCPCurve, QCPGraph, and QCPStatisticalBox.
Public Slots | |
| QCustomPlot * | parentPlot () const |
| QString | name () const |
| bool | visible () const |
| QPen | pen () const |
| QBrush | brush () const |
| QCPAxis * | keyAxis () const |
| QCPAxis * | valueAxis () const |
| void | setName (const QString &name) |
| void | setVisible (bool visible) |
| void | setPen (const QPen &pen) |
| void | setBrush (const QBrush &brush) |
| void | setKeyAxis (QCPAxis *axis) |
| void | setValueAxis (QCPAxis *axis) |
| void | rescaleAxes (bool onlyEnlarge=false) const |
| void | rescaleKeyAxis (bool onlyEnlarge=false) const |
| void | rescaleValueAxis (bool onlyEnlarge=false) const |
| virtual void | clearData ()=0 |
| virtual bool | addToLegend () const |
| virtual bool | removeFromLegend () const |
Public Member Functions | |
| QCPAbstractPlottable (QCPAxis *keyAxis, QCPAxis *valueAxis) | |
| virtual | ~QCPAbstractPlottable () |
Protected Types | |
| enum | SignDomain { SDNegative, SDBoth, SDPositive } |
Protected Member Functions | |
| virtual void | draw (QPainter *painter) const =0 |
| virtual void | drawLegendIcon (QPainter *painter, const QRect &rect) const =0 |
| virtual QCPRange | getKeyRange (bool &validRange, SignDomain inSignDomain=SDBoth) const =0 |
| virtual QCPRange | getValueRange (bool &validRange, SignDomain inSignDomain=SDBoth) const =0 |
| void | coordsToPixels (double key, double value, double &x, double &y) const |
| const QPointF | coordsToPixels (double key, double value) const |
Protected Attributes | |
| QCustomPlot * | mParentPlot |
| QString | mName |
| bool | mVisible |
| QPen | mPen |
| QBrush | mBrush |
| QCPAxis * | mKeyAxis |
| QCPAxis * | mValueAxis |
Friends | |
| class | QCustomPlot |
| class | QCPPlottableLegendItem |
The abstract base class for all data representing objects in a plot.
It defines a very basic interface like name, pen, brush, visibility etc. Since this class is abstract, it can't be instantiated. Use one of the subclasses or create a subclass yourself (see below), to create new ways of displaying data.
All further specifics are in the subclasses, for example:
To create an own plottable, you implement a subclass of QCPAbstractPlottable. These are the pure virtual functions, you must implement:
See the documentation of those functions for what they need to do.
For drawing your plot, you can use the coordsToPixels functions to translate a point in plot coordinates to pixel coordinates. This function is quite convenient, because it takes the orientation of the key and value axes into account for you (x and y are swapped when the key axis is vertical and the value axis horizontal). If you are worried about performance (i.e. you need to translate many points in a loop like QCPGraph), you can directly use QCPAxis::coordToPixel. However, you must then take care about the orientation of the axis yourself.
From QCPAbstractPlottable you inherit the following members you may use:
Definition at line 112 of file qcustomplot.h.
|
protected |
Represents negative and positive sign domain for passing to getKeyRange and getValueRange.
Definition at line 149 of file qcustomplot.h.
Constructs an abstract plottable which uses keyAxis as its key axis ("x") and valueAxis as its value axis ("y"). keyAxis and valueAxis must reside in the same QCustomPlot instance.
Since QCPAbstractPlottable is an abstract class that defines the basic interface to plottables (i.e. any form of data representation inside a plot, like graphs, curves etc.), it can't be directly instantiated.
You probably want one of the subclasses like QCPGraph and QCPCurve instead.
Definition at line 6092 of file qcustomplot.cc.
|
inlinevirtual |
Definition at line 117 of file qcustomplot.h.
|
virtualslot |
Adds this plottable to the legend of the parent QCustomPlot.
Normally, a QCPPlottableLegendItem is created and inserted into the legend. If the plottable needs a more specialized representation in the plot, this function will take this into account and instead create the specialized subclass of QCPAbstractLegendItem.
Returns true on success, i.e. when a legend item associated with this plottable isn't already in the legend.
Definition at line 6260 of file qcustomplot.cc.
|
inlineslot |
Definition at line 125 of file qcustomplot.h.
|
pure virtualslot |
Clears all data in the plottable.
Implemented in QCPCurve.
|
protected |
Definition at line 6298 of file qcustomplot.cc.
|
protected |
Definition at line 6316 of file qcustomplot.cc.
|
protectedpure virtual |
Implemented in QCPStatisticalBox, QCPBars, QCPCurve, and QCPGraph.
|
protectedpure virtual |
Implemented in QCPStatisticalBox, QCPBars, QCPCurve, and QCPGraph.
|
protectedpure virtual |
Implemented in QCPStatisticalBox, QCPBars, QCPCurve, and QCPGraph.
|
protectedpure virtual |
Implemented in QCPStatisticalBox, QCPBars, QCPCurve, and QCPGraph.
|
inlineslot |
Definition at line 126 of file qcustomplot.h.
|
inlineslot |
Definition at line 122 of file qcustomplot.h.
|
inlineslot |
Definition at line 121 of file qcustomplot.h.
|
inlineslot |
Definition at line 124 of file qcustomplot.h.
|
virtualslot |
Removes the plottable from the legend of the parent QCustomPlot. This means the QCPAbstractLegendItem (usually a QCPPlottableLegendItem) that is associated with this plottable is removed.
Returns true on success, i.e. if a legend item associated with this plottable was found and removed from the legend.
Definition at line 6280 of file qcustomplot.cc.
|
slot |
Rescales the key and value axes associated with this plottable to contain all displayed data, so the whole plottable is visible. If the scaling of an axis is logarithmic, rescaleAxes will make sure not to rescale to an illegal range i.e. a range containing different signs and/or zero. Instead it will stay in the current sign domain and ignore all entities of the plottable that lie outside of that domain.
onlyEnlarge makes sure the ranges are only expanded, never reduced. So it's possible to show multiple plottables in their entirety by multiple calls to rescaleAxes where the first call has onlyEnlarge set to false (the default), and all subsequent set to true.
Definition at line 6188 of file qcustomplot.cc.
|
slot |
Rescales the key axis of the plottable so the whole plottable is visible.
See rescaleAxes for detailed behaviour.
Definition at line 6199 of file qcustomplot.cc.
|
slot |
Rescales the value axis of the plottable so the whole plottable is visible.
See rescaleAxes for detailed behaviour.
Definition at line 6226 of file qcustomplot.cc.
|
slot |
The brush is used to draw basic fills of the plottable representation in the plot. The Fill can be a color, gradient or texture, see the usage of QBrush.
For example, the QCPGraph subclass draws the fill under the graph with this brush, when it's not set to Qt::NoBrush.
Definition at line 6148 of file qcustomplot.cc.
|
slot |
The key axis of a plottable can be set to any axis of a QCustomPlot, as long as it is orthogonal to the plottable's value axis. The typical mathematical choice is to use the x-axis (QCustomPlot::xAxis) as key axis and the y-axis (QCustomPlot::yAxis) as value axis.
Definition at line 6160 of file qcustomplot.cc.
|
slot |
The name is the textual representation of this plottable as it is displayed in the QCPLegend of the parent QCustomPlot. It may contain any utf-8 characters, including newlines.
Definition at line 6111 of file qcustomplot.cc.
|
slot |
The pen is used to draw basic lines that make up the plottable representation in the plot.
For example, the QCPGraph subclass draws its graph lines and scatter points with this pen.
Definition at line 6134 of file qcustomplot.cc.
|
slot |
The value axis of a plottable can be set to any axis of a QCustomPlot, as long as it is orthogonal to the plottable's key axis. The typical mathematical choice is to use the x-axis (QCustomPlot::xAxis) as key axis and the y-axis (QCustomPlot::yAxis) as value axis.
Definition at line 6172 of file qcustomplot.cc.
|
slot |
If the plottable visibility is set to false, it won't be drawn to the plot surface. It will still appear in a QCPLegend that it's associated with, though.
Definition at line 6120 of file qcustomplot.cc.
|
inlineslot |
Definition at line 127 of file qcustomplot.h.
|
inlineslot |
Definition at line 123 of file qcustomplot.h.
|
friend |
Definition at line 168 of file qcustomplot.h.
|
friend |
Definition at line 167 of file qcustomplot.h.
|
protected |
Definition at line 157 of file qcustomplot.h.
|
protected |
Definition at line 158 of file qcustomplot.h.
|
protected |
Definition at line 154 of file qcustomplot.h.
|
protected |
Definition at line 153 of file qcustomplot.h.
|
protected |
Definition at line 156 of file qcustomplot.h.
|
protected |
Definition at line 158 of file qcustomplot.h.
|
protected |
Definition at line 155 of file qcustomplot.h.
1.8.13