SimCenterCommon
Common functionality used within different SimCenter projects
|
Groups multiple QCPBars together so they appear side by side. More...
#include <qcustomplot.h>
Public Types | |
enum | SpacingType { stAbsolute, stAxisRectRatio, stPlotCoords } |
Public Member Functions | |
QCPBarsGroup (QCustomPlot *parentPlot) | |
virtual | ~QCPBarsGroup () |
SpacingType | spacingType () const |
double | spacing () const |
void | setSpacingType (SpacingType spacingType) |
void | setSpacing (double spacing) |
QList< QCPBars * > | bars () const |
QCPBars * | bars (int index) const |
int | size () const |
bool | isEmpty () const |
void | clear () |
bool | contains (QCPBars *bars) const |
void | append (QCPBars *bars) |
void | insert (int i, QCPBars *bars) |
void | remove (QCPBars *bars) |
Protected Member Functions | |
void | registerBars (QCPBars *bars) |
void | unregisterBars (QCPBars *bars) |
double | keyPixelOffset (const QCPBars *bars, double keyCoord) |
double | getPixelSpacing (const QCPBars *bars, double keyCoord) |
Protected Attributes | |
QCustomPlot * | mParentPlot |
SpacingType | mSpacingType |
double | mSpacing |
QList< QCPBars * > | mBars |
Friends | |
class | QCPBars |
Groups multiple QCPBars together so they appear side by side.
When showing multiple QCPBars in one plot which have bars at identical keys, it may be desirable to have them appearing next to each other at each key. This is what adding the respective QCPBars plottables to a QCPBarsGroup achieves. (An alternative approach is to stack them on top of each other, see QCPBars::moveAbove.)
To add a QCPBars plottable to the group, create a new group and then add the respective bars intances:
Alternatively to appending to the group like shown above, you can also set the group on the QCPBars plottable via QCPBars::setBarsGroup.
The spacing between the bars can be configured via setSpacingType and setSpacing. The bars in this group appear in the plot in the order they were appended. To insert a bars plottable at a certain index position, or to reposition a bars plottable which is already in the group, use insert.
To remove specific bars from the group, use either remove or call QCPBars::setBarsGroup(0) on the respective bars plottable.
To clear the entire group, call clear, or simply delete the group.
The image above is generated with the following code:
Definition at line 5341 of file qcustomplot.h.
Defines the ways the spacing between bars in the group can be specified. Thus it defines what the number passed to setSpacing actually means.
Definition at line 5355 of file qcustomplot.h.
QCPBarsGroup::QCPBarsGroup | ( | QCustomPlot * | parentPlot | ) |
Constructs a new bars group for the specified QCustomPlot instance.
Definition at line 22823 of file qcustomplot.cpp.
|
virtual |
Definition at line 22831 of file qcustomplot.cpp.
void QCPBarsGroup::append | ( | QCPBars * | bars | ) |
Adds the specified bars plottable to this group. Alternatively, you can also use QCPBars::setBarsGroup on the bars instance.
Definition at line 22894 of file qcustomplot.cpp.
|
inline |
Returns all bars currently in this group.
Definition at line 5373 of file qcustomplot.h.
void QCPBarsGroup::clear | ( | void | ) |
Removes all QCPBars plottables from this group.
Definition at line 22882 of file qcustomplot.cpp.
|
inline |
Returns whether the specified bars plottable is part of this group.
Definition at line 5378 of file qcustomplot.h.
|
protected |
Definition at line 23048 of file qcustomplot.cpp.
Inserts the specified bars plottable into this group at the specified index position i. This gives you full control over the ordering of the bars.
bars may already be part of this group. In that case, bars is just moved to the new index position.
Definition at line 22917 of file qcustomplot.cpp.
|
inline |
Returns whether this bars group is empty.
Definition at line 5376 of file qcustomplot.h.
|
protected |
Definition at line 22982 of file qcustomplot.cpp.
|
protected |
Definition at line 22958 of file qcustomplot.cpp.
void QCPBarsGroup::remove | ( | QCPBars * | bars | ) |
Removes the specified bars plottable from this group.
Definition at line 22937 of file qcustomplot.cpp.
void QCPBarsGroup::setSpacing | ( | double | spacing | ) |
Sets the spacing between adjacent bars. What the number passed as spacing actually means, is defined by the current SpacingType, which can be set with setSpacingType.
Definition at line 22854 of file qcustomplot.cpp.
void QCPBarsGroup::setSpacingType | ( | SpacingType | spacingType | ) |
Sets how the spacing between adjacent bars is interpreted. See SpacingType.
The actual spacing can then be specified with setSpacing.
Definition at line 22843 of file qcustomplot.cpp.
|
inline |
Returns the number of QCPBars plottables that are part of this group.
Definition at line 5375 of file qcustomplot.h.
|
inline |
Definition at line 5366 of file qcustomplot.h.
|
inline |
Definition at line 5365 of file qcustomplot.h.
|
protected |
Definition at line 22971 of file qcustomplot.cpp.
|
friend |
Definition at line 5401 of file qcustomplot.h.
|
protected |
Definition at line 5388 of file qcustomplot.h.
|
protected |
Definition at line 5385 of file qcustomplot.h.
|
protected |
Definition at line 5387 of file qcustomplot.h.
|
protected |
Definition at line 5386 of file qcustomplot.h.