##// END OF EJS Templates
minor.typo
Michal Klocek -
r89:75b5e13eb832
parent child
Show More
@@ -1,45 +1,45
1 #include <QApplication>
1 #include <QApplication>
2 #include <QMainWindow>
2 #include <QMainWindow>
3 #include <qchartview.h>
3 #include <qchartview.h>
4 #include <qxychartseries.h>
4 #include <qxychartseries.h>
5 #include <qchart.h>
5 #include <qchart.h>
6 #include <cmath>
6 #include <cmath>
7
7
8 QTCOMMERCIALCHART_USE_NAMESPACE
8 QTCOMMERCIALCHART_USE_NAMESPACE
9
9
10 #define PI 3.14159265358979
10 #define PI 3.14159265358979
11
11
12 int main(int argc, char *argv[])
12 int main(int argc, char *argv[])
13 {
13 {
14 QApplication a(argc, argv);
14 QApplication a(argc, argv);
15
15
16 QMainWindow window;
16 QMainWindow window;
17
17
18 QXYChartSeries* series0 = QXYChartSeries::create();
18 QXYChartSeries* series0 = QXYChartSeries::create();
19 QPen blue(Qt::blue);
19 QPen blue(Qt::blue);
20 blue.setWidth(3);
20 blue.setWidth(3);
21 series0->setPen(blue);
21 series0->setPen(blue);
22 QXYChartSeries* series1 = QXYChartSeries::create();
22 QXYChartSeries* series1 = QXYChartSeries::create();
23 QPen red(Qt::red);
23 QPen red(Qt::red);
24 red.setWidth(3);
24 red.setWidth(3);
25 series1->setPen(red);
25 series1->setPen(red);
26
26
27 int numPoints = 100;
27 int numPoints = 100;
28
28
29 for (int x = 0; x <= numPoints; ++x) {
29 for (int x = 0; x <= numPoints; ++x) {
30 series0->add(x, abs(sin(PI/50*x)*100));
30 series0->add(x, abs(sin(PI/50*x)*100));
31 series1->add(x, abs(cos(PI/50*x)*100));
31 series1->add(x, abs(cos(PI/50*x)*100));
32 }
32 }
33
33
34 QChartView* chartView = new QChartView(&window);
34 QChartView* chartView = new QChartView(&window);
35 chartView->setRenderHint(QPainter::Antialiasing);
35 chartView->setRenderHint(QPainter::Antialiasing);
36 chartView->setTitle("Example: sin & cos functions");
36 chartView->setTitle("Basic line chart example");
37 chartView->addSeries(series0);
37 chartView->addSeries(series0);
38 chartView->addSeries(series1);
38 chartView->addSeries(series1);
39
39
40 window.setCentralWidget(chartView);
40 window.setCentralWidget(chartView);
41 window.resize(400, 300);
41 window.resize(400, 300);
42 window.show();
42 window.show();
43
43
44 return a.exec();
44 return a.exec();
45 }
45 }
General Comments 0
You need to be logged in to leave comments. Login now