##// END OF EJS Templates
updated documentation and examples for barcharts
sauimone -
r325:043a715b3681
parent child
Show More
@@ -13,12 +13,13 int main(int argc, char *argv[])
13 13 QMainWindow window;
14 14
15 15 //! [1]
16 // Create category
16 17 QBarCategory *category = new QBarCategory;
17 18 *category << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "June" << "Jul" << "Aug" << "Sep" << "Oct" << "Nov" << "Dec";
18 19 //! [1]
19 20
20 21 //! [2]
21 QBarChartSeries* series= new QBarChartSeries(category);
22 // Create some test sets for chat
22 23
23 24 QBarSet *set0 = new QBarSet("Bub");
24 25 QBarSet *set1 = new QBarSet("Bob");
@@ -26,29 +27,38 int main(int argc, char *argv[])
26 27 QBarSet *set3 = new QBarSet("Larry");
27 28 QBarSet *set4 = new QBarSet("Zak");
28 29
29 // Create some test data to chart
30 30 *set0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8 << 9 << 10 << 11 << 12;
31 31 *set1 << 5 << 0 << 0 << 4 << 0 << 7 << 8 << 9 << 9 << 0 << 4 << 2;
32 32 *set2 << 3 << 5 << 8 << 13 << 8 << 5 << 3 << 2 << 1 << 1 << 3 << 5;
33 33 *set3 << 5 << 6 << 7 << 3 << 4 << 5 << 8 << 9 << 10 << 5 << 2 << 7;
34 34 *set4 << 9 << 7 << 5 << 3 << 1 << 2 << 4 << 6 << 8 << 10 << 1 << 6;
35 //! [2]
36
37 //! [3]
38 // Create series and add sets to it
39 QBarChartSeries* series= new QBarChartSeries(category);
35 40
36 41 series->addBarSet(set0);
37 42 series->addBarSet(set1);
38 43 series->addBarSet(set2);
39 44 series->addBarSet(set3);
40 45 series->addBarSet(set4);
41 //! [2]
42
43 46 //! [3]
47
48 //! [4]
49 // Enable some features
44 50 series->enableToolTip();
45 51 series->enableFloatingValues();
46 //! [3]
52 //! [4]
53
54 //! [5]
55 // Create view for chart and add series to it. Apply theme.
47 56
48 57 QChartView* chartView = new QChartView(&window);
49 58 chartView->addSeries(series);
50 59 chartView->setChartTitle("simple stacked barchart");
51 60 chartView->setChartTheme(QChart::ChartThemeIcy);
61 //! [5]
52 62
53 63 window.setCentralWidget(chartView);
54 64 window.resize(600, 300);
@@ -13,39 +13,52 int main(int argc, char *argv[])
13 13 QApplication a(argc, argv);
14 14 QMainWindow window;
15 15
16 //! [1]
17 // Create category
16 18 QBarCategory *category = new QBarCategory;
17 19 *category << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "June" << "Jul" << "Aug" << "Sep" << "Oct" << "Nov" << "Dec";
18
19 20 //! [1]
20 QPercentBarChartSeries* series = new QPercentBarChartSeries(category);
21 21
22 //! [2]
23 // Create some test sets for chat
22 24 QBarSet *set0 = new QBarSet("Bub");
23 25 QBarSet *set1 = new QBarSet("Bob");
24 26 QBarSet *set2 = new QBarSet("Guybrush");
25 27 QBarSet *set3 = new QBarSet("Larry");
26 28 QBarSet *set4 = new QBarSet("Zak");
27 29
28 // Create some test data to chart
29 30 *set0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8 << 9 << 10 << 11 << 12;
30 31 *set1 << 5 << 0 << 0 << 4 << 0 << 7 << 8 << 9 << 9 << 0 << 4 << 2;
31 32 *set2 << 3 << 5 << 8 << 13 << 8 << 5 << 3 << 2 << 1 << 1 << 3 << 5;
32 33 *set3 << 5 << 6 << 7 << 3 << 4 << 5 << 8 << 9 << 10 << 5 << 2 << 7;
33 34 *set4 << 9 << 7 << 5 << 3 << 1 << 2 << 4 << 6 << 8 << 10 << 1 << 6;
35 //! [2]
36
37 //! [3]
38 // Create series and add sets to it
39 QPercentBarChartSeries* series = new QPercentBarChartSeries(category);
34 40
35 41 series->addBarSet(set0);
36 42 series->addBarSet(set1);
37 43 series->addBarSet(set2);
38 44 series->addBarSet(set3);
39 45 series->addBarSet(set4);
40 //! [1]
46 //! [3]
41 47
48 //! [4]
49 // Enable features
42 50 series->enableToolTip();
43 51 series->enableFloatingValues();
52 //! [4]
53
54 //! [5]
55 // Create view for chart and add series to it. Apply theme.
44 56
45 57 QChartView* chartView = new QChartView(&window);
46 58 chartView->addSeries(series);
47 59 chartView->setChartTitle("simple percent barchart");
48 60 chartView->setChartTheme(QChart::ChartThemeIcy);
61 //! [5]
49 62
50 63 window.setCentralWidget(chartView);
51 64 window.resize(400, 300);
@@ -13,38 +13,51 int main(int argc, char *argv[])
13 13 QMainWindow window;
14 14
15 15 //! [1]
16 // Create category
16 17 QBarCategory *category = new QBarCategory;
17 18 *category << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "June" << "Jul" << "Aug" << "Sep" << "Oct" << "Nov" << "Dec";
19 //! [1]
18 20
19 QStackedBarChartSeries* series = new QStackedBarChartSeries(category);
20
21 //! [2]
22 // Create some test sets for chat
21 23 QBarSet *set0 = new QBarSet("Bub");
22 24 QBarSet *set1 = new QBarSet("Bob");
23 25 QBarSet *set2 = new QBarSet("Guybrush");
24 26 QBarSet *set3 = new QBarSet("Larry");
25 27 QBarSet *set4 = new QBarSet("Zak");
26 28
27 // Create some test data to chart
28 29 *set0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8 << 9 << 10 << 11 << 12;
29 30 *set1 << 5 << 0 << 0 << 4 << 0 << 7 << 8 << 9 << 9 << 0 << 4 << 2;
30 31 *set2 << 3 << 5 << 8 << 13 << 8 << 5 << 3 << 2 << 1 << 1 << 3 << 5;
31 32 *set3 << 5 << 6 << 7 << 3 << 4 << 5 << 8 << 9 << 10 << 5 << 2 << 7;
32 33 *set4 << 9 << 7 << 5 << 3 << 1 << 2 << 4 << 6 << 8 << 10 << 1 << 6;
34 //! [2]
35
36 //! [3]
37 // Create series and add sets to it
38 QStackedBarChartSeries* series = new QStackedBarChartSeries(category);
33 39
34 40 series->addBarSet(set0);
35 41 series->addBarSet(set1);
36 42 series->addBarSet(set2);
37 43 series->addBarSet(set3);
38 44 series->addBarSet(set4);
45 //! [3]
39 46
47 //! [4]
48 // Enable features
40 49 series->enableToolTip();
41 50 series->enableFloatingValues();
42 //! [1]
51 //! [4]
52
53 //! [5]
54 // Create view for chart and add series to it. Apply theme.
43 55
44 56 QChartView* chartView = new QChartView(&window);
45 57 chartView->addSeries(series);
46 58 chartView->setChartTitle("simple stacked barchart");
47 59 chartView->setChartTheme(QChart::ChartThemeIcy);
60 //! [5]
48 61
49 62 window.setCentralWidget(chartView);
50 63 window.resize(400, 300);
@@ -17,12 +17,20 QTCOMMERCIALCHART_BEGIN_NAMESPACE
17 17
18 18 \mainclass
19 19
20 Example on how to add sets to bar chart:
20 Example on how to create category:
21 \snippet ../example/barchart/main.cpp 1
22
23 Example on how to create sets of data:
21 24 \snippet ../example/barchart/main.cpp 2
22 25
26 Example on how to add sets to bar chart:
27 \snippet ../example/barchart/main.cpp 3
23 28
24 29 Example on how to enable tooltip and floating values:
25 \snippet ../example/barchart/main.cpp 3
30 \snippet ../example/barchart/main.cpp 4
31
32 Example on how to create view and apply theme:
33 \snippet ../example/barchart/main.cpp 5
26 34
27 35 \sa QBarCategory, QBarSet, QStackedBarChartSeries, QPercentBarChartSeries
28 36 */
@@ -13,6 +13,11 QTCOMMERCIALCHART_BEGIN_NAMESPACE
13 13 If set has fewer values than there are categories, then the missing values are assumed to be
14 14 at the end of set. For missing values in middle of a set, numerical value of zero is used.
15 15
16 \mainclass
17
18 Example on how to create sets of data:
19 \snippet ../example/barchart/main.cpp 2
20
16 21 \sa QBarCategory, QBarChartSeries, QStackedBarChartSeries, QPercentBarChartSeries
17 22 */
18 23
@@ -12,8 +12,20 QTCOMMERCIALCHART_BEGIN_NAMESPACE
12 12
13 13 \mainclass
14 14
15 Example on using QPercentBarChartSeries
16 \snippet ../example/percentbarchart/main.cpp 1
15 Example on how to create category:
16 \snippet ../example/barchart/main.cpp 1
17
18 Example on how to create sets of data:
19 \snippet ../example/barchart/main.cpp 2
20
21 Example on how to add sets to bar chart:
22 \snippet ../example/barchart/main.cpp 3
23
24 Example on how to enable tooltip and floating values:
25 \snippet ../example/barchart/main.cpp 4
26
27 Example on how to create view and apply theme:
28 \snippet ../example/barchart/main.cpp 5
17 29
18 30 \sa QBarCategory, QBarSet, QStackedBarChartSeries, QBarChartSeries
19 31 */
@@ -12,8 +12,20 QTCOMMERCIALCHART_BEGIN_NAMESPACE
12 12
13 13 \mainclass
14 14
15 Example on using QStackedBarChartSeries
16 \snippet ../example/stackedbarchart/main.cpp 1
15 Example on how to create category:
16 \snippet ../example/barchart/main.cpp 1
17
18 Example on how to create sets of data:
19 \snippet ../example/barchart/main.cpp 2
20
21 Example on how to add sets to bar chart:
22 \snippet ../example/barchart/main.cpp 3
23
24 Example on how to enable tooltip and floating values:
25 \snippet ../example/barchart/main.cpp 4
26
27 Example on how to create view and apply theme:
28 \snippet ../example/barchart/main.cpp 5
17 29
18 30 \sa QBarCategory, QBarSet, QPercentBarChartSeries, QBarChartSeries
19 31 */
General Comments 0
You need to be logged in to leave comments. Login now