QDateTimeAxis 類

The QDateTimeAxis 類將日期和時間添加到圖錶軸。 更多...

頭: #include <QDateTimeAxis>
實例化: DateTimeAxis
繼承: QAbstractAxis

特性

公共函數

QDateTimeAxis (QObject * parent = nullptr)
virtual ~QDateTimeAxis ()
QString format () const
QDateTime max () const
QDateTime min () const
void setFormat (QString format )
void setMax (QDateTime max )
void setMin (QDateTime min )
void setRange (QDateTime min , QDateTime max )
void setTickCount (int count )
int tickCount () const

重實現公共函數

virtual QAbstractAxis::AxisType type () const

信號

void formatChanged (QString format )
void maxChanged (QDateTime max )
void minChanged (QDateTime min )
void rangeChanged (QDateTime min , QDateTime max )
void tickCountChanged (int tickCount )

靜態公共成員

const QMetaObject staticMetaObject

額外繼承成員

詳細描述

The QDateTimeAxis 類將日期和時間添加到圖錶軸。

QDateTimeAxis can be set up to show an axis line with tick marks, grid lines, and shades. The labels can be configured by setting an appropriate DateTime format. QDateTimeAxis works correctly with dates from 4714 BCE to 287396 CE. For other limitiations related to QDateTime ,見 QDateTime 文檔編製。

注意: QDateTimeAxis is disabled on platforms that define qreal as float.

QDateTimeAxis can be used with any QXYSeries . To add a data point to the series, QDateTime::toMSecsSinceEpoch () is used:

QLineSeries *series = new QLineSeries;
QDateTime xValue;
xValue.setDate(QDate(2012, 1 , 18));
xValue.setTime(QTime(9, 34));
qreal yValue = 12;
series->append(xValue.toMSecsSinceEpoch(), yValue);
xValue.setDate(QDate(2013, 5 , 11));
xValue.setTime(QTime(11, 14));
qreal yValue = 22;
series->append(xValue.toMSecsSinceEpoch(), yValue);
					

The following code snippet illustrates adding the series to the chart and setting up QDateTimeAxis :

QChartView *chartView = new QChartView;
chartView->chart()->addSeries(series);
// ...
QDateTimeAxis *axisX = new QDateTimeAxis;
axisX->setFormat("dd-MM-yyyy h:mm");
chartView->chart()->setAxisX(axisX, series);
					

特性文檔編製

format : QString

This property holds the format string that is used when creating the label for the axis out of a QDateTime 對象。

QDateTime documentation for information on how the string should be defined.

訪問函數:

QString format () const
void setFormat (QString format )

通知程序信號:

void formatChanged (QString format )

另請參閱 QChart::locale .

max : QDateTime

此特性保持軸的最大值。

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

訪問函數:

QDateTime max () const
void setMax (QDateTime max )

通知程序信號:

void maxChanged (QDateTime max )

min : QDateTime

此特性保持軸的最小值。

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

訪問函數:

QDateTime min () const
void setMin (QDateTime min )

通知程序信號:

void minChanged (QDateTime min )

tickCount : int

This property holds the number of tick marks on the axis.

訪問函數:

int tickCount () const
void setTickCount (int count )

通知程序信號:

void tickCountChanged (int tickCount )

成員函數文檔編製

QDateTimeAxis:: QDateTimeAxis ( QObject * parent = nullptr)

Constructs an axis object that is a child of parent .

[虛擬] QDateTimeAxis:: ~QDateTimeAxis ()

銷毀對象。

[signal] void QDateTimeAxis:: formatChanged ( QString format )

此信號發射,當 format of the axis changes.

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

[signal] void QDateTimeAxis:: maxChanged ( QDateTime max )

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

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

[signal] void QDateTimeAxis:: minChanged ( QDateTime min )

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

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

[signal] void QDateTimeAxis:: rangeChanged ( QDateTime min , QDateTime max )

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

void QDateTimeAxis:: setRange ( QDateTime min , QDateTime max )

Sets the range on the axis from min to max 。若 min 大於 max ,此函數返迴不做任何改變。

void QDateTimeAxis:: setTickCount ( int count )

Sets the number of tick marks on the axis to count .

注意: setter 函數對於特性 tickCount .

另請參閱 tickCount ().

int QDateTimeAxis:: tickCount () const

Returns the number of tick marks on the axis.

注意: getter 函數對於特性 tickCount .

另請參閱 setTickCount ().

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

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

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

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

重實現自 QAbstractAxis::type ().

返迴軸的類型。