##// END OF EJS Templates
QDateTimeAxis docs updated
Marek Rosa -
r1967:2d1e68a17556
parent child
Show More
@@ -24,7 +24,6
24 24 #include "chartdatetimeaxisy_p.h"
25 25 #include "domain_p.h"
26 26 #include <cmath>
27 #include <QDebug>
28 27
29 28 QTCOMMERCIALCHART_BEGIN_NAMESPACE
30 29 /*!
@@ -34,24 +33,33 QTCOMMERCIALCHART_BEGIN_NAMESPACE
34 33
35 34 The labels can be configured by setting an appropriate DateTime format.
36 35 QDateTimeAxis works correctly with dates from 4714 BCE to 287396 CE
37 There are also other limitiation that are specified in QDateTime documentation. Please refer to it.
36 There are also other limitiation related to QDateTime . Please refer to QDateTime documentation.
38 37 QDateTimeAxis can be setup to show axis line with tick marks, grid lines and shades.
39 38
39 NOTE: QDateTimeAxis is disabled on ARM platform at the present time.
40
40 41 \image api_datatime_axis.png
41 42
42 Example code on how to use QDateTimeAxis.
43 QDateTimeAxis can be used with QLineSeries, QSplineSeries or QScatterSeries.
44 To add a data point to the series QDateTime::toMSecsSinceEpoch() is used.
43 45 \code
44 QChartView *chartView = new QChartView;
45 46 QLineSeries *series = new QLineSeries;
46 47
47 48 QDateTime xValue;
48 49 xValue.setDate(QDate(2012, 1 , 18));
49 50 xValue.setTime(QTime(9, 34));
50 series->append(xValue.toMSecsSinceEpoch(), 12);
51 qreal yValue = 12;
52 series->append(xValue.toMSecsSinceEpoch(), yValue);
51 53
52 54 xValue.setDate(QDate(2013, 5 , 11));
53 55 xValue.setTime(QTime(11, 14));
54 series->append(xValue.toMSecsSinceEpoch(), 22);
56 qreal yValue = 22;
57 series->append(xValue.toMSecsSinceEpoch(), yValue);
58 \endcode
59
60 Adding the series to the chart and setting up the QDateTimeAxis.
61 \code
62 QChartView *chartView = new QChartView;
55 63 chartView->chart()->addSeries(series);
56 64
57 65 // ...
General Comments 0
You need to be logged in to leave comments. Login now