QDateTimeAxis¶
The QDateTimeAxis
class adds dates and times to a chart’s axis. More…
Synopsis¶
Functions¶
Signals¶
def
formatChanged
(format)def
maxChanged
(max)def
minChanged
(min)def
rangeChanged
(min, max)def
tickCountChanged
(tick)
Detailed Description¶
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, 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);
- class PySide6.QtCharts.QDateTimeAxis([parent=None])¶
- Parameters
parent –
PySide6.QtCore.QObject
Constructs an axis object that is a child of parent
.
- PySide6.QtCharts.QDateTimeAxis.format()¶
- Return type
str
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.
See also
- PySide6.QtCharts.QDateTimeAxis.formatChanged(format)¶
- Parameters
format – str
- PySide6.QtCharts.QDateTimeAxis.max()¶
- Return type
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.
- PySide6.QtCharts.QDateTimeAxis.maxChanged(max)¶
- Parameters
max –
PySide6.QtCore.QDateTime
- PySide6.QtCharts.QDateTimeAxis.min()¶
- Return type
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.
- PySide6.QtCharts.QDateTimeAxis.minChanged(min)¶
- Parameters
min –
PySide6.QtCore.QDateTime
- PySide6.QtCharts.QDateTimeAxis.rangeChanged(min, max)¶
- Parameters
min –
PySide6.QtCore.QDateTime
max –
PySide6.QtCore.QDateTime
- PySide6.QtCharts.QDateTimeAxis.setFormat(format)¶
- Parameters
format – str
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.
See also
- PySide6.QtCharts.QDateTimeAxis.setMax(max)¶
- Parameters
max –
PySide6.QtCore.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.
- PySide6.QtCharts.QDateTimeAxis.setMin(min)¶
- Parameters
min –
PySide6.QtCore.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.
- PySide6.QtCharts.QDateTimeAxis.setRange(min, max)¶
- Parameters
min –
PySide6.QtCore.QDateTime
max –
PySide6.QtCore.QDateTime
Sets the range on the axis from min
to max
. If min
is greater than max
, this function returns without making any changes.
- PySide6.QtCharts.QDateTimeAxis.setTickCount(count)¶
- Parameters
count – int
This property holds The number of tick marks on the axis..
- PySide6.QtCharts.QDateTimeAxis.tickCount()¶
- Return type
int
This property holds The number of tick marks on the axis..
- PySide6.QtCharts.QDateTimeAxis.tickCountChanged(tick)¶
- Parameters
tick – int
© 2022 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.