QDateTimeAxis Class
The QDateTimeAxis class adds dates and times to a chart's axis. 更多...
头文件: | #include <QDateTimeAxis> |
Instantiated By: | DateTimeAxis |
基类: | QAbstractAxis |
属性
- 27 个属性继承自 QAbstractAxis
- 1 个属性继承自 QObject
公有函数
QDateTimeAxis(QObject *parent = Q_NULLPTR) | |
~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 AxisType | type() const |
- 58 个公有函数继承自 QAbstractAxis
- 32 个公有函数继承自 QObject
信号
void | formatChanged(QString format) |
void | maxChanged(QDateTime max) |
void | minChanged(QDateTime min) |
void | rangeChanged(QDateTime min, QDateTime max) |
void | tickCountChanged(int tickCount) |
- 25 个信号继承自 QAbstractAxis
- 2 个信号继承自 QObject
其他继承的成员
- 1 个公有槽函数继承自 QObject
- 1 个公有变量继承自 QObject
- 10 个静态公有成员继承自 QObject
- 9 个受保护的函数继承自 QObject
- 2 个受保护的变量继承自 QObject
详细描述
The QDateTimeAxis class adds dates and times to a chart's axis.
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, see QDateTime documentation.
Note: 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 object.
See QDateTime documentation for information on how the string should be defined.
访问函数:
QString | format() const |
void | setFormat(QString format) |
Notifier signal:
void | formatChanged(QString format) |
参见 QChart::locale.
max : QDateTime
This property holds the maximum value on the axis.
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) |
Notifier signal:
void | maxChanged(QDateTime max) |
min : QDateTime
This property holds the minimum value on the axis.
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) |
Notifier signal:
void | minChanged(QDateTime min) |
tickCount : int
This property holds the number of tick marks on the axis.
访问函数:
int | tickCount() const |
void | setTickCount(int count) |
Notifier signal:
void | tickCountChanged(int tickCount) |
成员函数
QDateTimeAxis::QDateTimeAxis(QObject *parent = Q_NULLPTR)
Constructs an axis object that is a child of parent.
QDateTimeAxis::~QDateTimeAxis()
Destroys the object.
[signal]
void QDateTimeAxis::formatChanged(QString format)
This signal is emitted when the format of the axis changes.
Note: Notifier signal for property format.
[signal]
void QDateTimeAxis::maxChanged(QDateTime max)
This signal is emitted when the maximum value of the axis, specified by max, changes.
Note: Notifier signal for property max.
[signal]
void QDateTimeAxis::minChanged(QDateTime min)
This signal is emitted when the minimum value of the axis, specified by min, changes.
Note: Notifier signal for property 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, changes.
void QDateTimeAxis::setRange(QDateTime min, QDateTime max)
Sets the range on the axis from min to max. If min is greater than max, this function returns without making any changes.
void QDateTimeAxis::setTickCount(int count)
Sets the number of tick marks on the axis to count.
Note: Setter function for property tickCount.
参见 tickCount().
int QDateTimeAxis::tickCount() const
Returns the number of tick marks on the axis.
Note: Getter function for property tickCount.
参见 setTickCount().
[signal]
void QDateTimeAxis::tickCountChanged(int tickCount)
This signal is emitted when the number of tick marks on the axis, specified by tickCount, changes.
Note: Notifier signal for property tickCount.
[virtual]
AxisType QDateTimeAxis::type() const
Reimplemented from QAbstractAxis::type().
Returns the type of the axis.