##// END OF EJS Templates
Add newlines to examples to make docs nicer
Jani Honkonen -
r883:6a54ca9aa4b1
parent child
Show More
@@ -29,6 +29,7 QTCOMMERCIALCHART_USE_NAMESPACE
29 int main(int argc, char *argv[])
29 int main(int argc, char *argv[])
30 {
30 {
31 QApplication a(argc, argv);
31 QApplication a(argc, argv);
32
32 //![1]
33 //![1]
33 QLineSeries* series0 = new QLineSeries();
34 QLineSeries* series0 = new QLineSeries();
34 QLineSeries* series1 = new QLineSeries();
35 QLineSeries* series1 = new QLineSeries();
@@ -40,6 +41,7 int main(int argc, char *argv[])
40 *series1 << QPointF(1, 3) << QPointF(3, 4) << QPointF(7, 3) << QPointF(8, 2) << QPointF(12, 3)
41 *series1 << QPointF(1, 3) << QPointF(3, 4) << QPointF(7, 3) << QPointF(8, 2) << QPointF(12, 3)
41 << QPointF(16, 4) << QPointF(18, 3);
42 << QPointF(16, 4) << QPointF(18, 3);
42 //![2]
43 //![2]
44
43 //![3]
45 //![3]
44 QAreaSeries* series = new QAreaSeries(series0, series1);
46 QAreaSeries* series = new QAreaSeries(series0, series1);
45 QPen pen(0x059605);
47 QPen pen(0x059605);
@@ -52,6 +54,7 int main(int argc, char *argv[])
52 gradient.setCoordinateMode(QGradient::ObjectBoundingMode);
54 gradient.setCoordinateMode(QGradient::ObjectBoundingMode);
53 series->setBrush(gradient);
55 series->setBrush(gradient);
54 //![3]
56 //![3]
57
55 //![4]
58 //![4]
56 QChart* chart = new QChart();
59 QChart* chart = new QChart();
57 chart->addSeries(series);
60 chart->addSeries(series);
@@ -59,15 +62,18 int main(int argc, char *argv[])
59 chart->axisX()->setRange(0, 20);
62 chart->axisX()->setRange(0, 20);
60 chart->axisY()->setRange(0, 10);
63 chart->axisY()->setRange(0, 10);
61 //![4]
64 //![4]
65
62 //![5]
66 //![5]
63 QChartView* chartView = new QChartView(chart);
67 QChartView* chartView = new QChartView(chart);
64 chartView->setRenderHint(QPainter::Antialiasing);
68 chartView->setRenderHint(QPainter::Antialiasing);
65 //![5]
69 //![5]
70
66 //![6]
71 //![6]
67 QMainWindow window;
72 QMainWindow window;
68 window.setCentralWidget(chartView);
73 window.setCentralWidget(chartView);
69 window.resize(400, 300);
74 window.resize(400, 300);
70 window.show();
75 window.show();
71 //![6]
76 //![6]
77
72 return a.exec();
78 return a.exec();
73 }
79 }
@@ -29,10 +29,12 QTCOMMERCIALCHART_USE_NAMESPACE
29 int main(int argc, char *argv[])
29 int main(int argc, char *argv[])
30 {
30 {
31 QApplication a(argc, argv);
31 QApplication a(argc, argv);
32
32 //![1]
33 //![1]
33 QBarCategories categories;
34 QBarCategories categories;
34 categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun";
35 categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun";
35 //![1]
36 //![1]
37
36 //![2]
38 //![2]
37 QBarSet *set0 = new QBarSet("Jane");
39 QBarSet *set0 = new QBarSet("Jane");
38 QBarSet *set1 = new QBarSet("John");
40 QBarSet *set1 = new QBarSet("John");
@@ -46,6 +48,7 int main(int argc, char *argv[])
46 *set3 << 5 << 6 << 7 << 3 << 4 << 5;
48 *set3 << 5 << 6 << 7 << 3 << 4 << 5;
47 *set4 << 9 << 7 << 5 << 3 << 1 << 2;
49 *set4 << 9 << 7 << 5 << 3 << 1 << 2;
48 //![2]
50 //![2]
51
49 //![3]
52 //![3]
50 QBarSeries* series = new QBarSeries(categories);
53 QBarSeries* series = new QBarSeries(categories);
51 series->appendBarSet(set0);
54 series->appendBarSet(set0);
@@ -54,20 +57,24 int main(int argc, char *argv[])
54 series->appendBarSet(set3);
57 series->appendBarSet(set3);
55 series->appendBarSet(set4);
58 series->appendBarSet(set4);
56 //![3]
59 //![3]
60
57 //![4]
61 //![4]
58 QChart* chart = new QChart();
62 QChart* chart = new QChart();
59 chart->addSeries(series);
63 chart->addSeries(series);
60 chart->setTitle("Simple barchart example");
64 chart->setTitle("Simple barchart example");
61 //![4]
65 //![4]
66
62 //![5]
67 //![5]
63 QChartView* chartView = new QChartView(chart);
68 QChartView* chartView = new QChartView(chart);
64 chartView->setRenderHint(QPainter::Antialiasing);
69 chartView->setRenderHint(QPainter::Antialiasing);
65 //![5]
70 //![5]
71
66 //![6]
72 //![6]
67 QMainWindow window;
73 QMainWindow window;
68 window.setCentralWidget(chartView);
74 window.setCentralWidget(chartView);
69 window.resize(400, 300);
75 window.resize(400, 300);
70 window.show();
76 window.show();
71 //![6]
77 //![6]
78
72 return a.exec();
79 return a.exec();
73 }
80 }
@@ -35,14 +35,17 int main(int argc, char *argv[])
35 blue.setWidth(3);
35 blue.setWidth(3);
36 series->setPen(blue);
36 series->setPen(blue);
37 //![1]
37 //![1]
38
38 //![2]
39 //![2]
39 *series << QPointF(0, 6) << QPointF(2, 4) << QPointF(3, 8) << QPointF(7, 4) << QPointF(10,5);
40 *series << QPointF(0, 6) << QPointF(2, 4) << QPointF(3, 8) << QPointF(7, 4) << QPointF(10,5);
40 //![2]
41 //![2]
42
41 //![3]
43 //![3]
42 QChart* chart = new QChart();
44 QChart* chart = new QChart();
43 chart->addSeries(series);
45 chart->addSeries(series);
44 chart->setTitle("Simple customchart example");
46 chart->setTitle("Simple customchart example");
45 //![3]
47 //![3]
48
46 //![4]
49 //![4]
47 QFont font;
50 QFont font;
48 font.setPixelSize(18);
51 font.setPixelSize(18);
@@ -57,6 +60,7 int main(int argc, char *argv[])
57 backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
60 backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
58 chart->setBackgroundBrush(backgroundGradient);
61 chart->setBackgroundBrush(backgroundGradient);
59 //![4]
62 //![4]
63
60 //![5]
64 //![5]
61 QPen black(Qt::black);
65 QPen black(Qt::black);
62 QChartAxis* axisX = chart->axisX();
66 QChartAxis* axisX = chart->axisX();
@@ -72,6 +76,7 int main(int argc, char *argv[])
72 axisY->setShadesBrush(Qt::white);
76 axisY->setShadesBrush(Qt::white);
73 axisY->setShadesVisible(true);
77 axisY->setShadesVisible(true);
74 //![5]
78 //![5]
79
75 //![6]
80 //![6]
76 QChartAxisCategories* categoriesX = chart->axisX()->categories();
81 QChartAxisCategories* categoriesX = chart->axisX()->categories();
77 categoriesX->insert(1,"low");
82 categoriesX->insert(1,"low");
@@ -83,21 +88,25 int main(int argc, char *argv[])
83 categoriesY->insert(5,"med");
88 categoriesY->insert(5,"med");
84 categoriesY->insert(10,"fast");
89 categoriesY->insert(10,"fast");
85 //![6]
90 //![6]
91
86 //![7]
92 //![7]
87 axisX->setRange(0,10);
93 axisX->setRange(0,10);
88 axisX->setTicksCount(4);
94 axisX->setTicksCount(4);
89 axisY->setRange(0,10);
95 axisY->setRange(0,10);
90 axisY->setTicksCount(4);
96 axisY->setTicksCount(4);
91 //![7]
97 //![7]
98
92 //![8]
99 //![8]
93 QChartView* chartView = new QChartView(chart);
100 QChartView* chartView = new QChartView(chart);
94 chartView->setRenderHint(QPainter::Antialiasing);
101 chartView->setRenderHint(QPainter::Antialiasing);
95 //![8]
102 //![8]
103
96 //![9]
104 //![9]
97 QMainWindow window;
105 QMainWindow window;
98 window.setCentralWidget(chartView);
106 window.setCentralWidget(chartView);
99 window.resize(400, 300);
107 window.resize(400, 300);
100 window.show();
108 window.show();
101 //![9]
109 //![9]
110
102 return a.exec();
111 return a.exec();
103 }
112 }
@@ -28,12 +28,14 QTCOMMERCIALCHART_USE_NAMESPACE
28 int main(int argc, char *argv[])
28 int main(int argc, char *argv[])
29 {
29 {
30 QApplication a(argc, argv);
30 QApplication a(argc, argv);
31
31 //![1]
32 //![1]
32 QLineSeries* series = new QLineSeries();
33 QLineSeries* series = new QLineSeries();
33 QPen red(Qt::red);
34 QPen red(Qt::red);
34 red.setWidth(3);
35 red.setWidth(3);
35 series->setPen(red);
36 series->setPen(red);
36 //![1]
37 //![1]
38
37 //![2]
39 //![2]
38 series->append(0, 6);
40 series->append(0, 6);
39 series->append(2, 4);
41 series->append(2, 4);
@@ -42,20 +44,24 int main(int argc, char *argv[])
42 series->append(10, 5);
44 series->append(10, 5);
43 *series << QPointF(11, 1) << QPointF(13, 3) << QPointF(17, 6) << QPointF(18, 3) << QPointF(20, 2);
45 *series << QPointF(11, 1) << QPointF(13, 3) << QPointF(17, 6) << QPointF(18, 3) << QPointF(20, 2);
44 //![2]
46 //![2]
47
45 //![3]
48 //![3]
46 QChart* chart = new QChart();
49 QChart* chart = new QChart();
47 chart->addSeries(series);
50 chart->addSeries(series);
48 chart->setTitle("Simple line chart example");
51 chart->setTitle("Simple line chart example");
49 //![3]
52 //![3]
53
50 //![4]
54 //![4]
51 QChartView* chartView = new QChartView(chart);
55 QChartView* chartView = new QChartView(chart);
52 chartView->setRenderHint(QPainter::Antialiasing);
56 chartView->setRenderHint(QPainter::Antialiasing);
53 //![4]
57 //![4]
58
54 //![5]
59 //![5]
55 QMainWindow window;
60 QMainWindow window;
56 window.setCentralWidget(chartView);
61 window.setCentralWidget(chartView);
57 window.resize(400, 300);
62 window.resize(400, 300);
58 window.show();
63 window.show();
59 //![5]
64 //![5]
65
60 return a.exec();
66 return a.exec();
61 }
67 }
@@ -29,10 +29,12 QTCOMMERCIALCHART_USE_NAMESPACE
29 int main(int argc, char *argv[])
29 int main(int argc, char *argv[])
30 {
30 {
31 QApplication a(argc, argv);
31 QApplication a(argc, argv);
32
32 //![1]
33 //![1]
33 QBarCategories categories;
34 QBarCategories categories;
34 categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun";
35 categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun";
35 //![1]
36 //![1]
37
36 //![2]
38 //![2]
37 QBarSet *set0 = new QBarSet("Jane");
39 QBarSet *set0 = new QBarSet("Jane");
38 QBarSet *set1 = new QBarSet("John");
40 QBarSet *set1 = new QBarSet("John");
@@ -46,6 +48,7 int main(int argc, char *argv[])
46 *set3 << 5 << 6 << 7 << 3 << 4 << 5;
48 *set3 << 5 << 6 << 7 << 3 << 4 << 5;
47 *set4 << 9 << 7 << 5 << 3 << 1 << 2;
49 *set4 << 9 << 7 << 5 << 3 << 1 << 2;
48 //![2]
50 //![2]
51
49 //![3]
52 //![3]
50 QPercentBarSeries* series = new QPercentBarSeries(categories);
53 QPercentBarSeries* series = new QPercentBarSeries(categories);
51 series->appendBarSet(set0);
54 series->appendBarSet(set0);
@@ -54,21 +57,25 int main(int argc, char *argv[])
54 series->appendBarSet(set3);
57 series->appendBarSet(set3);
55 series->appendBarSet(set4);
58 series->appendBarSet(set4);
56 //![3]
59 //![3]
60
57 //![4]
61 //![4]
58 QChart* chart = new QChart();
62 QChart* chart = new QChart();
59 chart->addSeries(series);
63 chart->addSeries(series);
60 chart->setTitle("Simple precentbarchart example");
64 chart->setTitle("Simple precentbarchart example");
61 //![4]
65 //![4]
66
62 //![5]
67 //![5]
63 QChartView* chartView = new QChartView(chart);
68 QChartView* chartView = new QChartView(chart);
64 chartView->setRenderHint(QPainter::Antialiasing);
69 chartView->setRenderHint(QPainter::Antialiasing);
65 //![5]
70 //![5]
71
66 //![6]
72 //![6]
67 QMainWindow window;
73 QMainWindow window;
68 window.setCentralWidget(chartView);
74 window.setCentralWidget(chartView);
69 window.resize(400, 300);
75 window.resize(400, 300);
70 window.show();
76 window.show();
71 //![6]
77 //![6]
78
72 return a.exec();
79 return a.exec();
73 }
80 }
74
81
@@ -28,6 +28,7 QTCOMMERCIALCHART_USE_NAMESPACE
28 int main(int argc, char *argv[])
28 int main(int argc, char *argv[])
29 {
29 {
30 QApplication a(argc, argv);
30 QApplication a(argc, argv);
31
31 //![1]
32 //![1]
32 QPen pen(Qt::black);
33 QPen pen(Qt::black);
33 pen.setWidth(2);
34 pen.setWidth(2);
@@ -56,6 +57,7 int main(int argc, char *argv[])
56
57
57 *series1 << QPointF(1, 1) << QPointF(3, 3) << QPointF(7, 6) << QPointF(8, 3) << QPointF(10, 2);
58 *series1 << QPointF(1, 1) << QPointF(3, 3) << QPointF(7, 6) << QPointF(8, 3) << QPointF(10, 2);
58 //![2]
59 //![2]
60
59 //![3]
61 //![3]
60 QChart* chart = new QChart();
62 QChart* chart = new QChart();
61
63
@@ -63,15 +65,18 int main(int argc, char *argv[])
63 chart->addSeries(series1);
65 chart->addSeries(series1);
64 chart->setTitle("Simple scatterchart example");
66 chart->setTitle("Simple scatterchart example");
65 //![3]
67 //![3]
68
66 //![4]
69 //![4]
67 QChartView* chartView = new QChartView(chart);
70 QChartView* chartView = new QChartView(chart);
68 chartView->setRenderHint(QPainter::Antialiasing);
71 chartView->setRenderHint(QPainter::Antialiasing);
69 //![4]
72 //![4]
73
70 //![5]
74 //![5]
71 QMainWindow window;
75 QMainWindow window;
72 window.setCentralWidget(chartView);
76 window.setCentralWidget(chartView);
73 window.resize(400, 300);
77 window.resize(400, 300);
74 window.show();
78 window.show();
75 //![5]
79 //![5]
80
76 return a.exec();
81 return a.exec();
77 }
82 }
@@ -29,10 +29,12 QTCOMMERCIALCHART_USE_NAMESPACE
29 int main(int argc, char *argv[])
29 int main(int argc, char *argv[])
30 {
30 {
31 QApplication a(argc, argv);
31 QApplication a(argc, argv);
32
32 //![1]
33 //![1]
33 QBarCategories categories;
34 QBarCategories categories;
34 categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun";
35 categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun";
35 //![1]
36 //![1]
37
36 //![2]
38 //![2]
37 QBarSet *set0 = new QBarSet("Jane");
39 QBarSet *set0 = new QBarSet("Jane");
38 QBarSet *set1 = new QBarSet("John");
40 QBarSet *set1 = new QBarSet("John");
@@ -46,6 +48,7 int main(int argc, char *argv[])
46 *set3 << 5 << 6 << 7 << 3 << 4 << 5;
48 *set3 << 5 << 6 << 7 << 3 << 4 << 5;
47 *set4 << 9 << 7 << 5 << 3 << 1 << 2;
49 *set4 << 9 << 7 << 5 << 3 << 1 << 2;
48 //![2]
50 //![2]
51
49 //![3]
52 //![3]
50 QStackedBarSeries* series = new QStackedBarSeries(categories);
53 QStackedBarSeries* series = new QStackedBarSeries(categories);
51 series->appendBarSet(set0);
54 series->appendBarSet(set0);
@@ -54,21 +57,25 int main(int argc, char *argv[])
54 series->appendBarSet(set3);
57 series->appendBarSet(set3);
55 series->appendBarSet(set4);
58 series->appendBarSet(set4);
56 //![3]
59 //![3]
60
57 //![4]
61 //![4]
58 QChart* chart = new QChart();
62 QChart* chart = new QChart();
59 chart->addSeries(series);
63 chart->addSeries(series);
60 chart->setTitle("Simple stackedbarchart example");
64 chart->setTitle("Simple stackedbarchart example");
61 //![4]
65 //![4]
66
62 //![5]
67 //![5]
63 QChartView* chartView = new QChartView(chart);
68 QChartView* chartView = new QChartView(chart);
64 chartView->setRenderHint(QPainter::Antialiasing);
69 chartView->setRenderHint(QPainter::Antialiasing);
65 //![5]
70 //![5]
71
66 //![6]
72 //![6]
67 QMainWindow window;
73 QMainWindow window;
68 window.setCentralWidget(chartView);
74 window.setCentralWidget(chartView);
69 window.resize(400, 300);
75 window.resize(400, 300);
70 window.show();
76 window.show();
71 //![6]
77 //![6]
78
72 return a.exec();
79 return a.exec();
73 }
80 }
74
81
@@ -40,10 +40,12 int main(int argc, char *argv[])
40 red.setWidth(3);
40 red.setWidth(3);
41 series1->setPen(red);
41 series1->setPen(red);
42 //![1]
42 //![1]
43
43 //![2]
44 //![2]
44 *series0 << QPointF(0, 6) << QPointF(2, 4) << QPointF(3, 8) << QPointF(7, 4) << QPointF(10, 5);
45 *series0 << QPointF(0, 6) << QPointF(2, 4) << QPointF(3, 8) << QPointF(7, 4) << QPointF(10, 5);
45 *series1 << QPointF(1, 1) << QPointF(3, 3) << QPointF(7, 6) << QPointF(8, 3) << QPointF(10, 2);
46 *series1 << QPointF(1, 1) << QPointF(3, 3) << QPointF(7, 6) << QPointF(8, 3) << QPointF(10, 2);
46 //![2]
47 //![2]
48
47 //![3]
49 //![3]
48 QChart* chart = new QChart();
50 QChart* chart = new QChart();
49
51
@@ -52,15 +54,18 int main(int argc, char *argv[])
52 chart->setTitle("Zoom in/out chart example");
54 chart->setTitle("Zoom in/out chart example");
53 chart->setAnimationOptions(QChart::AllAnimations);
55 chart->setAnimationOptions(QChart::AllAnimations);
54 //![3]
56 //![3]
57
55 //![4]
58 //![4]
56 ChartView* chartView = new ChartView(chart);
59 ChartView* chartView = new ChartView(chart);
57 chartView->setRenderHint(QPainter::Antialiasing);
60 chartView->setRenderHint(QPainter::Antialiasing);
58 //![4]
61 //![4]
62
59 //![5]
63 //![5]
60 QMainWindow window;
64 QMainWindow window;
61 window.setCentralWidget(chartView);
65 window.setCentralWidget(chartView);
62 window.resize(400, 300);
66 window.resize(400, 300);
63 window.show();
67 window.show();
64 //![5]
68 //![5]
69
65 return a.exec();
70 return a.exec();
66 }
71 }
General Comments 0
You need to be logged in to leave comments. Login now