QAbstractBarSeries 类是用于所有条形系列类的抽象父级类。 更多...
头: | #include <QAbstractBarSeries> |
实例化: | AbstractBarSeries |
继承: | QAbstractSeries |
继承者: | QBarSeries , QHorizontalBarSeries , QHorizontalPercentBarSeries , QHorizontalStackedBarSeries , QPercentBarSeries ,和 QStackedBarSeries |
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 | 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 ) |
在条形图表中,条形被定义为每种类别包含一个数据值的条形集。条形的位置由类别指定,且其高度由数据值指定。包含多个条形集的条形系列,将属于同一类别的条形分组在一起。条形的显示方式,由选择用于创建条形图表的这种类的子类确定。
若 QValueAxis 被使用而不是 QBarCategoryAxis 对于主条形轴,条形围绕类别的索引值分组。
见 条形图表范例 学习如何使用 QBarSeries 类创建简单条形图表。
另请参阅 QBarSet , QBarSeries , QStackedBarSeries , QPercentBarSeries , QHorizontalBarSeries , QHorizontalStackedBarSeries ,和 QHorizontalPercentBarSeries .
此枚举值描述数据值标签的位置:
常量 | 值 | 描述 |
---|---|---|
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 轴的刻度比例缩放。
注意: 当用于 QBarSeries ,此值指定一组条形的宽度,而不是单个条形的宽度。
访问函数:
qreal | barWidth () const |
void | setBarWidth (qreal width ) |
另请参阅 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 () |
[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 ().
[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 .
[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
.
[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 .
[虚拟]
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 ().
Removes all bar sets from the series and permanently deletes them.
返回条形系列的条形集数。
注意: getter 函数对于特性 count。
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 .
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 操作成功。