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