1 | NO CONTENT: new file 100644, binary diff hidden |
|
NO CONTENT: new file 100644, binary diff hidden |
1 | NO CONTENT: new file 100644, binary diff hidden |
|
NO CONTENT: new file 100644, binary diff hidden |
1 | NO CONTENT: new file 100644, binary diff hidden |
|
NO CONTENT: new file 100644, binary diff hidden |
1 | NO CONTENT: file renamed from doc/images/example_zoomlinechart1.png to doc/images/examples_zoomlinechart1.png |
|
NO CONTENT: file renamed from doc/images/example_zoomlinechart1.png to doc/images/examples_zoomlinechart1.png |
1 | NO CONTENT: file renamed from doc/images/example_zoomlinechart2.png to doc/images/examples_zoomlinechart2.png |
|
NO CONTENT: file renamed from doc/images/example_zoomlinechart2.png to doc/images/examples_zoomlinechart2.png |
@@ -1,39 +1,40 | |||||
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 simple bar chart. Barchart shows the data in sets as separate bars, which are grouped in categories. |
|
6 | The example shows how to create simple bar chart. Barchart shows the data in sets as separate bars, which are grouped in categories. | |
7 |
|
7 | |||
8 |
|
|
8 | \image examples_barchart.png | |
9 |
|
9 | |||
10 | First we define categories. |
|
10 | First we define categories. | |
11 |
|
11 | |||
12 | \snippet ../examples/barchart/main.cpp 1 |
|
12 | \snippet ../examples/barchart/main.cpp 1 | |
13 |
|
13 | |||
14 | Data that barchart visualizes, is defined by QBarSet instances. Here we create some sets and append data |
|
14 | Data that barchart visualizes, is defined by QBarSet instances. Here we create some sets and append data | |
15 |
|
|
15 | we want to visualize to them. | |
16 |
|
16 | |||
17 | \snippet ../examples/barchart/main.cpp 2 |
|
17 | \snippet ../examples/barchart/main.cpp 2 | |
18 |
|
18 | |||
19 | To combine the sets and categories to a chart, we need to create QBarSeries instance. When creating |
|
19 | To combine the sets and categories to a chart, we need to create QBarSeries instance. When creating | |
20 | the QBarSeries, the categories must be known. Sets can be added later. For example purposes the sets |
|
20 | the QBarSeries, the categories must be known. Sets can be added later. For example purposes the sets | |
21 | are added to series here. |
|
21 | are added to series here. | |
22 |
|
22 | |||
23 | \snippet ../examples/barchart/main.cpp 3 |
|
23 | \snippet ../examples/barchart/main.cpp 3 | |
24 |
|
24 | |||
25 | We want our barchart to behave so, that when mouse is hovered over bar, the name of set which the bar |
|
25 | Then we create a chart and add the series to it. | |
26 | represents is shown as tooltip. |
|
26 | ||
27 | Also when we click the bar, floating values for the set are toggled. Floating values are the data values |
|
|||
28 | that are drawn on top of bars. |
|
|||
29 |
|
||||
30 | \snippet ../examples/barchart/main.cpp 4 |
|
27 | \snippet ../examples/barchart/main.cpp 4 | |
31 |
|
28 | |||
32 | Here we create the view and add our series to it. Also we set the title and theme we want our chart to use |
|
29 | And we also want to show the legend, so that the data is easier to read. | |
33 |
|
30 | |||
34 | \snippet ../examples/barchart/main.cpp 5 |
|
31 | \snippet ../examples/barchart/main.cpp 5 | |
35 |
|
32 | |||
36 | For barchart, we don't need X-axis to be visible, so it can be disabled. |
|
33 | Finally we add the chart onto a view. | |
37 |
|
34 | |||
38 | \snippet ../examples/barchart/main.cpp 6 |
|
35 | \snippet ../examples/barchart/main.cpp 6 | |
39 | */ No newline at end of file |
|
36 | ||
|
37 | And it is ready to be shown in a window. | |||
|
38 | ||||
|
39 | \snippet ../examples/percentbarchart/main.cpp 7 | |||
|
40 | */ |
@@ -1,39 +1,17 | |||||
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 |
|
8 | |||
8 |
|
|
9 | \image examples_percentbarchart.png | |
9 |
|
||||
10 | First we define categories. |
|
|||
11 |
|
10 | |||
12 | \snippet ../examples/percentbarchart/main.cpp 1 |
|
11 | Creating percent bar chart is just like creating a regular \l {BarChart Example} {bar chart}, except that for a | |
13 |
|
12 | percent bar chart, we use QPercentBarSeries api instead of QBarSeries. Also, in the | ||
14 | Data that barchart visualizes, is defined by QBarSet instances. Here we create some sets and append data |
|
13 | \l {BarChart Example} {bar chart} we used nice numbers algorithm to make the y axis numbering look better. With | |
15 | we want to visulaize to them. |
|
14 | percent bar chart there is no need for that, because the maximum y-axis value is always 100. | |
16 |
|
||||
17 | \snippet ../examples/percentbarchart/main.cpp 2 |
|
|||
18 |
|
||||
19 | To combine the sets and categories to a chart, we need to create QBarSeries instance. When creating |
|
|||
20 | the QBarSeries, the categories must be known. Sets can be added later. For example purposes the sets |
|
|||
21 | are added to series here. |
|
|||
22 |
|
15 | |||
23 | \snippet ../examples/percentbarchart/main.cpp 3 |
|
16 | \snippet ../examples/percentbarchart/main.cpp 3 | |
24 |
|
17 | */ | ||
25 | We want our barchart to behave so, that when mouse is hovered over bar, the name of set which the bar |
|
|||
26 | represents is shown as tooltip. |
|
|||
27 | Also when we click the bar, floating values for the set are toggled. Floating values are the data values |
|
|||
28 | that are drawn on top of bars. |
|
|||
29 |
|
||||
30 | \snippet ../examples/percentbarchart/main.cpp 4 |
|
|||
31 |
|
||||
32 | Here we create the view and add our series to it. Also we set the title and theme we want our chart to use |
|
|||
33 |
|
||||
34 | \snippet ../examples/percentbarchart/main.cpp 5 |
|
|||
35 |
|
||||
36 | For barchart, we don't need X-axis to be visible, so it can be disabled. |
|
|||
37 |
|
||||
38 | \snippet ../examples/percentbarchart/main.cpp 6 |
|
|||
39 | */ No newline at end of file |
|
@@ -1,39 +1,15 | |||||
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 |
|
8 | |||
8 |
|
|
9 | \image examples_stackedbarchart.png | |
9 |
|
10 | |||
10 | First we define categories. |
|
11 | Creating stacked bar chart is just like creating a regular \l {BarChart Example} {bar chart}, except that for a | |
11 |
|
12 | stacked bar chart, we use QStackedBarSeries api instead of QBarSeries. | ||
12 | \snippet ../examples/stackedbarchart/main.cpp 1 |
|
|||
13 |
|
||||
14 | Data that barchart visualizes, is defined by QBarSet instances. Here we create some sets and append data |
|
|||
15 | we want to visulaize to them. |
|
|||
16 |
|
||||
17 | \snippet ../examples/stackedbarchart/main.cpp 2 |
|
|||
18 |
|
||||
19 | To combine the sets and categories to a chart, we need to create QBarSeries instance. When creating |
|
|||
20 | the QBarSeries, the categories must be known. Sets can be added later. For example purposes the sets |
|
|||
21 | are added to series here. |
|
|||
22 |
|
13 | |||
23 | \snippet ../examples/stackedbarchart/main.cpp 3 |
|
14 | \snippet ../examples/stackedbarchart/main.cpp 3 | |
24 |
|
15 | */ | ||
25 | We want our barchart to behave so, that when mouse is hovered over bar, the name of set which the bar |
|
|||
26 | represents is shown as tooltip. |
|
|||
27 | Also when we click the bar, floating values for the set are toggled. Floating values are the data values |
|
|||
28 | that are drawn on top of bars. |
|
|||
29 |
|
||||
30 | \snippet ../examples/stackedbarchart/main.cpp 4 |
|
|||
31 |
|
||||
32 | Here we create the view and add our series to it. Also we set the title and theme we want our chart to use |
|
|||
33 |
|
||||
34 | \snippet ../examples/stackedbarchart/main.cpp 5 |
|
|||
35 |
|
||||
36 | For barchart, we don't need X-axis to be visible, so it can be disabled. |
|
|||
37 |
|
||||
38 | \snippet ../examples/stackedbarchart/main.cpp 6 |
|
|||
39 | */ No newline at end of file |
|
@@ -1,22 +1,22 | |||||
1 | /*! |
|
1 | /*! | |
2 | \example examples/zoomlinechart |
|
2 | \example examples/zoomlinechart | |
3 | \title Zoom line example |
|
3 | \title Zoom line example | |
4 | \subtitle |
|
4 | \subtitle | |
5 |
|
5 | |||
6 | The example shows how to create your own custom zooming effect with QRubberBand. |
|
6 | The example shows how to create your own custom zooming effect with QRubberBand. | |
7 | \image example_zoomlinechart1.png |
|
7 | \image examples_zoomlinechart1.png | |
8 | \image example_zoomlinechart2.png |
|
8 | \image examples_zoomlinechart2.png | |
9 |
|
9 | |||
10 | Let's first create a line series with some example data. |
|
10 | Let's first create a line series with some example data. | |
11 | \snippet ../examples/zoomlinechart/main.cpp 1 |
|
11 | \snippet ../examples/zoomlinechart/main.cpp 1 | |
12 |
|
12 | |||
13 | Then we create a custom chart view by deriving from QChartView: |
|
13 | Then we create a custom chart view by deriving from QChartView: | |
14 | \snippet ../examples/zoomlinechart/chartview.h 1 |
|
14 | \snippet ../examples/zoomlinechart/chartview.h 1 | |
15 |
|
15 | |||
16 | We override mouse and key event handling |
|
16 | We override mouse and key event handling | |
17 | \snippet ../examples/zoomlinechart/chartview.h 2 |
|
17 | \snippet ../examples/zoomlinechart/chartview.h 2 | |
18 |
|
18 | |||
19 | Then we implement a custom logic for mouse and key events. For example pressing '+' key will zoom in and pressing |
|
19 | Then we implement a custom logic for mouse and key events. For example pressing '+' key will zoom in and pressing | |
20 | the '-' key will zoom out. |
|
20 | the '-' key will zoom out. | |
21 | \snippet ../examples/zoomlinechart/chartview.cpp 1 |
|
21 | \snippet ../examples/zoomlinechart/chartview.cpp 1 | |
22 | */ |
|
22 | */ |
@@ -1,87 +1,87 | |||||
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 <QPercentBarSeries> |
|
24 | #include <QPercentBarSeries> | |
25 | #include <QBarSet> |
|
25 | #include <QBarSet> | |
26 | #include <QLegend> |
|
26 | #include <QLegend> | |
27 |
|
27 | |||
28 | QTCOMMERCIALCHART_USE_NAMESPACE |
|
28 | QTCOMMERCIALCHART_USE_NAMESPACE | |
29 |
|
29 | |||
30 | int main(int argc, char *argv[]) |
|
30 | int main(int argc, char *argv[]) | |
31 | { |
|
31 | { | |
32 | QApplication a(argc, argv); |
|
32 | QApplication a(argc, argv); | |
33 |
|
33 | |||
34 | //![1] |
|
34 | //![1] | |
35 | QBarCategories categories; |
|
35 | QBarCategories categories; | |
36 | categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun"; |
|
36 | categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun"; | |
37 | //![1] |
|
37 | //![1] | |
38 |
|
38 | |||
39 | //![2] |
|
39 | //![2] | |
40 | QBarSet *set0 = new QBarSet("Jane"); |
|
40 | QBarSet *set0 = new QBarSet("Jane"); | |
41 | QBarSet *set1 = new QBarSet("John"); |
|
41 | QBarSet *set1 = new QBarSet("John"); | |
42 | QBarSet *set2 = new QBarSet("Axel"); |
|
42 | QBarSet *set2 = new QBarSet("Axel"); | |
43 | QBarSet *set3 = new QBarSet("Mary"); |
|
43 | QBarSet *set3 = new QBarSet("Mary"); | |
44 | QBarSet *set4 = new QBarSet("Samantha"); |
|
44 | QBarSet *set4 = new QBarSet("Samantha"); | |
45 |
|
45 | |||
46 | *set0 << 1 << 2 << 3 << 4 << 5 << 6; |
|
46 | *set0 << 1 << 2 << 3 << 4 << 5 << 6; | |
47 | *set1 << 5 << 0 << 0 << 4 << 0 << 7; |
|
47 | *set1 << 5 << 0 << 0 << 4 << 0 << 7; | |
48 | *set2 << 3 << 5 << 8 << 13 << 8 << 5; |
|
48 | *set2 << 3 << 5 << 8 << 13 << 8 << 5; | |
49 | *set3 << 5 << 6 << 7 << 3 << 4 << 5; |
|
49 | *set3 << 5 << 6 << 7 << 3 << 4 << 5; | |
50 | *set4 << 9 << 7 << 5 << 3 << 1 << 2; |
|
50 | *set4 << 9 << 7 << 5 << 3 << 1 << 2; | |
51 | //![2] |
|
51 | //![2] | |
52 |
|
52 | |||
53 | //![3] |
|
53 | //![3] | |
54 | QPercentBarSeries* series = new QPercentBarSeries(categories); |
|
54 | QPercentBarSeries* series = new QPercentBarSeries(categories); | |
55 | series->appendBarSet(set0); |
|
55 | series->appendBarSet(set0); | |
56 | series->appendBarSet(set1); |
|
56 | series->appendBarSet(set1); | |
57 | series->appendBarSet(set2); |
|
57 | series->appendBarSet(set2); | |
58 | series->appendBarSet(set3); |
|
58 | series->appendBarSet(set3); | |
59 | series->appendBarSet(set4); |
|
59 | series->appendBarSet(set4); | |
60 | //![3] |
|
60 | //![3] | |
61 |
|
61 | |||
62 | //![4] |
|
62 | //![4] | |
63 | QChart* chart = new QChart(); |
|
63 | QChart* chart = new QChart(); | |
64 | chart->addSeries(series); |
|
64 | chart->addSeries(series); | |
65 |
chart->setTitle("Simple p |
|
65 | chart->setTitle("Simple percentbarchart example"); | |
66 | //![4] |
|
66 | //![4] | |
67 |
|
67 | |||
68 | //![5] |
|
68 | //![5] | |
69 | chart->legend()->setVisible(true); |
|
69 | chart->legend()->setVisible(true); | |
70 | chart->legend()->setAlignment(QLegend::AlignmentBottom); |
|
70 | chart->legend()->setAlignment(QLegend::AlignmentBottom); | |
71 | //![5] |
|
71 | //![5] | |
72 |
|
72 | |||
73 | //![6] |
|
73 | //![6] | |
74 | QChartView* chartView = new QChartView(chart); |
|
74 | QChartView* chartView = new QChartView(chart); | |
75 | chartView->setRenderHint(QPainter::Antialiasing); |
|
75 | chartView->setRenderHint(QPainter::Antialiasing); | |
76 | //![6] |
|
76 | //![6] | |
77 |
|
77 | |||
78 | //![7] |
|
78 | //![7] | |
79 | QMainWindow window; |
|
79 | QMainWindow window; | |
80 | window.setCentralWidget(chartView); |
|
80 | window.setCentralWidget(chartView); | |
81 | window.resize(400, 300); |
|
81 | window.resize(400, 300); | |
82 | window.show(); |
|
82 | window.show(); | |
83 | //![7] |
|
83 | //![7] | |
84 |
|
84 | |||
85 | return a.exec(); |
|
85 | return a.exec(); | |
86 | } |
|
86 | } | |
87 |
|
87 |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
General Comments 0
You need to be logged in to leave comments.
Login now