diff options
author | Marek Rosa <marek.rosa@digia.com> | 2012-09-05 13:15:47 +0300 |
---|---|---|
committer | Marek Rosa <marek.rosa@digia.com> | 2012-09-05 16:53:23 +0300 |
commit | 012112176bdd7f097c1e5b73f95a108751561406 (patch) | |
tree | a3683bfcd0c88a8f14624a1bbe8a848fa3275686 /examples | |
parent | 86ffb652e42357425028e7baaabb76ecc23f7929 (diff) |
datetimeaxis example documented
Diffstat (limited to 'examples')
-rw-r--r-- | examples/datetimeaxis/main.cpp | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/examples/datetimeaxis/main.cpp b/examples/datetimeaxis/main.cpp index ae106018..c20b3651 100644 --- a/examples/datetimeaxis/main.cpp +++ b/examples/datetimeaxis/main.cpp @@ -41,6 +41,8 @@ int main(int argc, char *argv[]) //![2] // data from http://www.swpc.noaa.gov/ftpdir/weekly/RecentIndices.txt + // http://www.swpc.noaa.gov/ftpdir/weekly/README + // http://www.weather.gov/disclaimer QFile sunSpots(":sun"); if (!sunSpots.open(QIODevice::ReadOnly | QIODevice::Text)) { return 1; @@ -60,28 +62,31 @@ int main(int argc, char *argv[]) //![2] //![3] - QChart* chart = new QChart(); - chart->legend()->hide(); + QChart* chart = new QChart(); chart->addSeries(series); + chart->legend()->hide(); chart->createDefaultAxes(); + chart->setTitle("Sunspots count (by Space Weather Prediction Center)"); + //![3] + + //![4] QDateTimeAxis *axisX = new QDateTimeAxis; axisX->setTickCount(10); axisX->setFormat("MMM yyyy"); chart->setAxisX(axisX, series); - chart->setTitle("Sunspots count (by Space Weather Prediction Center)"); - //![3] - //![4] + + //![5] QChartView* chartView = new QChartView(chart); chartView->setRenderHint(QPainter::Antialiasing); - //![4] - //![5] + + //![6] QMainWindow window; window.setCentralWidget(chartView); window.resize(800, 600); window.show(); - //![5] + //![6] return a.exec(); } |