QValueAxis 類

The QValueAxis 類將值添加到圖錶軸。 更多...

頭: #include <QValueAxis>
實例化: ValueAxis
繼承: QAbstractAxis
繼承者: QCategoryAxis

公共類型

enum TickType { TicksDynamic, TicksFixed }

特性

公共函數

QValueAxis (QObject * parent = nullptr)
virtual ~QValueAxis ()
QString labelFormat () const
qreal max () const
qreal min () const
int minorTickCount () const
void setLabelFormat (const QString & format )
void setMax (qreal max )
void setMin (qreal min )
void setMinorTickCount (int count )
void setRange (qreal min , qreal max )
void setTickAnchor (qreal anchor )
void setTickCount (int count )
void setTickInterval (qreal insterval )
void setTickType (QValueAxis::TickType type )
qreal tickAnchor () const
int tickCount () const
qreal tickInterval () const
QValueAxis::TickType tickType () const

重實現公共函數

virtual QAbstractAxis::AxisType type () const

公共槽

void applyNiceNumbers ()

信號

void labelFormatChanged (const QString & format )
void maxChanged (qreal max )
void minChanged (qreal min )
void minorTickCountChanged (int minorTickCount )
void rangeChanged (qreal min , qreal max )
void tickAnchorChanged (qreal anchor )
void tickCountChanged (int tickCount )
void tickIntervalChanged (qreal interval )
void tickTypeChanged (QValueAxis::TickType type )

靜態公共成員

const QMetaObject staticMetaObject

額外繼承成員

詳細描述

The QValueAxis 類將值添加到圖錶軸。

A value axis can be set up to show an axis line with tick marks, grid lines, and shades. The values on the axis are drawn at the positions of tick marks.

以下範例代碼闡明如何使用 QValueAxis 類:

QChartView *chartView = new QChartView;
QLineSeries *series = new QLineSeries;
// ...
chartView->chart()->addSeries(series);
QValueAxis *axisX = new QValueAxis;
axisX->setRange(10, 20.5);
axisX->setTickCount(10);
axisX->setLabelFormat("%.2f");
chartView->chart()->setAxisX(axisX, series);
					

成員類型文檔編製

enum QValueAxis:: TickType

This enum describes how the ticks and labels are positioned on the axis.

常量 描述
QValueAxis::TicksDynamic 0 Ticks are placed according to tickAnchor and tickInterval 值。
QValueAxis::TicksFixed 1 Ticks are placed evenly across the axis range. The tickCount value specifies the number of ticks.

特性文檔編製

labelFormat : QString

此特性保持軸的標簽格式。

格式字符串支持的以下轉換說明符、長度修飾符和標誌的提供通過 printf() 在標準 C++ 庫:d、i、o、x、X、f、F、e、E、g、G、c。

QChart::localizeNumbers is true ,支持的說明符限於:d、e、E、f、g、G 和 i。另外,僅支持精度修飾符。其餘格式來自默認 QLocale 對於應用程序。

訪問函數:

QString labelFormat () const
void setLabelFormat (const QString & format )

通知程序信號:

void labelFormatChanged (const QString & format )

另請參閱 QString::asprintf ().

max : qreal

此特性保持軸的最大值。

When setting this property, the minimum value is adjusted if necessary, to ensure that the range remains valid.

訪問函數:

qreal max () const
void setMax (qreal max )

通知程序信號:

void maxChanged (qreal max )

min : qreal

此特性保持軸的最小值。

When setting this property, the maximum value is adjusted if necessary, to ensure that the range remains valid.

訪問函數:

qreal min () const
void setMin (qreal min )

通知程序信號:

void minChanged (qreal min )

minorTickCount : int

此特性保持軸的次要刻度標記數。這指示在圖錶主要刻度之間要繪製多少柵格綫。次要刻度不繪製標簽。默認值為 0。

訪問函數:

int minorTickCount () const
void setMinorTickCount (int count )

通知程序信號:

void minorTickCountChanged (int minorTickCount )

tickAnchor : qreal

此特性保持從哪裏開始動態放置刻度標記和標簽的值。

該特性在 Qt 5.12 引入。

訪問函數:

qreal tickAnchor () const
void setTickAnchor (qreal anchor )

通知程序信號:

void tickAnchorChanged (qreal anchor )

tickCount : int

This property holds the number of tick marks on the axis. This indicates how many grid lines are drawn on the chart. The default value is 5, and the number cannot be less than 2.

訪問函數:

int tickCount () const
void setTickCount (int count )

通知程序信號:

void tickCountChanged (int tickCount )

tickInterval : qreal

此特性保持動態放置刻度標記和標簽之間的間隔。

該特性在 Qt 5.12 引入。

訪問函數:

qreal tickInterval () const
void setTickInterval (qreal insterval )

通知程序信號:

void tickIntervalChanged (qreal interval )

tickType : TickType

此特性保持刻度和標簽的定位方法。

該特性在 Qt 5.12 引入。

訪問函數:

QValueAxis::TickType tickType () const
void setTickType (QValueAxis::TickType type )

通知程序信號:

void tickTypeChanged (QValueAxis::TickType type )

成員函數文檔編製

QValueAxis:: QValueAxis ( QObject * parent = nullptr)

Constructs an axis object that is a child of parent .

[虛擬] QValueAxis:: ~QValueAxis ()

銷毀對象。

[slot] void QValueAxis:: applyNiceNumbers ()

修改軸的當前範圍和刻度標記數,以使看起來 nice . The algorithm considers numbers that can be expressed as a form of 1*10^n, 2* 10^n, or 5*10^n to be nice numbers. These numbers are used for setting spacing for the tick marks.

另請參閱 setRange () 和 setTickCount ().

[signal] void QValueAxis:: labelFormatChanged (const QString & format )

此信號發射,當 format 對於軸標簽改變。

注意: 通知程序信號對於特性 labelFormat .

[signal] void QValueAxis:: maxChanged ( qreal max )

This signal is emitted when the maximum value of the axis, specified by max ,改變。

注意: 通知程序信號對於特性 max .

[signal] void QValueAxis:: minChanged ( qreal min )

This signal is emitted when the minimum value of the axis, specified by min ,改變。

注意: 通知程序信號對於特性 min .

[signal] void QValueAxis:: minorTickCountChanged ( int minorTickCount )

This signal is emitted when the number of minor tick marks on the axis, specified by minorTickCount ,改變。

注意: 通知程序信號對於特性 minorTickCount .

[signal] void QValueAxis:: rangeChanged ( qreal min , qreal max )

This signal is emitted when the minimum or maximum value of the axis, specified by min and max ,改變。

void QValueAxis:: setRange ( qreal min , qreal max )

設置範圍從 min to max 在軸。若 min 大於 max ,此函數返迴不做任何改變。

[signal] void QValueAxis:: tickCountChanged ( int tickCount )

This signal is emitted when the number of tick marks on the axis, specified by tickCount ,改變。

注意: 通知程序信號對於特性 tickCount .

[虛擬] QAbstractAxis::AxisType QValueAxis:: type () const

重實現自 QAbstractAxis::type ().

返迴軸的類型。