##// END OF EJS Templates
barchart doc review updates
sauimone -
r1859:46904270c5f5
parent child
Show More
@@ -1,39 +1,47
1 /*!
1 /*!
2 \example examples/barchart
2 \example examples/barchart
3 \title BarChart Example
3 \title BarChart Example
4 \subtitle
4 \subtitle
5
5
6 The example shows how to create a bar chart. BarChart shows the data in sets as separate bars, which are in categories.
6 The example shows how to create a bar chart. BarChart shows the data in sets as separate bars, which are in categories.
7
7
8 \image examples_barchart.png
8 \image examples_barchart.png
9
9
10 The barsets are used in same way in all barcharts.
11 To illustrate difference between various barcharts, we use same data in examples.
10 Data that barchart visualizes, is defined by QBarSet instances. Here we create the sets and append data
12 Data that barchart visualizes, is defined by QBarSet instances. Here we create the sets and append data
11 to them.
13 to them. The data is appended here with << operator. Alternatively the append method could be used.
12
14
13 \snippet ../examples/barchart/main.cpp 1
15 \snippet ../examples/barchart/main.cpp 1
14
16
15 We create the series and append the sets to it. The barseries groups the data from sets to categories.
17 We create the series and append the barsets to it. The series takes ownership of the barsets. The series groups the data from sets to categories.
16 First value of each set are gropuped together at first category second value to second category and so on.
18 First value of each set are gropuped together at first category second value to second category and so on.
17
19
18 \snippet ../examples/barchart/main.cpp 2
20 \snippet ../examples/barchart/main.cpp 2
19
21
20 Then we create a chart and add the series to it.
22 Here we create the chart object and add the series to it. We set the title for chart with setTitle and then turn on animations of the series by calling
23 setAnimationOptions(QChart::SeriesAnimations)
21
24
22 \snippet ../examples/barchart/main.cpp 3
25 \snippet ../examples/barchart/main.cpp 3
23
26
24 We define the categories here and add them to QCategoriesAxis which we then set to be the x-axis of the chart.
27 To have categories displayed on axis, we need to create a QBarCategoryAxis for that. Here we create a category axis with list of categories and
28 set it to be the x-axis of the chart. The chart takes ownership of axis. For y-axis we use default axis, which is created and scaled to series data
29 by calling createDefaultAxes of the chart. Note that the call for createDefaultAxes must be before we set the category axis. Otherwise the default axis will
30 override the category axis.
25
31
26 \snippet ../examples/barchart/main.cpp 4
32 \snippet ../examples/barchart/main.cpp 4
27
33
28 And we also want to show the legend.
34 We also want to show the legend. To do that, we get the legend pointer from chart and set it to visible. We also place the legend to bottom of the chart by setting it's alignment
35 to Qt::AlignBottom.
29
36
30 \snippet ../examples/barchart/main.cpp 5
37 \snippet ../examples/barchart/main.cpp 5
31
38
32 Finally we add the chart onto a view.
39 Finally we add the chart onto a view. We also turn on the antialiasing for the chartView.
33
40
34 \snippet ../examples/barchart/main.cpp 6
41 \snippet ../examples/barchart/main.cpp 6
35
42
36 And it is ready to be shown in a window.
43 Chart is ready to be shown. We set the chart to be central widget of the window.
44 We also set the size for the chart window and show it.
37
45
38 \snippet ../examples/barchart/main.cpp 7
46 \snippet ../examples/barchart/main.cpp 7
39 */
47 */ No newline at end of file
@@ -1,39 +1,48
1 /*!
1 /*!
2 \example examples/horizontalbarchart
2 \example examples/horizontalbarchart
3 \title HorizontalBarChart Example
3 \title HorizontalBarChart Example
4 \subtitle
4 \subtitle
5
5
6 The example shows how to create a horizontal bar chart. HorizontalBarChart shows the data in sets as separate bars, which are grouped in categories.
6 The example shows how to create a horizontal bar chart. QHorizontalBarChart shows the data in sets as separate bars, which are grouped in categories. QHorizontalBarChart works just like
7 QBarChart, except that the bars are drawn horizontally on the chart.
7
8
8 \image examples_horizontalbarchart.png
9 \image examples_horizontalbarchart.png
9
10
11 The barsets are used in same way in all barcharts.
12 To illustrate difference between various barcharts, we use same data in examples.
10 Data that barchart visualizes, is defined by QBarSet instances. Here we create the sets and append data
13 Data that barchart visualizes, is defined by QBarSet instances. Here we create the sets and append data
11 to them.
14 to them. The data is appended here with << operator. Alternatively the append method could be used.
12
15
13 \snippet ../examples/horizontalbarchart/main.cpp 1
16 \snippet ../examples/horizontalbarchart/main.cpp 1
14
17
15 We create the series and append the sets to it. The horizontalbarseries groups the data from sets to categories.
18 We create the series and append the barsets to it. The series takes ownership of the barsets. The series groups the data from sets to categories.
16 First value of each set are gropuped together at first category second value to second category and so on.
19 First value of each set are gropuped together at first category second value to second category and so on.
17
20
18 \snippet ../examples/horizontalbarchart/main.cpp 2
21 \snippet ../examples/horizontalbarchart/main.cpp 2
19
22
20 Then we create a chart and add the series to it.
23 Here we create the chart object and add the series to it. We set the title for chart with setTitle and then turn on animations of the series by calling
24 setAnimationOptions(QChart::SeriesAnimations)
21
25
22 \snippet ../examples/horizontalbarchart/main.cpp 3
26 \snippet ../examples/horizontalbarchart/main.cpp 3
23
27
24 We define the categories here and add them to QCategoriesAxis which we then set to be the x-axis of the chart.
28 To have categories displayed on axis, we need to create a QBarCategoryAxis for that. Here we create a category axis with list of categories and
29 set it to be the y-axis of the chart. The chart takes ownership of axis. For x-axis we use default axis, which is created and scaled to series data
30 by calling createDefaultAxes of the chart. Note that the call for createDefaultAxes must be before we set the category axis. Otherwise the default axis will
31 override the category axis.
25
32
26 \snippet ../examples/horizontalbarchart/main.cpp 4
33 \snippet ../examples/horizontalbarchart/main.cpp 4
27
34
28 And we also want to show the legend.
35 We also want to show the legend. To do that, we get the legend pointer from chart and set it to visible. We also place the legend to bottom of the chart by setting it's alignment
36 to Qt::AlignBottom.
29
37
30 \snippet ../examples/horizontalbarchart/main.cpp 5
38 \snippet ../examples/horizontalbarchart/main.cpp 5
31
39
32 Finally we add the chart onto a view.
40 Finally we add the chart onto a view. We also turn on the antialiasing for the chartView.
33
41
34 \snippet ../examples/horizontalbarchart/main.cpp 6
42 \snippet ../examples/horizontalbarchart/main.cpp 6
35
43
36 And it is ready to be shown in a window.
44 Chart is ready to be shown. We set the chart to be central widget of the window.
45 We also set the size for the chart window and show it.
37
46
38 \snippet ../examples/horizontalbarchart/main.cpp 7
47 \snippet ../examples/horizontalbarchart/main.cpp 7
39 */
48 */
@@ -1,17 +1,53
1 /*!
1 /*!
2 \example examples/horizontalpercentbarchart
2 \example examples/horizontalpercentbarchart
3 \title HorizontalPercentBarChart Example
3 \title HorizontalPercentBarChart Example
4 \subtitle
4 \subtitle
5
5
6 The example shows how to create simple horizontal percent bar chart. Horizontal percent bar chart shows the data in set as percentage of
6 The example shows how to create simple horizontal percent bar chart. Horizontal percent bar chart shows the data in set as percentage of
7 all sets, per category.
7 all sets, per category.
8
8
9 \image examples_horizontalpercentbarchart.png
10
11 Creating horizontal percent bar chart is just like creating a regular \l {BarChart Example} {bar chart}, except that for a
9 Creating horizontal percent bar chart is just like creating a regular \l {BarChart Example} {bar chart}, except that for a
12 horizontal percent bar chart, we use QHorizontalPercentBarSeries api instead of QBarSeries. Also, in the
10 horizontal percent bar chart, we use QHorizontalPercentBarSeries api instead of QBarSeries. Also, in the
13 \l {BarChart Example} {bar chart} we used nice numbers algorithm to make the y axis numbering look better. With
11 \l {BarChart Example} {bar chart} we used nice numbers algorithm to make the y axis numbering look better. With
14 percent bar chart there is no need for that, because the maximum y-axis value is always 100.
12 percent bar chart there is no need for that, because the maximum y-axis value is always 100.
13
14 \image examples_horizontalpercentbarchart.png
15
16 The barsets are used in same way in all barcharts.
17 To illustrate difference between various barcharts, we use same data in examples.
18 Data that barchart visualizes, is defined by QBarSet instances. Here we create the sets and append data
19 to them. The data is appended here with << operator. Alternatively the append method could be used.
20
21 \snippet ../examples/horizontalpercentbarchart/main.cpp 1
22
23 We create the series and append the barsets to it. The series takes ownership of the barsets. The series groups the data from sets to categories.
24 First value of each set are gropuped together at first category second value to second category and so on.
25
26 \snippet ../examples/horizontalpercentbarchart/main.cpp 2
27
28 Here we create the chart object and add the series to it. We set the title for chart with setTitle and then turn on animations of the series by calling
29 setAnimationOptions(QChart::SeriesAnimations)
15
30
16 \snippet ../examples/horizontalpercentbarchart/main.cpp 3
31 \snippet ../examples/horizontalpercentbarchart/main.cpp 3
32
33 To have categories displayed on axis, we need to create a QBarCategoryAxis for that. Here we create a category axis with list of categories and
34 set it to be the y-axis of the chart. The chart takes ownership of axis. For x-axis we use default axis, which is created and scaled to series data
35 by calling createDefaultAxes of the chart. Note that the call for createDefaultAxes must be before we set the category axis. Otherwise the default axis will
36 override the category axis.
37
38 \snippet ../examples/horizontalpercentbarchart/main.cpp 4
39
40 We also want to show the legend. To do that, we get the legend pointer from chart and set it to visible. We also place the legend to bottom of the chart by setting it's alignment
41 to Qt::AlignBottom.
42
43 \snippet ../examples/horizontalpercentbarchart/main.cpp 5
44
45 Finally we add the chart onto a view. We also turn on the antialiasing for the chartView.
46
47 \snippet ../examples/horizontalpercentbarchart/main.cpp 6
48
49 Chart is ready to be shown. We set the chart to be central widget of the window.
50 We also set the size for the chart window and show it.
51
52 \snippet ../examples/horizontalpercentbarchart/main.cpp 7
17 */
53 */
@@ -1,15 +1,50
1 /*!
1 /*!
2 \example examples/horizontalstackedbarchart
2 \example examples/horizontalstackedbarchart
3 \title HorizontalStackedBarChart Example
3 \title HorizontalStackedBarChart Example
4 \subtitle
4 \subtitle
5
5
6 The example shows how to create simple stacked horizontal bar chart. Stacked bar chart shows the data in sets as bars that are
6 The example shows how to create simple stacked horizontal bar chart. Stacked bar chart shows the data in sets as bars that are
7 stacked on top of each other. The stacking is done per category.
7 stacked on top of each other. The stacking is done per category.
8 Creating stacked horizontal bar chart is just like creating a regular \l {BarChart Example} {bar chart}, except that for a
9 stacked horizontal bar chart, we use QHorizontalStackedBarSeries api instead of QBarSeries.
8
10
9 \image examples_horizontalstackedbarchart.png
11 \image examples_horizontalstackedbarchart.png
10
12
11 Creating stacked horizontal bar chart is just like creating a regular \l {BarChart Example} {bar chart}, except that for a
13 The barsets are used in same way in all barcharts.
12 stacked horizontal bar chart, we use QHorizontalStackedBarSeries api instead of QBarSeries.
14 To illustrate difference between various barcharts, we use same data in examples.
15 Data that barchart visualizes, is defined by QBarSet instances. Here we create the sets and append data
16 to them. The data is appended here with << operator. Alternatively the append method could be used.
17
18 \snippet ../examples/horizontalstackedbarchart/main.cpp 1
19
20 We create the series and append the barsets to it. The series takes ownership of the barsets. The series groups the data from sets to categories.
21 First value of each set are gropuped together at first category second value to second category and so on.
22
23 \snippet ../examples/horizontalstackedbarchart/main.cpp 2
24
25 Here we create the chart object and add the series to it. We set the title for chart with setTitle and then turn on animations of the series by calling
26 setAnimationOptions(QChart::SeriesAnimations)
13
27
14 \snippet ../examples/horizontalstackedbarchart/main.cpp 3
28 \snippet ../examples/horizontalstackedbarchart/main.cpp 3
15 */
29
30 To have categories displayed on axis, we need to create a QBarCategoryAxis for that. Here we create a category axis with list of categories and
31 set it to be the y-axis of the chart. The chart takes ownership of axis. For x-axis we use default axis, which is created and scaled to series data
32 by calling createDefaultAxes of the chart. Note that the call for createDefaultAxes must be before we set the category axis. Otherwise the default axis will
33 override the category axis.
34
35 \snippet ../examples/horizontalstackedbarchart/main.cpp 4
36
37 We also want to show the legend. To do that, we get the legend pointer from chart and set it to visible. We also place the legend to bottom of the chart by setting it's alignment
38 to Qt::AlignBottom.
39
40 \snippet ../examples/horizontalstackedbarchart/main.cpp 5
41
42 Finally we add the chart onto a view. We also turn on the antialiasing for the chartView.
43
44 \snippet ../examples/horizontalstackedbarchart/main.cpp 6
45
46 Chart is ready to be shown. We set the chart to be central widget of the window.
47 We also set the size for the chart window and show it.
48
49 \snippet ../examples/horizontalstackedbarchart/main.cpp 7
50 */ No newline at end of file
@@ -1,17 +1,53
1 /*!
1 /*!
2 \example examples/percentbarchart
2 \example examples/percentbarchart
3 \title PercentBarChart Example
3 \title PercentBarChart Example
4 \subtitle
4 \subtitle
5
5
6 The example shows how to create simple percent bar chart. Percent bar chart shows the data in set as percentage of
6 The example shows how to create simple percent bar chart. Percent bar chart shows the data in set as percentage of
7 all sets, per category.
7 all sets, per category.
8
8
9 \image examples_percentbarchart.png
10
11 Creating percent bar chart is just like creating a regular \l {BarChart Example} {bar chart}, except that for a
9 Creating percent bar chart is just like creating a regular \l {BarChart Example} {bar chart}, except that for a
12 percent bar chart, we use QPercentBarSeries api instead of QBarSeries. Also, in the
10 percent bar chart, we use QPercentBarSeries api instead of QBarSeries. Also, in the
13 \l {BarChart Example} {bar chart} we used nice numbers algorithm to make the y axis numbering look better. With
11 \l {BarChart Example} {bar chart} we used nice numbers algorithm to make the y axis numbering look better. With
14 percent bar chart there is no need for that, because the maximum y-axis value is always 100.
12 percent bar chart there is no need for that, because the maximum y-axis value is always 100.
13
14 \image examples_percentbarchart.png
15
16 The barsets are used in same way in all barcharts.
17 To illustrate difference between various barcharts, we use same data in examples.
18 Data that barchart visualizes, is defined by QBarSet instances. Here we create the sets and append data
19 to them. The data is appended here with << operator. Alternatively the append method could be used.
20
21 \snippet ../examples/percentbarchart/main.cpp 1
22
23 We create the series and append the barsets to it. The series takes ownership of the barsets. The series groups the data from sets to categories.
24 First value of each set are gropuped together at first category second value to second category and so on.
25
26 \snippet ../examples/percentbarchart/main.cpp 2
27
28 Here we create the chart object and add the series to it. We set the title for chart with setTitle and then turn on animations of the series by calling
29 setAnimationOptions(QChart::SeriesAnimations)
15
30
16 \snippet ../examples/percentbarchart/main.cpp 3
31 \snippet ../examples/percentbarchart/main.cpp 3
32
33 To have categories displayed on axis, we need to create a QBarCategoryAxis for that. Here we create a category axis with list of categories and
34 set it to be the x-axis of the chart. The chart takes ownership of axis. For y-axis we use default axis, which is created and scaled to series data
35 by calling createDefaultAxes of the chart. Note that the call for createDefaultAxes must be before we set the category axis. Otherwise the default axis will
36 override the category axis.
37
38 \snippet ../examples/percentbarchart/main.cpp 4
39
40 We also want to show the legend. To do that, we get the legend pointer from chart and set it to visible. We also place the legend to bottom of the chart by setting it's alignment
41 to Qt::AlignBottom.
42
43 \snippet ../examples/percentbarchart/main.cpp 5
44
45 Finally we add the chart onto a view. We also turn on the antialiasing for the chartView.
46
47 \snippet ../examples/percentbarchart/main.cpp 6
48
49 Chart is ready to be shown. We set the chart to be central widget of the window.
50 We also set the size for the chart window and show it.
51
52 \snippet ../examples/percentbarchart/main.cpp 7
17 */
53 */
@@ -1,15 +1,54
1 /*!
1 /*!
2 \example examples/stackedbarchart
2 \example examples/stackedbarchart
3 \title StackedBarChart Example
3 \title StackedBarChart Example
4 \subtitle
4 \subtitle
5
5
6 The example shows how to create simple stacked bar chart. Stacked bar chart shows the data in sets as bars that are
6 The example shows how to create simple stacked bar chart. Stacked bar chart shows the data in sets as bars that are
7 stacked on top of each other. The stacking is done per category.
7 stacked on top of each other. The stacking is done per category.
8 The example shows how to create simple stacked bar chart. Stacked bar chart shows the data in sets as bars that are
9 stacked on top of each other. The stacking is done per category.
10 Creating stacked bar chart is just like creating a regular \l {BarChart Example} {bar chart}, except that for a
11 stacked bar chart, we use QStackedBarSeries api instead of QBarSeries.
8
12
9 \image examples_stackedbarchart.png
13 \image examples_stackedbarchart.png
10
14
11 Creating stacked bar chart is just like creating a regular \l {BarChart Example} {bar chart}, except that for a
15 The barsets are used in same way in all barcharts.
12 stacked bar chart, we use QStackedBarSeries api instead of QBarSeries.
16 To illustrate difference between various barcharts, we use same data in examples.
17 Data that barchart visualizes, is defined by QBarSet instances. Here we create the sets and append data
18 to them. The data is appended here with << operator. Alternatively the append method could be used.
19
20 \snippet ../examples/stackedbarchart/main.cpp 1
21
22 We create the series and append the barsets to it. The series takes ownership of the barsets. The series groups the data from sets to categories.
23 First value of each set are gropuped together at first category second value to second category and so on.
24
25 \snippet ../examples/stackedbarchart/main.cpp 2
26
27 Here we create the chart object and add the series to it. We set the title for chart with setTitle and then turn on animations of the series by calling
28 setAnimationOptions(QChart::SeriesAnimations)
13
29
14 \snippet ../examples/stackedbarchart/main.cpp 3
30 \snippet ../examples/stackedbarchart/main.cpp 3
31
32 To have categories displayed on axis, we need to create a QBarCategoryAxis for that. Here we create a category axis with list of categories and
33 set it to be the x-axis of the chart. The chart takes ownership of axis. For y-axis we use default axis, which is created and scaled to series data
34 by calling createDefaultAxes of the chart. Note that the call for createDefaultAxes must be before we set the category axis. Otherwise the default axis will
35 override the category axis.
36
37 \snippet ../examples/stackedbarchart/main.cpp 4
38
39 We also want to show the legend. To do that, we get the legend pointer from chart and set it to visible. We also place the legend to bottom of the chart by setting it's alignment
40 to Qt::AlignBottom.
41
42 \snippet ../examples/stackedbarchart/main.cpp 5
43
44 Finally we add the chart onto a view. We also turn on the antialiasing for the chartView.
45
46 \snippet ../examples/stackedbarchart/main.cpp 6
47
48 Chart is ready to be shown. We set the chart to be central widget of the window.
49 We also set the size for the chart window and show it.
50
51 \snippet ../examples/stackedbarchart/main.cpp 7
15 */
52 */
53
54
@@ -1,92 +1,92
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2012 Digia Plc
3 ** Copyright (C) 2012 Digia Plc
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 **
6 **
7 ** This file is part of the Qt Commercial Charts Add-on.
7 ** This file is part of the Qt Commercial Charts Add-on.
8 **
8 **
9 ** $QT_BEGIN_LICENSE$
9 ** $QT_BEGIN_LICENSE$
10 ** Licensees holding valid Qt Commercial licenses may use this file in
10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 ** accordance with the Qt Commercial License Agreement provided with the
11 ** accordance with the Qt Commercial License Agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia.
13 ** a written agreement between you and Digia.
14 **
14 **
15 ** If you have questions regarding the use of this file, please use
15 ** If you have questions regarding the use of this file, please use
16 ** contact form at http://qt.digia.com
16 ** contact form at http://qt.digia.com
17 ** $QT_END_LICENSE$
17 ** $QT_END_LICENSE$
18 **
18 **
19 ****************************************************************************/
19 ****************************************************************************/
20
20
21 #include <QApplication>
21 #include <QApplication>
22 #include <QMainWindow>
22 #include <QMainWindow>
23 #include <QChartView>
23 #include <QChartView>
24 #include <QBarSeries>
24 #include <QBarSeries>
25 #include <QBarSet>
25 #include <QBarSet>
26 #include <QLegend>
26 #include <QLegend>
27 #include <QBarCategoryAxis>
27 #include <QBarCategoryAxis>
28
28
29 QTCOMMERCIALCHART_USE_NAMESPACE
29 QTCOMMERCIALCHART_USE_NAMESPACE
30
30
31 int main(int argc, char *argv[])
31 int main(int argc, char *argv[])
32 {
32 {
33 QApplication a(argc, argv);
33 QApplication a(argc, argv);
34
34
35 //![1]
35 //![1]
36 QBarSet *set0 = new QBarSet("Jane");
36 QBarSet *set0 = new QBarSet("Jane");
37 QBarSet *set1 = new QBarSet("John");
37 QBarSet *set1 = new QBarSet("John");
38 QBarSet *set2 = new QBarSet("Axel");
38 QBarSet *set2 = new QBarSet("Axel");
39 QBarSet *set3 = new QBarSet("Mary");
39 QBarSet *set3 = new QBarSet("Mary");
40 QBarSet *set4 = new QBarSet("Samantha");
40 QBarSet *set4 = new QBarSet("Samantha");
41
41
42 *set0 << 1 << 2 << 3 << 4 << 5 << 6;
42 *set0 << 1 << 2 << 3 << 4 << 5 << 6;
43 *set1 << 5 << 0 << 0 << 4 << 0 << 7;
43 *set1 << 5 << 0 << 0 << 4 << 0 << 7;
44 *set2 << 3 << 5 << 8 << 13 << 8 << 5;
44 *set2 << 3 << 5 << 8 << 13 << 8 << 5;
45 *set3 << 5 << 6 << 7 << 3 << 4 << 5;
45 *set3 << 5 << 6 << 7 << 3 << 4 << 5;
46 *set4 << 9 << 7 << 5 << 3 << 1 << 2;
46 *set4 << 9 << 7 << 5 << 3 << 1 << 2;
47 //![1]
47 //![1]
48
48
49 //![2]
49 //![2]
50 QBarSeries* series = new QBarSeries();
50 QBarSeries* series = new QBarSeries();
51 series->append(set0);
51 series->append(set0);
52 series->append(set1);
52 series->append(set1);
53 series->append(set2);
53 series->append(set2);
54 series->append(set3);
54 series->append(set3);
55 series->append(set4);
55 series->append(set4);
56
56
57 //![2]
57 //![2]
58
58
59 //![3]
59 //![3]
60 QChart* chart = new QChart();
60 QChart* chart = new QChart();
61 chart->addSeries(series);
61 chart->addSeries(series);
62 chart->setTitle("Simple barchart example");
62 chart->setTitle("Simple barchart example");
63 chart->createDefaultAxes();
64 //![3]
63 //![3]
65
64
66 //![4]
65 //![4]
67 QStringList categories;
66 QStringList categories;
68 categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun";
67 categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun";
69 QBarCategoryAxis* axis = new QBarCategoryAxis();
68 QBarCategoryAxis* axis = new QBarCategoryAxis();
70 axis->append(categories);
69 axis->append(categories);
70 chart->createDefaultAxes();
71 chart->setAxisX(axis,series);
71 chart->setAxisX(axis,series);
72 //![4]
72 //![4]
73
73
74 //![5]
74 //![5]
75 chart->legend()->setVisible(true);
75 chart->legend()->setVisible(true);
76 chart->legend()->setAlignment(Qt::AlignBottom);
76 chart->legend()->setAlignment(Qt::AlignBottom);
77 //![5]
77 //![5]
78
78
79 //![6]
79 //![6]
80 QChartView* chartView = new QChartView(chart);
80 QChartView* chartView = new QChartView(chart);
81 chartView->setRenderHint(QPainter::Antialiasing);
81 chartView->setRenderHint(QPainter::Antialiasing);
82 //![6]
82 //![6]
83
83
84 //![7]
84 //![7]
85 QMainWindow window;
85 QMainWindow window;
86 window.setCentralWidget(chartView);
86 window.setCentralWidget(chartView);
87 window.resize(400, 300);
87 window.resize(400, 300);
88 window.show();
88 window.show();
89 //![7]
89 //![7]
90
90
91 return a.exec();
91 return a.exec();
92 }
92 }
@@ -1,94 +1,93
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2012 Digia Plc
3 ** Copyright (C) 2012 Digia Plc
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 **
6 **
7 ** This file is part of the Qt Commercial Charts Add-on.
7 ** This file is part of the Qt Commercial Charts Add-on.
8 **
8 **
9 ** $QT_BEGIN_LICENSE$
9 ** $QT_BEGIN_LICENSE$
10 ** Licensees holding valid Qt Commercial licenses may use this file in
10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 ** accordance with the Qt Commercial License Agreement provided with the
11 ** accordance with the Qt Commercial License Agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia.
13 ** a written agreement between you and Digia.
14 **
14 **
15 ** If you have questions regarding the use of this file, please use
15 ** If you have questions regarding the use of this file, please use
16 ** contact form at http://qt.digia.com
16 ** contact form at http://qt.digia.com
17 ** $QT_END_LICENSE$
17 ** $QT_END_LICENSE$
18 **
18 **
19 ****************************************************************************/
19 ****************************************************************************/
20
20
21 #include <QApplication>
21 #include <QApplication>
22 #include <QMainWindow>
22 #include <QMainWindow>
23 #include <QChartView>
23 #include <QChartView>
24 #include <QBarSeries>
24 #include <QBarSeries>
25 #include <QBarSet>
25 #include <QBarSet>
26 #include <QLegend>
26 #include <QLegend>
27 #include <QBarCategoryAxis>
27 #include <QBarCategoryAxis>
28 #include <QHorizontalBarSeries>
28 #include <QHorizontalBarSeries>
29
29
30 QTCOMMERCIALCHART_USE_NAMESPACE
30 QTCOMMERCIALCHART_USE_NAMESPACE
31
31
32 int main(int argc, char *argv[])
32 int main(int argc, char *argv[])
33 {
33 {
34 QApplication a(argc, argv);
34 QApplication a(argc, argv);
35
35
36 //![1]
36 //![1]
37 QBarSet *set0 = new QBarSet("Jane");
37 QBarSet *set0 = new QBarSet("Jane");
38 QBarSet *set1 = new QBarSet("John");
38 QBarSet *set1 = new QBarSet("John");
39 QBarSet *set2 = new QBarSet("Axel");
39 QBarSet *set2 = new QBarSet("Axel");
40 QBarSet *set3 = new QBarSet("Mary");
40 QBarSet *set3 = new QBarSet("Mary");
41 QBarSet *set4 = new QBarSet("Samantha");
41 QBarSet *set4 = new QBarSet("Samantha");
42
42
43 *set0 << 1 << 2 << 3 << 4 << 5 << 6;
43 *set0 << 1 << 2 << 3 << 4 << 5 << 6;
44 *set1 << 5 << 0 << 0 << 4 << 0 << 7;
44 *set1 << 5 << 0 << 0 << 4 << 0 << 7;
45 *set2 << 3 << 5 << 8 << 13 << 8 << 5;
45 *set2 << 3 << 5 << 8 << 13 << 8 << 5;
46 *set3 << 5 << 6 << 7 << 3 << 4 << 5;
46 *set3 << 5 << 6 << 7 << 3 << 4 << 5;
47 *set4 << 9 << 7 << 5 << 3 << 1 << 2;
47 *set4 << 9 << 7 << 5 << 3 << 1 << 2;
48 //![1]
48 //![1]
49
49
50 //![2]
50 //![2]
51 QHorizontalBarSeries *series = new QHorizontalBarSeries();
51 QHorizontalBarSeries *series = new QHorizontalBarSeries();
52 series->append(set0);
52 series->append(set0);
53 series->append(set1);
53 series->append(set1);
54 series->append(set2);
54 series->append(set2);
55 series->append(set3);
55 series->append(set3);
56 series->append(set4);
56 series->append(set4);
57
58 //![2]
57 //![2]
59
58
60 //![3]
59 //![3]
61 QChart* chart = new QChart();
60 QChart* chart = new QChart();
62 chart->addSeries(series);
61 chart->addSeries(series);
63 chart->setTitle("Simple horizontal barchart example");
62 chart->setTitle("Simple horizontal barchart example");
64 chart->createDefaultAxes();
65 chart->setAnimationOptions(QChart::SeriesAnimations);
63 chart->setAnimationOptions(QChart::SeriesAnimations);
66 //![3]
64 //![3]
67
65
68 //![4]
66 //![4]
69 QStringList categories;
67 QStringList categories;
70 categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun";
68 categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun";
71 QBarCategoryAxis* axis = new QBarCategoryAxis();
69 QBarCategoryAxis* axis = new QBarCategoryAxis();
72 axis->append(categories);
70 axis->append(categories);
71 chart->createDefaultAxes();
73 chart->setAxisY(axis,series);
72 chart->setAxisY(axis,series);
74 //![4]
73 //![4]
75
74
76 //![5]
75 //![5]
77 chart->legend()->setVisible(true);
76 chart->legend()->setVisible(true);
78 chart->legend()->setAlignment(Qt::AlignBottom);
77 chart->legend()->setAlignment(Qt::AlignBottom);
79 //![5]
78 //![5]
80
79
81 //![6]
80 //![6]
82 QChartView* chartView = new QChartView(chart);
81 QChartView* chartView = new QChartView(chart);
83 chartView->setRenderHint(QPainter::Antialiasing);
82 chartView->setRenderHint(QPainter::Antialiasing);
84 //![6]
83 //![6]
85
84
86 //![7]
85 //![7]
87 QMainWindow window;
86 QMainWindow window;
88 window.setCentralWidget(chartView);
87 window.setCentralWidget(chartView);
89 window.resize(400, 300);
88 window.resize(400, 300);
90 window.show();
89 window.show();
91 //![7]
90 //![7]
92
91
93 return a.exec();
92 return a.exec();
94 }
93 }
@@ -1,95 +1,94
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2012 Digia Plc
3 ** Copyright (C) 2012 Digia Plc
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 **
6 **
7 ** This file is part of the Qt Commercial Charts Add-on.
7 ** This file is part of the Qt Commercial Charts Add-on.
8 **
8 **
9 ** $QT_BEGIN_LICENSE$
9 ** $QT_BEGIN_LICENSE$
10 ** Licensees holding valid Qt Commercial licenses may use this file in
10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 ** accordance with the Qt Commercial License Agreement provided with the
11 ** accordance with the Qt Commercial License Agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia.
13 ** a written agreement between you and Digia.
14 **
14 **
15 ** If you have questions regarding the use of this file, please use
15 ** If you have questions regarding the use of this file, please use
16 ** contact form at http://qt.digia.com
16 ** contact form at http://qt.digia.com
17 ** $QT_END_LICENSE$
17 ** $QT_END_LICENSE$
18 **
18 **
19 ****************************************************************************/
19 ****************************************************************************/
20
20
21 #include <QApplication>
21 #include <QApplication>
22 #include <QMainWindow>
22 #include <QMainWindow>
23 #include <QChartView>
23 #include <QChartView>
24 #include <QBarSeries>
24 #include <QBarSeries>
25 #include <QBarSet>
25 #include <QBarSet>
26 #include <QLegend>
26 #include <QLegend>
27 #include <QBarCategoryAxis>
27 #include <QBarCategoryAxis>
28 #include <QHorizontalPercentBarSeries>
28 #include <QHorizontalPercentBarSeries>
29
29
30 QTCOMMERCIALCHART_USE_NAMESPACE
30 QTCOMMERCIALCHART_USE_NAMESPACE
31
31
32 int main(int argc, char *argv[])
32 int main(int argc, char *argv[])
33 {
33 {
34 QApplication a(argc, argv);
34 QApplication a(argc, argv);
35
35
36 //![1]
36 //![1]
37 QBarSet *set0 = new QBarSet("Jane");
37 QBarSet *set0 = new QBarSet("Jane");
38 QBarSet *set1 = new QBarSet("John");
38 QBarSet *set1 = new QBarSet("John");
39 QBarSet *set2 = new QBarSet("Axel");
39 QBarSet *set2 = new QBarSet("Axel");
40 QBarSet *set3 = new QBarSet("Mary");
40 QBarSet *set3 = new QBarSet("Mary");
41 QBarSet *set4 = new QBarSet("Samantha");
41 QBarSet *set4 = new QBarSet("Samantha");
42
42
43 *set0 << 1 << 2 << 3 << 4 << 5 << 6;
43 *set0 << 1 << 2 << 3 << 4 << 5 << 6;
44 *set1 << 5 << 0 << 0 << 4 << 0 << 7;
44 *set1 << 5 << 0 << 0 << 4 << 0 << 7;
45 *set2 << 3 << 5 << 8 << 13 << 8 << 5;
45 *set2 << 3 << 5 << 8 << 13 << 8 << 5;
46 *set3 << 5 << 6 << 7 << 3 << 4 << 5;
46 *set3 << 5 << 6 << 7 << 3 << 4 << 5;
47 *set4 << 9 << 7 << 5 << 3 << 1 << 2;
47 *set4 << 9 << 7 << 5 << 3 << 1 << 2;
48 //![1]
48 //![1]
49
49
50 //![2]
50 //![2]
51 QHorizontalPercentBarSeries *series = new QHorizontalPercentBarSeries();
51 QHorizontalPercentBarSeries *series = new QHorizontalPercentBarSeries();
52 series->append(set0);
52 series->append(set0);
53 series->append(set1);
53 series->append(set1);
54 series->append(set2);
54 series->append(set2);
55 series->append(set3);
55 series->append(set3);
56 series->append(set4);
56 series->append(set4);
57
57
58 //![2]
58 //![2]
59
59
60 //![3]
60 //![3]
61 QChart* chart = new QChart();
61 QChart* chart = new QChart();
62 chart->addSeries(series);
62 chart->addSeries(series);
63 chart->setTitle("Simple horizontal percent barchart example");
63 chart->setTitle("Simple horizontal percent barchart example");
64 chart->createDefaultAxes();
65 chart->setAnimationOptions(QChart::SeriesAnimations);
64 chart->setAnimationOptions(QChart::SeriesAnimations);
66 //![3]
65 //![3]
67
66
68 //![4]
67 //![4]
69 QStringList categories;
68 QStringList categories;
70 categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun";
69 categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun";
71 QBarCategoryAxis* axis = new QBarCategoryAxis();
70 QBarCategoryAxis* axis = new QBarCategoryAxis();
72 axis->append(categories);
71 axis->append(categories);
73 chart->createDefaultAxes();
72 chart->createDefaultAxes();
74 chart->setAxisY(axis,series);
73 chart->setAxisY(axis,series);
75 //![4]
74 //![4]
76
75
77 //![5]
76 //![5]
78 chart->legend()->setVisible(true);
77 chart->legend()->setVisible(true);
79 chart->legend()->setAlignment(Qt::AlignBottom);
78 chart->legend()->setAlignment(Qt::AlignBottom);
80 //![5]
79 //![5]
81
80
82 //![6]
81 //![6]
83 QChartView* chartView = new QChartView(chart);
82 QChartView* chartView = new QChartView(chart);
84 chartView->setRenderHint(QPainter::Antialiasing);
83 chartView->setRenderHint(QPainter::Antialiasing);
85 //![6]
84 //![6]
86
85
87 //![7]
86 //![7]
88 QMainWindow window;
87 QMainWindow window;
89 window.setCentralWidget(chartView);
88 window.setCentralWidget(chartView);
90 window.resize(400, 300);
89 window.resize(400, 300);
91 window.show();
90 window.show();
92 //![7]
91 //![7]
93
92
94 return a.exec();
93 return a.exec();
95 }
94 }
@@ -1,95 +1,94
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2012 Digia Plc
3 ** Copyright (C) 2012 Digia Plc
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 **
6 **
7 ** This file is part of the Qt Commercial Charts Add-on.
7 ** This file is part of the Qt Commercial Charts Add-on.
8 **
8 **
9 ** $QT_BEGIN_LICENSE$
9 ** $QT_BEGIN_LICENSE$
10 ** Licensees holding valid Qt Commercial licenses may use this file in
10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 ** accordance with the Qt Commercial License Agreement provided with the
11 ** accordance with the Qt Commercial License Agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia.
13 ** a written agreement between you and Digia.
14 **
14 **
15 ** If you have questions regarding the use of this file, please use
15 ** If you have questions regarding the use of this file, please use
16 ** contact form at http://qt.digia.com
16 ** contact form at http://qt.digia.com
17 ** $QT_END_LICENSE$
17 ** $QT_END_LICENSE$
18 **
18 **
19 ****************************************************************************/
19 ****************************************************************************/
20
20
21 #include <QApplication>
21 #include <QApplication>
22 #include <QMainWindow>
22 #include <QMainWindow>
23 #include <QChartView>
23 #include <QChartView>
24 #include <QBarSeries>
24 #include <QBarSeries>
25 #include <QBarSet>
25 #include <QBarSet>
26 #include <QLegend>
26 #include <QLegend>
27 #include <QBarCategoryAxis>
27 #include <QBarCategoryAxis>
28 #include <QHorizontalStackedBarSeries>
28 #include <QHorizontalStackedBarSeries>
29
29
30 QTCOMMERCIALCHART_USE_NAMESPACE
30 QTCOMMERCIALCHART_USE_NAMESPACE
31
31
32 int main(int argc, char *argv[])
32 int main(int argc, char *argv[])
33 {
33 {
34 QApplication a(argc, argv);
34 QApplication a(argc, argv);
35
35
36 //![1]
36 //![1]
37 QBarSet *set0 = new QBarSet("Jane");
37 QBarSet *set0 = new QBarSet("Jane");
38 QBarSet *set1 = new QBarSet("John");
38 QBarSet *set1 = new QBarSet("John");
39 QBarSet *set2 = new QBarSet("Axel");
39 QBarSet *set2 = new QBarSet("Axel");
40 QBarSet *set3 = new QBarSet("Mary");
40 QBarSet *set3 = new QBarSet("Mary");
41 QBarSet *set4 = new QBarSet("Samantha");
41 QBarSet *set4 = new QBarSet("Samantha");
42
42
43 *set0 << 1 << 2 << 3 << 4 << 5 << 6;
43 *set0 << 1 << 2 << 3 << 4 << 5 << 6;
44 *set1 << 5 << 0 << 0 << 4 << 0 << 7;
44 *set1 << 5 << 0 << 0 << 4 << 0 << 7;
45 *set2 << 3 << 5 << 8 << 13 << 8 << 5;
45 *set2 << 3 << 5 << 8 << 13 << 8 << 5;
46 *set3 << 5 << 6 << 7 << 3 << 4 << 5;
46 *set3 << 5 << 6 << 7 << 3 << 4 << 5;
47 *set4 << 9 << 7 << 5 << 3 << 1 << 2;
47 *set4 << 9 << 7 << 5 << 3 << 1 << 2;
48 //![1]
48 //![1]
49
49
50 //![2]
50 //![2]
51 QHorizontalStackedBarSeries *series = new QHorizontalStackedBarSeries();
51 QHorizontalStackedBarSeries *series = new QHorizontalStackedBarSeries();
52 series->append(set0);
52 series->append(set0);
53 series->append(set1);
53 series->append(set1);
54 series->append(set2);
54 series->append(set2);
55 series->append(set3);
55 series->append(set3);
56 series->append(set4);
56 series->append(set4);
57
57
58 //![2]
58 //![2]
59
59
60 //![3]
60 //![3]
61 QChart* chart = new QChart();
61 QChart* chart = new QChart();
62 chart->addSeries(series);
62 chart->addSeries(series);
63 chart->setTitle("Simple horizontal stacked barchart example");
63 chart->setTitle("Simple horizontal stacked barchart example");
64 chart->createDefaultAxes();
65 chart->setAnimationOptions(QChart::SeriesAnimations);
64 chart->setAnimationOptions(QChart::SeriesAnimations);
66 //![3]
65 //![3]
67
66
68 //![4]
67 //![4]
69 QStringList categories;
68 QStringList categories;
70 categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun";
69 categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun";
71 QBarCategoryAxis* axis = new QBarCategoryAxis();
70 QBarCategoryAxis* axis = new QBarCategoryAxis();
72 axis->append(categories);
71 axis->append(categories);
73 chart->createDefaultAxes();
72 chart->createDefaultAxes();
74 chart->setAxisY(axis,series);
73 chart->setAxisY(axis,series);
75 //![4]
74 //![4]
76
75
77 //![5]
76 //![5]
78 chart->legend()->setVisible(true);
77 chart->legend()->setVisible(true);
79 chart->legend()->setAlignment(Qt::AlignBottom);
78 chart->legend()->setAlignment(Qt::AlignBottom);
80 //![5]
79 //![5]
81
80
82 //![6]
81 //![6]
83 QChartView* chartView = new QChartView(chart);
82 QChartView* chartView = new QChartView(chart);
84 chartView->setRenderHint(QPainter::Antialiasing);
83 chartView->setRenderHint(QPainter::Antialiasing);
85 //![6]
84 //![6]
86
85
87 //![7]
86 //![7]
88 QMainWindow window;
87 QMainWindow window;
89 window.setCentralWidget(chartView);
88 window.setCentralWidget(chartView);
90 window.resize(400, 300);
89 window.resize(400, 300);
91 window.show();
90 window.show();
92 //![7]
91 //![7]
93
92
94 return a.exec();
93 return a.exec();
95 }
94 }
@@ -1,92 +1,92
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2012 Digia Plc
3 ** Copyright (C) 2012 Digia Plc
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 **
6 **
7 ** This file is part of the Qt Commercial Charts Add-on.
7 ** This file is part of the Qt Commercial Charts Add-on.
8 **
8 **
9 ** $QT_BEGIN_LICENSE$
9 ** $QT_BEGIN_LICENSE$
10 ** Licensees holding valid Qt Commercial licenses may use this file in
10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 ** accordance with the Qt Commercial License Agreement provided with the
11 ** accordance with the Qt Commercial License Agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia.
13 ** a written agreement between you and Digia.
14 **
14 **
15 ** If you have questions regarding the use of this file, please use
15 ** If you have questions regarding the use of this file, please use
16 ** contact form at http://qt.digia.com
16 ** contact form at http://qt.digia.com
17 ** $QT_END_LICENSE$
17 ** $QT_END_LICENSE$
18 **
18 **
19 ****************************************************************************/
19 ****************************************************************************/
20
20
21 #include <QApplication>
21 #include <QApplication>
22 #include <QMainWindow>
22 #include <QMainWindow>
23 #include <QChartView>
23 #include <QChartView>
24 #include <QStackedBarSeries>
24 #include <QStackedBarSeries>
25 #include <QBarSet>
25 #include <QBarSet>
26 #include <QLegend>
26 #include <QLegend>
27 #include <QBarCategoryAxis>
27 #include <QBarCategoryAxis>
28
28
29 QTCOMMERCIALCHART_USE_NAMESPACE
29 QTCOMMERCIALCHART_USE_NAMESPACE
30
30
31 int main(int argc, char *argv[])
31 int main(int argc, char *argv[])
32 {
32 {
33 QApplication a(argc, argv);
33 QApplication a(argc, argv);
34
34
35 //![1]
35 //![1]
36 QBarSet *set0 = new QBarSet("Jane");
36 QBarSet *set0 = new QBarSet("Jane");
37 QBarSet *set1 = new QBarSet("John");
37 QBarSet *set1 = new QBarSet("John");
38 QBarSet *set2 = new QBarSet("Axel");
38 QBarSet *set2 = new QBarSet("Axel");
39 QBarSet *set3 = new QBarSet("Mary");
39 QBarSet *set3 = new QBarSet("Mary");
40 QBarSet *set4 = new QBarSet("Samantha");
40 QBarSet *set4 = new QBarSet("Samantha");
41
41
42 *set0 << 1 << 2 << 3 << 4 << 5 << 6;
42 *set0 << 1 << 2 << 3 << 4 << 5 << 6;
43 *set1 << 5 << 0 << 0 << 4 << 0 << 7;
43 *set1 << 5 << 0 << 0 << 4 << 0 << 7;
44 *set2 << 3 << 5 << 8 << 13 << 8 << 5;
44 *set2 << 3 << 5 << 8 << 13 << 8 << 5;
45 *set3 << 5 << 6 << 7 << 3 << 4 << 5;
45 *set3 << 5 << 6 << 7 << 3 << 4 << 5;
46 *set4 << 9 << 7 << 5 << 3 << 1 << 2;
46 *set4 << 9 << 7 << 5 << 3 << 1 << 2;
47 //![1]
47 //![1]
48
48
49 //![2]
49 //![2]
50 QStackedBarSeries* series = new QStackedBarSeries();
50 QStackedBarSeries* series = new QStackedBarSeries();
51 series->append(set0);
51 series->append(set0);
52 series->append(set1);
52 series->append(set1);
53 series->append(set2);
53 series->append(set2);
54 series->append(set3);
54 series->append(set3);
55 series->append(set4);
55 series->append(set4);
56 //![2]
56 //![2]
57
57
58 //![3]
58 //![3]
59 QChart* chart = new QChart();
59 QChart* chart = new QChart();
60 chart->addSeries(series);
60 chart->addSeries(series);
61 chart->setTitle("Simple stackedbarchart example");
61 chart->setTitle("Simple stackedbarchart example");
62 chart->createDefaultAxes();
63 //![3]
62 //![3]
64
63
65 //![4]
64 //![4]
66 QStringList categories;
65 QStringList categories;
67 categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun";
66 categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun";
68 QBarCategoryAxis* axis = new QBarCategoryAxis();
67 QBarCategoryAxis* axis = new QBarCategoryAxis();
69 axis->append(categories);
68 axis->append(categories);
69 chart->createDefaultAxes();
70 chart->setAxisX(axis,series);
70 chart->setAxisX(axis,series);
71 //![4]
71 //![4]
72
72
73 //![5]
73 //![5]
74 chart->legend()->setVisible(true);
74 chart->legend()->setVisible(true);
75 chart->legend()->setAlignment(Qt::AlignBottom);
75 chart->legend()->setAlignment(Qt::AlignBottom);
76 //![5]
76 //![5]
77
77
78 //![6]
78 //![6]
79 QChartView* chartView = new QChartView(chart);
79 QChartView* chartView = new QChartView(chart);
80 chartView->setRenderHint(QPainter::Antialiasing);
80 chartView->setRenderHint(QPainter::Antialiasing);
81 //![6]
81 //![6]
82
82
83 //![7]
83 //![7]
84 QMainWindow window;
84 QMainWindow window;
85 window.setCentralWidget(chartView);
85 window.setCentralWidget(chartView);
86 window.resize(400, 300);
86 window.resize(400, 300);
87 window.show();
87 window.show();
88 //![7]
88 //![7]
89
89
90 return a.exec();
90 return a.exec();
91 }
91 }
92
92
General Comments 0
You need to be logged in to leave comments. Login now