QAbstractBarSeries 类

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 (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
bool remove (QBarSet * set )
void setBarWidth (qreal width )
void setLabelsAngle (qreal angle )
void setLabelsFormat (const QString & format )
void setLabelsPosition (QAbstractBarSeries::LabelsPosition position )
void setLabelsVisible (bool visible = true)
bool take (QBarSet * set )

信号

void barsetsAdded (QList<QBarSet *> sets )
void barsetsRemoved (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 labelsVisibleChanged ()
void pressed (int index , QBarSet * barset )
void released (int index , QBarSet * barset )

额外继承成员

详细描述

QAbstractBarSeries 类是所有条形系列类的抽象父级类。

在条形图表中,条形被定义为每种类别包含一个数据值的条形集。条形的位置由类别指定,且其高度由数据值指定。包含多个条形集的条形系列,将属于同一类别的条形分组在一起。条形的显示方式,由选择用于创建条形图表的这种类的子类确定。

QValueAxis 被使用而不是 QBarCategoryAxis 对于主条形轴,条形围绕类别的索引值分组。

条形图表范例 学习如何使用 QBarSeries 类创建简单条形图表。

另请参阅 QBarSet , QBarSeries , QStackedBarSeries , QPercentBarSeries , QHorizontalBarSeries , QHorizontalStackedBarSeries ,和 QHorizontalPercentBarSeries .

成员类型文档编制

enum QAbstractBarSeries:: LabelsPosition

此枚举值描述数据值标签的位置:

常量 描述
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.

特性文档编制

barWidth : qreal

此特性保持系列条形的宽度。

宽度单位是 X 轴的单位。条形的最小宽度为 0,且负值被视为 0。将宽度设为 0 意味着屏幕中的条形宽度为 1 像素,不管 X 轴的刻度。宽于 0 的条形按 X 轴的刻度比例缩放。

注意: 当用于 QBarSeries ,此值指定一组条形的宽度,而不是单个条形的宽度。

访问函数:

qreal barWidth () const
void setBarWidth (qreal width )

另请参阅 QBarSeries .

count : const int

This property holds the number of bar sets in a bar series.

访问函数:

int count () const

通知程序信号:

void countChanged ()

labelsAngle : qreal

This property holds the angle of the value labels in degrees.

访问函数:

qreal labelsAngle () const
void setLabelsAngle (qreal angle )

通知程序信号:

void labelsAngleChanged (qreal angle )

labelsFormat : QString

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, whereas labels on the edge of the plot area are cut. 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 and labelsPosition .

labelsPosition : LabelsPosition

此特性保持值标签的位置。

访问函数:

QAbstractBarSeries::LabelsPosition labelsPosition () const
void setLabelsPosition (QAbstractBarSeries::LabelsPosition position )

通知程序信号:

void labelsPositionChanged (QAbstractBarSeries::LabelsPosition position )

另请参阅 labelsVisible and labelsFormat .

labelsVisible : bool

This property holds the visibility of the labels in a bar series.

访问函数:

bool isLabelsVisible () const
void setLabelsVisible (bool visible = true)

通知程序信号:

void labelsVisibleChanged ()

成员函数文档编制

[virtual] QAbstractBarSeries:: ~QAbstractBarSeries ()

Removes the abstract bar series and the bar sets owned by it.

bool QAbstractBarSeries:: append ( QBarSet * set )

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.

bool QAbstractBarSeries:: append ( QList < QBarSet *> sets )

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 .

QList < QBarSet *> QAbstractBarSeries:: barSets () const

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

qreal QAbstractBarSeries:: barWidth () const

返回系列条形的宽度。

注意: Getter 函数对于特性 barWidth .

另请参阅 setBarWidth ().

[signal] void QAbstractBarSeries:: barsetsAdded ( QList < QBarSet *> sets )

This signal is emitted when the bar sets specified by sets are added to the series.

另请参阅 append () 和 insert ().

[signal] void QAbstractBarSeries:: barsetsRemoved ( QList < QBarSet *> sets )

This signal is emitted when the bar sets specified by sets are removed from the series.

另请参阅 remove ().

void QAbstractBarSeries:: clear ()

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 .

int QAbstractBarSeries:: count () const

返回条形系列的条形集数。

注意: 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 .

bool QAbstractBarSeries:: insert ( int index , QBarSet * set )

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.

bool QAbstractBarSeries:: isLabelsVisible () const

返回标签的可见性。

注意: 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:: 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 .

bool QAbstractBarSeries:: remove ( QBarSet * set )

Removes the bar set specified by set from the series and permanently deletes it if the removal succeeds. Returns true 若集被移除。

void QAbstractBarSeries:: setBarWidth ( qreal width )

将系列条形的宽度设为 width .

注意: Setter 函数对于特性 barWidth .

另请参阅 barWidth ().

void QAbstractBarSeries:: setLabelsVisible ( bool visible = true)

将条形系列中标签的可见性设为 visible .

注意: Setter 函数对于特性 labelsVisible .

另请参阅 isLabelsVisible ().

bool QAbstractBarSeries:: take ( QBarSet * set )

拿取单个 set 从系列。不删除条形集对象。

注意: The series remains the barset's parent object. You must set the parent object to take full ownership.

返回 true 若 take 操作成功。