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