##// END OF EJS Templates
removed groupedbarchart example. fixed barchart example
sauimone -
r1600:2104eb1dd62b
parent child
Show More
@@ -24,6 +24,7
24 #include <QBarSeries>
24 #include <QBarSeries>
25 #include <QBarSet>
25 #include <QBarSet>
26 #include <QLegend>
26 #include <QLegend>
27 #include <QCategoriesAxis>
27
28
28 QTCOMMERCIALCHART_USE_NAMESPACE
29 QTCOMMERCIALCHART_USE_NAMESPACE
29
30
@@ -36,44 +37,56 int main(int argc, char *argv[])
36 QBarSet *set1 = new QBarSet("John");
37 QBarSet *set1 = new QBarSet("John");
37 QBarSet *set2 = new QBarSet("Axel");
38 QBarSet *set2 = new QBarSet("Axel");
38 QBarSet *set3 = new QBarSet("Mary");
39 QBarSet *set3 = new QBarSet("Mary");
40 QBarSet *set4 = new QBarSet("Samantha");
39
41
40 *set0 << QPointF(0.0, 1) << QPointF(1.0, 2) << QPointF(2.4, 3) << QPointF(3.0, 4) << QPointF(4.0, 5) << QPointF(5.0, 6);
42 *set0 << 1 << 2 << 3 << 4 << 5 << 6;
41 *set1 << QPointF(0.1, 2) << QPointF(1.2, 3) << QPointF(2.45, 4) << QPointF(3.2, 5) << QPointF(4.2, 6) << QPointF(5.2, 7);
43 *set1 << 5 << 0 << 0 << 4 << 0 << 7;
42 *set2 << QPointF(0.2, 3) << QPointF(1.4, 4) << QPointF(2.50, 5) << QPointF(3.4, 6) << QPointF(4.4, 7) << QPointF(5.4, 8);
44 *set2 << 3 << 5 << 8 << 13 << 8 << 5;
43 *set3 << QPointF(0.3, 4) << QPointF(1.6, 5) << QPointF(2.55, 6) << QPointF(3.6, 7) << QPointF(4.6, 8) << QPointF(5.6, 9);
45 *set3 << 5 << 6 << 7 << 3 << 4 << 5;
46 *set4 << 9 << 7 << 5 << 3 << 1 << 2;
44 //![1]
47 //![1]
45
48
46 //![2]
49 //![2]
47 QBarSeries* series = new QBarSeries();
50 QBarSeries* series = new QBarSeries();
48 series->setBarWidth(0.2);
49 series->append(set0);
51 series->append(set0);
50 series->append(set1);
52 series->append(set1);
51 series->append(set2);
53 series->append(set2);
52 series->append(set3);
54 series->append(set3);
55 series->append(set4);
56
53 //![2]
57 //![2]
54
58
55 //![3]
59 //![3]
56 QChart* chart = new QChart();
60 QChart* chart = new QChart();
57 chart->addSeries(series);
61 chart->addSeries(series);
58 chart->setTitle("Barchart example");
62 chart->setTitle("Barchart example");
63 chart->createDefaultAxes();
59 //![3]
64 //![3]
60
65
61 //![4]
66 //![4]
62 chart->legend()->setVisible(true);
67 QStringList categories;
63 chart->legend()->setAlignment(Qt::AlignBottom);
68 categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun";
69 QCategoriesAxis* axis = new QCategoriesAxis();
70 axis->append(categories);
71 chart->setAxisX(axis,series);
64 //![4]
72 //![4]
65
73
66 //![5]
74 //![5]
67 QChartView* chartView = new QChartView(chart);
75 chart->legend()->setVisible(true);
68 chartView->setRenderHint(QPainter::Antialiasing);
76 chart->legend()->setAlignment(Qt::AlignBottom);
69 //![5]
77 //![5]
70
78
71 //![6]
79 //![6]
80 QChartView* chartView = new QChartView(chart);
81 chartView->setRenderHint(QPainter::Antialiasing);
82 //![6]
83
84 //![7]
72 QMainWindow window;
85 QMainWindow window;
73 window.setCentralWidget(chartView);
86 window.setCentralWidget(chartView);
74 window.resize(400, 300);
87 window.resize(400, 300);
75 window.show();
88 window.show();
76 //![6]
89 //![7]
77
90
78 return a.exec();
91 return a.exec();
79 }
92 }
@@ -19,7 +19,7 SUBDIRS += \
19 stackedbarchartdrilldown \
19 stackedbarchartdrilldown \
20 zoomlinechart \
20 zoomlinechart \
21 modeldata \
21 modeldata \
22 groupedbarchart \
22 barchart \
23 legend \
23 legend \
24 barmodelmapper \
24 barmodelmapper \
25 qmlpiechart
25 qmlpiechart
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now