@@ -1,69 +1,71 | |||
|
1 | 1 | #include <QApplication> |
|
2 | 2 | #include <QMainWindow> |
|
3 | 3 | #include <qchartview.h> |
|
4 | 4 | #include <qbarseries.h> |
|
5 | 5 | #include <qbarset.h> |
|
6 | 6 | #include <qbarcategory.h> |
|
7 | 7 | |
|
8 | 8 | QTCOMMERCIALCHART_USE_NAMESPACE |
|
9 | 9 | |
|
10 | 10 | int main(int argc, char *argv[]) |
|
11 | 11 | { |
|
12 | 12 | QApplication a(argc, argv); |
|
13 | 13 | QMainWindow window; |
|
14 | 14 | |
|
15 | 15 | //! [1] |
|
16 | 16 | // Create category |
|
17 | 17 | QBarCategory *category = new QBarCategory; |
|
18 | 18 | *category << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "June" << "Jul" << "Aug" << "Sep" << "Oct" << "Nov" << "Dec"; |
|
19 | 19 | //! [1] |
|
20 | 20 | |
|
21 | 21 | //! [2] |
|
22 | 22 | // Create some test sets for chat |
|
23 | 23 | |
|
24 | 24 | QBarSet *set0 = new QBarSet("Bub"); |
|
25 | 25 | QBarSet *set1 = new QBarSet("Bob"); |
|
26 | 26 | QBarSet *set2 = new QBarSet("Guybrush"); |
|
27 | 27 | QBarSet *set3 = new QBarSet("Larry"); |
|
28 | 28 | QBarSet *set4 = new QBarSet("Zak"); |
|
29 | 29 | |
|
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 | 35 | //! [2] |
|
36 | 36 | |
|
37 | 37 | //! [3] |
|
38 | 38 | // Create series and add sets to it |
|
39 | 39 | QBarSeries* series= new QBarSeries(category); |
|
40 | 40 | |
|
41 | 41 | series->addBarSet(set0); |
|
42 | 42 | series->addBarSet(set1); |
|
43 | 43 | series->addBarSet(set2); |
|
44 | 44 | series->addBarSet(set3); |
|
45 | 45 | series->addBarSet(set4); |
|
46 | 46 | //! [3] |
|
47 | 47 | |
|
48 | 48 | //! [4] |
|
49 | 49 | // Enable some features |
|
50 | // series->setToolTipEnabled(); | |
|
51 | // series->enableFloatingValues(); | |
|
50 | 52 | series->setToolTipEnabled(); |
|
51 |
series-> |
|
|
53 | series->setFloatingValuesEnabled(); | |
|
52 | 54 | //! [4] |
|
53 | 55 | |
|
54 | 56 | //! [5] |
|
55 | 57 | // Create view for chart and add series to it. Apply theme. |
|
56 | 58 | |
|
57 | 59 | QChartView* chartView = new QChartView(&window); |
|
58 | 60 | chartView->addSeries(series); |
|
59 | 61 | chartView->setChartTitle("simple stacked barchart"); |
|
60 | 62 | chartView->setChartTheme(QChart::ChartThemeIcy); |
|
61 | 63 | //! [5] |
|
62 | 64 | |
|
63 | 65 | window.setCentralWidget(chartView); |
|
64 | 66 | window.resize(600, 300); |
|
65 | 67 | window.show(); |
|
66 | 68 | |
|
67 | 69 | return a.exec(); |
|
68 | 70 | } |
|
69 | 71 |
@@ -1,69 +1,69 | |||
|
1 | 1 | #include <QApplication> |
|
2 | 2 | #include <QMainWindow> |
|
3 | 3 | #include <QStandardItemModel> |
|
4 | 4 | #include <qpercentbarseries.h> |
|
5 | 5 | #include <qbarcategory.h> |
|
6 | 6 | #include <qchartview.h> |
|
7 | 7 | #include <qbarset.h> |
|
8 | 8 | |
|
9 | 9 | QTCOMMERCIALCHART_USE_NAMESPACE |
|
10 | 10 | |
|
11 | 11 | int main(int argc, char *argv[]) |
|
12 | 12 | { |
|
13 | 13 | QApplication a(argc, argv); |
|
14 | 14 | QMainWindow window; |
|
15 | 15 | |
|
16 | 16 | //! [1] |
|
17 | 17 | // Create category |
|
18 | 18 | QBarCategory *category = new QBarCategory; |
|
19 | 19 | *category << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "June" << "Jul" << "Aug" << "Sep" << "Oct" << "Nov" << "Dec"; |
|
20 | 20 | //! [1] |
|
21 | 21 | |
|
22 | 22 | //! [2] |
|
23 | 23 | // Create some test sets for chat |
|
24 | 24 | QBarSet *set0 = new QBarSet("Bub"); |
|
25 | 25 | QBarSet *set1 = new QBarSet("Bob"); |
|
26 | 26 | QBarSet *set2 = new QBarSet("Guybrush"); |
|
27 | 27 | QBarSet *set3 = new QBarSet("Larry"); |
|
28 | 28 | QBarSet *set4 = new QBarSet("Zak"); |
|
29 | 29 | |
|
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 | 35 | //! [2] |
|
36 | 36 | |
|
37 | 37 | //! [3] |
|
38 | 38 | // Create series and add sets to it |
|
39 | 39 | QPercentBarSeries* series = new QPercentBarSeries(category); |
|
40 | 40 | |
|
41 | 41 | series->addBarSet(set0); |
|
42 | 42 | series->addBarSet(set1); |
|
43 | 43 | series->addBarSet(set2); |
|
44 | 44 | series->addBarSet(set3); |
|
45 | 45 | series->addBarSet(set4); |
|
46 | 46 | //! [3] |
|
47 | 47 | |
|
48 | 48 | //! [4] |
|
49 | 49 | // Enable features |
|
50 | 50 | series->setToolTipEnabled(); |
|
51 |
series-> |
|
|
51 | series->setFloatingValuesEnabled(); | |
|
52 | 52 | //! [4] |
|
53 | 53 | |
|
54 | 54 | //! [5] |
|
55 | 55 | // Create view for chart and add series to it. Apply theme. |
|
56 | 56 | |
|
57 | 57 | QChartView* chartView = new QChartView(&window); |
|
58 | 58 | chartView->addSeries(series); |
|
59 | 59 | chartView->setChartTitle("simple percent barchart"); |
|
60 | 60 | chartView->setChartTheme(QChart::ChartThemeIcy); |
|
61 | 61 | //! [5] |
|
62 | 62 | |
|
63 | 63 | window.setCentralWidget(chartView); |
|
64 | 64 | window.resize(400, 300); |
|
65 | 65 | window.show(); |
|
66 | 66 | |
|
67 | 67 | return a.exec(); |
|
68 | 68 | } |
|
69 | 69 |
@@ -1,68 +1,68 | |||
|
1 | 1 | #include <QApplication> |
|
2 | 2 | #include <QMainWindow> |
|
3 | 3 | #include <qchartview.h> |
|
4 | 4 | #include <qstackedbarseries.h> |
|
5 | 5 | #include <qbarset.h> |
|
6 | 6 | #include <qbarcategory.h> |
|
7 | 7 | |
|
8 | 8 | QTCOMMERCIALCHART_USE_NAMESPACE |
|
9 | 9 | |
|
10 | 10 | int main(int argc, char *argv[]) |
|
11 | 11 | { |
|
12 | 12 | QApplication a(argc, argv); |
|
13 | 13 | QMainWindow window; |
|
14 | 14 | |
|
15 | 15 | //! [1] |
|
16 | 16 | // Create category |
|
17 | 17 | QBarCategory *category = new QBarCategory; |
|
18 | 18 | *category << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "June" << "Jul" << "Aug" << "Sep" << "Oct" << "Nov" << "Dec"; |
|
19 | 19 | //! [1] |
|
20 | 20 | |
|
21 | 21 | //! [2] |
|
22 | 22 | // Create some test sets for chat |
|
23 | 23 | QBarSet *set0 = new QBarSet("Bub"); |
|
24 | 24 | QBarSet *set1 = new QBarSet("Bob"); |
|
25 | 25 | QBarSet *set2 = new QBarSet("Guybrush"); |
|
26 | 26 | QBarSet *set3 = new QBarSet("Larry"); |
|
27 | 27 | QBarSet *set4 = new QBarSet("Zak"); |
|
28 | 28 | |
|
29 | 29 | *set0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8 << 9 << 10 << 11 << 12; |
|
30 | 30 | *set1 << 5 << 0 << 0 << 4 << 0 << 7 << 8 << 9 << 9 << 0 << 4 << 2; |
|
31 | 31 | *set2 << 3 << 5 << 8 << 13 << 8 << 5 << 3 << 2 << 1 << 1 << 3 << 5; |
|
32 | 32 | *set3 << 5 << 6 << 7 << 3 << 4 << 5 << 8 << 9 << 10 << 5 << 2 << 7; |
|
33 | 33 | *set4 << 9 << 7 << 5 << 3 << 1 << 2 << 4 << 6 << 8 << 10 << 1 << 6; |
|
34 | 34 | //! [2] |
|
35 | 35 | |
|
36 | 36 | //! [3] |
|
37 | 37 | // Create series and add sets to it |
|
38 | 38 | QStackedBarSeries* series = new QStackedBarSeries(category); |
|
39 | 39 | |
|
40 | 40 | series->addBarSet(set0); |
|
41 | 41 | series->addBarSet(set1); |
|
42 | 42 | series->addBarSet(set2); |
|
43 | 43 | series->addBarSet(set3); |
|
44 | 44 | series->addBarSet(set4); |
|
45 | 45 | //! [3] |
|
46 | 46 | |
|
47 | 47 | //! [4] |
|
48 | 48 | // Enable features |
|
49 | 49 | series->setToolTipEnabled(); |
|
50 |
series-> |
|
|
50 | series->setFloatingValuesEnabled(); | |
|
51 | 51 | //! [4] |
|
52 | 52 | |
|
53 | 53 | //! [5] |
|
54 | 54 | // Create view for chart and add series to it. Apply theme. |
|
55 | 55 | |
|
56 | 56 | QChartView* chartView = new QChartView(&window); |
|
57 | 57 | chartView->addSeries(series); |
|
58 | 58 | chartView->setChartTitle("simple stacked barchart"); |
|
59 | 59 | chartView->setChartTheme(QChart::ChartThemeIcy); |
|
60 | 60 | //! [5] |
|
61 | 61 | |
|
62 | 62 | window.setCentralWidget(chartView); |
|
63 | 63 | window.resize(400, 300); |
|
64 | 64 | window.show(); |
|
65 | 65 | |
|
66 | 66 | return a.exec(); |
|
67 | 67 | } |
|
68 | 68 |
@@ -1,51 +1,36 | |||
|
1 | 1 | #include "qpercentbarseries.h" |
|
2 | 2 | |
|
3 | 3 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
4 | 4 | |
|
5 | 5 | /*! |
|
6 | 6 | \class QPercentBarSeries |
|
7 | 7 | \brief part of QtCommercial chart API. |
|
8 | 8 | |
|
9 | 9 | QPercentBarSeries represents a series of data shown as bars. Each bar of QBarSet is shown as percentage |
|
10 | 10 | of all bars in category. One QPercentBarSeries can contain multible QBarSet data sets. |
|
11 | 11 | QBarSeries groups the data from sets to categories, which are defined by QBarCategory class. |
|
12 | 12 | |
|
13 | 13 | \mainclass |
|
14 | 14 | |
|
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 | |
|
29 | ||
|
30 | 15 | \sa QBarCategory, QBarSet, QStackedBarSeries, QBarSeries |
|
31 | 16 | */ |
|
32 | 17 | |
|
33 | 18 | /*! |
|
34 | 19 | \fn virtual QChartSeriesType QPercentBarSeries::type() const |
|
35 | 20 | \brief Returns type of series. |
|
36 | 21 | \sa QChartSeries, QChartSeriesType |
|
37 | 22 | */ |
|
38 | 23 | |
|
39 | 24 | /*! |
|
40 | 25 | Constructs empty QPercentBarSeries. Parameter \a category defines the categories for chart. |
|
41 | 26 | QPercentBarSeries is QObject which is a child of a \a parent. |
|
42 | 27 | */ |
|
43 | 28 | QPercentBarSeries::QPercentBarSeries(QBarCategory *category, QObject *parent) |
|
44 | 29 | : QBarSeries(category, parent) |
|
45 | 30 | { |
|
46 | 31 | } |
|
47 | 32 | |
|
48 | 33 | #include "moc_qpercentbarseries.cpp" |
|
49 | 34 | |
|
50 | 35 | QTCOMMERCIALCHART_END_NAMESPACE |
|
51 | 36 |
@@ -1,51 +1,36 | |||
|
1 | 1 | #include "qstackedbarseries.h" |
|
2 | 2 | |
|
3 | 3 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
4 | 4 | |
|
5 | 5 | /*! |
|
6 | 6 | \class QStackedBarSeries |
|
7 | 7 | \brief part of QtCommercial chart API. |
|
8 | 8 | |
|
9 | 9 | QStackedBarSeries represents a series of data shown as bars. All bars in same category are |
|
10 | 10 | stacked on top of each other. One QStackedBarSeries can contain multible QBarSet data sets. |
|
11 | 11 | QStackedBarSeries groups the data from sets to categories, which are defined by QBarCategory class. |
|
12 | 12 | |
|
13 | 13 | \mainclass |
|
14 | 14 | |
|
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 | |
|
29 | ||
|
30 | 15 | \sa QBarCategory, QBarSet, QPercentBarSeries, QBarSeries |
|
31 | 16 | */ |
|
32 | 17 | |
|
33 | 18 | /*! |
|
34 | 19 | \fn virtual QChartSeriesType QStackedBarSeries::type() const |
|
35 | 20 | \brief Returns type of series. |
|
36 | 21 | \sa QChartSeries, QChartSeriesType |
|
37 | 22 | */ |
|
38 | 23 | |
|
39 | 24 | /*! |
|
40 | 25 | Constructs empty QStackedBarSeries. Parameter \a category defines the categories for chart. |
|
41 | 26 | QStackedBarSeries is QObject which is a child of a \a parent. |
|
42 | 27 | */ |
|
43 | 28 | QStackedBarSeries::QStackedBarSeries(QBarCategory *category, QObject *parent) |
|
44 | 29 | : QBarSeries(category, parent) |
|
45 | 30 | { |
|
46 | 31 | } |
|
47 | 32 | |
|
48 | 33 | #include "moc_qstackedbarseries.cpp" |
|
49 | 34 | |
|
50 | 35 | QTCOMMERCIALCHART_END_NAMESPACE |
|
51 | 36 |
General Comments 0
You need to be logged in to leave comments.
Login now