##// END OF EJS Templates
QDateTimeAxis: added snippet on how to use it
Marek Rosa -
r1882:325b4aac9444
parent child
Show More
@@ -35,6 +35,27 QTCOMMERCIALCHART_BEGIN_NAMESPACE
35 35 The labels can be configured by setting an appropriate DateTime format.
36 36 Note that any date before 4714 BCE or after about 1.4 million CE may not be accurately stored.
37 37 QDateTimeAxis can be setup to show axis line with tick marks, grid lines and shades.
38
39 Example code on how to use QDateTimeAxis.
40 \code
41 QChartView *chartView = new QChartView;
42 QLineSeries *series = new QLineSeries;
43
44 QDateTime xValue;
45 xValue.setDate(QDate(2012, 1 , 18));
46 xValue.setTime(QTime(9, 34));
47 series->append(xValue.toMSecsSinceEpoch(), 12);
48
49 xValue.setDate(QDate(2013, 5 , 11));
50 xValue.setTime(QTime(11, 14));
51 series->append(xValue.toMSecsSinceEpoch(), 22);
52 chartView->chart()->addSeries(series);
53
54 // ...
55 QDateTimeAxis *axisX = new QDateTimeAxis;
56 axisX->setFormat("dd-MM-yyyy h:mm");
57 chartView->chart()->setAxisX(series, axisX);
58 \endcode
38 59 */
39 60
40 61 /*!
@@ -41,6 +41,8 QTCOMMERCIALCHART_BEGIN_NAMESPACE
41 41 QChartView *chartView = new QChartView;
42 42 QLineSeries *series = new QLineSeries;
43 43 // ...
44 chartView->chart()->addSeries(series);
45
44 46 QValueAxis *axisX = new QValueAxis;
45 47 axisX->setRange(10, 20.5);
46 48 axisX->setTickCount(10);
General Comments 0
You need to be logged in to leave comments. Login now