@@ -3,10 +3,11 | |||||
3 | \title Qt Charts API |
|
3 | \title Qt Charts API | |
4 | \keyword All Classes |
|
4 | \keyword All Classes | |
5 |
|
5 | |||
6 |
Charts API is buil |
|
6 | Charts API is built on top of Qt Graphics View Framework. Charts can be displayed as QGraphicsWidget using the QChart class. However | |
7 |
there is also convenience class QChartView which is QWidget based. These |
|
7 | there is also the convenience class QChartView, which is QWidget based. These enable us to quickly use Qt Charts as a normal Qt widget. | |
8 |
|
8 | |||
9 |
Each chart type is represented by QAbstractSeries derived class. To create |
|
9 | Each chart type is represented by the QAbstractSeries derived class. To create charts, the users have to use an instance of the related | |
|
10 | series class and add it to a QChart instance. | |||
10 | \code |
|
11 | \code | |
11 | QLineSeries* series = new QLineSeries(); |
|
12 | QLineSeries* series = new QLineSeries(); | |
12 | series->add(0, 6); |
|
13 | series->add(0, 6); | |
@@ -35,7 +36,7 | |||||
35 | <li><a href="qabstractaxis.html">QAbstractAxis</a></li> |
|
36 | <li><a href="qabstractaxis.html">QAbstractAxis</a></li> | |
36 | <li><a href="qvalueaxis.html">QValueAxis</a></li> |
|
37 | <li><a href="qvalueaxis.html">QValueAxis</a></li> | |
37 | <li><a href="qlogvalueaxis.html">QLogValueAxis</a></li> |
|
38 | <li><a href="qlogvalueaxis.html">QLogValueAxis</a></li> | |
38 |
<li><a href="qbarcategoryaxis.html">QBarCategoryAxis</a></li> |
|
39 | <li><a href="qbarcategoryaxis.html">QBarCategoryAxis</a></li> | |
39 | <li><a href="qcategoryaxis.html">QCategoryAxis</a></li> |
|
40 | <li><a href="qcategoryaxis.html">QCategoryAxis</a></li> | |
40 | <li><a href="qdatetimeaxis.html">QDateTimeAxis</a></li> |
|
41 | <li><a href="qdatetimeaxis.html">QDateTimeAxis</a></li> | |
41 | <li><a href="qlegend.html">QLegend</a></li> |
|
42 | <li><a href="qlegend.html">QLegend</a></li> | |
@@ -96,5 +97,5 | |||||
96 | </tr> |
|
97 | </tr> | |
97 | </table> |
|
98 | </table> | |
98 | \endraw |
|
99 | \endraw | |
99 |
|
100 | |||
100 | */ |
|
101 | */ |
@@ -3,6 +3,6 | |||||
3 | \title Audio demo |
|
3 | \title Audio demo | |
4 | \subtitle |
|
4 | \subtitle | |
5 |
|
5 | |||
6 |
This demo |
|
6 | This demo shows the drawing of dynamic data (microphone input). | |
7 | \image demos_audio.png |
|
7 | \image demos_audio.png | |
8 | */ |
|
8 | */ |
@@ -6,7 +6,7 | |||||
6 | This demo shows how to draw an additional element (a callout) on top of the chart. |
|
6 | This demo shows how to draw an additional element (a callout) on top of the chart. | |
7 | \image demos_callout.png |
|
7 | \image demos_callout.png | |
8 |
|
8 | |||
9 |
QChart class provides two methods that map between the scene coordinates and the series |
|
9 | QChart class provides two methods that map between the scene coordinates and the series domain (defined by the axes ranges). | |
10 |
|
10 | |||
11 | QPointF QChart::mapToPosition(const QPointF &value, QAbstractSeries *series) |
|
11 | QPointF QChart::mapToPosition(const QPointF &value, QAbstractSeries *series) | |
12 |
|
12 |
@@ -3,9 +3,10 | |||||
3 | \title Chart themes demo |
|
3 | \title Chart themes demo | |
4 | \subtitle |
|
4 | \subtitle | |
5 |
|
5 | |||
6 |
This demo shows the look and feel of the different built |
|
6 | This demo shows the look and feel of the different built-in themes for all supported chart types. | |
7 | The background palette of the application is also customized according to the selected theme, to make the result |
|
7 | In order to give the result a more harmonious look, the background palette of the application is | |
8 | look harmonious. |
|
8 | customized to the theme selected. | |
|
9 | ||||
9 | \image demo_chartthemes_light.png |
|
10 | \image demo_chartthemes_light.png | |
10 | \image demo_chartthemes_brown_sand.png |
|
11 | \image demo_chartthemes_brown_sand.png | |
11 | \image demo_chartthemes_blue_cerulean.png |
|
12 | \image demo_chartthemes_blue_cerulean.png |
@@ -3,7 +3,7 | |||||
3 | \title Dynamic spline demo |
|
3 | \title Dynamic spline demo | |
4 | \subtitle |
|
4 | \subtitle | |
5 |
|
5 | |||
6 |
Th |
|
6 | This example shows how to draw dynamic data. | |
7 |
|
7 | |||
8 | \image demos_dynamicspline1.png |
|
8 | \image demos_dynamicspline1.png | |
9 | \image demos_dynamicspline2.png |
|
9 | \image demos_dynamicspline2.png |
@@ -3,10 +3,10 | |||||
3 | \title Nested donuts demo |
|
3 | \title Nested donuts demo | |
4 | \subtitle |
|
4 | \subtitle | |
5 |
|
5 | |||
6 |
This example shows how to |
|
6 | This example shows how to create a nested donuts chart using the QPieSeries API. | |
7 | \image demos_nesteddonuts.png |
|
7 | \image demos_nesteddonuts.png | |
8 |
|
8 | |||
9 | Let's start by creating a QChartView instance and enabling the Antialiasing on it. QChart object is then obtained from the QChartView instance. |
|
9 | Let's start by creating a QChartView instance and enabling the Antialiasing on it. A QChart object is then obtained from the QChartView instance. | |
10 | The legend is disabled and the title of the chart is set. Last line enables the animations of the chart. |
|
10 | The legend is disabled and the title of the chart is set. Last line enables the animations of the chart. | |
11 |
|
11 | |||
12 | \snippet ../demos/nesteddonuts/widget.cpp 1 |
|
12 | \snippet ../demos/nesteddonuts/widget.cpp 1 | |
@@ -16,11 +16,11 | |||||
16 |
|
16 | |||
17 | \snippet ../demos/nesteddonuts/widget.cpp 2 |
|
17 | \snippet ../demos/nesteddonuts/widget.cpp 2 | |
18 |
|
18 | |||
19 |
|
|
19 | The following block of code defines the individual donuts and their slices. First a new QPieSeries object is created. | |
20 | The number of slices in each donut is randomized. |
|
20 | The number of slices in each donut is randomized. | |
21 | The internal for loop creates the slices with a random value and label same as the value. |
|
21 | The internal for loop creates the slices with a random value and label same as the value. | |
22 | Next the label of the slice is set to be visible and its color is set to white. |
|
22 | Next the label of the slice is set to be visible and its color is set to white. | |
23 | To make the example more interesting the hovered signal of the slice is connected to widget's slot which inner workings are explained later. |
|
23 | To make the example more interesting the hovered signal of the slice is connected to widget's slot, of which the inner workings are explained later. | |
24 | Finally the slice is added to the donut. The donut's size is adjusted to achieve the nesting of the donuts. |
|
24 | Finally the slice is added to the donut. The donut's size is adjusted to achieve the nesting of the donuts. | |
25 | Then the donut is added to the widget's list of donuts and to the chart. |
|
25 | Then the donut is added to the widget's list of donuts and to the chart. | |
26 |
|
26 | |||
@@ -35,12 +35,12 | |||||
35 | \snippet ../demos/nesteddonuts/widget.cpp 5 |
|
35 | \snippet ../demos/nesteddonuts/widget.cpp 5 | |
36 |
|
36 | |||
37 | The widget's updatedRotation slot is defined below. |
|
37 | The widget's updatedRotation slot is defined below. | |
38 |
It goes through all of the donuts and modifies th |
|
38 | It goes through all of the donuts and modifies their current rotation by a random value. | |
39 |
|
39 | |||
40 | \snippet ../demos/nesteddonuts/widget.cpp 6 |
|
40 | \snippet ../demos/nesteddonuts/widget.cpp 6 | |
41 |
|
41 | |||
42 | The earlier mentioned explodeSlice slot code is provided below. |
|
42 | The earlier mentioned explodeSlice slot code is provided below. | |
43 | If the slice is set to exploded then stop the timer that controls the donuts rotation. |
|
43 | If the slice is set to exploded, then stop the timer that controls the donuts rotation. | |
44 | Then the slice's start and end angles are obtained from the slice. |
|
44 | Then the slice's start and end angles are obtained from the slice. | |
45 | To highlight the selected slice all the other donuts that lie outward from the one that contains the selected slice |
|
45 | To highlight the selected slice all the other donuts that lie outward from the one that contains the selected slice | |
46 | have their start and end angles modified so that they wouldn't "block" the way for the hightlighted slice. |
|
46 | have their start and end angles modified so that they wouldn't "block" the way for the hightlighted slice. |
@@ -3,8 +3,8 | |||||
3 | \title Qml charts demo |
|
3 | \title Qml charts demo | |
4 | \subtitle |
|
4 | \subtitle | |
5 |
|
5 | |||
6 |
This |
|
6 | This basic demonstration shows how to use the different chart types by using qml. Creating each chart type begins | |
7 | with creation of a ChartView. |
|
7 | with the creation of a ChartView. | |
8 |
|
8 | |||
9 | \table |
|
9 | \table | |
10 | \row |
|
10 | \row | |
@@ -19,7 +19,7 | |||||
19 | \table |
|
19 | \table | |
20 | \row |
|
20 | \row | |
21 | \o \br |
|
21 | \o \br | |
22 | To create a chart with line series: |
|
22 | To create a chart with a line series: | |
23 | \br |
|
23 | \br | |
24 | \br |
|
24 | \br | |
25 | \snippet ../demos/qmlchart/qml/qmlchart/View2.qml 1 |
|
25 | \snippet ../demos/qmlchart/qml/qmlchart/View2.qml 1 | |
@@ -49,7 +49,7 | |||||
49 | \table |
|
49 | \table | |
50 | \row |
|
50 | \row | |
51 | \o \br |
|
51 | \o \br | |
52 | Then couple of scatter series: |
|
52 | Then a couple of scatter series: | |
53 | \br |
|
53 | \br | |
54 | \br |
|
54 | \br | |
55 | \snippet ../demos/qmlchart/qml/qmlchart/View5.qml 1 |
|
55 | \snippet ../demos/qmlchart/qml/qmlchart/View5.qml 1 | |
@@ -109,7 +109,7 | |||||
109 | \table |
|
109 | \table | |
110 | \row |
|
110 | \row | |
111 | \o \br |
|
111 | \o \br | |
112 | And finally an example how to create a donut chart with two pie series: |
|
112 | And finally an example demonstrating how to create a donut chart with two pie series: | |
113 | \br |
|
113 | \br | |
114 | \br |
|
114 | \br | |
115 | \snippet ../demos/qmlchart/qml/qmlchart/View12.qml 1 |
|
115 | \snippet ../demos/qmlchart/qml/qmlchart/View12.qml 1 |
@@ -8,19 +8,19 | |||||
8 | This application shows you how to customize different visual properties of a ChartView and series. It shows |
|
8 | This application shows you how to customize different visual properties of a ChartView and series. It shows | |
9 | a wheel of fortune by customizing a pie series. |
|
9 | a wheel of fortune by customizing a pie series. | |
10 |
|
10 | |||
11 | First we create ChartView and a couple of series. |
|
11 | First we create the ChartView and a couple of series. | |
12 | \snippet ../demos/qmlcustomizations/qml/qmlcustomizations/main.qml 1 |
|
12 | \snippet ../demos/qmlcustomizations/qml/qmlcustomizations/main.qml 1 | |
13 |
|
13 | |||
14 | The application data is generated in Component.onCompleted of the main rectangle: |
|
14 | The application data is generated in Component.onCompleted of the main rectangle: | |
15 | \snippet ../demos/qmlcustomizations/qml/qmlcustomizations/main.qml 2 |
|
15 | \snippet ../demos/qmlcustomizations/qml/qmlcustomizations/main.qml 2 | |
16 |
|
16 | |||
17 | The following customizations are done repeatedly with a timer. To highlight one of the pie slices at time |
|
17 | The following customizations are done repeatedly with a timer. To highlight one of the pie slices at time | |
18 |
we modify it |
|
18 | we modify its exploded property: | |
19 | \snippet ../demos/qmlcustomizations/qml/qmlcustomizations/main.qml 3 |
|
19 | \snippet ../demos/qmlcustomizations/qml/qmlcustomizations/main.qml 3 | |
20 |
|
20 | |||
21 | Then an animation using a scatter series with one data point: |
|
21 | Then an animation using a scatter series with one data point: | |
22 | \snippet ../demos/qmlcustomizations/qml/qmlcustomizations/main.qml 4 |
|
22 | \snippet ../demos/qmlcustomizations/qml/qmlcustomizations/main.qml 4 | |
23 |
|
23 | |||
24 |
When the wheel of fortune has stopped, we make the active slice blink by modifying it |
|
24 | When the wheel of fortune has stopped, we make the active slice blink by modifying its colors. | |
25 | \snippet ../demos/qmlcustomizations/qml/qmlcustomizations/main.qml 5 |
|
25 | \snippet ../demos/qmlcustomizations/qml/qmlcustomizations/main.qml 5 | |
26 | */ |
|
26 | */ |
@@ -3,7 +3,7 | |||||
3 | \title Qml Custom Legend |
|
3 | \title Qml Custom Legend | |
4 | \subtitle |
|
4 | \subtitle | |
5 |
|
5 | |||
6 |
This demo application shows you how to create your own |
|
6 | This demo application shows you how to create your own custom legend instead of using the | |
7 | built-in legend of ChartView API. |
|
7 | built-in legend of ChartView API. | |
8 |
|
8 | |||
9 | \table |
|
9 | \table | |
@@ -18,7 +18,7 | |||||
18 | \o \inlineimage demos-qmlcustomlegend1.png |
|
18 | \o \inlineimage demos-qmlcustomlegend1.png | |
19 | \row |
|
19 | \row | |
20 | \o \br |
|
20 | \o \br | |
21 | Hovering with mouse on top of the legend will highlight the hovered series |
|
21 | Hovering with mouse on top of the legend will highlight the hovered series. | |
22 | \br |
|
22 | \br | |
23 | (see CustomLegend.qml). |
|
23 | (see CustomLegend.qml). | |
24 | \br |
|
24 | \br |
@@ -9,9 +9,9 | |||||
9 | First we create a ChartView: |
|
9 | First we create a ChartView: | |
10 | \snippet ../demos/qmlcustommodel/qml/qmlcustommodel/main.qml 1 |
|
10 | \snippet ../demos/qmlcustommodel/qml/qmlcustommodel/main.qml 1 | |
11 |
|
11 | |||
12 |
Then our data model that contains the shares of t |
|
12 | Then our data model that contains the shares of the top 5 car manufacturers in Finland for the last 5 years. The model | |
13 | could be constructed from various sources depending on the use case, but here we use static data for the sake of |
|
13 | could be constructed from various sources depending on the use case, but here we use static data for the sake of | |
14 | simplicity. Check customtablemodel.cpp, declarativemodel.cpp and plugin.cpp to see how to make your own |
|
14 | simplicity. Check customtablemodel.cpp, declarativemodel.cpp, and plugin.cpp to see how to make your own | |
15 | QAbstractItemModel accessible on QML. |
|
15 | QAbstractItemModel accessible on QML. | |
16 | \snippet ../demos/qmlcustommodel/qml/qmlcustommodel/main.qml 2 |
|
16 | \snippet ../demos/qmlcustommodel/qml/qmlcustommodel/main.qml 2 | |
17 |
|
17 | |||
@@ -19,8 +19,8 | |||||
19 | the car manufacturers in Finland in 2011: |
|
19 | the car manufacturers in Finland in 2011: | |
20 | \snippet ../demos/qmlcustommodel/qml/qmlcustommodel/main.qml 3 |
|
20 | \snippet ../demos/qmlcustommodel/qml/qmlcustommodel/main.qml 3 | |
21 |
|
21 | |||
22 |
And one line series for each manufacturer presenting the share between 2007-2011, for example |
|
22 | And one line series for each manufacturer presenting the share between 2007-2011, for example for Volkswagen. | |
23 |
|
|
23 | The series is not visible by default. It is made visible when the user clicks on the Volkswagen slice | |
24 | on the pie series: |
|
24 | on the pie series: | |
25 | \snippet ../demos/qmlcustommodel/qml/qmlcustommodel/main.qml 4 |
|
25 | \snippet ../demos/qmlcustommodel/qml/qmlcustommodel/main.qml 4 | |
26 |
|
26 |
@@ -5,7 +5,7 | |||||
5 |
|
5 | |||
6 | \image demos_qmlf1legends.png |
|
6 | \image demos_qmlf1legends.png | |
7 |
|
7 | |||
8 |
This application demonstrates |
|
8 | This application demonstrates how to use XmlListModel as a datasource for a Chart. | |
9 |
|
9 | |||
10 | Let's define an empty ChartView first: |
|
10 | Let's define an empty ChartView first: | |
11 | \snippet ../demos/qmlf1legends/qml/qmlf1legends/main.qml 1 |
|
11 | \snippet ../demos/qmlf1legends/qml/qmlf1legends/main.qml 1 |
@@ -4,12 +4,12 | |||||
4 |
|
4 | |||
5 | \image demos_qmloscilloscope.png |
|
5 | \image demos_qmloscilloscope.png | |
6 |
|
6 | |||
7 |
|
|
7 | The oscilloscope application demonstrates how to use the Qt Charts QML API to implement an | |
8 | application with strict performance requirements. The application uses generated data with |
|
8 | application with strict performance requirements. The application uses generated data with | |
9 | configurable characteristics to mimic a simple oscilloscope user interface. To find out the |
|
9 | configurable characteristics to mimic a simple oscilloscope user interface. To find out the | |
10 | actual screen refresh performance of the application, you can set QML_SHOW_FRAMERATE = 1 to |
|
10 | actual screen refresh performance of the application, you can set QML_SHOW_FRAMERATE = 1 to | |
11 | your run environment settings to get the framerate shown in the application output console. |
|
11 | your run environment settings to get the framerate shown in the application output console. | |
12 |
|
|
12 | To do so go to Projects - Run - Run environment in Qt Creator and select Add. Then you can | |
13 | experiment with the different configurable options of the demo application to find the |
|
13 | experiment with the different configurable options of the demo application to find the | |
14 | configuration that gives you the best performance in your environment. |
|
14 | configuration that gives you the best performance in your environment. | |
15 |
|
15 | |||
@@ -28,7 +28,7 | |||||
28 | \snippet ../demos/qmloscilloscope/qml/qmloscilloscope/ScopeView.qml 1 |
|
28 | \snippet ../demos/qmloscilloscope/qml/qmloscilloscope/ScopeView.qml 1 | |
29 |
|
29 | |||
30 | The data of the line series is updated with a QML timer. In a real life application the |
|
30 | The data of the line series is updated with a QML timer. In a real life application the | |
31 | updating could triggered with a signal from Qt C++ code. |
|
31 | updating could be triggered with a signal from Qt C++ code. | |
32 | \snippet ../demos/qmloscilloscope/qml/qmloscilloscope/ScopeView.qml 2 |
|
32 | \snippet ../demos/qmloscilloscope/qml/qmloscilloscope/ScopeView.qml 2 | |
33 |
|
33 | |||
34 | The oscilloscope also allows you to switch the type of the series used for visualizing the |
|
34 | The oscilloscope also allows you to switch the type of the series used for visualizing the |
@@ -3,7 +3,7 | |||||
3 | \title Qml Polar Chart |
|
3 | \title Qml Polar Chart | |
4 | \subtitle |
|
4 | \subtitle | |
5 |
|
5 | |||
6 |
This is a demonstration o |
|
6 | This is a demonstration on how to use a polar chart in your QML application. | |
7 |
|
7 | |||
8 | \table |
|
8 | \table | |
9 | \row |
|
9 | \row | |
@@ -16,8 +16,8 | |||||
16 | \o \inlineimage demos_qmlpolarchart1.png |
|
16 | \o \inlineimage demos_qmlpolarchart1.png | |
17 | \row |
|
17 | \row | |
18 | \o \br |
|
18 | \o \br | |
19 |
The next example shows a chart with some accurate historical data |
|
19 | The next example shows a chart with some accurate historical data for which we need to use a DateTimeAxis | |
20 | and AreaSeries. |
|
20 | and a AreaSeries. | |
21 | \br |
|
21 | \br | |
22 | \br |
|
22 | \br | |
23 | \snippet ../demos/qmlpolarchart/qml/qmlpolarchart/View2.qml 1 |
|
23 | \snippet ../demos/qmlpolarchart/qml/qmlpolarchart/View2.qml 1 |
@@ -5,7 +5,7 | |||||
5 |
|
5 | |||
6 | \image demos_qmlweather.png |
|
6 | \image demos_qmlweather.png | |
7 |
|
7 | |||
8 | This is a basic demonstration how to use the different chart types by using qml. By default the |
|
8 | This is a basic demonstration showing how to use the different chart types by using qml. By default the | |
9 | application uses static test data to mimic a weather forecast. You can also obtain an application |
|
9 | application uses static test data to mimic a weather forecast. You can also obtain an application | |
10 | id from http://www.worldweatheronline.com/ to get access to their weather API. You can then give |
|
10 | id from http://www.worldweatheronline.com/ to get access to their weather API. You can then give | |
11 | your application id as a parameter to the Qml Weather executable to make it use live data. |
|
11 | your application id as a parameter to the Qml Weather executable to make it use live data. | |
@@ -15,7 +15,7 | |||||
15 | bin\qmlweather.exe 1234567890abcdef123456 |
|
15 | bin\qmlweather.exe 1234567890abcdef123456 | |
16 | \endcode |
|
16 | \endcode | |
17 |
|
17 | |||
18 |
The demo application uses a ChartView and a |
|
18 | The demo application uses a ChartView and a some series to visualize weather data: | |
19 | \snippet ../demos/qmlweather/qml/qmlweather/main.qml 1 |
|
19 | \snippet ../demos/qmlweather/qml/qmlweather/main.qml 1 | |
20 | \snippet ../demos/qmlweather/qml/qmlweather/main.qml 2 |
|
20 | \snippet ../demos/qmlweather/qml/qmlweather/main.qml 2 | |
21 |
|
21 |
@@ -11,5 +11,5 | |||||
11 |
|
11 | |||
12 | \snippet ../demos/quick2chart/qml/quick2chart/View1.qml 2 |
|
12 | \snippet ../demos/quick2chart/qml/quick2chart/View1.qml 2 | |
13 |
|
13 | |||
14 | Additionally, antialiasing is set with qml property in Qt Quick 2. |
|
14 | Additionally, antialiasing is set with the qml property in Qt Quick 2. | |
15 | */ |
|
15 | */ |
@@ -4,13 +4,13 | |||||
4 |
|
4 | |||
5 | \image demos_qmloscilloscope.png |
|
5 | \image demos_qmloscilloscope.png | |
6 |
|
6 | |||
7 | This is a reimplementation of \l{Oscilloscope} demo in Qt Quick 2. |
|
7 | This is a reimplementation of the \l{Oscilloscope} demo in Qt Quick 2. | |
8 |
|
8 | |||
9 | The main difference in qml files is importing the correct version of Qt Quick: |
|
9 | The main difference in qml files is importing the correct version of Qt Quick: | |
10 |
|
10 | |||
11 | \snippet ../demos/quick2oscilloscope/qml/quick2oscilloscope/main.qml 3 |
|
11 | \snippet ../demos/quick2oscilloscope/qml/quick2oscilloscope/main.qml 3 | |
12 |
|
12 | |||
13 | \note QML_SHOW_FRAMERATE environment variable doesn't work with Qt Quick 2. |
|
13 | \note QML_SHOW_FRAMERATE environment variable doesn't work with Qt Quick 2. | |
14 |
|
|
14 | From Qt 5.1.0 on, the QSG_RENDER_TIMING environment variable can be used | |
15 | similarly to display rendering time. |
|
15 | similarly to display rendering time. | |
16 | */ |
|
16 | */ |
@@ -2,7 +2,7 | |||||
2 | \page demos.html |
|
2 | \page demos.html | |
3 | \title Qt Charts Demos |
|
3 | \title Qt Charts Demos | |
4 | \keyword Demos |
|
4 | \keyword Demos | |
5 |
|
5 | |||
6 | \raw HTML |
|
6 | \raw HTML | |
7 | <div class="qchart"> |
|
7 | <div class="qchart"> | |
8 |
|
8 |
@@ -3,28 +3,28 | |||||
3 | \title AreaChart Example |
|
3 | \title AreaChart Example | |
4 | \subtitle |
|
4 | \subtitle | |
5 |
|
5 | |||
6 | The example shows how to create simple area chart. |
|
6 | The example shows how to create a simple area chart. | |
7 |
|
7 | |||
8 | \image examples_areachart.png |
|
8 | \image examples_areachart.png | |
9 |
|
9 | |||
10 |
To create area charts, we need two QLineSeries instances. They are going to define upper and lower boundary of the area. |
|
10 | To create area charts, we need two QLineSeries instances. They are going to define the upper and lower boundary of the area. | |
11 |
|
11 | |||
12 | \snippet ../examples/areachart/main.cpp 1 |
|
12 | \snippet ../examples/areachart/main.cpp 1 | |
13 |
|
13 | |||
14 |
We add data to both series |
|
14 | We add data to both series and use the stream operator. | |
15 |
|
15 | |||
16 | \snippet ../examples/areachart/main.cpp 2 |
|
16 | \snippet ../examples/areachart/main.cpp 2 | |
17 |
|
17 | |||
18 |
Now we create QAreaSeries instance using two line series objects. We set the custom gradient fill and width of the outline. |
|
18 | Now we create a QAreaSeries instance using two line series objects. We set the custom gradient fill and width of the outline. | |
19 |
|
19 | |||
20 | \snippet ../examples/areachart/main.cpp 3 |
|
20 | \snippet ../examples/areachart/main.cpp 3 | |
21 |
|
21 | |||
22 |
|
|
22 | Last we create the QChartView instance, set the title, set anti-aliasing, and add the area series. We also create the default axes and specify the ranges on them. | |
23 |
|
23 | |||
24 |
\snippet ../examples/areachart/main.cpp 4 |
|
24 | \snippet ../examples/areachart/main.cpp 4 | |
25 |
|
25 | |||
26 |
|
|
26 | The chart is ready to be shown. | |
27 |
|
27 | |||
28 |
\snippet ../examples/areachart/main.cpp 5 |
|
28 | \snippet ../examples/areachart/main.cpp 5 | |
29 |
|
29 | |||
30 | */ |
|
30 | */ |
@@ -7,10 +7,10 | |||||
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. |
|
10 | The barsets are used in the same way in all barcharts. | |
11 |
|
|
11 | To illustrate the difference between various barcharts, we use the same data in the examples. | |
12 | Data that barchart visualizes, is defined by QBarSet instances. Here we create the sets and append data |
|
12 | Data that the barchart visualizes, is defined by the QBarSet instances. Here we create the sets and append data | |
13 | to them. The data is appended here with << operator. Alternatively the append method could be used. |
|
13 | to them. The data is appended here with the << operator. Alternatively, the append method could be used. | |
14 |
|
14 | |||
15 | \snippet ../examples/barchart/main.cpp 1 |
|
15 | \snippet ../examples/barchart/main.cpp 1 | |
16 |
|
16 | |||
@@ -20,19 +20,18 | |||||
20 | \snippet ../examples/barchart/main.cpp 2 |
|
20 | \snippet ../examples/barchart/main.cpp 2 | |
21 |
|
21 | |||
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 |
|
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 |
|
|
23 | setAnimationOptions(QChart::SeriesAnimations) | |
24 |
|
24 | |||
25 | \snippet ../examples/barchart/main.cpp 3 |
|
25 | \snippet ../examples/barchart/main.cpp 3 | |
26 |
|
26 | |||
27 |
|
|
27 | To have categories displayed on axis, we need to create a QBarCategoryAxis for that. Here we create a category axis with a list of categories and | |
28 |
|
|
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 |
|
|
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 |
|
|
30 | override the category axis. | |
31 |
|
31 | |||
32 | \snippet ../examples/barchart/main.cpp 4 |
|
32 | \snippet ../examples/barchart/main.cpp 4 | |
33 |
|
33 | |||
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 its alignment |
|
34 | We also want to show the legend. To do that, we get the legend pointer from the chart and set it to visible. We also place the legend to the bottom of the chart by setting its alignment to Qt::AlignBottom. | |
35 | to Qt::AlignBottom. |
|
|||
36 |
|
35 | |||
37 | \snippet ../examples/barchart/main.cpp 5 |
|
36 | \snippet ../examples/barchart/main.cpp 5 | |
38 |
|
37 | |||
@@ -40,8 +39,7 | |||||
40 |
|
39 | |||
41 | \snippet ../examples/barchart/main.cpp 6 |
|
40 | \snippet ../examples/barchart/main.cpp 6 | |
42 |
|
41 | |||
43 |
|
|
42 | The chart is ready to be shown. We set the chart to be central widget of the window. We also set the size for the chart window and show it. | |
44 | We also set the size for the chart window and show it. |
|
|||
45 |
|
43 | |||
46 | \snippet ../examples/barchart/main.cpp 7 |
|
44 | \snippet ../examples/barchart/main.cpp 7 | |
47 | */ |
|
45 | */ |
@@ -8,32 +8,32 | |||||
8 | \image examples_barmodelmapper.png |
|
8 | \image examples_barmodelmapper.png | |
9 |
|
9 | |||
10 | Let's start by creating an instance of CustomTableModel class. |
|
10 | Let's start by creating an instance of CustomTableModel class. | |
11 | CustomTableModel class is derived from QAbstractTableModel and it was created for the purpose of this example. |
|
11 | The CustomTableModel class is derived from QAbstractTableModel, and it was created for the purpose of this example. | |
12 |
The constructor of this class populates the internal data store |
|
12 | The constructor of this class populates the model's internal data store with the data required for our chart example. | |
13 |
|
13 | |||
14 | \snippet ../examples/barmodelmapper/tablewidget.cpp 1 |
|
14 | \snippet ../examples/barmodelmapper/tablewidget.cpp 1 | |
15 |
|
15 | |||
16 | We now have a model with data that we would like to display both on the chart and in a QTableView. |
|
16 | We now have a model with data that we would like to display both on the chart and in a QTableView. | |
17 | First, we create QTableView and tell it use the model as a data source. To have the data presented nicely the minimum width of the table view is set and its headers resize mode changed to stretch. |
|
17 | First, we create QTableView and tell it to use the model as a data source. To have the data presented nicely, the minimum width of the table view is set and its headers resize mode changed to stretch. | |
18 |
|
18 | |||
19 | \snippet ../examples/barmodelmapper/tablewidget.cpp 2 |
|
19 | \snippet ../examples/barmodelmapper/tablewidget.cpp 2 | |
20 |
|
20 | |||
21 | Now we need QChart instance to display the same data on the chart. |
|
21 | Now we need a QChart instance to display the same data on the chart. | |
22 |
We also enable animations. It makes it easier to see how |
|
22 | We also enable animations. It makes it easier to see how a modification to the model's data affects the chart. | |
23 |
|
23 | |||
24 | \snippet ../examples/barmodelmapper/tablewidget.cpp 3 |
|
24 | \snippet ../examples/barmodelmapper/tablewidget.cpp 3 | |
25 |
|
25 | |||
26 |
|
|
26 | The first line of the code below creates new bar series. Variables firstRow and rowCount are used to define a custom model mapping. | |
27 | Custom mapping allows to take only part of the data from the model. In this case data from 5 rows starting with the row with the index 3. |
|
27 | Custom mapping allows to take only part of the data from the model. In this case data from 5 rows starting with the row with the index 3. | |
28 |
|
|
28 | The following three lines create an instance of the QVBarModelMapper class and specify that the data for the bar sets should be taken from the model's columns with indexes from 1 to 4 (inclusive). | |
29 | To create a connection between the series and the model we set both of those objects to QVBarModelMapper. |
|
29 | To create a connection between the series and the model we set both of those objects to QVBarModelMapper. | |
30 |
|
30 | |||
31 | Finally the series is added to the chart. |
|
31 | Finally the series is added to the chart. | |
32 |
|
32 | |||
33 | \snippet ../examples/barmodelmapper/tablewidget.cpp 4 |
|
33 | \snippet ../examples/barmodelmapper/tablewidget.cpp 4 | |
34 |
|
34 | |||
35 | To show in QTableView which data corresponds with which bar set this example uses table coloring. |
|
35 | To show in QTableView which data corresponds with which bar set, this example uses table coloring. | |
36 | When series is added to the chart it is assigned a color based on the currently selected theme. |
|
36 | When series is added to the chart, it is assigned a color based on the currently selected theme. | |
37 | Code below extracts that color from the series and uses it to create colored QTableView. |
|
37 | Code below extracts that color from the series and uses it to create colored QTableView. | |
38 | Coloring of the view is not a part of the QChart functionality. |
|
38 | Coloring of the view is not a part of the QChart functionality. | |
39 |
|
39 | |||
@@ -44,14 +44,14 | |||||
44 |
|
44 | |||
45 | \snippet ../examples/barmodelmapper/tablewidget.cpp 6 |
|
45 | \snippet ../examples/barmodelmapper/tablewidget.cpp 6 | |
46 |
|
46 | |||
47 | To avoid setting up the QGraphicsScene we use QChartView class that does it for us. QChart object pointer is used as a parameter of the QChartView constructor. |
|
47 | To avoid setting up the QGraphicsScene we use the QChartView class that does it for us. The QChart object pointer is used as a parameter of the QChartView constructor. | |
48 | To make the render look nicer Antialiasing is turned on and the minimum size of the chartView widget is set. |
|
48 | To make the render look nicer Antialiasing is turned on and the minimum size of the chartView widget is set. | |
49 |
|
49 | |||
50 | \snippet ../examples/barmodelmapper/tablewidget.cpp 7 |
|
50 | \snippet ../examples/barmodelmapper/tablewidget.cpp 7 | |
51 |
|
51 | |||
52 | Finally we place both widgets in a layout and use the layout as the application layout. |
|
52 | Finally, we place both widgets in a layout and use the layout as the application layout. | |
53 |
|
53 | |||
54 | \snippet ../examples/barmodelmapper/tablewidget.cpp 8 |
|
54 | \snippet ../examples/barmodelmapper/tablewidget.cpp 8 | |
55 |
|
55 | |||
56 |
|
|
56 | The application is ready. Try modifying the data in the table view and see how it affects the chart. | |
57 | */ |
|
57 | */ |
@@ -3,7 +3,7 | |||||
3 | \title Box and Whiskers Example |
|
3 | \title Box and Whiskers Example | |
4 | \subtitle |
|
4 | \subtitle | |
5 |
|
5 | |||
6 |
The example shows how to create a box-and-whiskers chart. It also shows how to read the non-continuous data from |
|
6 | The example shows how to create a box-and-whiskers chart. It also shows how to read the non-continuous data from a file, | |
7 | arrange it and find medians needed for box-and-whiskers plotting. |
|
7 | arrange it and find medians needed for box-and-whiskers plotting. | |
8 |
|
8 | |||
9 | \image examples_boxplotchart.png |
|
9 | \image examples_boxplotchart.png | |
@@ -23,35 +23,35 | |||||
23 |
|
23 | |||
24 | \snippet ../examples/boxplotchart/main.cpp 3 |
|
24 | \snippet ../examples/boxplotchart/main.cpp 3 | |
25 |
|
25 | |||
26 |
In this code snippet a new QChart instance is created and previously created series are added to it. |
|
26 | In this code snippet a new QChart instance is created and previously created series are added to it. The title is also defined and | |
27 | animation is set to be SeriesAnimation. |
|
27 | animation is set to be SeriesAnimation. | |
28 |
|
28 | |||
29 | \snippet ../examples/boxplotchart/main.cpp 4 |
|
29 | \snippet ../examples/boxplotchart/main.cpp 4 | |
30 |
|
30 | |||
31 | Here we ask chart to create default axes for our presentation. We also set range for vertical axis by querying the pointer |
|
31 | Here we ask the chart to create default axes for our presentation. We also set the range for the vertical axis by querying the pointer | |
32 | for the axis from the chart and then setting the min and max for that axis. |
|
32 | for the axis from the chart, and then setting the min and max for that axis. | |
33 |
|
33 | |||
34 | \snippet ../examples/boxplotchart/main.cpp 5 |
|
34 | \snippet ../examples/boxplotchart/main.cpp 5 | |
35 |
|
35 | |||
36 | In this section we set legends visible and place them at the bottom of the chart. |
|
36 | In this section we set the legends to be visible and place them at the bottom of the chart. | |
37 |
|
37 | |||
38 | \snippet ../examples/boxplotchart/main.cpp 6 |
|
38 | \snippet ../examples/boxplotchart/main.cpp 6 | |
39 |
|
39 | |||
40 | Finally we add the chart onto a view. We also turn on the antialiasing for the chartView. |
|
40 | Finally, we add the chart onto a view. We also turn on the antialiasing for the chartView. | |
41 |
|
41 | |||
42 | \snippet ../examples/boxplotchart/main.cpp 7 |
|
42 | \snippet ../examples/boxplotchart/main.cpp 7 | |
43 |
|
43 | |||
44 | The chart is ready to be shown. We set the chart to be central widget of the window. |
|
44 | The chart is ready to be shown. We set the chart to be the central widget of the window. | |
45 | We also set the size for the chart window and show it. |
|
45 | We also set the size for the chart window and show it. | |
46 |
|
46 | |||
47 | \snippet ../examples/boxplotchart/main.cpp 8 |
|
47 | \snippet ../examples/boxplotchart/main.cpp 8 | |
48 |
|
48 | |||
49 | Here the method readBox is explained in detail. Firstly a line is read from the file and lines starting with # are rejected |
|
49 | Here the method readBox is explained in detail. Firstly, a line is read from the file and lines starting with # are rejected | |
50 | since they are considered as comment lines. |
|
50 | since they are considered as comment lines. | |
51 |
|
51 | |||
52 | \snippet ../examples/boxplotchart/boxdatareader.cpp 1 |
|
52 | \snippet ../examples/boxplotchart/boxdatareader.cpp 1 | |
53 |
|
53 | |||
54 |
|
|
54 | In this file the data is arranged as number, space, number, or space. On this snippet the line is split into single number strings which | |
55 | are stored on QStringList. |
|
55 | are stored on QStringList. | |
56 |
|
56 | |||
57 | \snippet ../examples/boxplotchart/boxdatareader.cpp 2 |
|
57 | \snippet ../examples/boxplotchart/boxdatareader.cpp 2 | |
@@ -62,14 +62,14 | |||||
62 |
|
62 | |||
63 | \snippet ../examples/boxplotchart/boxdatareader.cpp 3 |
|
63 | \snippet ../examples/boxplotchart/boxdatareader.cpp 3 | |
64 |
|
64 | |||
65 |
|
|
65 | Below you will find a code sample showing how to select extremes and medians from the continuous data. Firstly a new QBoxSet is created. | |
66 | Lower and upper extremes are simple to select; they are just first and last items on the sortedList. For medians we use a helper |
|
66 | Lower and upper extremes are simple to select; they are just first and last items on the sortedList. For medians we use a helper | |
67 | method findMedian which is explained later. For the median from the upper half we need to adjust the begin number if |
|
67 | method findMedian which is explained later. For the median from the upper half we need to adjust the begin number if the | |
68 | amount of the numbers is even or uneven. The end number for lower half comes naturally from int rounding. |
|
68 | amount of the numbers is even or uneven. The end number for lower half comes naturally from int rounding. | |
69 |
|
69 | |||
70 | \snippet ../examples/boxplotchart/boxdatareader.cpp 4 |
|
70 | \snippet ../examples/boxplotchart/boxdatareader.cpp 4 | |
71 |
|
71 | |||
72 |
|
|
72 | Below you will find the code sample for the method findMedian. If the amount of numbers is uneven we select the number from | |
73 | the middle. For even amount numbers we take two numbers from the middle and calculate the mean value. |
|
73 | the middle. For even amount numbers we take two numbers from the middle and calculate the mean value. | |
74 |
|
74 | |||
75 | \snippet ../examples/boxplotchart/boxdatareader.cpp 5 |
|
75 | \snippet ../examples/boxplotchart/boxdatareader.cpp 5 |
@@ -1,6 +1,6 | |||||
1 | /*! |
|
1 | /*! | |
2 | \example examples/customchart |
|
2 | \example examples/customchart | |
3 |
\title Custom |
|
3 | \title Custom Chart Example | |
4 | \subtitle |
|
4 | \subtitle | |
5 |
|
5 | |||
6 | This example shows how to customize the appearance of the different elements on a chart. |
|
6 | This example shows how to customize the appearance of the different elements on a chart. | |
@@ -9,16 +9,16 | |||||
9 | We begin by creating a simple line series and a chart object. |
|
9 | We begin by creating a simple line series and a chart object. | |
10 | \snippet ../examples/customchart/main.cpp 1 |
|
10 | \snippet ../examples/customchart/main.cpp 1 | |
11 |
|
11 | |||
12 |
|
|
12 | First we customize the series and the chart's title and background. | |
13 | \snippet ../examples/customchart/main.cpp 2 |
|
13 | \snippet ../examples/customchart/main.cpp 2 | |
14 |
|
14 | |||
15 | Then we customize the axes. |
|
15 | Then we customize the axes. | |
16 | \snippet ../examples/customchart/main.cpp 3 |
|
16 | \snippet ../examples/customchart/main.cpp 3 | |
17 |
|
17 | |||
18 |
|
|
18 | Then the axis label values and ranges. Once the axes are ready, we set them to be used by the chart. | |
19 | \snippet ../examples/customchart/main.cpp 4 |
|
19 | \snippet ../examples/customchart/main.cpp 4 | |
20 |
|
20 | |||
21 | Finally we create a view containing the chart. |
|
21 | Finally, we create a view containing the chart. | |
22 | \snippet ../examples/customchart/main.cpp 5 |
|
22 | \snippet ../examples/customchart/main.cpp 5 | |
23 |
|
23 | |||
24 | Now we are ready to show the chart on a main window. |
|
24 | Now we are ready to show the chart on a main window. |
@@ -6,32 +6,33 | |||||
6 | The example shows how to use QLineChart with QDateTimeAxis. |
|
6 | The example shows how to use QLineChart with QDateTimeAxis. | |
7 |
|
7 | |||
8 | \image examples_datetimeaxis.png |
|
8 | \image examples_datetimeaxis.png | |
9 |
|
9 | |||
10 |
To create line chart, QLineSeries instance is needed. Let's create one. |
|
10 | To create line chart, QLineSeries instance is needed. Let's create one. | |
11 |
|
11 | |||
12 | \snippet ../examples/datetimeaxis/main.cpp 1 |
|
12 | \snippet ../examples/datetimeaxis/main.cpp 1 | |
13 |
|
13 | |||
14 |
On the charts we will present how the number of sun spots changes in time. The data ( |
|
14 | On the charts we will present how the number of sun spots changes in time. The data (from the Space Weather Prediction Center) is read from a text file. | |
15 | In the snippet below notice how QDateTime::toMSecsSinceEpoch method is used to convert the QDateTime object into a number that can be passed to QLineSeries append method. |
|
15 | In the snippet below, notice how the QDateTime::toMSecsSinceEpoch method is used to convert the QDateTime object into a number that can be passed to the QLineSeries append method. | |
16 |
|
16 | |||
17 | \snippet ../examples/datetimeaxis/main.cpp 2 |
|
17 | \snippet ../examples/datetimeaxis/main.cpp 2 | |
18 |
|
18 | |||
19 | To present the data on the chart we need QChart instance. We add the series to it, hide the legend, create the default axes and set the title of the chart. |
|
19 | To present the data on the chart we need the QChart instance. We add the series to it, hide the legend, create the default axes and set the title of the chart. | |
20 |
|
20 | |||
21 | \snippet ../examples/datetimeaxis/main.cpp 3 |
|
21 | \snippet ../examples/datetimeaxis/main.cpp 3 | |
22 |
|
22 | |||
23 |
|
|
23 | Since we use QLineSeries, calling createDefaultAxes will create QValueAxis both as X- and Y-axis. To use QDateTimeAxis we need to set it manually to the chart. | |
24 |
First the instance of QDateTimeAxis is created, then the number of ticks |
|
24 | First, the instance of QDateTimeAxis is created, then the number of ticks to be shown is set. The number of sun spots is provided as an average for the month. | |
25 | Please refer to QDateTime::toString() method documentation to learn about the available format options. |
|
25 | Therefore we don't need the axis labels to contain the information about the time and the day. This is achieved by setting a custom label format. | |
|
26 | Please refer to the QDateTime::toString() method documentation to learn about the available format options. | |||
26 |
|
27 | |||
27 | \snippet ../examples/datetimeaxis/main.cpp 4 |
|
28 | \snippet ../examples/datetimeaxis/main.cpp 4 | |
28 |
|
29 | |||
29 |
Then we create a QChartView object with QChart as a parameter. This way we don't need to create QGraphicsView scene ourselves. We also set the Antialiasing on to have the rendered lines look nicer. |
|
30 | Then we create a QChartView object with QChart as a parameter. This way we don't need to create the QGraphicsView scene ourselves. We also set the Antialiasing on to have the rendered lines look nicer. | |
30 |
|
31 | |||
31 |
\snippet ../examples/datetimeaxis/main.cpp 5 |
|
32 | \snippet ../examples/datetimeaxis/main.cpp 5 | |
32 |
|
33 | |||
33 |
|
|
34 | The chart is ready to be shown. | |
34 |
|
35 | |||
35 | \snippet ../examples/datetimeaxis/main.cpp 6 |
|
36 | \snippet ../examples/datetimeaxis/main.cpp 6 | |
36 |
|
37 | |||
37 | */ |
|
38 | */ |
@@ -14,7 +14,7 | |||||
14 |
|
14 | |||
15 | \snippet ../examples/donutbreakdown/main.cpp 2 |
|
15 | \snippet ../examples/donutbreakdown/main.cpp 2 | |
16 |
|
16 | |||
17 |
Our own chart works |
|
17 | Our own chart works in such a way that we create a main series in the constructor we create a main series, | |
18 | which aggregates the data provided by the breakdown series. This is the piechart in the center. |
|
18 | which aggregates the data provided by the breakdown series. This is the piechart in the center. | |
19 |
|
19 | |||
20 | \snippet ../examples/donutbreakdown/donutbreakdownchart.cpp 1 |
|
20 | \snippet ../examples/donutbreakdown/donutbreakdownchart.cpp 1 | |
@@ -29,7 +29,7 | |||||
29 |
|
29 | |||
30 | \snippet ../examples/donutbreakdown/donutbreakdownchart.cpp 3 |
|
30 | \snippet ../examples/donutbreakdown/donutbreakdownchart.cpp 3 | |
31 |
|
31 | |||
32 |
|
|
32 | The legend markers are customized to show the breakdown percentage. The markers for the main level slices are hidden. | |
33 |
|
33 | |||
34 | \snippet ../examples/donutbreakdown/donutbreakdownchart.cpp 4 |
|
34 | \snippet ../examples/donutbreakdown/donutbreakdownchart.cpp 4 | |
35 |
|
35 | |||
@@ -38,7 +38,7 | |||||
38 | \snippet ../examples/donutbreakdown/mainslice.cpp 1 |
|
38 | \snippet ../examples/donutbreakdown/mainslice.cpp 1 | |
39 | \snippet ../examples/donutbreakdown/mainslice.cpp 2 |
|
39 | \snippet ../examples/donutbreakdown/mainslice.cpp 2 | |
40 |
|
40 | |||
41 |
|
|
41 | Now that we have our chart defined, we can finally create a QChartView and show the chart. | |
42 |
|
42 | |||
43 | \snippet ../examples/donutbreakdown/main.cpp 3 |
|
43 | \snippet ../examples/donutbreakdown/main.cpp 3 | |
44 |
|
44 |
@@ -3,6 +3,6 | |||||
3 | \title Donutchart Example |
|
3 | \title Donutchart Example | |
4 | \subtitle |
|
4 | \subtitle | |
5 |
|
5 | |||
6 |
Th |
|
6 | This example shows how to create a simple donut chart, and do some customizations to a slice. | |
7 | \image examples_donutchart.png |
|
7 | \image examples_donutchart.png | |
8 | */ |
|
8 | */ |
@@ -4,36 +4,36 | |||||
4 | \subtitle |
|
4 | \subtitle | |
5 |
|
5 | |||
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 |
|
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 |
|
|
7 | QBarChart, except that the bars are drawn horizontally on the chart. | |
8 |
|
8 | |||
9 | \image examples_horizontalbarchart.png |
|
9 | \image examples_horizontalbarchart.png | |
10 |
|
10 | |||
11 | The barsets are used in same way in all barcharts. |
|
11 | The bar sets are used in the same way in all bar charts. | |
12 |
|
|
12 | To illustrate the difference between various bar charts, we use the same data in all examples. | |
13 | Data that barchart visualizes, is defined by QBarSet instances. Here we create the sets and append data |
|
13 | Data that bar chart visualizes, is defined by QBarSet instances. Here we create the sets and append data | |
14 | to them. The data is appended here with << operator. Alternatively the append method could be used. |
|
14 | to them. The data is appended here with << operator. Alternatively, the append method could also be used. | |
15 |
|
15 | |||
16 | \snippet ../examples/horizontalbarchart/main.cpp 1 |
|
16 | \snippet ../examples/horizontalbarchart/main.cpp 1 | |
17 |
|
17 | |||
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. |
|
18 | We create the series and append the bar sets to it. The series takes ownership of the barsets. The series groups the data from sets to categories. | |
19 |
|
|
19 | The first values of each set are grouped together in the first category; the second values in the second category, and so on. | |
20 |
|
20 | |||
21 | \snippet ../examples/horizontalbarchart/main.cpp 2 |
|
21 | \snippet ../examples/horizontalbarchart/main.cpp 2 | |
22 |
|
22 | |||
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 |
|
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 |
|
|
24 | setAnimationOptions(QChart::SeriesAnimations). | |
25 |
|
25 | |||
26 | \snippet ../examples/horizontalbarchart/main.cpp 3 |
|
26 | \snippet ../examples/horizontalbarchart/main.cpp 3 | |
27 |
|
27 | |||
28 |
|
|
28 | To have the categories displayed on axis, we need to create a QBarCategoryAxis. Here we create a category axis with a list of categories and | |
29 |
|
|
29 | set it to be the y-axis of the chart. The chart takes ownership of axis. For the x-axis we use the default axis, which is created and scaled to series data | |
30 |
|
|
30 | by calling createDefaultAxes of the chart. Note that the call for createDefaultAxes must be done before we set the category axis. Otherwise the default axis will | |
31 |
|
|
31 | override the category axis. | |
32 |
|
32 | |||
33 | \snippet ../examples/horizontalbarchart/main.cpp 4 |
|
33 | \snippet ../examples/horizontalbarchart/main.cpp 4 | |
34 |
|
34 | |||
35 |
We also want to show the legend. To do |
|
35 | We also want to show the legend. To do so, we get the legend pointer from chart and set it to visible. We also place the legend to the bottom of the chart by setting its alignment | |
36 |
|
|
36 | to Qt::AlignBottom. | |
37 |
|
37 | |||
38 | \snippet ../examples/horizontalbarchart/main.cpp 5 |
|
38 | \snippet ../examples/horizontalbarchart/main.cpp 5 | |
39 |
|
39 | |||
@@ -41,8 +41,8 | |||||
41 |
|
41 | |||
42 | \snippet ../examples/horizontalbarchart/main.cpp 6 |
|
42 | \snippet ../examples/horizontalbarchart/main.cpp 6 | |
43 |
|
43 | |||
44 |
|
|
44 | The chart is ready to be shown. We set the chart to be the central widget of the window. | |
45 |
|
|
45 | We also set the size for the chart window and show it. | |
46 |
|
46 | |||
47 | \snippet ../examples/horizontalbarchart/main.cpp 7 |
|
47 | \snippet ../examples/horizontalbarchart/main.cpp 7 | |
48 | */ |
|
48 | */ |
@@ -3,51 +3,52 | |||||
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. |
|
6 | The example shows how to create a simple horizontal percent bar chart. The horizontal percent bar chart shows the data in a set as a percentage of | |
7 |
all sets |
|
7 | all sets per category. | |
8 |
|
8 | |||
9 | Creating horizontal percent bar chart is just like creating a regular \l {BarChart Example} {bar chart}, except that for a |
|
9 | Creating a horizontal percent bar chart is just like creating a regular \l {BarChart Example} {bar chart}, except that for a | |
10 | horizontal percent bar chart, we use QHorizontalPercentBarSeries api instead of QBarSeries. Also, in the |
|
10 | horizontal percent bar chart, we use the QHorizontalPercentBarSeries api instead of QBarSeries. Also, in the | |
11 |
\l {BarChart Example} {bar chart} we used nice numbers algorithm to make the y |
|
11 | \l {BarChart Example} {bar chart}, we used a nice numbers algorithm to make the y-axis numbering look better. With | |
12 | percent bar chart there is no need for that, because the maximum y-axis value is always 100. |
|
12 | the percent bar chart there is no need for that, because the maximum y-axis value is always 100. | |
13 |
|
13 | |||
14 | \image examples_horizontalpercentbarchart.png |
|
14 | \image examples_horizontalpercentbarchart.png | |
15 |
|
15 | |||
16 | The barsets are used in same way in all barcharts. |
|
16 | The barsets are used in same way in all barcharts. | |
17 |
|
|
17 | To illustrate the difference between various barcharts, we use same data in examples. | |
18 |
|
|
18 | The data which the bar chart 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. |
|
19 | to them. The data is appended here with << operator. Alternatively the append method could be used. | |
20 |
|
20 | |||
21 | \snippet ../examples/horizontalpercentbarchart/main.cpp 1 |
|
21 | \snippet ../examples/horizontalpercentbarchart/main.cpp 1 | |
22 |
|
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. |
|
23 | We create the series and append the bar sets to it. The series takes ownership of the barsets. The series groups the data from sets to categories. | |
24 |
|
|
24 | The first values of each set are grouped together in the first category, the second value in the second category etc. | |
25 |
|
25 | |||
26 | \snippet ../examples/horizontalpercentbarchart/main.cpp 2 |
|
26 | \snippet ../examples/horizontalpercentbarchart/main.cpp 2 | |
27 |
|
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 |
|
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 |
|
|
29 | setAnimationOptions(QChart::SeriesAnimations) | |
30 |
|
30 | |||
31 | \snippet ../examples/horizontalpercentbarchart/main.cpp 3 |
|
31 | \snippet ../examples/horizontalpercentbarchart/main.cpp 3 | |
32 |
|
32 | |||
33 |
|
|
33 | To have the categories displayed on an axis, we need to create a QBarCategoryAxis first. Here we create a category axis with a list of categories and | |
34 |
|
|
34 | set it to be the y-axis of the chart. The chart takes ownership of the axis. For the x-axis we use the default axis, which is created and scaled to series data | |
35 |
|
|
35 | by calling createDefaultAxes of the chart. Note that createDefaultAxes must be called before we set the category axis. Otherwise the default axis will | |
36 |
|
|
36 | override the category axis. | |
37 |
|
37 | |||
38 | \snippet ../examples/horizontalpercentbarchart/main.cpp 4 |
|
38 | \snippet ../examples/horizontalpercentbarchart/main.cpp 4 | |
39 |
|
39 | |||
40 |
We also want to show the legend. To do that, we get the legend pointer from |
|
40 | We also want to show the legend. To do that, we get the legend pointer from the chart | |
41 | to Qt::AlignBottom. |
|
41 | and set it to visible. We also place the legend to bottom of the chart by setting its | |
|
42 | alignment to Qt::AlignBottom. | |||
42 |
|
43 | |||
43 | \snippet ../examples/horizontalpercentbarchart/main.cpp 5 |
|
44 | \snippet ../examples/horizontalpercentbarchart/main.cpp 5 | |
44 |
|
45 | |||
45 | Finally we add the chart onto a view. We also turn on the antialiasing for the chartView. |
|
46 | Finally, we add the chart onto a view. We also turn on the antialiasing for the chartView. | |
46 |
|
47 | |||
47 | \snippet ../examples/horizontalpercentbarchart/main.cpp 6 |
|
48 | \snippet ../examples/horizontalpercentbarchart/main.cpp 6 | |
48 |
|
49 | |||
49 |
|
|
50 | The chart is ready to be shown. We set the chart to be the central widget of the window. | |
50 |
|
|
51 | We also set the size for the chart window and show it. | |
51 |
|
52 | |||
52 |
\snippet ../examples/horizontalpercentbarchart/main.cpp 7 |
|
53 | \snippet ../examples/horizontalpercentbarchart/main.cpp 7 | |
53 | */ |
|
54 | */ |
@@ -3,39 +3,40 | |||||
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. |
|
6 | The example shows how to create a simple stacked horizontal bar chart. The 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 |
|
|
8 | Creating a 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. |
|
9 | stacked horizontal bar chart, we use the QHorizontalStackedBarSeries api instead of QBarSeries. | |
10 |
|
10 | |||
11 | \image examples_horizontalstackedbarchart.png |
|
11 | \image examples_horizontalstackedbarchart.png | |
12 |
|
12 | |||
13 | The barsets are used in same way in all barcharts. |
|
13 | The bar sets are used in same way in all bar charts. | |
14 |
|
|
14 | To illustrate the difference between various barcharts, we use the same data in all examples. | |
15 |
|
|
15 | The data that barchart visualizes, is defined by the 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. |
|
16 | to them. The data is appended here with the << operator. Alternatively, the append method could also be used. | |
17 |
|
17 | |||
18 | \snippet ../examples/horizontalstackedbarchart/main.cpp 1 |
|
18 | \snippet ../examples/horizontalstackedbarchart/main.cpp 1 | |
19 |
|
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. |
|
20 | We create the series and append the bar sets to it. The series takes ownership of the bar sets. The series groups the data from sets to categories. | |
21 |
|
|
21 | The first values of each set are grouped together in the first category, the second values in the second category and so on. | |
22 |
|
22 | |||
23 | \snippet ../examples/horizontalstackedbarchart/main.cpp 2 |
|
23 | \snippet ../examples/horizontalstackedbarchart/main.cpp 2 | |
24 |
|
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 |
|
25 | Here we create the chart object and add the series to it. We set the title for the chart with setTitle, and then turn on the animations of the series by calling | |
26 |
|
|
26 | setAnimationOptions(QChart::SeriesAnimations). | |
27 |
|
27 | |||
28 | \snippet ../examples/horizontalstackedbarchart/main.cpp 3 |
|
28 | \snippet ../examples/horizontalstackedbarchart/main.cpp 3 | |
29 |
|
29 | |||
30 |
|
|
30 | To have categories displayed on an axis, we need to create a QBarCategoryAxis. Here we create a category axis with a list of categories and | |
31 |
|
|
31 | set it to be the y-axis of the chart. The chart takes ownership of the axis. For the x-axis we use the default axis, which is created and scaled to series data | |
32 |
|
|
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 |
|
|
33 | override the category axis. | |
34 |
|
34 | |||
35 | \snippet ../examples/horizontalstackedbarchart/main.cpp 4 |
|
35 | \snippet ../examples/horizontalstackedbarchart/main.cpp 4 | |
36 |
|
36 | |||
37 |
We also want to show the legend. To do that, we get the legend pointer from |
|
37 | We also want to show the legend. To do that, we get the legend pointer from the chart and | |
38 | to Qt::AlignBottom. |
|
38 | set it to visible. We also place the legend to the bottom of the chart by setting its alignment | |
|
39 | to Qt::AlignBottom. | |||
39 |
|
40 | |||
40 | \snippet ../examples/horizontalstackedbarchart/main.cpp 5 |
|
41 | \snippet ../examples/horizontalstackedbarchart/main.cpp 5 | |
41 |
|
42 | |||
@@ -43,8 +44,8 | |||||
43 |
|
44 | |||
44 | \snippet ../examples/horizontalstackedbarchart/main.cpp 6 |
|
45 | \snippet ../examples/horizontalstackedbarchart/main.cpp 6 | |
45 |
|
46 | |||
46 |
|
|
47 | The chart is ready to be shown. We set the chart to be the central widget of the window. | |
47 |
|
|
48 | We also set the size for the chart window and show it. | |
48 |
|
49 | |||
49 | \snippet ../examples/horizontalstackedbarchart/main.cpp 7 |
|
50 | \snippet ../examples/horizontalstackedbarchart/main.cpp 7 | |
50 | */ |
|
51 | */ |
@@ -3,10 +3,10 | |||||
3 | \title Legend Example |
|
3 | \title Legend Example | |
4 | \subtitle |
|
4 | \subtitle | |
5 |
|
5 | |||
6 |
|
|
6 | This example shows how to detach the legend from the chart and how to attach it back. By default the chart | |
7 |
|
|
7 | draws the legend inside the same view with the chart. In some cases the user may want to draw the legend to somewhere else. To make this possible the legend can be detached from the chart. Detaching means that the chart doesn't draw the legend or try to change its layout. Detached legend can then be drawn wherever the user wishes, for example, in a different graphics scene. The behavior of the legend can be inspected by running the legend example. | |
8 |
|
|
8 | In the example we use the bar series where we add or remove the bar sets. The legend reflects the changes in series. The legend can be detached or attached back to the chart and its alignment can be modified. | |
9 |
|
|
9 | When the legend is detached, it can be resized and positioned freely. | |
10 |
|
10 | |||
11 | \table |
|
11 | \table | |
12 | \row |
|
12 | \row | |
@@ -14,20 +14,19 | |||||
14 | \o \inlineimage examples_legend_detach2.png |
|
14 | \o \inlineimage examples_legend_detach2.png | |
15 | \endtable |
|
15 | \endtable | |
16 |
|
16 | |||
17 |
|
|
17 | Here we turn the legend visible and set its alignment to the bottom of the chart. | |
18 |
|
18 | |||
19 | \snippet ../examples/legend/mainwidget.cpp 1 |
|
19 | \snippet ../examples/legend/mainwidget.cpp 1 | |
20 |
|
20 | |||
21 |
This snippet shows how to detach the legend from chart. After detaching, we turn its background to visible and set a different color to it. This makes it easier to see |
|
21 | This snippet shows how to detach the legend from the chart. After detaching, we turn its background to visible and set a different color to it. This makes it easier to see how the items inside the legend are arranged in detached mode. | |
22 | in detached mode. |
|
|||
23 |
|
22 | |||
24 | \snippet ../examples/legend/mainwidget.cpp 2 |
|
23 | \snippet ../examples/legend/mainwidget.cpp 2 | |
25 |
|
24 | |||
26 | Here we attach legend back to chart. The background is turned invisible. |
|
25 | Here we attach the legend back to the chart. The background is turned invisible. | |
27 |
|
26 | |||
28 | \snippet ../examples/legend/mainwidget.cpp 3 |
|
27 | \snippet ../examples/legend/mainwidget.cpp 3 | |
29 |
|
28 | |||
30 |
|
|
29 | This shows how we set the detached legend dimensions. After setting the new values, we call update to show changes on screen. | |
31 |
|
30 | |||
32 | \snippet ../examples/legend/mainwidget.cpp 4 |
|
31 | \snippet ../examples/legend/mainwidget.cpp 4 | |
33 | */ |
|
32 | */ |
@@ -3,17 +3,17 | |||||
3 | \title LegendMarkers Example |
|
3 | \title LegendMarkers Example | |
4 | \subtitle |
|
4 | \subtitle | |
5 |
|
5 | |||
6 | The example shows how to make use of legend markers. In this example we create an application which uses QLegendMarker clicked signal to show/hide corresponding series |
|
6 | The example shows how to make use of legend markers. In this example we create an application which uses the QLegendMarker clicked signal to show/hide the corresponding series | |
7 |
|
|
7 | in a chart. The connect marker button connects a clicked signal from all markers in a legend to the handleMarkerClicked slot. | |
8 |
|
8 | |||
9 | \image examples_legendmarkers.png |
|
9 | \image examples_legendmarkers.png | |
10 |
|
10 | |||
11 |
Our application has buttons for adding or removing series in chart and button to connect or disconnect legend markers clicked signal to our handler. |
|
11 | Our application has buttons for adding or removing a series in a chart and a button to connect or disconnect the legend markers clicked signal to our handler. | |
12 |
|
|
12 | In the image above we have connected the markers and clicked on one of them. | |
13 |
|
13 | |||
14 | \snippet ../examples/legendmarkers/mainwidget.cpp 1 |
|
14 | \snippet ../examples/legendmarkers/mainwidget.cpp 1 | |
15 |
|
15 | |||
16 | Here we connect the markers in legend to our handler. To avoid connecting same marker more than once, we first disconnect it. |
|
16 | Here we connect the markers in the legend to our handler. To avoid connecting the same marker more than once, we first disconnect it. | |
17 |
|
17 | |||
18 | \snippet ../examples/legendmarkers/mainwidget.cpp 2 |
|
18 | \snippet ../examples/legendmarkers/mainwidget.cpp 2 | |
19 |
|
19 | |||
@@ -21,21 +21,21 | |||||
21 |
|
21 | |||
22 | \snippet ../examples/legendmarkers/mainwidget.cpp 3 |
|
22 | \snippet ../examples/legendmarkers/mainwidget.cpp 3 | |
23 |
|
23 | |||
24 | In our handler we first cast the sender of event to QLegendMarker. |
|
24 | In our handler we first cast the sender of the event to the QLegendMarker. | |
25 |
|
25 | |||
26 | \snippet ../examples/legendmarkers/mainwidget.cpp 4 |
|
26 | \snippet ../examples/legendmarkers/mainwidget.cpp 4 | |
27 |
|
27 | |||
28 |
Then we check the type of marker. This is |
|
28 | Then we check the type of the marker. This is required if we want to access the detailed methods of the marker and cast it to the correct type. | |
29 |
|
|
29 | If all we need is the pointer to QAbstractSeries, the casting isn't necessary. In case of a pie or bar series, we may need the pointer to a related QPieSlice or QBarSet. | |
30 |
|
30 | |||
31 | \snippet ../examples/legendmarkers/mainwidget.cpp 5 |
|
31 | \snippet ../examples/legendmarkers/mainwidget.cpp 5 | |
32 |
|
32 | |||
33 | We want to toggle the visibility of the series, when marker is clicked. To do so, we get the pointer to related series from marker and toggle its visibility. |
|
33 | We want to toggle the visibility of the series, when the marker is clicked. To do so, we get the pointer to a related series from the marker and toggle its visibility. | |
34 |
|
|
34 | Since the legend marker follows the visibility of the series by default, we also set the marked back to visible. If we don't do so, the marker will be | |
35 |
|
|
35 | invisible in the legend and we can't click on it anymore. | |
36 |
|
36 | |||
37 | \snippet ../examples/legendmarkers/mainwidget.cpp 6 |
|
37 | \snippet ../examples/legendmarkers/mainwidget.cpp 6 | |
38 |
|
38 | |||
39 | Instead of making marker invisible when series is hidden, we dim the color of the marker. Here we do it by modifying the color of the laberBrush. |
|
39 | Instead of making the marker invisible when the series is hidden, we dim the color of the marker. Here we do it by modifying the color of the laberBrush. | |
40 |
|
40 | |||
41 | */ |
|
41 | */ |
@@ -3,32 +3,32 | |||||
3 | \title Line and BarChart Example |
|
3 | \title Line and BarChart Example | |
4 | \subtitle |
|
4 | \subtitle | |
5 |
|
5 | |||
6 | The example shows how to combine different charts and set the axes. In the example we combine linechart with |
|
6 | The example shows how to combine different charts and set the axes. In the example we combine a linechart with | |
7 |
|
|
7 | a barchart and use the category axis as a common axis for both. | |
8 |
|
8 | |||
9 | \image examples_lineandbar.png |
|
9 | \image examples_lineandbar.png | |
10 |
|
10 | |||
11 |
|
|
11 | Here we create data for our bar series. | |
12 |
|
12 | |||
13 | \snippet ../examples/lineandbar/main.cpp 1 |
|
13 | \snippet ../examples/lineandbar/main.cpp 1 | |
14 |
|
14 | |||
15 |
We create |
|
15 | We create a bar series and append sets to it. | |
16 |
|
|
16 | The first values of each set are grouped together in the first category, the second values in the second category and so on. | |
17 |
|
17 | |||
18 | \snippet ../examples/lineandbar/main.cpp 2 |
|
18 | \snippet ../examples/lineandbar/main.cpp 2 | |
19 |
|
19 | |||
20 |
|
|
20 | Then we create a line series and add data to it. To make the data match with the barchart, we use the index as an x-value for our line series, so that | |
21 |
|
|
21 | first point is at (0,value) second at (1,value) and so on. | |
22 |
|
22 | |||
23 |
|
|
23 | \snippet ../examples/lineandbar/main.cpp 8 | |
24 |
|
24 | |||
25 | Here we create the chart and add both series to it. |
|
25 | Here we create the chart and add both series to it. | |
26 |
|
26 | |||
27 | \snippet ../examples/lineandbar/main.cpp 3 |
|
27 | \snippet ../examples/lineandbar/main.cpp 3 | |
28 |
|
28 | |||
29 |
|
|
29 | To make the chart show the series properly, we have to create custom axes for the series. If we don't create custom axes, then each series will get scaled to | |
30 |
|
|
30 | use the maximum area of the chart (like in single series case) and the result will be incorrect. With custom axes we set the range of both series to follow the | |
31 |
|
|
31 | same axis. For the x-axis we use the QBarCategoryAxis and for the y-axis we use QValuesAxis. | |
32 |
|
32 | |||
33 | \snippet ../examples/lineandbar/main.cpp 4 |
|
33 | \snippet ../examples/lineandbar/main.cpp 4 | |
34 |
|
34 | |||
@@ -40,7 +40,7 | |||||
40 |
|
40 | |||
41 | \snippet ../examples/lineandbar/main.cpp 6 |
|
41 | \snippet ../examples/lineandbar/main.cpp 6 | |
42 |
|
42 | |||
43 |
|
|
43 | Now it is ready to be shown in a window. | |
44 |
|
44 | |||
45 | \snippet ../examples/lineandbar/main.cpp 7 |
|
45 | \snippet ../examples/lineandbar/main.cpp 7 | |
46 | */ |
|
46 | */ |
@@ -3,28 +3,28 | |||||
3 | \title LineChart Example |
|
3 | \title LineChart Example | |
4 | \subtitle |
|
4 | \subtitle | |
5 |
|
5 | |||
6 | The example shows how to create simple line chart. |
|
6 | The example shows how to create a simple line chart. | |
7 |
|
7 | |||
8 | \image examples_linechart.png |
|
8 | \image examples_linechart.png | |
9 |
|
9 | |||
10 |
To create line chart, QLineSeries instance is needed. Let's create one. |
|
10 | To create a line chart, a QLineSeries instance is needed. Let's create one. | |
11 |
|
11 | |||
12 | \snippet ../examples/linechart/main.cpp 1 |
|
12 | \snippet ../examples/linechart/main.cpp 1 | |
13 |
|
13 | |||
14 |
Then we add data to series. We can use append() member function or use stream operator. |
|
14 | Then we add data to the series. We can use the append() member function or use the stream operator. | |
15 |
|
15 | |||
16 | \snippet ../examples/linechart/main.cpp 2 |
|
16 | \snippet ../examples/linechart/main.cpp 2 | |
17 |
|
17 | |||
18 | To present the data on the chart we need QChart instance. We add the series to it, create the default axes and set the title of the chart. |
|
18 | To present the data on the chart we need a QChart instance. We add the series to it, create the default axes, and set the title of the chart. | |
19 |
|
19 | |||
20 | \snippet ../examples/linechart/main.cpp 3 |
|
20 | \snippet ../examples/linechart/main.cpp 3 | |
21 |
|
21 | |||
22 |
Then we create a QChartView object with QChart as a parameter. This way we don't need to create QGraphicsView scene ourselves. We also set the Antialiasing on to have the rendered lines look nicer. |
|
22 | Then we create a QChartView object with QChart as a parameter. This way we don't need to create a QGraphicsView scene ourselves. We also set the Antialiasing on to have the rendered lines look nicer. | |
23 |
|
23 | |||
24 |
\snippet ../examples/linechart/main.cpp 4 |
|
24 | \snippet ../examples/linechart/main.cpp 4 | |
25 |
|
25 | |||
26 |
|
|
26 | The chart is ready to be shown. | |
27 |
|
27 | |||
28 | \snippet ../examples/linechart/main.cpp 5 |
|
28 | \snippet ../examples/linechart/main.cpp 5 | |
29 |
|
29 | |||
30 | */ |
|
30 | */ |
@@ -1,17 +1,17 | |||||
1 | /*! |
|
1 | /*! | |
2 | \example examples/logvalueaxis |
|
2 | \example examples/logvalueaxis | |
3 |
\title Logarithmic |
|
3 | \title Logarithmic Axis Example | |
4 | \subtitle |
|
4 | \subtitle | |
5 |
|
5 | |||
6 | The example shows how to use QLogValueAxis. |
|
6 | The example shows how to use QLogValueAxis. | |
7 |
|
7 | |||
8 | \image examples_logvalueaxis.png |
|
8 | \image examples_logvalueaxis.png | |
9 |
|
9 | |||
10 | Create QLineSeries instance and add some data to it. |
|
10 | Create a QLineSeries instance and add some data to it. | |
11 |
|
11 | |||
12 | \snippet ../examples/logvalueaxis/main.cpp 1 |
|
12 | \snippet ../examples/logvalueaxis/main.cpp 1 | |
13 |
|
13 | |||
14 | To present the data on the chart we need QChart instance. Add the series to it, hide the legend and set the title of the chart. |
|
14 | To present the data on the chart we need a QChart instance. Add the series to it, hide the legend and set the title of the chart. | |
15 |
|
15 | |||
16 | \snippet ../examples/logvalueaxis/main.cpp 2 |
|
16 | \snippet ../examples/logvalueaxis/main.cpp 2 | |
17 |
|
17 | |||
@@ -19,12 +19,12 | |||||
19 |
|
19 | |||
20 | \snippet ../examples/logvalueaxis/main.cpp 3 |
|
20 | \snippet ../examples/logvalueaxis/main.cpp 3 | |
21 |
|
21 | |||
22 |
Then create a QChartView object with QChart as a parameter. Enable antialiasing to have the rendered line look nicer. |
|
22 | Then create a QChartView object with QChart as a parameter. Enable antialiasing to have the rendered line look nicer. | |
23 |
|
23 | |||
24 |
\snippet ../examples/logvalueaxis/main.cpp 4 |
|
24 | \snippet ../examples/logvalueaxis/main.cpp 4 | |
25 |
|
25 | |||
26 |
|
|
26 | The chart is ready to be shown. | |
27 |
|
27 | |||
28 | \snippet ../examples/logvalueaxis/main.cpp 5 |
|
28 | \snippet ../examples/logvalueaxis/main.cpp 5 | |
29 |
|
29 | |||
30 | */ |
|
30 | */ |
@@ -1,51 +1,52 | |||||
1 | /*! |
|
1 | /*! | |
2 | \example examples/modeldata |
|
2 | \example examples/modeldata | |
3 |
\title Model |
|
3 | \title Model Data Example | |
4 | \subtitle |
|
4 | \subtitle | |
5 |
|
5 | |||
6 | This example shows how to use QAbstractItemModel derived model as the data for the series. |
|
6 | This example shows how to use the QAbstractItemModel derived model as the data for the series. | |
7 |
|
7 | |||
8 | \image examples_modeldata.png |
|
8 | \image examples_modeldata.png | |
9 |
|
9 | |||
10 | Let's start by creating an instance of CustomTableModel class. |
|
10 | Let's start by creating an instance of the CustomTableModel class. | |
11 | CustomTableModel class is derived from QAbstractTableModel and it was created for the purpose of this example. |
|
11 | The CustomTableModel class is derived from QAbstractTableModel and it was created for the purpose of this example. | |
12 |
The constructor of this class populates the internal data store of the model with the data that is |
|
12 | The constructor of this class populates the internal data store of the model with the data that is suitable for our chart example. | |
13 |
|
13 | |||
14 | \snippet ../examples/modeldata/tablewidget.cpp 1 |
|
14 | \snippet ../examples/modeldata/tablewidget.cpp 1 | |
15 |
|
15 | |||
16 | We now have a model with data that we would like to display both on the chart and in a QTableView. |
|
16 | We now have a model with data that we would like to display both on the chart and in a QTableView. | |
17 | First, we create QTableView and tell it use the model as a data source. To make the data cells fill the table view we also change headers resize mode. |
|
17 | First, we create QTableView and tell it to use the model as a data source. To make the data cells fill the table view we also change headers resize mode. | |
18 |
|
18 | |||
19 | \snippet ../examples/modeldata/tablewidget.cpp 2 |
|
19 | \snippet ../examples/modeldata/tablewidget.cpp 2 | |
20 |
|
20 | |||
21 | Now we need QChart instance to display the same data on the chart. |
|
21 | Now we need the QChart instance to display the same data on the chart. | |
22 | We also enable animations. It makes it easier to see how modifying the model's data affect the chart. |
|
22 | We also enable animations. It makes it easier to see how modifying the model's data affect the chart. | |
23 |
|
23 | |||
24 | \snippet ../examples/modeldata/tablewidget.cpp 3 |
|
24 | \snippet ../examples/modeldata/tablewidget.cpp 3 | |
25 |
|
25 | |||
26 |
The code below creates new line series and gives it a name. |
|
26 | The code below creates new line series and gives it a name. The following line creates an instance of QVXYModelMapper class. | |
27 |
|
|
27 | The next two lines specify that X-coordinates are taken from the model's column(Qt::Vertical) with index 0. The Y-coordinates are taken from the model's column with index 1. | |
28 | To create a connection between the series and the model we set both of those objects to QVXYModelMapper. |
|
28 | To create a connection between the series and the model we set both of those objects to QVXYModelMapper. | |
29 |
|
29 | |||
30 | Finally the series is added to the chart. |
|
30 | Finally, the series is added to the chart. | |
31 |
|
31 | |||
32 | \snippet ../examples/modeldata/tablewidget.cpp 4 |
|
32 | \snippet ../examples/modeldata/tablewidget.cpp 4 | |
33 |
|
33 | |||
34 | To show in QTableView which data corresponds with which series this example uses table coloring. |
|
34 | To show in QTableView which data corresponds with which series this example uses table coloring. | |
35 | When series is added to the chart it is assigned a color based on the currently selected theme. |
|
35 | When a series is added to the chart it is assigned a color based on the currently selected theme. | |
36 |
|
|
36 | The code below extracts that color from the series and uses it to create a colored QTableView. | |
37 |
|
|
37 | The coloring of the view is not a part of the QChart functionality. | |
38 |
|
38 | |||
39 | \snippet ../examples/modeldata/tablewidget.cpp 5 |
|
39 | \snippet ../examples/modeldata/tablewidget.cpp 5 | |
40 |
|
40 | |||
41 | The same operations are done with second series. Notice that for this series different columns of the same model are mapped. |
|
41 | The same operations are done with a second series. Notice that for this series different columns of the same model are mapped. | |
42 |
|
42 | |||
43 | \snippet ../examples/modeldata/tablewidget.cpp 6 |
|
43 | \snippet ../examples/modeldata/tablewidget.cpp 6 | |
44 |
|
44 | |||
45 | \snippet ../examples/modeldata/tablewidget.cpp 7 |
|
45 | \snippet ../examples/modeldata/tablewidget.cpp 7 | |
46 |
|
46 | |||
47 |
To avoid setting up the QGraphicsScene we use QChartView class that does it for us. |
|
47 | To avoid setting up the QGraphicsScene we use the QChartView class that does it for us. | |
48 | To make the render look nicer Antialiasing is turned on and the minimum size of the chartView widget is set. |
|
48 | QChart object pointer is used as a parameter of the QChartView constructor. | |
|
49 | To make the chart look nicer, Antialiasing is turned on and the minimum size of the chartView widget is set. | |||
49 |
|
50 | |||
50 | \snippet ../examples/modeldata/tablewidget.cpp 8 |
|
51 | \snippet ../examples/modeldata/tablewidget.cpp 8 | |
51 |
|
52 | |||
@@ -53,5 +54,5 | |||||
53 |
|
54 | |||
54 | \snippet ../examples/modeldata/tablewidget.cpp 9 |
|
55 | \snippet ../examples/modeldata/tablewidget.cpp 9 | |
55 |
|
56 | |||
56 |
|
|
57 | The application is ready. Try modifying the data in the table view and see how it affects the chart. | |
57 | */ |
|
58 | */ |
@@ -1,36 +1,36 | |||||
1 | /*! |
|
1 | /*! | |
2 | \example examples/multiaxis |
|
2 | \example examples/multiaxis | |
3 |
\title Multiple |
|
3 | \title Multiple Axes Example | |
4 | \subtitle |
|
4 | \subtitle | |
5 |
|
5 | |||
6 | The example shows how to create simple chart with two vertical axes. One for each series. |
|
6 | The example shows how to create a simple chart with two vertical axes. One for each series. | |
7 |
|
7 | |||
8 | \image examples_multiaxis.png |
|
8 | \image examples_multiaxis.png | |
9 |
|
9 | |||
10 | Create QChart instance, hide the legend of the chart and set its title. |
|
10 | Create the QChart instance, hide the legend of the chart, and set its title. | |
11 |
|
11 | |||
12 | \snippet ../examples/multiaxis/main.cpp 1 |
|
12 | \snippet ../examples/multiaxis/main.cpp 1 | |
13 |
|
13 | |||
14 | Create a QValueAxis instance that will be used as a horizontal axis by both series and add it the bottom of the chart. |
|
14 | Create a QValueAxis instance that will be used as a horizontal axis by both series and add it the bottom of the chart. | |
15 |
|
|
15 | The axis can be shared between many series, but each series can have only one vertical and horizontal axis. | |
16 |
|
16 | |||
17 | \snippet ../examples/multiaxis/main.cpp 2 |
|
17 | \snippet ../examples/multiaxis/main.cpp 2 | |
18 |
|
18 | |||
19 |
Create the first series, add the data to it |
|
19 | Create the first series, and add the data to it. Finally, add the series to the chart. Instantiate its own Y-axis, add it to the chart. Then attach both the common X-axis and the series specific Y-axis. | |
20 | In this example the color of the axis line is set to be the same as the color of the series to make it possible to distinguish which axis is attached to which series. |
|
20 | In this example the color of the axis line is set to be the same as the color of the series to make it possible to distinguish which axis is attached to which series. | |
21 |
|
21 | |||
22 | \snippet ../examples/multiaxis/main.cpp 3 |
|
22 | \snippet ../examples/multiaxis/main.cpp 3 | |
23 |
|
23 | |||
24 | Similarly prepare another series. This time different axis type is used. Additionally grid lines color is also set to be the same as the color of the series. |
|
24 | Similarly prepare another series. This time a different axis type is used. Additionally grid lines color is also set to be the same as the color of the series. | |
25 |
|
25 | |||
26 | \snippet ../examples/multiaxis/main.cpp 4 |
|
26 | \snippet ../examples/multiaxis/main.cpp 4 | |
27 |
|
27 | |||
28 | Create a QChartView object with QChart as a parameter. Enable Antialiasing to have the rendered splines look nicer. |
|
28 | Create a QChartView object with QChart as a parameter. Enable Antialiasing to have the rendered splines look nicer. | |
29 |
|
29 | |||
30 | \snippet ../examples/multiaxis/main.cpp 5 |
|
30 | \snippet ../examples/multiaxis/main.cpp 5 | |
31 |
|
31 | |||
32 |
|
|
32 | The chart is ready to be shown. | |
33 |
|
33 | |||
34 | \snippet ../examples/multiaxis/main.cpp 6 |
|
34 | \snippet ../examples/multiaxis/main.cpp 6 | |
35 |
|
35 | |||
36 | */ |
|
36 | */ |
@@ -3,42 +3,42 | |||||
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. |
|
6 | The example shows how to create a simple percent bar chart. A percent bar chart shows the data in sets as a percentage of | |
7 |
all sets |
|
7 | all sets per category. | |
8 |
|
8 | |||
9 | Creating percent bar chart is just like creating a regular \l {BarChart Example} {bar chart}, except that for a |
|
9 | Creating percent bar charts is just like creating a regular \l {BarChart Example} {bar chart}, except that for a | |
10 | percent bar chart, we use QPercentBarSeries api instead of QBarSeries. Also, in the |
|
10 | percent bar charts, we use the QPercentBarSeries api instead of QBarSeries. Also, in the | |
11 |
\l {BarChart Example} {bar chart} we used nice numbers algorithm to make the y |
|
11 | \l {BarChart Example} {bar chart} we used the nice numbers algorithm to make the y-axis numbering look better. With | |
12 | percent bar chart there is no need for that, because the maximum y-axis value is always 100. |
|
12 | the percent bar chart there is no need for that, because the maximum y-axis value is always 100. | |
13 |
|
13 | |||
14 | \image examples_percentbarchart.png |
|
14 | \image examples_percentbarchart.png | |
15 |
|
15 | |||
16 | The barsets are used in same way in all barcharts. |
|
16 | The barsets are used in same way in all barcharts. | |
17 |
|
|
17 | To illustrate the difference between various barcharts, we use the same data in all examples. | |
18 |
|
|
18 | The data visualized by the bar chart 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. |
|
19 | to them. The data is appended here with the << operator. Alternatively the append method could be used. | |
20 |
|
20 | |||
21 | \snippet ../examples/percentbarchart/main.cpp 1 |
|
21 | \snippet ../examples/percentbarchart/main.cpp 1 | |
22 |
|
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. |
|
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 |
|
|
24 | The first values of each set are grouped together in the first category, the second values in the second category etc. | |
25 |
|
25 | |||
26 | \snippet ../examples/percentbarchart/main.cpp 2 |
|
26 | \snippet ../examples/percentbarchart/main.cpp 2 | |
27 |
|
27 | |||
28 |
Here we create the chart object and add the series to it. We set the title |
|
28 | Here we create the chart object and add the series to it. We set the title of the chart with setTitle, and then turn on animations of the series by calling | |
29 |
|
|
29 | setAnimationOptions(QChart::SeriesAnimations) | |
30 |
|
30 | |||
31 | \snippet ../examples/percentbarchart/main.cpp 3 |
|
31 | \snippet ../examples/percentbarchart/main.cpp 3 | |
32 |
|
32 | |||
33 |
|
|
33 | To have categories displayed on axis, we need to create a QBarCategoryAxis for that. Here we create a category axis with a list of categories and | |
34 |
|
|
34 | set it to be the x-axis of the chart. The chart takes ownership of the axis. For the y-axis we use the default axis, which is created and scaled | |
35 |
|
|
35 | to series data by calling createDefaultAxes of the chart. Note that createDefaultAxes must be called before we set the category axis. | |
36 | override the category axis. |
|
36 | Otherwise the default axis will override the category axis. | |
37 |
|
37 | |||
38 | \snippet ../examples/percentbarchart/main.cpp 4 |
|
38 | \snippet ../examples/percentbarchart/main.cpp 4 | |
39 |
|
39 | |||
40 |
We also want to show the legend. To do |
|
40 | We also want to show the legend. To do so, we get the legend pointer from the chart and set it to visible. We also place the legend to bottom of | |
41 | to Qt::AlignBottom. |
|
41 | the chart by setting its alignment to Qt::AlignBottom. | |
42 |
|
42 | |||
43 | \snippet ../examples/percentbarchart/main.cpp 5 |
|
43 | \snippet ../examples/percentbarchart/main.cpp 5 | |
44 |
|
44 | |||
@@ -46,8 +46,8 | |||||
46 |
|
46 | |||
47 | \snippet ../examples/percentbarchart/main.cpp 6 |
|
47 | \snippet ../examples/percentbarchart/main.cpp 6 | |
48 |
|
48 | |||
49 |
|
|
49 | The chart is ready to be shown. We set the chart to be central widget of the window. | |
50 |
|
|
50 | We also set the size for the chart window and show it. | |
51 |
|
51 | |||
52 |
\snippet ../examples/percentbarchart/main.cpp 7 |
|
52 | \snippet ../examples/percentbarchart/main.cpp 7 | |
53 | */ |
|
53 | */ |
@@ -3,6 +3,6 | |||||
3 | \title Piechart Example |
|
3 | \title Piechart Example | |
4 | \subtitle |
|
4 | \subtitle | |
5 |
|
5 | |||
6 | The example shows how to create simple pie chart and do some customizations to a pie slice. |
|
6 | The example shows how to create a simple pie chart and do some customizations to a pie slice. | |
7 | \image examples_piechart.png |
|
7 | \image examples_piechart.png | |
8 | */ |
|
8 | */ |
@@ -1,6 +1,6 | |||||
1 | /*! |
|
1 | /*! | |
2 | \example examples/piechartdrilldown |
|
2 | \example examples/piechartdrilldown | |
3 |
\title Piechart |
|
3 | \title Piechart Drilldown Example | |
4 | \subtitle |
|
4 | \subtitle | |
5 |
|
5 | |||
6 | The example shows how to implement a piechart with drilldown effect. |
|
6 | The example shows how to implement a piechart with drilldown effect. |
@@ -1,15 +1,15 | |||||
1 | /*! |
|
1 | /*! | |
2 | \example examples/polarchart |
|
2 | \example examples/polarchart | |
3 |
\title Polar |
|
3 | \title Polar Chart Example | |
4 | \subtitle |
|
4 | \subtitle | |
5 |
|
5 | |||
6 | The example shows how to create simple polar chart with multiple different series. |
|
6 | The example shows how to create a simple polar chart with multiple different series. | |
7 | It also shows how to implement scrolling and zooming of the polar chart as well as |
|
7 | It also shows how to implement scrolling and zooming of the polar chart as well as | |
8 | visually demonstrate how polar chart and cartesian chart relate to each other. |
|
8 | visually demonstrate how polar charts and cartesian charts relate to each other. | |
9 |
|
9 | |||
10 | \image examples_polarchart.png |
|
10 | \image examples_polarchart.png | |
11 |
|
11 | |||
12 |
Creating polar chart is done |
|
12 | Creating a polar chart is done with a QPolarChart instance instead of a QChart instance. | |
13 |
|
13 | |||
14 | \snippet ../examples/polarchart/main.cpp 1 |
|
14 | \snippet ../examples/polarchart/main.cpp 1 | |
15 |
|
15 | |||
@@ -18,15 +18,15 | |||||
18 |
|
18 | |||
19 | \snippet ../examples/polarchart/main.cpp 2 |
|
19 | \snippet ../examples/polarchart/main.cpp 2 | |
20 |
|
20 | |||
21 |
Zooming and scrolling of |
|
21 | Zooming and scrolling of a polar chart is logically nearly identical to zooming and scrolling of a cartesian chart. | |
22 | The main difference is that when scrolling along X-axis (angular axis), angle is used instead of number of pixels. |
|
22 | The main difference is that when scrolling along the X-axis (angular axis), the angle is used instead of the number of pixels. | |
23 | Another difference is that zooming to a rectangle cannot be done. |
|
23 | Another difference is that zooming to a rectangle cannot be done. | |
24 |
|
24 | |||
25 | \snippet ../examples/polarchart/chartview.cpp 1 |
|
25 | \snippet ../examples/polarchart/chartview.cpp 1 | |
26 |
|
26 | |||
27 |
|
|
27 | The same axes and series can be used in both cartesian and polar charts, though not simultaneously. | |
28 |
To switch between chart types, you need to |
|
28 | To switch between chart types, you first need to remove the series and axes from the old chart, and then add | |
29 | them to the new chart. If you want to preserve axis ranges, those need to be copied, too. |
|
29 | them to the new chart. If you want to preserve the axis ranges, those need to be copied, too. | |
30 |
|
30 | |||
31 | \snippet ../examples/polarchart/chartview.cpp 2 |
|
31 | \snippet ../examples/polarchart/chartview.cpp 2 | |
32 |
|
32 |
@@ -3,25 +3,25 | |||||
3 | \title ScatterChart Example |
|
3 | \title ScatterChart Example | |
4 | \subtitle |
|
4 | \subtitle | |
5 |
|
5 | |||
6 | The example shows how to create simple scatter chart. |
|
6 | The example shows how to create a simple scatter chart. | |
7 |
|
7 | |||
8 | \image examples_scatterchart.png |
|
8 | \image examples_scatterchart.png | |
9 |
|
9 | |||
10 |
To create scatter charts, QScatterSeries instance is needed. Here we create scatter series instance and |
|
10 | To create scatter charts, a QScatterSeries instance is needed. Here we create a scatter series instance, and set the type, color, and width of outline for the scatter points. | |
11 |
|
11 | |||
12 | \snippet ../examples/scatterchart/chartview.cpp 1 |
|
12 | \snippet ../examples/scatterchart/chartview.cpp 1 | |
13 |
|
13 | |||
14 |
We add data to be shown. We can use append() member function or use stream operator. |
|
14 | We add the data to be shown. We can use the append() member function or use the stream operator. | |
15 |
|
15 | |||
16 | \snippet ../examples/scatterchart/chartview.cpp 2 |
|
16 | \snippet ../examples/scatterchart/chartview.cpp 2 | |
17 |
|
17 | |||
18 | In the end we enable anti-aliasing, set the chart title and add the scatter series onto the chart. We also disable |
|
18 | In the end we enable anti-aliasing, set the chart title, and add the scatter series onto the chart. We also disable | |
19 | drop shadow, because it would not look good on an application with only chart view shown. |
|
19 | drop shadow, because it would not look good on an application with only chart view shown. | |
20 |
|
20 | |||
21 | \snippet ../examples/scatterchart/chartview.cpp 3 |
|
21 | \snippet ../examples/scatterchart/chartview.cpp 3 | |
22 |
|
22 | |||
23 |
|
|
23 | The chart is ready to be shown. | |
24 |
|
24 | |||
25 | \snippet ../examples/scatterchart/main.cpp 4 |
|
25 | \snippet ../examples/scatterchart/main.cpp 4 | |
26 |
|
26 | |||
27 | */ |
|
27 | */ |
@@ -3,7 +3,7 | |||||
3 | \title ScatterInteractions Example |
|
3 | \title ScatterInteractions Example | |
4 | \subtitle |
|
4 | \subtitle | |
5 |
|
5 | |||
6 |
Th |
|
6 | This example shows how to create a simple scatter chart and how to interact with the chart. | |
7 |
|
7 | |||
8 | \image examples_scatterinteractions.png |
|
8 | \image examples_scatterinteractions.png | |
9 | */ |
|
9 | */ |
@@ -3,27 +3,27 | |||||
3 | \title SplineChart Example |
|
3 | \title SplineChart Example | |
4 | \subtitle |
|
4 | \subtitle | |
5 |
|
5 | |||
6 | The example shows how to create simple spline chart. |
|
6 | The example shows how to create a simple spline chart. | |
7 |
|
7 | |||
8 | \image examples_splinechart.png |
|
8 | \image examples_splinechart.png | |
9 |
|
9 | |||
10 | To create spline chart we need to put our data into QSplineSeries. QSplineSeries automatically calculates spline segment control points that are needed to properly draw the spline. |
|
10 | To create spline charts we need to put our data into QSplineSeries. QSplineSeries automatically calculates spline segment control points that are needed to properly draw the spline. | |
11 |
|
11 | |||
12 | \snippet ../examples/splinechart/main.cpp 1 |
|
12 | \snippet ../examples/splinechart/main.cpp 1 | |
13 |
|
13 | |||
14 | Now let's add some data points to the series. |
|
14 | Now let's add some data points to the series. | |
15 |
|
||||
16 | \snippet ../examples/splinechart/main.cpp 2 |
|
|||
17 |
|
15 | |||
18 | The data series has been populated. To display it on a chart we create QChart object and add the data series to it. We also set the title and the values range on y axis, so that our chart is better visible. |
|
16 | \snippet ../examples/splinechart/main.cpp 2 | |
|
17 | ||||
|
18 | The data series has been populated. To display it on a chart we create a QChart object and add the data series to it. We also set the title and the values range on the y-axis, so that our chart's visibility is better. | |||
19 |
|
19 | |||
20 | \snippet ../examples/splinechart/main.cpp 3 |
|
20 | \snippet ../examples/splinechart/main.cpp 3 | |
21 |
|
21 | |||
22 | Then we create a QChartView object with QChart as a parameter. This way we don't need to create QGraphicsView scene ourselves. We also set the Antialiasing on to have the rendered lines look nicer. |
|
22 | Then we create a QChartView object with QChart as a parameter. This way we don't need to create a QGraphicsView scene ourselves. We also set the Antialiasing on to have the rendered lines look nicer. | |
23 |
|
23 | |||
24 |
\snippet ../examples/splinechart/main.cpp 4 |
|
24 | \snippet ../examples/splinechart/main.cpp 4 | |
25 |
|
25 | |||
26 |
|
|
26 | Finally, we set the QChartView as the windows's central widget. | |
27 |
|
27 | |||
28 |
\snippet ../examples/splinechart/main.cpp 5 |
|
28 | \snippet ../examples/splinechart/main.cpp 5 | |
29 | */ |
|
29 | */ |
@@ -3,52 +3,49 | |||||
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. |
|
6 | The example shows how to create a simple stacked bar chart. The stacked bar chart shows the data in sets as bars | |
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 |
|
8 | The example shows how to create a 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. |
|
9 | stacked on top of each other. The stacking is done per category. | |
10 |
|
|
10 | Creating a 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. |
|
11 | stacked bar chart, we use the QStackedBarSeries api instead of QBarSeries. | |
12 |
|
12 | |||
13 | \image examples_stackedbarchart.png |
|
13 | \image examples_stackedbarchart.png | |
14 |
|
14 | |||
15 | The barsets are used in same way in all barcharts. |
|
15 | The barsets are used in same way in all barcharts. | |
16 |
|
|
16 | To illustrate the difference between various barcharts, we use same data in all examples. | |
17 |
Data |
|
17 | Data, which the barchart visualizes, is defined by the 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. |
|
18 | to them. The data is appended here with << operator. Alternatively the append method could be used. | |
19 |
|
19 | |||
20 | \snippet ../examples/stackedbarchart/main.cpp 1 |
|
20 | \snippet ../examples/stackedbarchart/main.cpp 1 | |
21 |
|
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. |
|
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 |
|
|
23 | The first values of each set are grouped together in the first category, the second values in the second category etc. | |
24 |
|
24 | |||
25 | \snippet ../examples/stackedbarchart/main.cpp 2 |
|
25 | \snippet ../examples/stackedbarchart/main.cpp 2 | |
26 |
|
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 |
|
27 | Here we create the chart object and add the series to it. We set the title for the chart with setTitle, and then turn on animations of the series by calling | |
28 |
|
|
28 | setAnimationOptions(QChart::SeriesAnimations). | |
29 |
|
29 | |||
30 | \snippet ../examples/stackedbarchart/main.cpp 3 |
|
30 | \snippet ../examples/stackedbarchart/main.cpp 3 | |
31 |
|
31 | |||
32 |
|
|
32 | To have categories displayed on the axis, we need to create a QBarCategoryAxis. Here we create a category axis with list of categories and | |
33 |
|
|
33 | set it to be the x-axis of the chart. The chart takes ownership of the axis. For the y-axis we use default axis, which is created and scaled to series data | |
34 |
|
|
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 |
|
|
35 | override the category axis. | |
36 |
|
36 | |||
37 | \snippet ../examples/stackedbarchart/main.cpp 4 |
|
37 | \snippet ../examples/stackedbarchart/main.cpp 4 | |
38 |
|
38 | |||
39 |
We also want to show the legend. To do |
|
39 | We also want to show the legend. To do so, we get the legend pointer from the chart and set it to visible. We also place the legend to the bottom of the chart by setting its alignment to Qt::AlignBottom. | |
40 | to Qt::AlignBottom. |
|
|||
41 |
|
40 | |||
42 | \snippet ../examples/stackedbarchart/main.cpp 5 |
|
41 | \snippet ../examples/stackedbarchart/main.cpp 5 | |
43 |
|
42 | |||
44 | Finally we add the chart onto a view. We also turn on the antialiasing for the chartView. |
|
43 | Finally, we add the chart onto a view. We also turn on the antialiasing for the chartView. | |
45 |
|
44 | |||
46 | \snippet ../examples/stackedbarchart/main.cpp 6 |
|
45 | \snippet ../examples/stackedbarchart/main.cpp 6 | |
47 |
|
46 | |||
48 |
|
|
47 | The chart is ready to be shown. We set the chart to be the central widget of the window. | |
49 |
|
|
48 | We also set the size for the chart window and show it. | |
50 |
|
49 | |||
51 | \snippet ../examples/stackedbarchart/main.cpp 7 |
|
50 | \snippet ../examples/stackedbarchart/main.cpp 7 | |
52 | */ |
|
51 | */ | |
53 |
|
||||
54 |
|
@@ -3,43 +3,43 | |||||
3 | \title StackedBarChart Drilldown Example |
|
3 | \title StackedBarChart Drilldown Example | |
4 | \subtitle |
|
4 | \subtitle | |
5 |
|
5 | |||
6 |
The example shows how to implement drilldown using stacked barchart. In drilldown example we create stacked barchart, which shows the harvest of various chili peppers during season. In season view the harvest is grouped by month. To drill down to weekly view, |
|
6 | The example shows how to implement drilldown using a stacked barchart. In thedrilldown example we create a stacked bar chart, which shows the harvest of various chili peppers during season. In season view the harvest is grouped by month. To drill down to weekly view, right-click the selected month. On weekly view, the harvest of the month clicked is shown by week. | |
7 |
|
7 | |||
8 |
|
|
8 | The season view looks like this: | |
9 | \image examples_stackedbarchartdrilldown1.png |
|
9 | \image examples_stackedbarchartdrilldown1.png | |
10 |
|
10 | |||
11 |
|
|
11 | Clicking on a month shows that month's harvest: | |
12 | \image examples_stackedbarchartdrilldown2.png |
|
12 | \image examples_stackedbarchartdrilldown2.png | |
13 |
|
13 | |||
14 |
First we define a drilldown series class, which adds categories to stacked bar series and mapping for categories to other drilldown series. |
|
14 | First we define a drilldown series class, which adds categories to the stacked bar series and mapping for categories to other drilldown series. | |
15 |
|
|
15 | The purpose of the drilldown series is to contain knowledge of the drilldown structure. The mapDrilldownSeries function maps the category to a given series. We can request the mapping for a category with the drilldownSeries(int category) function. | |
16 |
|
16 | |||
17 | \snippet ../examples/stackedbarchartdrilldown/drilldownseries.h 1 |
|
17 | \snippet ../examples/stackedbarchartdrilldown/drilldownseries.h 1 | |
18 |
|
18 | |||
19 | Next we define our own drilldown chart, which implements handler for mouse click. All QBarSeries derived classes send out clicked(QBarSet*, int) signal when series is clicked with mouse. The parameter QBarSet contains pointer to clicked bar set and parameter int contains the index of clicked category. |
|
19 | Next we define our own drilldown chart, which implements the handler for the mouse click. All QBarSeries derived classes send out the clicked(QBarSet*, int) signal when a series is clicked with the mouse. The parameter QBarSet contains the pointer to the clicked bar set and parameter int contains the index of the clicked category. | |
20 |
|
20 | |||
21 | \snippet ../examples/stackedbarchartdrilldown/drilldownchart.h 1 |
|
21 | \snippet ../examples/stackedbarchartdrilldown/drilldownchart.h 1 | |
22 |
|
22 | |||
23 |
|
|
23 | Now we have our drilldown classes and we can start using them. | |
24 |
|
|
24 | First create the chart. | |
25 |
|
25 | |||
26 | \snippet ../examples/stackedbarchartdrilldown/main.cpp 1 |
|
26 | \snippet ../examples/stackedbarchartdrilldown/main.cpp 1 | |
27 |
|
27 | |||
28 |
We define categories |
|
28 | We define the categories from which the drilldown series will be constructed. | |
29 |
|
29 | |||
30 | \snippet ../examples/stackedbarchartdrilldown/main.cpp 2 |
|
30 | \snippet ../examples/stackedbarchartdrilldown/main.cpp 2 | |
31 |
|
31 | |||
32 |
To create the drilldown structure, we first create our top level series, which we call seasonSeries. For each month in seasonSeries we create a drilldown series |
|
32 | To create the drilldown structure, we first create our top level series, which we call seasonSeries. For each month in seasonSeries we create a drilldown series called weeklySeries which contains more detailed data for that month. | |
33 |
In weeklySeries, we use the drilldown handler to bring us back to seasonSeries. To do |
|
33 | In weeklySeries, we use the drilldown handler to bring us back to seasonSeries. To do so we add mapping to the series. The seasonSeries is mapped to weeklySeries for each month. Every weeklySeries is mapped back to the seasonSeries. | |
34 | To make mapping work, we connect the clicked signals from our series to the drilldownChart. |
|
34 | To make mapping work, we connect the clicked signals from our series to the drilldownChart. | |
35 |
|
35 | |||
36 | \snippet ../examples/stackedbarchartdrilldown/main.cpp 3 |
|
36 | \snippet ../examples/stackedbarchartdrilldown/main.cpp 3 | |
37 |
|
37 | |||
38 | When we have our drilldown structure ready, we can add the data to it. Here we generate random crop for each plant in each week. The monthly crop is calculated from weekly crops and is set as value to monthly series. |
|
38 | When we have our drilldown structure ready, we can add the data to it. Here we generate a random crop for each plant in each week. The monthly crop is calculated from weekly crops and is set as value to the monthly series. | |
39 |
|
39 | |||
40 | \snippet ../examples/stackedbarchartdrilldown/main.cpp 4 |
|
40 | \snippet ../examples/stackedbarchartdrilldown/main.cpp 4 | |
41 |
|
41 | |||
42 | Here we set the chart to show top level series initially. |
|
42 | Here we set the chart to show the top level series initially. | |
43 |
|
43 | |||
44 | \snippet ../examples/stackedbarchartdrilldown/main.cpp 5 |
|
44 | \snippet ../examples/stackedbarchartdrilldown/main.cpp 5 | |
45 | */ |
|
45 | */ |
@@ -3,33 +3,33 | |||||
3 | \title Temperature records example |
|
3 | \title Temperature records example | |
4 | \subtitle |
|
4 | \subtitle | |
5 |
|
5 | |||
6 |
The example shows how to create a bar chart with negative bars. For example |
|
6 | The example shows how to create a bar chart with negative bars. For our example we use temperature data. | |
7 |
|
7 | |||
8 | \image examples_temperaturerecords.png |
|
8 | \image examples_temperaturerecords.png | |
9 |
|
9 | |||
10 |
|
|
10 | First we create two barsets and append the data to them. One set represents the minimum temperatures and another the maximum temperatures. | |
11 |
|
11 | |||
12 | \snippet ../examples/temperaturerecords/main.cpp 1 |
|
12 | \snippet ../examples/temperaturerecords/main.cpp 1 | |
13 |
|
13 | |||
14 |
We create the series and append the barsets to it. The series takes ownership of the barsets. |
|
14 | We create the series and append the barsets to it. The series takes ownership of the barsets. | |
15 |
|
15 | |||
16 | \snippet ../examples/temperaturerecords/main.cpp 2 |
|
16 | \snippet ../examples/temperaturerecords/main.cpp 2 | |
17 |
|
17 | |||
18 | 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 |
|
18 | Here we create the chart object and add the series to it. We set the title for the chart with setTitle, and then turn on animations of the series by calling | |
19 |
|
|
19 | setAnimationOptions(QChart::SeriesAnimations) | |
20 |
|
20 | |||
21 | \snippet ../examples/temperaturerecords/main.cpp 3 |
|
21 | \snippet ../examples/temperaturerecords/main.cpp 3 | |
22 |
|
||||
23 | 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 |
|
|||
24 | 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 |
|
|||
25 | by calling createDefaultAxes of the chart. We change the range for y-axis, since in this case it gives nicer result than autoscaling. |
|
|||
26 |
|
22 | |||
27 | Note that the call for createDefaultAxes must be before we set the category axis. Otherwise the default axis will override the category axis. |
|
23 | To have categories displayed on an axis, we need to create a QBarCategoryAxis. Here we create a category axis with a list of categories and | |
|
24 | set it to be the x-axis of the chart. The chart takes ownership of the axis. For y-axis we use the default axis, which is created and scaled to the series data | |||
|
25 | by calling createDefaultAxes of the chart. We change the range for the y-axis, since this gives nicer result than with autoscaling. | |||
|
26 | ||||
|
27 | Note that the call for createDefaultAxes must be before we set the category axis. Otherwise the default axis will override the category axis. | |||
28 |
|
28 | |||
29 | \snippet ../examples/temperaturerecords/main.cpp 4 |
|
29 | \snippet ../examples/temperaturerecords/main.cpp 4 | |
30 |
|
30 | |||
31 |
We also want to show the legend. To do |
|
31 | We also want to show the legend. To do so, we get the legend pointer from the chart and set it to visible. We also place the legend to the bottom | |
32 | to Qt::AlignBottom. |
|
32 | of the chart by setting its alignment to Qt::AlignBottom. | |
33 |
|
33 | |||
34 | \snippet ../examples/temperaturerecords/main.cpp 5 |
|
34 | \snippet ../examples/temperaturerecords/main.cpp 5 | |
35 |
|
35 | |||
@@ -37,8 +37,8 | |||||
37 |
|
37 | |||
38 | \snippet ../examples/temperaturerecords/main.cpp 6 |
|
38 | \snippet ../examples/temperaturerecords/main.cpp 6 | |
39 |
|
39 | |||
40 | Chart is ready to be shown. We set the chart to be central widget of the window. |
|
40 | Chart is ready to be shown. We set the chart to be the central widget of the window. | |
41 |
|
|
41 | We also set the size for the chart window and show it. | |
42 |
|
42 | |||
43 | \snippet ../examples/temperaturerecords/main.cpp 7 |
|
43 | \snippet ../examples/temperaturerecords/main.cpp 7 | |
44 | */ |
|
44 | */ |
@@ -1,6 +1,6 | |||||
1 | /*! |
|
1 | /*! | |
2 | \example examples/zoomlinechart |
|
2 | \example examples/zoomlinechart | |
3 |
\title Zoom |
|
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 by using a mouse |
|
6 | The example shows how to create your own custom zooming effect with QRubberBand by using a mouse | |
@@ -17,7 +17,7 | |||||
17 | We override mouse and key event handling |
|
17 | We override mouse and key event handling | |
18 | \snippet ../examples/zoomlinechart/chartview.h 2 |
|
18 | \snippet ../examples/zoomlinechart/chartview.h 2 | |
19 |
|
19 | |||
20 | Then we implement a custom logic for mouse and key events. For example pressing '+' key will zoom in and pressing |
|
20 | Then we implement a custom logic for mouse and key events. For example pressing the '+' key will zoom in and pressing | |
21 | the '-' key will zoom out. |
|
21 | the '-' key will zoom out. | |
22 | \snippet ../examples/zoomlinechart/chartview.cpp 1 |
|
22 | \snippet ../examples/zoomlinechart/chartview.cpp 1 | |
23 |
|
23 |
@@ -2,7 +2,7 | |||||
2 | \page examples.html |
|
2 | \page examples.html | |
3 | \title Qt Charts Examples |
|
3 | \title Qt Charts Examples | |
4 | \keyword Examples |
|
4 | \keyword Examples | |
5 |
|
5 | |||
6 | \raw HTML |
|
6 | \raw HTML | |
7 | <div class="qchart"> |
|
7 | <div class="qchart"> | |
8 |
|
8 | |||
@@ -119,12 +119,12 | |||||
119 | <td><a href="examples-splinechart.html">Spline Chart</a></td> |
|
119 | <td><a href="examples-splinechart.html">Spline Chart</a></td> | |
120 | <td><a href="examples-stackedbarchart.html">Stacked Bar Chart</a></td> |
|
120 | <td><a href="examples-stackedbarchart.html">Stacked Bar Chart</a></td> | |
121 | </tr> |
|
121 | </tr> | |
122 |
<tr> |
|
122 | <tr> | |
123 | <td><a href="examples-splinechart.html"><img src="images/examples_splinechart.png" width="300" alt="Spline Chart" /></a></td> |
|
123 | <td><a href="examples-splinechart.html"><img src="images/examples_splinechart.png" width="300" alt="Spline Chart" /></a></td> | |
124 | <td><a href="examples-stackedbarchart.html"><img src="images/examples_stackedbarchart.png" width="300" alt="Stacked Bar Chart" /></a></td> |
|
124 | <td><a href="examples-stackedbarchart.html"><img src="images/examples_stackedbarchart.png" width="300" alt="Stacked Bar Chart" /></a></td> | |
125 | </tr> |
|
125 | </tr> | |
126 |
|
126 | |||
127 |
<tr> |
|
127 | <tr> | |
128 | <td><a href="examples-stackedbarchartdrilldown.html">Stacked Bar Chart Drilldown</a></td> |
|
128 | <td><a href="examples-stackedbarchartdrilldown.html">Stacked Bar Chart Drilldown</a></td> | |
129 | <td><a href="examples-temperaturerecords.html">Temperature Records</a></td> |
|
129 | <td><a href="examples-temperaturerecords.html">Temperature Records</a></td> | |
130 | </tr> |
|
130 | </tr> |
@@ -1,6 +1,6 | |||||
1 | /*! |
|
1 | /*! | |
2 | \page gettingstarted.html |
|
2 | \page gettingstarted.html | |
3 |
\title Qt Charts |
|
3 | \title Qt Charts Getting Started | |
4 | \keyword Introduction |
|
4 | \keyword Introduction | |
5 |
|
5 | |||
6 | Compiling: |
|
6 | Compiling: | |
@@ -10,7 +10,7 | |||||
10 | make install |
|
10 | make install | |
11 | \endcode |
|
11 | \endcode | |
12 |
|
12 | |||
13 | Depending on the OS and the compiler you are using "make" might need to be replaced with another command like: nmake, mingw32-make, etc. |
|
13 | Depending on the OS and the compiler you are using, "make" might need to be replaced with another command like: nmake, mingw32-make, etc. | |
14 |
|
14 | |||
15 | To uninstall the Qt Charts run: |
|
15 | To uninstall the Qt Charts run: | |
16 | \code |
|
16 | \code | |
@@ -31,7 +31,7 | |||||
31 | make install |
|
31 | make install | |
32 | \endcode |
|
32 | \endcode | |
33 |
|
33 | |||
34 |
Please |
|
34 | Please note that the \i build_all option is necessary for the install to work correctly. Otherwise it will not install both versions. | |
35 |
|
35 | |||
36 | Building without demos and examples: |
|
36 | Building without demos and examples: | |
37 | \code |
|
37 | \code | |
@@ -69,5 +69,5 | |||||
69 |
|
69 | |||
70 | \raw HTML |
|
70 | \raw HTML | |
71 | \endraw |
|
71 | \endraw | |
72 |
|
72 | |||
73 | */ |
|
73 | */ |
@@ -7,10 +7,10 | |||||
7 | <img src="images/qt-logo.png" alt="qt-logo" style="margin:0px 8px"/> |
|
7 | <img src="images/qt-logo.png" alt="qt-logo" style="margin:0px 8px"/> | |
8 |
|
8 | |||
9 | <p> |
|
9 | <p> | |
10 | Qt Charts is a part of Qt Enterprise addons package. It provides a set of easy to use chart |
|
10 | Qt Charts is a part of the Qt Enterprise addons package. It provides a set of easy to use chart | |
11 | components which are available for Qt customers. It uses Qt Graphics View |
|
11 | components which are available for Qt customers. It uses the Qt Graphics View | |
12 | Framework, therefore charts can be easily integrated to modern user interfaces. Qt Charts can |
|
12 | Framework, therefore charts can be easily integrated to modern user interfaces. Qt Charts can | |
13 | be used as QWidgets, QGraphicsWidget or QML elements. Users can easily create impressive |
|
13 | be used as QWidgets, QGraphicsWidget, or QML elements. Users can easily create impressive | |
14 | graphs by selecting one of the charts themes. |
|
14 | graphs by selecting one of the charts themes. | |
15 | </p> |
|
15 | </p> | |
16 | <p> |
|
16 | <p> |
@@ -3,7 +3,7 | |||||
3 | \title Qt Charts QML API |
|
3 | \title Qt Charts QML API | |
4 | \keyword Charts QML API |
|
4 | \keyword Charts QML API | |
5 |
|
5 | |||
6 | Qt Charts QML API is an intuitive and simple way to show charts in your QML |
|
6 | The Qt Charts QML API is an intuitive and simple way to show charts in your QML | |
7 | applications. |
|
7 | applications. | |
8 |
|
8 | |||
9 | \table |
|
9 | \table | |
@@ -21,9 +21,9 | |||||
21 | \note Since Qt Charts utilizes Qt Graphics View Framework for drawing, it works best |
|
21 | \note Since Qt Charts utilizes Qt Graphics View Framework for drawing, it works best | |
22 | with Qt Quick 1, which is based on the same framework. |
|
22 | with Qt Quick 1, which is based on the same framework. | |
23 | As of release 1.3.0, Qt Charts is also usable with Qt Quick 2, though the performance |
|
23 | As of release 1.3.0, Qt Charts is also usable with Qt Quick 2, though the performance | |
24 | is slightly worse than with Qt Quick 1 due to additional rendering step that is required. |
|
24 | is slightly worse than with Qt Quick 1 due to the additional rendering step that is required. | |
25 |
|
25 | |||
26 | \note Qt Quick 1 is supported from Qt 4.7.4 onwards because of missing |
|
26 | \note Qt Quick 1 is supported from Qt 4.7.4 onwards because of the missing | |
27 | Q_REVISION macro in the earlier Qt releases. Qt Quick 2 is supported with only Qt 5. |
|
27 | Q_REVISION macro in the earlier Qt releases. Qt Quick 2 is supported with only Qt 5. | |
28 |
|
28 | |||
29 | \raw HTML |
|
29 | \raw HTML |
@@ -2,5 +2,5 | |||||
2 | \page tutorials.html |
|
2 | \page tutorials.html | |
3 | \title Tutorials |
|
3 | \title Tutorials | |
4 | \keyword Tutorials |
|
4 | \keyword Tutorials | |
5 |
|
5 | |||
6 | */ |
|
6 | */ |
@@ -14,8 +14,8 | |||||
14 | Sets the family name of the font. |
|
14 | Sets the family name of the font. | |
15 |
|
15 | |||
16 | The family name is case insensitive and may optionally include a foundry name, e.g. "Helvetica [Cronyx]". |
|
16 | The family name is case insensitive and may optionally include a foundry name, e.g. "Helvetica [Cronyx]". | |
17 | If the family is available from more than one foundry and the foundry isn't specified, an arbitrary foundry is chosen. |
|
17 | If the family is available from more than one foundry, and the foundry isn't specified, an arbitrary foundry is chosen. | |
18 | If the family isn't available a family will be set using the font matching algorithm. |
|
18 | If the family isn't available, a family will be set using the font matching algorithm. | |
19 | */ |
|
19 | */ | |
20 |
|
20 | |||
21 | /*! |
|
21 | /*! | |
@@ -46,19 +46,19 | |||||
46 | /*! |
|
46 | /*! | |
47 | \qmlproperty bool Font::italic |
|
47 | \qmlproperty bool Font::italic | |
48 |
|
48 | |||
49 |
Sets |
|
49 | Sets on or off the italic style property. | |
50 | */ |
|
50 | */ | |
51 |
|
51 | |||
52 | /*! |
|
52 | /*! | |
53 | \qmlproperty bool Font::underline |
|
53 | \qmlproperty bool Font::underline | |
54 |
|
54 | |||
55 |
Sets |
|
55 | Sets on or off the underlined property. | |
56 | */ |
|
56 | */ | |
57 |
|
57 | |||
58 | /*! |
|
58 | /*! | |
59 | \qmlproperty bool Font::strikeout |
|
59 | \qmlproperty bool Font::strikeout | |
60 |
|
60 | |||
61 |
Sets |
|
61 | Sets on or off the strikeout style. | |
62 | */ |
|
62 | */ | |
63 |
|
63 | |||
64 | /*! |
|
64 | /*! | |
@@ -102,9 +102,9 | |||||
102 |
|
102 | |||
103 | \list |
|
103 | \list | |
104 | \o Font.MixedCase - This is the normal text rendering option where no capitalization change is applied. |
|
104 | \o Font.MixedCase - This is the normal text rendering option where no capitalization change is applied. | |
105 |
\o Font.AllUppercase - |
|
105 | \o Font.AllUppercase - Changes the text to uppercasse. | |
106 |
\o Font.AllLowercase |
|
106 | \o Font.AllLowercase - Changes the text to lowercase. | |
107 |
\o Font.SmallCaps - |
|
107 | \o Font.SmallCaps - Renders the text small-caps type. | |
108 | \o Font.Capitalize - This alters the text to be rendered with the first character of each word as an uppercase character. |
|
108 | \o Font.Capitalize - This alters the text to be rendered with the first character of each word as an uppercase character. | |
109 | \endlist |
|
109 | \endlist | |
110 |
|
110 |
General Comments 0
You need to be logged in to leave comments.
Login now