Qt 5.7 | Qt Charts | C++ Classes | QBarSet

Qt 5.7.1 Reference Documentation

# QBarSet Class

Building block for different bar charts. More...

Header: | #include <QBarSet>
Instantiated By: | BarSet

- List of all members, including inherited members

## Properties

borderColor : QColor brush : QBrush color : QColor label : QString | labelBrush : QBrush labelColor : QColor labelFont : QFont pen : QPen

## Public Functions

| QBarSet(const QString label, QObject *parent = Q_NULLPTR)
virtual | ~QBarSet()
void | append(const qreal value)
void | append(const QList<qreal> &values)
qreal | at(const int index) const
QColor | borderColor()
QBrush | brush() const
QColor | color()
int | count() const
void | insert(const int index, const qreal value)
QString | label() const
QBrush | labelBrush() const
QColor | labelColor()
QFont | labelFont() const
QPen | pen() const
void | remove(const int index, const int count = 1)
void | replace(const int index, const qreal value)
void | setBorderColor(QColor color)
void | setBrush(const QBrush &brush)
void | setColor(QColor color)
void | setLabel(const QString label)
void | setLabelBrush(const QBrush &brush)
void | setLabelColor(QColor color)
void | setLabelFont(const QFont &font)
void | setPen(const QPen &pen)
qreal | sum() const
QBarSet & | operator<<(const qreal &value)
qreal | operator[](const int index) const

## Signals

void | borderColorChanged(QColor color)
void | brushChanged()
void | clicked(int index)
void | colorChanged(QColor color)
void | doubleClicked(int index)
void | hovered(bool status, int index)
void | labelBrushChanged()
void | labelChanged()
void | labelColorChanged(QColor color)
void | labelFontChanged()
void | penChanged()
void | pressed(int index)
void | released(int index)
void | valueChanged(int index)
void | valuesAdded(int index, int count)
void | valuesRemoved(int index, int count)

## Detailed Description

Building block for different bar charts.

QBarSet represents one set of bars. Set of bars contains one data value for each category. First value of set is assumed to belong to first category, second to second category and so on. If set has fewer values than there are categories, then the missing values are assumed to be at the end of set. For missing values in middle of a set, numerical value of zero is used. Labels for zero value sets are not shown.

See also QAbstractBarSeries, QBarSeries, QStackedBarSeries, and QPercentBarSeries.

## Property Documentation

### borderColor : QColor

The line (pen) color of the bar set.

Access functions:

QColor | borderColor()
void | setBorderColor(QColor color)

Notifier signal:

void | borderColorChanged(QColor color)

### brush : QBrush

This property defines the brush used by the bar set.

Access functions:

QBrush | brush() const
void | setBrush(const QBrush &brush)

Notifier signal:

void | brushChanged()

### color : QColor

The fill (brush) color of the bar set.

Access functions:

QColor | color()
void | setColor(QColor color)

Notifier signal:

void | colorChanged(QColor color)

### label : QString

Defines the label of the bar set.

Access functions:

QString | label() const
void | setLabel(const QString label)

Notifier signal:

void | labelChanged()

### labelBrush : QBrush

This property defines the brush used by the bar set's label.

Access functions:

QBrush | labelBrush() const
void | setLabelBrush(const QBrush &brush)

Notifier signal:

void | labelBrushChanged()

### labelColor : QColor

The text (label) color of the bar set.

Access functions:

QColor | labelColor()
void | setLabelColor(QColor color)

Notifier signal:

void | labelColorChanged(QColor color)

### labelFont : QFont

This property defines the font used by the bar set's label.

Access functions:

QFont | labelFont() const
void | setLabelFont(const QFont &font)

Notifier signal:

void | labelFontChanged()

### pen : QPen

This property defines the pen used by the bar set.

Access functions:

QPen | pen() const
void | setPen(const QPen &pen)

Notifier signal:

void | penChanged()

## Member Function Documentation

### QBarSet::QBarSet(const QString label, QObject *parent = Q_NULLPTR)

Constructs QBarSet with a label of label and with parent of parent.

### `[virtual]` QBarSet::~QBarSet()

Destroys the bar set.

### void QBarSet::append(const qreal value)

Appends new value value to the end of set.

### void QBarSet::append(const QList<qreal> &values)

Appends a list of reals to set. Works like append with single real value. The values in list are appended to end of bar set.

See also append().

### qreal QBarSet::at(const int index) const

Returns value of set indexed by index. If the index is out of bounds 0.0 is returned.

### QColor QBarSet::borderColor()

Returns the color of pen of this bar set.

Note: Getter function for property borderColor.

See also setBorderColor().

### `[signal]` void QBarSet::borderColorChanged(QColor color)

This signal is emitted when the line (pen) color of the set has changed to color.

Note: Notifier signal for property borderColor.

### QBrush QBarSet::brush() const

Returns brush of the set.

Note: Getter function for property brush.

See also setBrush().

### `[signal]` void QBarSet::brushChanged()

This signal is emitted when the brush of the bar set has changed.

Note: Notifier signal for property brush.

See also brush.

### `[signal]` void QBarSet::clicked(int index)

The signal is emitted if the user clicks with a mouse on top of bar set. Clicked bar inside set is indexed by index

### QColor QBarSet::color()

Returns the color of the brush of bar set.

Note: Getter function for property color.

See also setColor().

### `[signal]` void QBarSet::colorChanged(QColor color)

This signal is emitted when the fill (brush) color of the set has changed to color.

Note: Notifier signal for property color.

### int QBarSet::count() const

Returns count of values in set.

### `[signal]` void QBarSet::doubleClicked(int index)

The signal is emitted if the user doubleclicks with a mouse on top of bar set. Doubleclicked bar inside set is indexed by index

### `[signal]` void QBarSet::hovered(bool status, int index)

The signal is emitted if mouse is hovered on top of bar set. Parameter status is true, if mouse entered on top of bar set, false if mouse left from top of bar set. Hovered bar inside the set is indexed by index.

### void QBarSet::insert(const int index, const qreal value)

Inserts new value on the index position. The value that is currently at this postion is moved to position index + 1

See also remove().

### QString QBarSet::label() const

Returns label of the set.

Note: Getter function for property label.

See also setLabel().

### QBrush QBarSet::labelBrush() const

Returns brush of the values that are drawn on top of this bar set.

Note: Getter function for property labelBrush.

See also setLabelBrush().

### `[signal]` void QBarSet::labelBrushChanged()

This signal is emitted when the brush of the bar set's label has changed.

Note: Notifier signal for property labelBrush.

See also labelBrush.

### `[signal]` void QBarSet::labelChanged()

This signal is emitted when the label of the bar set has changed.

Note: Notifier signal for property label.

See also label.

### QColor QBarSet::labelColor()

Returns the color of labels of this bar set.

Note: Getter function for property labelColor.

See also setLabelColor().

### `[signal]` void QBarSet::labelColorChanged(QColor color)

This signal is emitted when the text (label) color of the set has changed to color.

Note: Notifier signal for property labelColor.

### QFont QBarSet::labelFont() const

Returns the pen for values that are drawn on top of this bar set.

Note: Getter function for property labelFont.

See also setLabelFont().

### `[signal]` void QBarSet::labelFontChanged()

This signal is emitted when the font of the bar set's label has changed.

Note: Notifier signal for property labelFont.

See also labelBrush.

### QPen QBarSet::pen() const

Returns pen of the set.

Note: Getter function for property pen.

See also setPen().

### `[signal]` void QBarSet::penChanged()

This signal is emitted when the pen of the bar set has changed.

Note: Notifier signal for property pen.

See also pen.

### `[signal]` void QBarSet::pressed(int index)

The signal is emitted if the user presses with a mouse on top of bar set. Pressed bar inside set is indexed by index

### `[signal]` void QBarSet::released(int index)

The signal is emitted if the user releases with a mouse on top of bar set. Released bar inside set is indexed by index

### void QBarSet::remove(const int index, const int count = 1)

Removes count number of values from the set starting at index.

See also insert().

### void QBarSet::replace(const int index, const qreal value)

Sets a new value value to set, indexed by index.

### void QBarSet::setBorderColor(QColor color)

Sets the color of pen for this bar set.

Note: Setter function for property borderColor.

See also borderColor().

### void QBarSet::setBrush(const QBrush &brush)

Sets brush for the set. Bars of this set are drawn using brush.

Note: Setter function for property brush.

See also brush().

### void QBarSet::setColor(QColor color)

Sets the color of brush for this bar set.

Note: Setter function for property color.

See also color().

### void QBarSet::setLabel(const QString label)

Sets new label for set.

Note: Setter function for property label.

See also label().

### void QBarSet::setLabelBrush(const QBrush &brush)

Sets brush of the values that are drawn on top of this bar set.

Note: Setter function for property labelBrush.

See also labelBrush().

### void QBarSet::setLabelColor(QColor color)

Sets the color of labels for this bar set.

Note: Setter function for property labelColor.

See also labelColor().

### void QBarSet::setLabelFont(const QFont &font)

Sets the font for values that are drawn on top of this bar set.

Note: Setter function for property labelFont.

See also labelFont().

### void QBarSet::setPen(const QPen &pen)

Sets pen for set. Bars of this set are drawn using pen

Note: Setter function for property pen.

See also pen().

### qreal QBarSet::sum() const

Returns sum of all values in the bar set.

### `[signal]` void QBarSet::valueChanged(int index)

This signal is emitted values the value in the set has been modified. Parameter index indicates the position of the modified value.

See also at().

### `[signal]` void QBarSet::valuesAdded(int index, int count)

This signal is emitted when new values have been added to the set. Parameter index indicates the position of the first inserted value. Parameter count is the number of inserted values.

See also append() and insert().

### `[signal]` void QBarSet::valuesRemoved(int index, int count)

This signal is emitted values have been removed from the set. Parameter index indicates the position of the first removed value. Parameter count is the number of removed values.

See also remove().

### QBarSet &QBarSet::operator<<(const qreal &value)

Convenience operator. Same as append, with real value.

See also append().

### qreal QBarSet::operator[](const int index) const

Returns value of set indexed by index. If the index is out of bounds 0.0 is returned.