ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
QCPBarsGroup Class Reference

Groups multiple QCPBars together so they appear side by side. More...

#include <qcustomplot.h>

Inheritance diagram for QCPBarsGroup:
Collaboration diagram for QCPBarsGroup:

Public Types

enum  SpacingType {
  stAbsolute , stAxisRectRatio , stPlotCoords , stAbsolute ,
  stAxisRectRatio , stPlotCoords
}
 
enum  SpacingType {
  stAbsolute , stAxisRectRatio , stPlotCoords , 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
 
QCPBarsbars (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)
 
 QCPBarsGroup (QCustomPlot *parentPlot)
 
 ~QCPBarsGroup ()
 
SpacingType spacingType () const
 
double spacing () const
 
void setSpacingType (SpacingType spacingType)
 
void setSpacing (double spacing)
 
QList< QCPBars * > bars () const
 
QCPBarsbars (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)
 
void registerBars (QCPBars *bars)
 
void unregisterBars (QCPBars *bars)
 
double keyPixelOffset (const QCPBars *bars, double keyCoord)
 
double getPixelSpacing (const QCPBars *bars, double keyCoord)
 

Protected Attributes

QCustomPlotmParentPlot
 
SpacingType mSpacingType
 
double mSpacing
 
QList< QCPBars * > mBars
 

Detailed Description

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.)

Usage

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.

Example

The image above is generated with the following code:

Definition at line 6345 of file qcustomplot.h.

Member Enumeration Documentation

◆ SpacingType [1/2]

Defines the ways the spacing between bars in the group can be specified. Thus it defines what the number passed to setSpacing actually means.

See also
setSpacingType, setSpacing
Enumerator
stAbsolute 

Bar spacing is in absolute pixels.

stAxisRectRatio 

Bar spacing is given by a fraction of the axis rect size

stPlotCoords 

Bar spacing is in key coordinates and thus scales with the key axis range

stAbsolute 

Bar spacing is in absolute pixels.

stAxisRectRatio 

Bar spacing is given by a fraction of the axis rect size

stPlotCoords 

Bar spacing is in key coordinates and thus scales with the key axis range

Definition at line 6358 of file qcustomplot.h.

◆ SpacingType [2/2]

Defines the ways the spacing between bars in the group can be specified. Thus it defines what the number passed to setSpacing actually means.

See also
setSpacingType, setSpacing
Enumerator
stAbsolute 

Bar spacing is in absolute pixels.

stAxisRectRatio 

Bar spacing is given by a fraction of the axis rect size

stPlotCoords 

Bar spacing is in key coordinates and thus scales with the key axis range

stAbsolute 

Bar spacing is in absolute pixels.

stAxisRectRatio 

Bar spacing is given by a fraction of the axis rect size

stPlotCoords 

Bar spacing is in key coordinates and thus scales with the key axis range

Definition at line 3346 of file qcustomplot.h.

Constructor & Destructor Documentation

◆ QCPBarsGroup() [1/2]

QCPBarsGroup::QCPBarsGroup ( QCustomPlot parentPlot)
explicit

Constructs a new bars group for the specified QCustomPlot instance.

Definition at line 24736 of file qcustomplot.cpp.

◆ ~QCPBarsGroup() [1/2]

QCPBarsGroup::~QCPBarsGroup ( )
virtual

Definition at line 24742 of file qcustomplot.cpp.

References clear().

◆ QCPBarsGroup() [2/2]

QCPBarsGroup::QCPBarsGroup ( QCustomPlot parentPlot)

◆ ~QCPBarsGroup() [2/2]

QCPBarsGroup::~QCPBarsGroup ( )

Member Function Documentation

◆ append() [1/2]

void QCPBarsGroup::append ( QCPBars bars)

Adds the specified bars plottable to this group. Alternatively, you can also use QCPBars::setBarsGroup on the bars instance.

See also
insert, remove

Definition at line 24797 of file qcustomplot.cpp.

References bars(), and mBars.

◆ append() [2/2]

void QCPBarsGroup::append ( QCPBars bars)

◆ bars() [1/4]

QList< QCPBars * > QCPBarsGroup::bars ( ) const
inline

Returns all bars currently in this group.

See also
bars(int index)

Definition at line 6381 of file qcustomplot.h.

Referenced by append(), clear(), getPixelSpacing(), insert(), keyPixelOffset(), registerBars(), remove(), and unregisterBars().

◆ bars() [2/4]

QList<QCPBars *> QCPBarsGroup::bars ( ) const
inline

Definition at line 3367 of file qcustomplot.h.

◆ bars() [3/4]

QCPBars * QCPBarsGroup::bars ( int  index) const

Returns the QCPBars instance with the specified index in this group. If no such QCPBars exists, returns 0.

See also
bars(), size

Definition at line 24771 of file qcustomplot.cpp.

References mBars.

◆ bars() [4/4]

QCPBars* QCPBarsGroup::bars ( int  index) const

◆ clear() [1/2]

void QCPBarsGroup::clear ( )

Removes all QCPBars plottables from this group.

See also
isEmpty

Definition at line 24785 of file qcustomplot.cpp.

References bars(), and mBars.

Referenced by ~QCPBarsGroup().

◆ clear() [2/2]

void QCPBarsGroup::clear ( )

◆ contains() [1/2]

bool QCPBarsGroup::contains ( QCPBars bars) const
inline

Definition at line 6386 of file qcustomplot.h.

◆ contains() [2/2]

bool QCPBarsGroup::contains ( QCPBars bars) const
inline

Definition at line 3372 of file qcustomplot.h.

◆ getPixelSpacing() [1/2]

double QCPBarsGroup::getPixelSpacing ( const QCPBars bars,
double  keyCoord 
)
protected

Definition at line 24953 of file qcustomplot.cpp.

References bars(), mSpacing, mSpacingType, stAbsolute, stAxisRectRatio, and stPlotCoords.

Referenced by keyPixelOffset().

◆ getPixelSpacing() [2/2]

double QCPBarsGroup::getPixelSpacing ( const QCPBars bars,
double  keyCoord 
)
protected

◆ insert() [1/2]

void QCPBarsGroup::insert ( int  i,
QCPBars bars 
)

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.

See also
append, remove

Definition at line 24820 of file qcustomplot.cpp.

References bars(), and mBars.

◆ insert() [2/2]

void QCPBarsGroup::insert ( int  i,
QCPBars bars 
)

◆ isEmpty() [1/2]

bool QCPBarsGroup::isEmpty ( ) const
inline

Returns whether this bars group is empty.

See also
size

Definition at line 6384 of file qcustomplot.h.

◆ isEmpty() [2/2]

bool QCPBarsGroup::isEmpty ( ) const
inline

Definition at line 3370 of file qcustomplot.h.

◆ keyPixelOffset() [1/2]

double QCPBarsGroup::keyPixelOffset ( const QCPBars bars,
double  keyCoord 
)
protected

◆ keyPixelOffset() [2/2]

double QCPBarsGroup::keyPixelOffset ( const QCPBars bars,
double  keyCoord 
)
protected

◆ registerBars() [1/2]

void QCPBarsGroup::registerBars ( QCPBars bars)
protected

Definition at line 24857 of file qcustomplot.cpp.

References bars(), and mBars.

Referenced by QCPBars::setBarsGroup().

◆ registerBars() [2/2]

void QCPBarsGroup::registerBars ( QCPBars bars)
protected

◆ remove() [1/2]

void QCPBarsGroup::remove ( QCPBars bars)

Removes the specified bars plottable from this group.

See also
contains, clear

Definition at line 24837 of file qcustomplot.cpp.

References bars(), and mBars.

◆ remove() [2/2]

void QCPBarsGroup::remove ( QCPBars bars)

◆ setSpacing() [1/2]

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.

See also
setSpacingType

Definition at line 24763 of file qcustomplot.cpp.

References mSpacing, and spacing().

◆ setSpacing() [2/2]

void QCPBarsGroup::setSpacing ( double  spacing)

◆ setSpacingType() [1/2]

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.

See also
setSpacing

Definition at line 24752 of file qcustomplot.cpp.

References mSpacingType, and spacingType().

◆ setSpacingType() [2/2]

void QCPBarsGroup::setSpacingType ( SpacingType  spacingType)

◆ size() [1/2]

int QCPBarsGroup::size ( ) const
inline

Returns the number of QCPBars plottables that are part of this group.

Definition at line 6383 of file qcustomplot.h.

◆ size() [2/2]

int QCPBarsGroup::size ( ) const
inline

Definition at line 3369 of file qcustomplot.h.

◆ spacing() [1/2]

double QCPBarsGroup::spacing ( ) const
inline

Definition at line 6374 of file qcustomplot.h.

Referenced by setSpacing().

◆ spacing() [2/2]

double QCPBarsGroup::spacing ( ) const
inline

Definition at line 3360 of file qcustomplot.h.

◆ spacingType() [1/2]

SpacingType QCPBarsGroup::spacingType ( ) const
inline

Definition at line 6373 of file qcustomplot.h.

Referenced by setSpacingType().

◆ spacingType() [2/2]

SpacingType QCPBarsGroup::spacingType ( ) const
inline

Definition at line 3359 of file qcustomplot.h.

◆ unregisterBars() [1/2]

void QCPBarsGroup::unregisterBars ( QCPBars bars)
protected

Definition at line 24868 of file qcustomplot.cpp.

References bars(), and mBars.

Referenced by QCPBars::setBarsGroup().

◆ unregisterBars() [2/2]

void QCPBarsGroup::unregisterBars ( QCPBars bars)
protected

Member Data Documentation

◆ mBars

QList< QCPBars * > QCPBarsGroup::mBars
protected

◆ mParentPlot

QCustomPlot * QCPBarsGroup::mParentPlot
protected

Definition at line 6393 of file qcustomplot.h.

◆ mSpacing

double QCPBarsGroup::mSpacing
protected

Definition at line 6395 of file qcustomplot.h.

Referenced by getPixelSpacing(), and setSpacing().

◆ mSpacingType

SpacingType QCPBarsGroup::mSpacingType
protected

Definition at line 6394 of file qcustomplot.h.

Referenced by getPixelSpacing(), and setSpacingType().


The documentation for this class was generated from the following files: