QAbstractBarSeries

The QAbstractBarSeries class is an abstract parent class for all bar series classes. More

Inheritance diagram of PySide6.QtCharts.QAbstractBarSeries

Inherited by: QStackedBarSeries, QPercentBarSeries, QHorizontalStackedBarSeries, QHorizontalPercentBarSeries, QHorizontalBarSeries, QBarSeries

Synopsis

Functions

Detailed Description

In bar charts, bars are defined as bar sets that contain one data value for each category. The position of a bar is specified by the category and its height by the data value. Bar series that contain multiple bar sets group together bars that belong to the same category. The way the bars are displayed is determined by the subclass of this class chosen to create the bar chart.

If a QValueAxis is used instead of QBarCategoryAxis for the main bar axis, the bars are grouped around the index value of the category.

See the bar chart example to learn how to use the QBarSeries class to create a simple bar chart.

class PySide6.QtCharts.QAbstractBarSeries
PySide6.QtCharts.QAbstractBarSeries.LabelsPosition

This enum value describes the position of the data value labels:

Constant

Description

QAbstractBarSeries.LabelsCenter

Label is located in the center of the bar.

QAbstractBarSeries.LabelsInsideEnd

Label is located inside the bar at the top.

QAbstractBarSeries.LabelsInsideBase

Label is located inside the bar at the bottom.

QAbstractBarSeries.LabelsOutsideEnd

Label is located outside the bar at the top.

PySide6.QtCharts.QAbstractBarSeries.append(sets)
Parameters

sets

Return type

bool

PySide6.QtCharts.QAbstractBarSeries.append(set)
Parameters

setPySide6.QtCharts.QBarSet

Return type

bool

Adds a set of bars specified by set to the bar series and takes ownership of it. If the set is null or it already belongs to the series, it will not be appended. Returns true if appending succeeded.

PySide6.QtCharts.QAbstractBarSeries.barSets()
Return type

Returns a list of bar sets in a bar series. Keeps the ownership of the bar sets.

PySide6.QtCharts.QAbstractBarSeries.barWidth()
Return type

float

Returns the width of the bars of the series.

See also

setBarWidth()

PySide6.QtCharts.QAbstractBarSeries.barsetsAdded(sets)
Parameters

sets

PySide6.QtCharts.QAbstractBarSeries.barsetsRemoved(sets)
Parameters

sets

PySide6.QtCharts.QAbstractBarSeries.clear()

Removes all bar sets from the series and permanently deletes them.

PySide6.QtCharts.QAbstractBarSeries.clicked(index, barset)
Parameters
PySide6.QtCharts.QAbstractBarSeries.count()
Return type

int

Returns the number of bar sets in a bar series.

PySide6.QtCharts.QAbstractBarSeries.countChanged()
PySide6.QtCharts.QAbstractBarSeries.doubleClicked(index, barset)
Parameters
PySide6.QtCharts.QAbstractBarSeries.hovered(status, index, barset)
Parameters
PySide6.QtCharts.QAbstractBarSeries.insert(index, set)
Parameters
Return type

bool

Inserts a bar set specified by set to a series at the position specified by index and takes ownership of the set. If the set is null or already belongs to the series, it will not be appended. Returns true if inserting succeeds.

PySide6.QtCharts.QAbstractBarSeries.isLabelsVisible()
Return type

bool

Returns the visibility of labels.

PySide6.QtCharts.QAbstractBarSeries.labelsAngle()
Return type

float

See also

setLabelsAngle()

PySide6.QtCharts.QAbstractBarSeries.labelsAngleChanged(angle)
Parameters

angle – float

PySide6.QtCharts.QAbstractBarSeries.labelsFormat()
Return type

str

PySide6.QtCharts.QAbstractBarSeries.labelsFormatChanged(format)
Parameters

format – str

PySide6.QtCharts.QAbstractBarSeries.labelsPosition()
Return type

LabelsPosition

PySide6.QtCharts.QAbstractBarSeries.labelsPositionChanged(position)
Parameters

positionLabelsPosition

PySide6.QtCharts.QAbstractBarSeries.labelsPrecision()
Return type

int

PySide6.QtCharts.QAbstractBarSeries.labelsPrecisionChanged(precision)
Parameters

precision – int

PySide6.QtCharts.QAbstractBarSeries.labelsVisibleChanged()
PySide6.QtCharts.QAbstractBarSeries.pressed(index, barset)
Parameters
PySide6.QtCharts.QAbstractBarSeries.released(index, barset)
Parameters
PySide6.QtCharts.QAbstractBarSeries.remove(set)
Parameters

setPySide6.QtCharts.QBarSet

Return type

bool

Removes the bar set specified by set from the series and permanently deletes it if the removal succeeds. Returns true if the set was removed.

PySide6.QtCharts.QAbstractBarSeries.setBarWidth(width)
Parameters

width – float

Sets the width of the bars of the series to width.

See also

barWidth()

PySide6.QtCharts.QAbstractBarSeries.setLabelsAngle(angle)
Parameters

angle – float

See also

labelsAngle()

PySide6.QtCharts.QAbstractBarSeries.setLabelsFormat(format)
Parameters

format – str

See also

labelsFormat()

PySide6.QtCharts.QAbstractBarSeries.setLabelsPosition(position)
Parameters

positionLabelsPosition

See also

labelsPosition()

PySide6.QtCharts.QAbstractBarSeries.setLabelsPrecision(precision)
Parameters

precision – int

PySide6.QtCharts.QAbstractBarSeries.setLabelsVisible([visible=true])
Parameters

visible – bool

Sets the visibility of labels in a bar series to visible.

PySide6.QtCharts.QAbstractBarSeries.take(set)
Parameters

setPySide6.QtCharts.QBarSet

Return type

bool

Takes a single set from the series. Does not delete the bar set object.

Note

The series remains the barset’s parent object. You must set the parent object to take full ownership.

Returns true if the take operation succeeds.