|
SETestKCL
1.0.
|
#include <qcustomplot.h>


Public Member Functions | |
| QCPStatisticalBox (QCPAxis *keyAxis, QCPAxis *valueAxis) | |
| double | key () const |
| double | minimum () const |
| double | lowerQuartile () const |
| double | median () const |
| double | upperQuartile () const |
| double | maximum () const |
| QVector< double > | outliers () const |
| double | width () const |
| double | whiskerWidth () const |
| QPen | whiskerPen () const |
| QPen | whiskerBarPen () const |
| QPen | medianPen () const |
| QCPScatterStyle | outlierStyle () const |
| 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) |
| virtual void | clearData () |
| virtual double | selectTest (const QPointF &pos, bool onlySelectable, QVariant *details=0) const |
Public Member Functions inherited from QCPAbstractPlottable | |
| QCPAbstractPlottable (QCPAxis *keyAxis, QCPAxis *valueAxis) | |
| QString | name () const |
| bool | antialiasedFill () const |
| bool | antialiasedScatters () const |
| bool | antialiasedErrorBars () const |
| QPen | pen () const |
| QPen | selectedPen () const |
| QBrush | brush () const |
| QBrush | selectedBrush () const |
| QCPAxis * | keyAxis () const |
| QCPAxis * | valueAxis () const |
| bool | selectable () const |
| bool | selected () const |
| 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) |
| virtual bool | addToLegend () |
| virtual bool | removeFromLegend () const |
| void | rescaleAxes (bool onlyEnlarge=false) const |
| void | rescaleKeyAxis (bool onlyEnlarge=false) const |
| void | rescaleValueAxis (bool onlyEnlarge=false) const |
Public Member Functions inherited from QCPLayerable | |
| QCPLayerable (QCustomPlot *plot, QString targetLayer=QString(), QCPLayerable *parentLayerable=0) | |
| ~QCPLayerable () | |
| bool | visible () const |
| QCustomPlot * | parentPlot () const |
| QCPLayerable * | parentLayerable () const |
| QCPLayer * | layer () const |
| bool | antialiased () const |
| void | setVisible (bool on) |
| Q_SLOT bool | setLayer (QCPLayer *layer) |
| bool | setLayer (const QString &layerName) |
| void | setAntialiased (bool enabled) |
| bool | realVisibility () const |
Protected Member Functions | |
| virtual void | draw (QCPPainter *painter) |
| virtual void | drawLegendIcon (QCPPainter *painter, const QRectF &rect) const |
| virtual QCPRange | getKeyRange (bool &foundRange, SignDomain inSignDomain=sdBoth) const |
| virtual QCPRange | getValueRange (bool &foundRange, SignDomain inSignDomain=sdBoth) const |
| 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 |
Protected Member Functions inherited from QCPAbstractPlottable | |
| virtual QRect | clipRect () const |
| virtual QCP::Interaction | selectionCategory () const |
| void | applyDefaultAntialiasingHint (QCPPainter *painter) const |
| virtual void | selectEvent (QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) |
| virtual void | deselectEvent (bool *selectionStateChanged) |
| 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 |
Protected Member Functions inherited from QCPLayerable | |
| virtual void | parentPlotInitialized (QCustomPlot *parentPlot) |
| void | initializeParentPlot (QCustomPlot *parentPlot) |
| void | setParentLayerable (QCPLayerable *parentLayerable) |
| bool | moveToLayer (QCPLayer *layer, bool prepend) |
| void | applyAntialiasingHint (QCPPainter *painter, bool localAntialiased, QCP::AntialiasedElement overrideElement) const |
Protected Attributes | |
| QVector< double > | mOutliers |
| double | mKey |
| double | mMinimum |
| double | mLowerQuartile |
| double | mMedian |
| double | mUpperQuartile |
| double | mMaximum |
| double | mWidth |
| double | mWhiskerWidth |
| QPen | mWhiskerPen |
| QPen | mWhiskerBarPen |
| QPen | mMedianPen |
| QCPScatterStyle | mOutlierStyle |
Protected Attributes inherited from QCPAbstractPlottable | |
| QString | mName |
| bool | mAntialiasedFill |
| bool | mAntialiasedScatters |
| bool | mAntialiasedErrorBars |
| QPen | mPen |
| QPen | mSelectedPen |
| QBrush | mBrush |
| QBrush | mSelectedBrush |
| QPointer< QCPAxis > | mKeyAxis |
| QPointer< QCPAxis > | mValueAxis |
| bool | mSelectable |
| bool | mSelected |
Protected Attributes inherited from QCPLayerable | |
| bool | mVisible |
| QCustomPlot * | mParentPlot |
| QPointer< QCPLayerable > | mParentLayerable |
| QCPLayer * | mLayer |
| bool | mAntialiased |
Friends | |
| class | QCustomPlot |
| class | QCPLegend |
Additional Inherited Members | |
Signals inherited from QCPAbstractPlottable | |
| void | selectionChanged (bool selected) |
| void | selectableChanged (bool selectable) |
Signals inherited from QCPLayerable | |
| void | layerChanged (QCPLayer *newLayer) |
Protected Types inherited from QCPAbstractPlottable | |
| enum | SignDomain { sdNegative, sdBoth, sdPositive } |
A plottable representing a single statistical box in a plot.
To plot data, assign it with the individual parameter functions or use setData to set all parameters at once. The individual functions are:
Additionally you can define a list of outliers, drawn as scatter datapoints:
The appearance of the box itself is controlled via setPen and setBrush. You may change the width of the box with setWidth in plot coordinates (not pixels).
Analog functions exist for the minimum/maximum-whiskers: setWhiskerPen, setWhiskerBarPen, setWhiskerWidth. The whisker width is the width of the bar at the top (maximum) and bottom (minimum).
The median indicator line has its own pen, setMedianPen.
If the whisker backbone pen is changed, make sure to set the capStyle to Qt::FlatCap. Else, the backbone line might exceed the whisker bars by a few pixels due to the pen cap being not perfectly flat.
The Outlier data points are drawn as normal scatter points. Their look can be controlled with setOutlierStyle
Like all data representing objects in QCustomPlot, the QCPStatisticalBox is a plottable. Usually, you first create an instance and add it to the customPlot:
and then modify the properties of the newly created plottable, e.g.:
Definition at line 2915 of file qcustomplot.h.
|
explicit |
Constructs a statistical box 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 and not have the same orientation. If either of these restrictions is violated, a corresponding message is printed to the debug output (qDebug), the construction is not aborted, though.
The constructed statistical box can be added to the plot with QCustomPlot::addPlottable, QCustomPlot then takes ownership of the statistical box.
Definition at line 19188 of file qcustomplot.cpp.
References QCPAbstractPlottable::setBrush(), setMedianPen(), setOutlierStyle(), QCPAbstractPlottable::setPen(), QCPAbstractPlottable::setSelectedBrush(), QCPAbstractPlottable::setSelectedPen(), setWhiskerBarPen(), setWhiskerPen(), setWhiskerWidth(), setWidth(), and QCPScatterStyle::ssCircle.
|
virtual |
Clears all data in the plottable.
Implements QCPAbstractPlottable.
Definition at line 19366 of file qcustomplot.cpp.
References setKey(), setLowerQuartile(), setMaximum(), setMedian(), setMinimum(), setOutliers(), and setUpperQuartile().
|
protectedvirtual |
Implements QCPAbstractPlottable.
Definition at line 19403 of file qcustomplot.cpp.
References drawMedian(), drawOutliers(), drawQuartileBox(), drawWhiskers(), QCP::isInvalidData(), mKey, QCPAbstractPlottable::mKeyAxis, mLowerQuartile, mMaximum, mMedian, mMinimum, mOutliers, mUpperQuartile, QCPAbstractPlottable::mValueAxis, QCPAbstractPlottable::name(), QCPPainter::restore(), and QCPPainter::save().
|
protectedvirtual |
Implements QCPAbstractPlottable.
Definition at line 19431 of file qcustomplot.cpp.
References QCPAbstractPlottable::applyDefaultAntialiasingHint(), QCPAbstractPlottable::mBrush, QCPAbstractPlottable::mPen, and QCPPainter::setPen().
|
protectedvirtual |
Definition at line 19465 of file qcustomplot.cpp.
References QCPAbstractPlottable::applyDefaultAntialiasingHint(), QCPAbstractPlottable::coordsToPixels(), QCPPainter::drawLine(), mKey, mMedian, mMedianPen, mWidth, and QCPPainter::setPen().
Referenced by draw().
|
protectedvirtual |
Definition at line 19499 of file qcustomplot.cpp.
References QCPAbstractPlottable::applyScattersAntialiasingHint(), QCPScatterStyle::applyTo(), QCPAbstractPlottable::coordsToPixels(), QCPScatterStyle::drawShape(), mKey, mOutliers, mOutlierStyle, and QCPAbstractPlottable::mPen.
Referenced by draw().
|
protectedvirtual |
Definition at line 19448 of file qcustomplot.cpp.
References QCPAbstractPlottable::applyDefaultAntialiasingHint(), QCPAbstractPlottable::coordsToPixels(), QCPAbstractPlottable::mainBrush(), QCPAbstractPlottable::mainPen(), mKey, mLowerQuartile, mUpperQuartile, mWidth, and QCPPainter::setPen().
Referenced by draw().
|
protectedvirtual |
Definition at line 19479 of file qcustomplot.cpp.
References QCPAbstractPlottable::applyErrorBarsAntialiasingHint(), QCPAbstractPlottable::coordsToPixels(), QCPPainter::drawLine(), mKey, mLowerQuartile, mMaximum, mMinimum, mUpperQuartile, mWhiskerBarPen, mWhiskerPen, mWhiskerWidth, and QCPPainter::setPen().
Referenced by draw().
|
protectedvirtual |
Implements QCPAbstractPlottable.
Definition at line 19508 of file qcustomplot.cpp.
References mKey, mWidth, QCPAbstractPlottable::sdBoth, QCPAbstractPlottable::sdNegative, and QCPAbstractPlottable::sdPositive.
|
protectedvirtual |
Implements QCPAbstractPlottable.
Definition at line 19542 of file qcustomplot.cpp.
References mLowerQuartile, mMaximum, mMedian, mMinimum, mOutliers, mUpperQuartile, QCPAbstractPlottable::sdBoth, QCPAbstractPlottable::sdNegative, and QCPAbstractPlottable::sdPositive.
|
inline |
Definition at line 2937 of file qcustomplot.h.
Referenced by setKey().
|
inline |
Definition at line 2939 of file qcustomplot.h.
|
inline |
Definition at line 2942 of file qcustomplot.h.
|
inline |
Definition at line 2940 of file qcustomplot.h.
|
inline |
Definition at line 2948 of file qcustomplot.h.
|
inline |
Definition at line 2938 of file qcustomplot.h.
|
inline |
Definition at line 2943 of file qcustomplot.h.
|
inline |
Definition at line 2949 of file qcustomplot.h.
|
virtual |
This function is used to decide whether a click hits a layerable object or not.
pos is a point in pixel coordinates on the QCustomPlot surface. This function returns the shortest pixel distance of this point to the object. If the object is either invisible or the distance couldn't be determined, -1.0 is returned. Further, if onlySelectable is true and the object is not selectable, -1.0 is returned, too.
If the object is represented not by single lines but by an area like a QCPItemText or the bars of a QCPBars plottable, a click inside the area should also be considered a hit. In these cases this function thus returns a constant value greater zero but still below the parent plot's selection tolerance. (typically the selectionTolerance multiplied by 0.99).
Providing a constant value for area objects allows selecting line objects even when they are obscured by such area objects, by clicking close to the lines (i.e. closer than 0.99*selectionTolerance).
The actual setting of the selection state is not done by this function. This is handled by the parent QCustomPlot when the mouseReleaseEvent occurs, and the finally selected object is notified via the selectEvent/deselectEvent methods.
details is an optional output parameter. Every layerable subclass may place any information in details. This information will be passed to selectEvent when the parent QCustomPlot decides on the basis of this selectTest call, that the object was successfully selected. The subsequent call to selectEvent will carry the details. This is useful for multi-part objects (like QCPAxis). This way, a possibly complex calculation to decide which part was clicked is only done once in selectTest. The result (i.e. the actually clicked part) can then be placed in details. So in the subsequent selectEvent, the decision which part was selected doesn't have to be done a second time for a single selection operation.
You may pass 0 as details to indicate that you are not interested in those selection details.
Implements QCPAbstractPlottable.
Definition at line 19378 of file qcustomplot.cpp.
References QCPRange::contains(), mKey, QCPAbstractPlottable::mKeyAxis, mLowerQuartile, mMaximum, mMinimum, QCPLayerable::mParentPlot, QCPAbstractPlottable::mSelectable, mUpperQuartile, QCPAbstractPlottable::mValueAxis, mWidth, QCPAbstractPlottable::pixelsToCoords(), and QCustomPlot::selectionTolerance().
| void setData | ( | double | key, |
| double | minimum, | ||
| double | lowerQuartile, | ||
| double | median, | ||
| double | upperQuartile, | ||
| double | maximum | ||
| ) |
Sets all parameters of the statistical box plot at once.
Definition at line 19293 of file qcustomplot.cpp.
References setKey(), setLowerQuartile(), setMaximum(), setMedian(), setMinimum(), and setUpperQuartile().
| void setKey | ( | double | key | ) |
Sets the key coordinate of the statistical box.
Definition at line 19213 of file qcustomplot.cpp.
Referenced by clearData(), and setData().
| void setLowerQuartile | ( | double | value | ) |
Sets the parameter "lower Quartile" of the statistical box plot. This is the lower end of the box. The lower and the upper quartiles are the two statistical quartiles around the median of the sample, they contain 50% of the sample data.
Definition at line 19236 of file qcustomplot.cpp.
References mLowerQuartile.
Referenced by clearData(), and setData().
| void setMaximum | ( | double | value | ) |
Sets the parameter "maximum" of the statistical box plot. This is the position of the upper whisker, typically the maximum measurement of the sample that's not considered an outlier.
Definition at line 19271 of file qcustomplot.cpp.
References mMaximum.
Referenced by clearData(), and setData().
| void setMedian | ( | double | value | ) |
Sets the parameter "median" of the statistical box plot. This is the value of the median mark inside the quartile box. The median separates the sample data in half (50% of the sample data is below/above the median).
Definition at line 19248 of file qcustomplot.cpp.
References mMedian.
Referenced by clearData(), and setData().
| void setMedianPen | ( | const QPen & | pen | ) |
Sets the pen used for drawing the median indicator line inside the statistical box.
Definition at line 19350 of file qcustomplot.cpp.
References mMedianPen, and QCPAbstractPlottable::pen().
Referenced by QCPStatisticalBox().
| void setMinimum | ( | double | value | ) |
Sets the parameter "minimum" of the statistical box plot. This is the position of the lower whisker, typically the minimum measurement of the sample that's not considered an outlier.
Definition at line 19224 of file qcustomplot.cpp.
References mMinimum.
Referenced by clearData(), and setData().
| void setOutliers | ( | const QVector< double > & | values | ) |
Sets a vector of outlier values that will be drawn as scatters. Any data points in the sample that are not within the whiskers (setMinimum, setMaximum) should be considered outliers and displayed as such.
Definition at line 19283 of file qcustomplot.cpp.
References mOutliers.
Referenced by clearData().
| void setOutlierStyle | ( | const QCPScatterStyle & | style | ) |
Sets the appearance of the outlier data points.
Definition at line 19360 of file qcustomplot.cpp.
References mOutlierStyle.
Referenced by QCPStatisticalBox().
| void setUpperQuartile | ( | double | value | ) |
Sets the parameter "upper Quartile" of the statistical box plot. This is the upper end of the box. The lower and the upper quartiles are the two statistical quartiles around the median of the sample, they contain 50% of the sample data.
Definition at line 19260 of file qcustomplot.cpp.
References mUpperQuartile.
Referenced by clearData(), and setData().
| void setWhiskerBarPen | ( | const QPen & | pen | ) |
Sets the pen used for drawing the whisker bars (Those are the lines parallel to the key axis at each end of the whisker backbone).
Definition at line 19342 of file qcustomplot.cpp.
References mWhiskerBarPen, and QCPAbstractPlottable::pen().
Referenced by QCPStatisticalBox().
| void setWhiskerPen | ( | const QPen & | pen | ) |
Sets the pen used for drawing the whisker backbone (That's the line parallel to the value axis).
Make sure to set the pen capStyle to Qt::FlatCap to prevent the whisker backbone from reaching a few pixels past the whisker bars, when using a non-zero pen width.
Definition at line 19331 of file qcustomplot.cpp.
References mWhiskerPen, and QCPAbstractPlottable::pen().
Referenced by QCPStatisticalBox().
| void setWhiskerWidth | ( | double | width | ) |
Sets the width of the whiskers (setMinimum, setMaximum) in key coordinates.
Definition at line 19318 of file qcustomplot.cpp.
References mWhiskerWidth, and width().
Referenced by QCPStatisticalBox().
| void setWidth | ( | double | width | ) |
Sets the width of the box in key coordinates.
Definition at line 19308 of file qcustomplot.cpp.
References mWidth, and width().
Referenced by QCPStatisticalBox().
|
inline |
Definition at line 2941 of file qcustomplot.h.
|
inline |
Definition at line 2947 of file qcustomplot.h.
|
inline |
Definition at line 2946 of file qcustomplot.h.
|
inline |
Definition at line 2945 of file qcustomplot.h.
|
inline |
Definition at line 2944 of file qcustomplot.h.
Referenced by setWhiskerWidth(), and setWidth().
|
friend |
Definition at line 2993 of file qcustomplot.h.
|
friend |
Definition at line 2992 of file qcustomplot.h.
|
protected |
Definition at line 2974 of file qcustomplot.h.
Referenced by draw(), drawMedian(), drawOutliers(), drawQuartileBox(), drawWhiskers(), getKeyRange(), selectTest(), and setKey().
|
protected |
Definition at line 2974 of file qcustomplot.h.
Referenced by draw(), drawQuartileBox(), drawWhiskers(), getValueRange(), selectTest(), and setLowerQuartile().
|
protected |
Definition at line 2974 of file qcustomplot.h.
Referenced by draw(), drawWhiskers(), getValueRange(), selectTest(), and setMaximum().
|
protected |
Definition at line 2974 of file qcustomplot.h.
Referenced by draw(), drawMedian(), getValueRange(), and setMedian().
|
protected |
Definition at line 2977 of file qcustomplot.h.
Referenced by drawMedian(), and setMedianPen().
|
protected |
Definition at line 2974 of file qcustomplot.h.
Referenced by draw(), drawWhiskers(), getValueRange(), selectTest(), and setMinimum().
|
protected |
Definition at line 2973 of file qcustomplot.h.
Referenced by draw(), drawOutliers(), getValueRange(), and setOutliers().
|
protected |
Definition at line 2978 of file qcustomplot.h.
Referenced by drawOutliers(), and setOutlierStyle().
|
protected |
Definition at line 2974 of file qcustomplot.h.
Referenced by draw(), drawQuartileBox(), drawWhiskers(), getValueRange(), selectTest(), and setUpperQuartile().
|
protected |
Definition at line 2977 of file qcustomplot.h.
Referenced by drawWhiskers(), and setWhiskerBarPen().
|
protected |
Definition at line 2977 of file qcustomplot.h.
Referenced by drawWhiskers(), and setWhiskerPen().
|
protected |
Definition at line 2976 of file qcustomplot.h.
Referenced by drawWhiskers(), and setWhiskerWidth().
|
protected |
Definition at line 2975 of file qcustomplot.h.
Referenced by drawMedian(), drawQuartileBox(), getKeyRange(), selectTest(), and setWidth().
1.8.5