QAbstractBarSeries#
The QAbstractBarSeries class is an abstract parent class for all bar series classes. More…
Inherited by: QStackedBarSeries, QPercentBarSeries, QHorizontalStackedBarSeries, QHorizontalPercentBarSeries, QHorizontalBarSeries, QBarSeries
Synopsis#
Properties#
- barWidth- Width of the bars of the series
- count- Number of bar sets in a bar series
- labelsAngle- Angle of the value labels in degrees
- labelsFormat- Format used for showing labels in a bar series
- labelsPosition- Position of value labels
- labelsPrecision- Maximum amount of significant digits shown in value labels
- labelsVisible- Visibility of the labels in a bar series
Functions#
- def - append(sets)
- def - append(set)
- def - barSets()
- def - barWidth()
- def - clear()
- def - count()
- def - insert(index, set)
- def - isLabelsVisible()
- def - labelsAngle()
- def - labelsFormat()
- def - labelsPosition()
- def - labelsPrecision()
- def - remove(set)
- def - setBarWidth(width)
- def - setLabelsAngle(angle)
- def - setLabelsFormat(format)
- def - setLabelsPosition(position)
- def - setLabelsPrecision(precision)
- def - setLabelsVisible([visible=true])
- def - take(set)
Signals#
- def - barsetsAdded(sets)
- def - barsetsRemoved(sets)
- def - clicked(index, barset)
- def - countChanged()
- def - doubleClicked(index, barset)
- def - hovered(status, index, barset)
- def - labelsAngleChanged(angle)
- def - labelsFormatChanged(format)
- def - labelsPositionChanged(position)
- def - labelsPrecisionChanged(precision)
- def - labelsVisibleChanged()
- def - pressed(index, barset)
- def - released(index, barset)
Note
This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE
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#
Note
Properties can be used directly when from __feature__ import true_property is used or via accessor functions otherwise.
- property PᅟySide6.QtCharts.QAbstractBarSeries.barWidth: float#
This property holds The width of the bars of the series..
The unit of width is the unit of the x-axis. The minimum width for bars is zero, and negative values are treated as zero. Setting the width to zero means that the width of the bar on the screen is one pixel regardless of the scale of the x-axis. Bars wider than zero are scaled using the x-axis scale.
Note
When used with QBarSeries , this value specifies the width of a group of bars instead of that of a single bar.
See also
- Access functions:
- barWidth()
- setBarWidth(width)
 
- property PᅟySide6.QtCharts.QAbstractBarSeries.count: int#
This property holds The number of bar sets in a bar series..
- Access functions:
- count()
- Signal - countChanged()
 
- property PᅟySide6.QtCharts.QAbstractBarSeries.labelsAngle: float#
This property holds The angle of the value labels in degrees..
- Access functions:
- labelsAngle()
- setLabelsAngle(angle)
- Signal - labelsAngleChanged(angle)
 
- property PᅟySide6.QtCharts.QAbstractBarSeries.labelsFormat: str#
This property holds The format used for showing labels in a bar series..
QAbstractBarSeries supports the following format tag:
@value
The value of the bar
For example, the following usage of the format tags would produce labels that show the value followed by the unit (u):
series->setLabelsFormat("@value u");
By default, the labels show the value of the bar. For the percent bar series, % is added after the value. The labels are shown on the plot area, if the bars are close to each other, the labels may overlap.
See also
labelsVisiblelabelsPositionlabelsPrecision
- Access functions:
- labelsFormat()
- setLabelsFormat(format)
- Signal - labelsFormatChanged(format)
 
- property PᅟySide6.QtCharts.QAbstractBarSeries.labelsPosition: LabelsPosition#
This property holds The position of value labels..
See also
labelsVisiblelabelsFormat
- Access functions:
- setLabelsPosition(position)
- Signal - labelsPositionChanged(position)
 
- property PᅟySide6.QtCharts.QAbstractBarSeries.labelsPrecision: int#
This property holds The maximum amount of significant digits shown in value labels..
Default value is 6.
- Access functions:
- setLabelsPrecision(precision)
- Signal - labelsPrecisionChanged(precision)
 
- property PᅟySide6.QtCharts.QAbstractBarSeries.labelsVisible: bool#
This property holds The visibility of the labels in a bar series..
- Access functions:
- setLabelsVisible([visible=true])
- Signal - labelsVisibleChanged()
 
- 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 
 
Adds a list of bar sets specified by sets to a bar series and takes ownership of the sets. Returns true if all sets were appended successfully. If any of the sets is null or was previously appended to the series, nothing is appended and this function returns false. If any of the sets appears in the list more than once, nothing is appended and this function returns false.
- PySide6.QtCharts.QAbstractBarSeries.append(set)
- Parameters:
- set – - PySide6.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
Getter of property barWidth .
- PySide6.QtCharts.QAbstractBarSeries.barsetsAdded(sets)#
- Parameters:
- sets – 
 
This signal is emitted when the bar sets specified by sets are added to the series.
- PySide6.QtCharts.QAbstractBarSeries.barsetsRemoved(sets)#
- Parameters:
- sets – 
 
This signal is emitted when the bar sets specified by sets are removed from the series.
See also
- PySide6.QtCharts.QAbstractBarSeries.clear()#
Removes all bar sets from the series and permanently deletes them.
- PySide6.QtCharts.QAbstractBarSeries.clicked(index, barset)#
- Parameters:
- index – int 
- barset – - PySide6.QtCharts.QBarSet
 
 
This signal is emitted when the user clicks the bar specified by index in the bar set specified by barset.
- PySide6.QtCharts.QAbstractBarSeries.count()#
- Return type:
- int 
 
Returns the number of bar sets in a bar series.
Getter of property count .
- PySide6.QtCharts.QAbstractBarSeries.countChanged()#
This signal is emitted when the number of bar sets is changed, for example by append() or remove() .
Notification signal of property count .
- PySide6.QtCharts.QAbstractBarSeries.doubleClicked(index, barset)#
- Parameters:
- index – int 
- barset – - PySide6.QtCharts.QBarSet
 
 
This signal is emitted when the user double-clicks the bar specified by index in the bar set specified by barset.
- PySide6.QtCharts.QAbstractBarSeries.hovered(status, index, barset)#
- Parameters:
- status – bool 
- index – int 
- barset – - PySide6.QtCharts.QBarSet
 
 
This signal is emitted when a mouse is hovered over the bar specified by index in the bar set specified by barset. When the mouse moves over the bar, status turns true, and when the mouse moves away again, it turns false.
- PySide6.QtCharts.QAbstractBarSeries.insert(index, set)#
- Parameters:
- index – int 
- set – - PySide6.QtCharts.QBarSet
 
- 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.
Getter of property labelsVisible .
- PySide6.QtCharts.QAbstractBarSeries.labelsAngle()#
- Return type:
- float 
 - See also 
Getter of property labelsAngle .
- PySide6.QtCharts.QAbstractBarSeries.labelsAngleChanged(angle)#
- Parameters:
- angle – float 
 
This signal is emitted when the angle of the value labels changes.
Notification signal of property labelsAngle .
- PySide6.QtCharts.QAbstractBarSeries.labelsFormat()#
- Return type:
- str 
 - See also 
Getter of property labelsFormat .
- PySide6.QtCharts.QAbstractBarSeries.labelsFormatChanged(format)#
- Parameters:
- format – str 
 
This signal is emitted when the format of data value labels changes.
Notification signal of property labelsFormat .
- PySide6.QtCharts.QAbstractBarSeries.labelsPosition()#
- Return type:
 - See also 
Getter of property labelsPosition .
- PySide6.QtCharts.QAbstractBarSeries.labelsPositionChanged(position)#
- Parameters:
- position – - LabelsPosition
 
This signal is emitted when the position of value labels changes.
Notification signal of property labelsPosition .
- PySide6.QtCharts.QAbstractBarSeries.labelsPrecision()#
- Return type:
- int 
 - See also 
Getter of property labelsPrecision .
- PySide6.QtCharts.QAbstractBarSeries.labelsPrecisionChanged(precision)#
- Parameters:
- precision – int 
 
This signal is emitted when the precision of the value labels changes.
Notification signal of property labelsPrecision .
- PySide6.QtCharts.QAbstractBarSeries.labelsVisibleChanged()#
This signal is emitted when the labels’ visibility changes.
See also
Notification signal of property labelsVisible .
- PySide6.QtCharts.QAbstractBarSeries.pressed(index, barset)#
- Parameters:
- index – int 
- barset – - PySide6.QtCharts.QBarSet
 
 
This signal is emitted when the user clicks the bar specified by index in the bar set specified by barset and holds down the mouse button.
- PySide6.QtCharts.QAbstractBarSeries.released(index, barset)#
- Parameters:
- index – int 
- barset – - PySide6.QtCharts.QBarSet
 
 
This signal is emitted when the user releases the mouse press on the bar specified by index in the bar set specified by barset.
- PySide6.QtCharts.QAbstractBarSeries.remove(set)#
- Parameters:
- set – - PySide6.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
Setter of property barWidth .
- PySide6.QtCharts.QAbstractBarSeries.setLabelsAngle(angle)#
- Parameters:
- angle – float 
 - See also 
Setter of property labelsAngle .
- PySide6.QtCharts.QAbstractBarSeries.setLabelsFormat(format)#
- Parameters:
- format – str 
 - See also 
Setter of property labelsFormat .
- PySide6.QtCharts.QAbstractBarSeries.setLabelsPosition(position)#
- Parameters:
- position – - LabelsPosition
 - See also 
Setter of property labelsPosition .
- PySide6.QtCharts.QAbstractBarSeries.setLabelsPrecision(precision)#
- Parameters:
- precision – int 
 - See also 
Setter of property labelsPrecision .
- PySide6.QtCharts.QAbstractBarSeries.setLabelsVisible([visible=true])#
- Parameters:
- visible – bool 
 
Sets the visibility of labels in a bar series to visible.
See also
Setter of property labelsVisible .
- PySide6.QtCharts.QAbstractBarSeries.take(set)#
- Parameters:
- set – - PySide6.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.
