QAbstractBarSeries 類

The 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 )

額外繼承成員

詳細描述

The 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 ()

成員函數文檔編製

[虛擬] 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 操作成功。