@@ -1,70 +1,70 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2016 The Qt Company Ltd. |
|
4 | 4 | ** Contact: https://www.qt.io/licensing/ |
|
5 | 5 | ** |
|
6 | 6 | ** This file is part of the Qt Charts module of the Qt Toolkit. |
|
7 | 7 | ** |
|
8 | 8 | ** $QT_BEGIN_LICENSE:GPL$ |
|
9 | 9 | ** Commercial License Usage |
|
10 | 10 | ** Licensees holding valid commercial Qt licenses may use this file in |
|
11 | 11 | ** accordance with the commercial license agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and The Qt Company. For licensing terms |
|
14 | 14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
|
15 | 15 | ** information use the contact form at https://www.qt.io/contact-us. |
|
16 | 16 | ** |
|
17 | 17 | ** GNU General Public License Usage |
|
18 | 18 | ** Alternatively, this file may be used under the terms of the GNU |
|
19 | 19 | ** General Public License version 3 or (at your option) any later version |
|
20 | 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by |
|
21 | 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 |
|
22 | 22 | ** included in the packaging of this file. Please review the following |
|
23 | 23 | ** information to ensure the GNU General Public License requirements will |
|
24 | 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. |
|
25 | 25 | ** |
|
26 | 26 | ** $QT_END_LICENSE$ |
|
27 | 27 | ** |
|
28 | 28 | ****************************************************************************/ |
|
29 | 29 | |
|
30 | 30 | /*! |
|
31 | 31 | \title Qt Charts |
|
32 | 32 | \page qtcharts-index.html |
|
33 | 33 | |
|
34 | 34 | Qt Charts module provides a set of easy to use chart components. It uses the Qt Graphics View |
|
35 | 35 | Framework, therefore charts can be easily integrated to modern user interfaces. Qt Charts can |
|
36 | 36 | be used as QWidgets, QGraphicsWidget, or QML types. Users can easily create impressive |
|
37 | 37 | graphs by selecting one of the charts themes. |
|
38 | 38 | |
|
39 | 39 | \section1 Getting Started |
|
40 | 40 | |
|
41 | 41 | To import Qt Charts QML types, add the following import statement to your \c .qml file: |
|
42 | 42 | |
|
43 | 43 | \snippet doc_src_qmlcharts.cpp 0 |
|
44 | 44 | |
|
45 | 45 | If you intend to use Qt Charts C++ classes in your application, use the |
|
46 | 46 | following include and using directives: |
|
47 | 47 | |
|
48 | 48 | \snippet doc_src_qtcharts.cpp 0 |
|
49 | 49 | |
|
50 | \note If you are only using a few classes from this module, we recommend including only those | |
|
51 | specific classes instead of the whole module. | |
|
50 | \note Since Qt Creator 3.0, projects created with Qt Quick Application | |
|
51 | wizard based on the Qt Quick 2 template uses QGuiApplication by default. | |
|
52 | All such QGuiApplication instances in the project must be replaced with | |
|
53 | QApplication as the module depends on Qt's \l{Graphics View Framework} | |
|
54 | for rendering. | |
|
52 | 55 | |
|
53 | 56 | To link against the Qt Charts module, add this line to your \c qmake project file: |
|
54 | 57 | |
|
55 | 58 | \snippet doc_src_qtcharts.pro 0 |
|
56 | 59 | |
|
57 | See the \l{Qt Charts Getting Started}{Getting started} page for further information on | |
|
58 | how to use Qt Charts in your application. | |
|
59 | ||
|
60 | 60 | \section1 References |
|
61 | 61 | \list |
|
62 | 62 | \li \l{Qt Charts C++ Classes} |
|
63 | 63 | \li \l{Qt Charts QML Types} |
|
64 | 64 | \endlist |
|
65 | 65 | |
|
66 | 66 | Qt Charts comes with the following examples: |
|
67 | 67 | |
|
68 | 68 | \annotatedlist qtcharts_examples |
|
69 | 69 | |
|
70 | 70 | */ |
@@ -1,209 +1,88 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2016 The Qt Company Ltd. |
|
4 | 4 | ** Contact: https://www.qt.io/licensing/ |
|
5 | 5 | ** |
|
6 | 6 | ** This file is part of the Qt Charts module of the Qt Toolkit. |
|
7 | 7 | ** |
|
8 | 8 | ** $QT_BEGIN_LICENSE:GPL$ |
|
9 | 9 | ** Commercial License Usage |
|
10 | 10 | ** Licensees holding valid commercial Qt licenses may use this file in |
|
11 | 11 | ** accordance with the commercial license agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and The Qt Company. For licensing terms |
|
14 | 14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
|
15 | 15 | ** information use the contact form at https://www.qt.io/contact-us. |
|
16 | 16 | ** |
|
17 | 17 | ** GNU General Public License Usage |
|
18 | 18 | ** Alternatively, this file may be used under the terms of the GNU |
|
19 | 19 | ** General Public License version 3 or (at your option) any later version |
|
20 | 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by |
|
21 | 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 |
|
22 | 22 | ** included in the packaging of this file. Please review the following |
|
23 | 23 | ** information to ensure the GNU General Public License requirements will |
|
24 | 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. |
|
25 | 25 | ** |
|
26 | 26 | ** $QT_END_LICENSE$ |
|
27 | 27 | ** |
|
28 | 28 | ****************************************************************************/ |
|
29 | 29 | |
|
30 | 30 | /*! |
|
31 | 31 | \module Qt Charts |
|
32 | 32 | \title Qt Charts C++ Classes |
|
33 | 33 | \ingroup modules |
|
34 | 34 | |
|
35 | 35 | \brief C++ classes for the Qt Charts API. |
|
36 | 36 | |
|
37 | 37 | Charts API is built on top of Qt Graphics View Framework. Charts can be displayed as QGraphicsWidget using the QChart class. However |
|
38 | 38 | there is also the convenience class QChartView, which is QWidget based. These enable us to quickly use Qt Charts as a normal Qt widget. |
|
39 | 39 | |
|
40 | 40 | Each chart type is represented by the QAbstractSeries derived class. To create charts, the users have to use an instance of the related |
|
41 | 41 | series class and add it to a QChart instance. |
|
42 | 42 | \code |
|
43 | 43 | QLineSeries* series = new QLineSeries(); |
|
44 | 44 | series->add(0, 6); |
|
45 | 45 | series->add(2, 4); |
|
46 | 46 | ... |
|
47 | 47 | chartView->chart()->addSeries(series); |
|
48 | 48 | chartView->chart()->createDefaultAxes(); |
|
49 | 49 | \endcode |
|
50 | 50 | */ |
|
51 | 51 | |
|
52 | 52 | /*! |
|
53 | 53 | \qmlmodule QtCharts 2.1 |
|
54 | 54 | \title Qt Charts QML Types |
|
55 | 55 | \ingroup qmlmodules |
|
56 | 56 | |
|
57 | 57 | \brief QML types for the Qt Charts API. |
|
58 | 58 | |
|
59 | 59 | The Qt Charts QML API is an intuitive and simple way to show charts in your QML |
|
60 | 60 | applications. |
|
61 | 61 | |
|
62 | 62 | Use the following QML to create a simple pie chart: |
|
63 | 63 | \image examples_qmlpiechart.png |
|
64 | 64 | \snippet qmlpiechart/qml/qmlpiechart/main.qml 1 |
|
65 | 65 | \snippet qmlpiechart/qml/qmlpiechart/main.qml 2 |
|
66 | 66 | \snippet qmlpiechart/qml/qmlpiechart/main.qml 3 |
|
67 | 67 | |
|
68 | 68 | \note Since Qt Creator 3.0 the project created with Qt Quick Application wizard based on |
|
69 | 69 | Qt Quick 2 template uses QGuiApplication by default. As Qt Charts utilizes Qt Graphics View |
|
70 | 70 | Framework for drawing, QApplication must be used. The project created with the wizard is |
|
71 | 71 | usable with Qt Charts after the QGuiApplication is replaced with QApplication. |
|
72 | 72 | |
|
73 | 73 | \section1 QML Types |
|
74 | 74 | */ |
|
75 | 75 | |
|
76 | 76 | /*! |
|
77 | 77 | \group charts_examples |
|
78 | 78 | \ingroup all-examples |
|
79 | 79 | \title Qt Charts Examples |
|
80 | 80 | |
|
81 | 81 | \brief Examples for the Qt Charts. |
|
82 | 82 | |
|
83 | 83 | For some code examples, see one of the Qt Charts examples: |
|
84 | 84 | |
|
85 | 85 | \section1 Examples |
|
86 | 86 | |
|
87 | 87 | \annotatedlist qtcharts_examples |
|
88 | 88 | */ |
|
89 | ||
|
90 | /*! | |
|
91 | \group qtcharts_getting_started | |
|
92 | \title Qt Charts Getting Started | |
|
93 | ||
|
94 | \section1 Installing the Qt Charts module | |
|
95 | ||
|
96 | Use the \c {Package Manager} in \c {Maintenance Tool} or the \c {Online installer} to install | |
|
97 | the Qt Charts module. The module can be found under \c {Qt Enterprise Add-Ons} in the | |
|
98 | package manager. | |
|
99 | ||
|
100 | After installation Qt Charts documentation and examples are available in Qt Creator. | |
|
101 | Examples can be found on the examples page of Qt Creator by selecting the Qt Charts | |
|
102 | component from the drop-down menu. | |
|
103 | ||
|
104 | The source code is installed into the QtCharts folder under EnterpriseAddOns. | |
|
105 | ||
|
106 | \section1 Building Qt Charts | |
|
107 | ||
|
108 | To build the Qt Charts module from source code yourself, set up a command prompt with | |
|
109 | an environment for building Qt applications, navigate to the directory containing | |
|
110 | \c {qtcharts.pro}, and configure the project with qmake: | |
|
111 | \code | |
|
112 | qmake | |
|
113 | \endcode | |
|
114 | ||
|
115 | qmake should be run from the folder where Qt has been installed. For example, | |
|
116 | if Qt is built with -prefix /opt/MyXCompiledQt, then qmake should be run | |
|
117 | from /opt/MyXCompiledQt/bin/qmake. | |
|
118 | ||
|
119 | After running qmake, build the project with make: | |
|
120 | \table | |
|
121 | \header | |
|
122 | \li OS \li Make command | |
|
123 | \row | |
|
124 | \li Linux \li make | |
|
125 | \row | |
|
126 | \li Windows (MinGw) \li mingw32-make | |
|
127 | \row | |
|
128 | \li Windows (MSVC) \li nmake | |
|
129 | \row | |
|
130 | \li OSX \li make | |
|
131 | \endtable | |
|
132 | ||
|
133 | The above generates the default makefiles for your configuration, which is typically | |
|
134 | the release build if you are using precompiled binary Qt distribution. To build both debug | |
|
135 | and release, or one specifically, use one of the following qmake lines instead. | |
|
136 | ||
|
137 | For debug builds: | |
|
138 | \code | |
|
139 | qmake CONFIG+=debug | |
|
140 | make | |
|
141 | \endcode | |
|
142 | or | |
|
143 | \code | |
|
144 | qmake CONFIG+=debug_and_release | |
|
145 | make debug | |
|
146 | \endcode | |
|
147 | ||
|
148 | For release builds: | |
|
149 | \code | |
|
150 | qmake CONFIG+=release | |
|
151 | make | |
|
152 | \endcode | |
|
153 | or | |
|
154 | \code | |
|
155 | qmake CONFIG+=debug_and_release | |
|
156 | make release | |
|
157 | \endcode | |
|
158 | ||
|
159 | For both builds (Windows/OS X only): | |
|
160 | \code | |
|
161 | qmake CONFIG+="debug_and_release build_all" | |
|
162 | make | |
|
163 | \endcode | |
|
164 | ||
|
165 | After building, install the module to your Qt directory: | |
|
166 | \code | |
|
167 | make install | |
|
168 | \endcode | |
|
169 | ||
|
170 | If you want to uninstall the module: | |
|
171 | \code | |
|
172 | make uninstall | |
|
173 | \endcode | |
|
174 | ||
|
175 | To build a statically linked version of the Qt Charts module, give the following commands: | |
|
176 | ||
|
177 | \snippet doc_src_qtcharts.cpp 1 | |
|
178 | ||
|
179 | \section1 Running examples | |
|
180 | ||
|
181 | Qt Charts examples are found under the \c examples subdirectory. To build and run a single | |
|
182 | example, in this case qmlpolarchart, navigate to the example directory and enter the following | |
|
183 | commands: | |
|
184 | ||
|
185 | \snippet doc_src_qtcharts.cpp 2 | |
|
186 | ||
|
187 | \note On some platforms, such as Windows, the executable can be generated under debug or | |
|
188 | release folders, depending on your build. | |
|
189 | ||
|
190 | \section1 Creating a simple application | |
|
191 | ||
|
192 | To create a simple application, start by creating a new Qt Gui Application project in Qt | |
|
193 | Creator and add this line to the \c .pro file of the project: | |
|
194 | ||
|
195 | \snippet doc_src_qtcharts.pro 0 | |
|
196 | ||
|
197 | In the \c main.cpp file, include the module headers and declare namespace usage: | |
|
198 | ||
|
199 | \snippet doc_src_qtcharts.cpp 0 | |
|
200 | ||
|
201 | \note Since Qt Creator 3.0 the project created with Qt Quick Application wizard based on | |
|
202 | Qt Quick 2 template uses QGuiApplication by default. As Qt Charts utilizes Qt Graphics View | |
|
203 | Framework for drawing, QApplication must be used. The project created with the wizard is | |
|
204 | usable with Qt Charts after the QGuiApplication is replaced with QApplication. | |
|
205 | ||
|
206 | For further code examples, see one of the Qt Charts examples: | |
|
207 | ||
|
208 | \annotatedlist qtcharts_examples | |
|
209 | */ |
General Comments 0
You need to be logged in to leave comments.
Login now