QAbstractBarSeries 类是用于所有条形系列类的抽象父级类。 更多...
头: | #include <QAbstractBarSeries> |
CMake: |
find_package(Qt6 REQUIRED COMPONENTS Graphs)
target_link_libraries(mytarget PRIVATE Qt6::Graphs) |
qmake: | QT += graphs |
实例化: | AbstractBarSeries |
继承: | QAbstractSeries |
继承者: | |
状态: | 技术预览 |
enum | LabelsPosition { LabelsCenter, LabelsInsideEnd, LabelsInsideBase, LabelsOutsideEnd } |
|
|
virtual | ~QAbstractBarSeries () |
bool | append (QBarSet * set ) |
bool | append (const QList<QBarSet *> & sets ) |
QList<QBarSet *> | barSets () const |
qreal | barWidth () const |
void | clear () |
int | count () const |
bool | insert (int index , QBarSet * set ) |
bool | isLabelsVisible () const |
qreal | labelsAngle () const |
QString | labelsFormat () const |
QAbstractBarSeries::LabelsPosition | labelsPosition () const |
int | labelsPrecision () const |
bool | remove (QBarSet * set ) |
void | setBarWidth (qreal width ) |
void | setLabelsAngle (qreal angle ) |
void | setLabelsFormat (const QString & format ) |
void | setLabelsPosition (QAbstractBarSeries::LabelsPosition position ) |
void | setLabelsPrecision (int precision ) |
void | setLabelsVisible (bool visible = true) |
bool | take (QBarSet * set ) |
void | barWidthChanged () |
void | barsetsAdded (const QList<QBarSet *> & sets ) |
void | barsetsRemoved (const QList<QBarSet *> & sets ) |
void | clicked (int index , QBarSet * barset ) |
void | countChanged () |
void | doubleClicked (int index , QBarSet * barset ) |
void | hovered (bool status , int index , QBarSet * barset ) |
void | labelsAngleChanged (qreal angle ) |
void | labelsFormatChanged (const QString & format ) |
void | labelsPositionChanged (QAbstractBarSeries::LabelsPosition position ) |
void | labelsPrecisionChanged (int precision ) |
void | labelsVisibleChanged () |
void | pressed (int index , QBarSet * barset ) |
void | released (int index , QBarSet * barset ) |
In bar graphs, 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 graph.
另请参阅 QBarSet and QBarSeries .
此枚举值描述数据值标签的位置:
常量 | 值 | 描述 |
---|---|---|
QAbstractBarSeries::LabelsCenter
|
0
|
Label is located in the center of the bar. |
QAbstractBarSeries::LabelsInsideEnd
|
1
|
Label is located inside the bar at the top. |
QAbstractBarSeries::LabelsInsideBase
|
2
|
Label is located inside the bar at the bottom. |
QAbstractBarSeries::LabelsOutsideEnd
|
3
|
Label is located outside the bar at the top. |
此特性保持系列条形的宽度。
宽度单位是 X 轴的单位。条形的最小宽度为 0,且负值被视为 0。将宽度设为 0 意味着屏幕中的条形宽度为 1 像素,不管 X 轴的刻度。宽于 0 的条形按 X 轴的刻度比例缩放。
By default, the barWidth is 0.5 (bars will take 50% of the available width). The valid values range from 0.0 (0%) to 1.0 (100%).
注意: 当用于 QBarSeries ,此值指定一组条形的宽度,而不是单个条形的宽度。
访问函数:
qreal | barWidth () const |
void | setBarWidth (qreal width ) |
通知程序信号:
void | barWidthChanged () |
另请参阅 QBarSeries .
[read-only]
count
: const
int
This property holds the number of bar sets in a bar series.
访问函数:
int | count () const |
通知程序信号:
void | countChanged () |
This property holds the angle of the value labels in degrees.
访问函数:
qreal | labelsAngle () const |
void | setLabelsAngle (qreal angle ) |
通知程序信号:
void | labelsAngleChanged (qreal angle ) |
This property holds the format used for showing labels in a bar series.
QAbstractBarSeries 支持以下格式标签:
@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.
访问函数:
QString | labelsFormat () const |
void | setLabelsFormat (const QString & format ) |
通知程序信号:
void | labelsFormatChanged (const QString & format ) |
另请参阅 labelsVisible , labelsPosition ,和 labelsPrecision .
此特性保持值标签的位置。
访问函数:
QAbstractBarSeries::LabelsPosition | labelsPosition () const |
void | setLabelsPosition (QAbstractBarSeries::LabelsPosition position ) |
通知程序信号:
void | labelsPositionChanged (QAbstractBarSeries::LabelsPosition position ) |
另请参阅 labelsVisible and labelsFormat .
This property holds the maximum amount of significant digits shown in value labels.
默认值为 6。
访问函数:
int | labelsPrecision () const |
void | setLabelsPrecision (int precision ) |
通知程序信号:
void | labelsPrecisionChanged (int precision ) |
This property holds the visibility of the labels in a bar series.
访问函数:
bool | isLabelsVisible () const |
void | setLabelsVisible (bool visible = true) |
通知程序信号:
void | labelsVisibleChanged () |
[virtual noexcept]
QAbstractBarSeries::
~QAbstractBarSeries
()
Removes the abstract bar series and the bar sets owned by it.
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.
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
.
Returns a list of bar sets in a bar series. Keeps the ownership of the bar sets.
返回系列条形的宽度。
注意: getter 函数对于特性 barWidth。
另请参阅 setBarWidth ().
[signal]
void
QAbstractBarSeries::
barWidthChanged
()
This signal is emitted when the bar width changes.
注意: 通知程序信号对于特性 barWidth .
[signal]
void
QAbstractBarSeries::
barsetsAdded
(const
QList
<
QBarSet
*> &
sets
)
This signal is emitted when the bar sets specified by sets are added to the series.
[signal]
void
QAbstractBarSeries::
barsetsRemoved
(const
QList
<
QBarSet
*> &
sets
)
This signal is emitted when the bar sets specified by sets are removed from the series.
另请参阅 remove ().
Removes all bar sets from the series and permanently deletes them.
[signal]
void
QAbstractBarSeries::
clicked
(
int
index
,
QBarSet
*
barset
)
This signal is emitted when the user clicks the bar specified by index in the bar set specified by barset .
返回条形系列的条形集数。
注意: getter 函数对于特性 count。
[signal]
void
QAbstractBarSeries::
countChanged
()
This signal is emitted when the number of bar sets is changed, for example by append () 或 remove ().
注意: 通知程序信号对于特性 count .
[signal]
void
QAbstractBarSeries::
doubleClicked
(
int
index
,
QBarSet
*
barset
)
This signal is emitted when the user double-clicks the bar specified by index in the bar set specified by barset .
[signal]
void
QAbstractBarSeries::
hovered
(
bool
status
,
int
index
,
QBarSet
*
barset
)
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
.
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.
返回标签的可见性。
注意: getter 函数对于特性 labelsVisible .
[signal]
void
QAbstractBarSeries::
labelsAngleChanged
(
qreal
angle
)
此信号发射当 angle of the value labels changes.
注意: 通知程序信号对于特性 labelsAngle .
[signal]
void
QAbstractBarSeries::
labelsFormatChanged
(const
QString
&
format
)
此信号发射当 format of data value labels changes.
注意: 通知程序信号对于特性 labelsFormat .
[signal]
void
QAbstractBarSeries::
labelsPositionChanged
(
QAbstractBarSeries::LabelsPosition
position
)
此信号发射当 position of value labels changes.
注意: 通知程序信号对于特性 labelsPosition .
[signal]
void
QAbstractBarSeries::
labelsPrecisionChanged
(
int
precision
)
此信号发射当 precision of the value labels changes.
注意: 通知程序信号对于特性 labelsPrecision .
[signal]
void
QAbstractBarSeries::
labelsVisibleChanged
()
This signal is emitted when the labels' visibility changes.
注意: 通知程序信号对于特性 labelsVisible .
另请参阅 isLabelsVisible () 和 setLabelsVisible ().
[signal]
void
QAbstractBarSeries::
pressed
(
int
index
,
QBarSet
*
barset
)
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.
[signal]
void
QAbstractBarSeries::
released
(
int
index
,
QBarSet
*
barset
)
This signal is emitted when the user releases the mouse press on the bar specified by index in the bar set specified by barset .
Removes the bar set specified by
set
from the series and permanently deletes it if the removal succeeds. Returns
true
若集被移除。
将系列条形的宽度设为 width .
注意: setter 函数对于特性 barWidth .
另请参阅 barWidth ().
将条形系列中标签的可见性设为 visible .
注意: setter 函数对于特性 labelsVisible .
另请参阅 isLabelsVisible ().
拿取单个 set 从系列。不删除条形集对象。
注意: The series remains the barset's parent object. You must set the parent object to take full ownership.
返回
true
若 take 操作成功。