PySide6.QtGraphs.QBarSet¶
- class QBarSet¶
- The - QBarSetclass represents one set of bars in a bar graph.- Details- A bar set contains one data value for each category. The first value of a set is assumed to belong to the first category, the second one to the second category, and so on. If the set has fewer values than there are categories, the missing values are assumed to be located at the end of the set. For missing values in the middle of a set, the numerical value of zero is used. Labels for zero value sets are not shown. - See also - Synopsis¶- Properties¶- borderColorᅟ- Border color of the bar set
- borderWidthᅟ- Width of the border line. By default, the width is -1, meaning the border width is defined by the theme
- colorᅟ- Fill color of the bar set
- countᅟ- Number of values in the bar set
- labelᅟ- Of the bar set
- labelColorᅟ- Text (label) color of the bar set
- selectedBarsᅟ- Indexes of the bars which are currently selected
- selectedColorᅟ- Fill color of the selected set
- valuesᅟ- Of the bar set
 - Methods¶- def - __init__()
- def - append()
- def - at()
- def - borderColor()
- def - borderWidth()
- def - clear()
- def - color()
- def - count()
- def - deselectBar()
- def - deselectBars()
- def - insert()
- def - isBarSelected()
- def - label()
- def - labelColor()
- def - __lshift__()
- def - operator[]()
- def - remove()
- def - replace()
- def - selectAllBars()
- def - selectBar()
- def - selectBars()
- def - selectedBars()
- def - selectedColor()
- def - setBarSelected()
- def - setBorderColor()
- def - setBorderWidth()
- def - setColor()
- def - setLabel()
- def - setLabelColor()
- def - setValues()
- def - sum()
- def - values()
 - Signals¶
- def - colorChanged()
- def - countChanged()
- def - labelChanged()
- def - update()
- def - updatedBars()
- def - valueAdded()
- def - valueChanged()
- def - valueRemoved()
- def - valuesAdded()
- def - valuesChanged()
- def - valuesRemoved()
 - 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 - Note - Properties can be used directly when - from __feature__ import true_propertyis used or via accessor functions otherwise.- This property holds The border color of the bar set.. - Access functions:
 - property borderWidthᅟ: float¶
 - This property holds The width of the border line. By default, the width is -1, meaning the border width is defined by the theme.. - Access functions:
 - This property holds The fill color of the bar set.. - Access functions:
- Signal - colorChanged()
 
 - property countᅟ: int¶
 - This property holds The number of values in the bar set.. - Access functions:
- Signal - countChanged()
 
 - property labelᅟ: str¶
 - This property holds The label of the bar set.. - Access functions:
- Signal - labelChanged()
 
 - This property holds The text (label) color of the bar set.. - Access functions:
 - property selectedBarsᅟ: list of qsizetype¶
 - This property holds The indexes of the bars which are currently selected.. - Access functions:
 - This property holds The fill color of the selected set.. - Access functions:
 - property valuesᅟ: list of QVariant¶
 - This property holds The values of the bar set.. - You can set a list of either real or point types as values. - If you set a list of real types as values, they directly define the bar set values. - If you set a list of point types as values, the x-coordinate of the point specifies its zero-based index in the bar set. The size of the bar set is the highest x-coordinate value + 1. If a point is missing for any x-coordinate between zero and the highest value, it gets the value zero. - Access functions:
- Signal - valuesChanged()
 
 - __init__(label[, parent=None])
- Parameters:
- label – str 
- parent – - QObject
 
 
 - Constructs a bar set with the label - labeland the parent- parent.- append(values)¶
- Parameters:
- values – .list of qreal 
 
 - Appends the list of real values specified by - valuesto the end of the bar set.- See also - append(value)
- Parameters:
- value – float 
 
 - Appends the new value specified by - valueto the end of the bar set.- at(index)¶
- Parameters:
- index – int 
- Return type:
- float 
 
 - Returns the value specified by - indexfrom the bar set. If the index is out of bounds, 0.0 is returned.- Returns the line color for the bar set. - See also - Getter of property - borderColorᅟ.- Notification signal of property - borderColorᅟ.- borderWidth()¶
- Return type:
- float 
 - See also 
 - Getter of property - borderWidthᅟ.- borderWidthChanged(width)¶
- Parameters:
- width – float 
 
 - Notification signal of property - borderWidthᅟ.- clear()¶
 - Removes all values from the set. - Returns the fill color for the bar set. - See also - Getter of property - colorᅟ.- Notification signal of property - colorᅟ.- count()¶
- Return type:
- int 
 
 - Returns the number of values in a bar set. - Getter of property - countᅟ.- countChanged()¶
 - Notification signal of property - countᅟ.- deselectAllBars()¶
 - Deselects all bars in the set. - deselectBar(index)¶
- Parameters:
- index – int 
 
 - Deselects the bar at - index.- deselectBars(indexes)¶
- Parameters:
- indexes – .list of qsizetype 
 
 - Marks multiple bars passed in an - indexeslist as deselected.- insert(index, value)¶
- Parameters:
- index – int 
- value – float 
 
 
 - Inserts - valuein the position specified by- index. The values following the inserted value are moved up one position.- See also - isBarSelected(index)¶
- Parameters:
- index – int 
- Return type:
- bool 
 
 - Returns - trueif the bar at the given- indexis among selected bars and- falseotherwise.- Note - Selected bars are drawn using the selected color if it was specified using - setSelectedColor.- label()¶
- Return type:
- str 
 
 - Returns the label of the bar set. - See also - Getter of property - labelᅟ.- labelChanged()¶
 - Notification signal of property - labelᅟ.- Returns the text color for the bar set. - See also - Getter of property - labelColorᅟ.- Notification signal of property - labelColorᅟ.- A convenience operator for appending the real value specified by - valueto the end of the bar set.- See also - operator(index)¶
- Parameters:
- index – int 
- Return type:
- float 
 
 - Returns the value of the bar set specified by - index. If the index is out of bounds, 0.0 is returned.- remove(index[, count=1])¶
- Parameters:
- index – int 
- count – int 
 
 
 - Removes the number of values specified by - countfrom the bar set starting with the value specified by- index.- See also - replace(index, value)¶
- Parameters:
- index – int 
- value – float 
 
 
 - Adds the value specified by - valueto the bar set at the position specified by- index.- selectAllBars()¶
 - Marks all bars in the set as selected. - selectBar(index)¶
- Parameters:
- index – int 
 
 - Marks the bar at - indexas selected.- selectBars(indexes)¶
- Parameters:
- indexes – .list of qsizetype 
 
 - Marks multiple bars passed in an - indexeslist as selected.- selectedBars()¶
- Return type:
- .list of qsizetype 
 
 - Returns a list of bars marked as selected. - See also - Getter of property - selectedBarsᅟ.- selectedBarsChanged(indexes)¶
- Parameters:
- indexes – .list of qsizetype 
 
 - This signal is emitted when the selected bar changes. - indexesis a list selected bar indexes.- Notification signal of property - selectedBarsᅟ.- Returns the color of the selected bars. - This is the fill (brush) color of bars marked as selected. If not specified, value of - coloris used as default.- See also - Getter of property - selectedColorᅟ.- Notification signal of property - selectedColorᅟ.- setBarSelected(index, selected)¶
- Parameters:
- index – int 
- selected – bool 
 
 
 - Marks the bar at - indexas either selected or deselected as specified by- selected.- Note - Selected bars are drawn using the selected color if it was specified. Emits - selectedBarsChanged.- See also - Sets the line color for the bar set to - color.- See also - Setter of property - borderColorᅟ.- setBorderWidth(borderWidth)¶
- Parameters:
- borderWidth – float 
 - See also 
 - Setter of property - borderWidthᅟ.- Sets the fill color for the bar set to - color.- See also - Setter of property - colorᅟ.- setLabel(label)¶
- Parameters:
- label – str 
 
 - Sets - labelas the new label for the bar set.- See also - Setter of property - labelᅟ.- Sets the text color for the bar set to - color.- See also - Setter of property - labelColorᅟ.- Sets the - colorof the selected bars.- See also - Setter of property - selectedColorᅟ.- Setter of property - valuesᅟ.- sum()¶
- Return type:
- float 
 
 - Returns the sum of all values in the bar set. - toggleSelection(indexes)¶
- Parameters:
- indexes – .list of qsizetype 
 
 - Changes the selection state of bars at the given - indexesto the opposite one.- update()¶
 - This signal is emitted when the barset is updated. - updatedBars()¶
 - This signal is emitted when the bars in this set are updated. - valueAdded(index, count)¶
- Parameters:
- index – int 
- count – int 
 
 
 - This signal is emitted when new values are added to the bar set. - indexindicates the position of the first inserted value, and- countis the number of inserted values.- valueChanged(index)¶
- Parameters:
- index – int 
 
 - This signal is emitted when the value at the position specified by - indexis modified.- See also - valueRemoved(index, count)¶
- Parameters:
- index – int 
- count – int 
 
 
 - This signal is emitted when values are removed from the bar set. - indexindicates the position of the first removed value, and- countis the number of removed values.- values()¶
- Return type:
- .list of QVariant 
 - See also 
 - Getter of property - valuesᅟ.- valuesAdded(index, count)¶
- Parameters:
- index – int 
- count – int 
 
 
 - This signal is emitted when new values are added to the bar set. - indexindicates the position of the first inserted value, and- countis the number of inserted values.- valuesChanged()¶
 - Notification signal of property - valuesᅟ.- valuesRemoved(index, count)¶
- Parameters:
- index – int 
- count – int 
 
 
 - This signal is emitted when values are removed from the bar set. - indexindicates the position of the first removed value, and- countis the number of removed values.- See also