| chartdatetimeaxisx.cpp |
|
4079 |
- |
| chartdatetimeaxisx_p.h |
CHARTDATETIMEAXISX_H |
1115 |
- |
| chartdatetimeaxisy.cpp |
|
4109 |
- |
| chartdatetimeaxisy_p.h |
CHARTDATETIMEAXISY_H |
1111 |
- |
| datetimeaxislabel.cpp |
|
1839 |
- |
| datetimeaxislabel_p.h |
|
1182 |
- |
| polarchartdatetimeaxisangular.cpp |
|
2008 |
- |
| polarchartdatetimeaxisangular_p.h |
|
1093 |
- |
| polarchartdatetimeaxisradial.cpp |
|
1979 |
- |
| polarchartdatetimeaxisradial_p.h |
|
1085 |
- |
| qdatetimeaxis.cpp |
!
\class QDateTimeAxis
\inmodule QtCharts
\brief 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.
\image api_datatime_axis.png {Screenshot cutout showing the x-axis describing date times}
QDateTimeAxis can be used with any QXYSeries.
To add a data point to the series, QDateTime::toMSecsSinceEpoch() is used:
\code
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);
\endcode
The following code snippet illustrates adding the series to the chart and setting up
QDateTimeAxis:
\code
QChartView *chartView = new QChartView;
chartView->chart()->addSeries(series);
// ...
QDateTimeAxis *axisX = new QDateTimeAxis;
axisX->setFormat("dd-MM-yyyy h:mm");
chartView->chart()->setAxisX(axisX, series);
\endcode
|
10255 |
- |
| qdatetimeaxis.h |
|
1575 |
- |
| qdatetimeaxis_p.h |
|
1492 |
- |