summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicholas Bennett <nicholas.bennett@qt.io>2023-06-05 18:41:58 +0300
committerNicholas Bennett <nicholas.bennett@qt.io>2023-06-15 15:26:38 +0000
commit5852d85f2743c62f9d79c17043b9b48826f5ffc3 (patch)
treeea21ae0b70fbf563907210553228ee31572817d6
parent2ae46ef08f6a10a0d44557bb592db06be667f2bb (diff)
Docs: Rework example documentation into charts widget gallery example
Removed example commands, fixed snippets to point to new locations, added page commands that have the existing html address and added \ingroup commands to create a table that points to the new pages. Removed examples documentation with no code walk-through. Move example documentation source files to example folder. Fixes: QTBUG-114221 Pick-to: 6.6 6.5 6.5.2 Change-Id: I7ab3b56457df4d33b52be6fd0022e7a92809d82c Reviewed-by: Mats Honkamaa <mats.honkamaa@qt.io> Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
-rw-r--r--examples/charts/chartsgallery/doc/images/ChartWidgetGallery.pngbin0 -> 71709 bytes
-rw-r--r--examples/charts/chartsgallery/doc/src/examples-areachart.qdoc (renamed from src/charts/doc/src/examples-areachart.qdoc)22
-rw-r--r--examples/charts/chartsgallery/doc/src/examples-barchart.qdoc40
-rw-r--r--examples/charts/chartsgallery/doc/src/examples-barmodelmapper.qdoc (renamed from src/charts/doc/src/examples-barmodelmapper.qdoc)30
-rw-r--r--examples/charts/chartsgallery/doc/src/examples-boxplotchart.qdoc (renamed from src/charts/doc/src/examples-boxplotchart.qdoc)44
-rw-r--r--examples/charts/chartsgallery/doc/src/examples-callout.qdoc (renamed from src/charts/doc/src/examples-callout.qdoc)12
-rw-r--r--examples/charts/chartsgallery/doc/src/examples-candlestickchart.qdoc (renamed from src/charts/doc/src/examples-candlestickchart.qdoc)39
-rw-r--r--examples/charts/chartsgallery/doc/src/examples-chartthemes.qdoc (renamed from src/charts/doc/src/examples-chartthemes.qdoc)41
-rw-r--r--examples/charts/chartsgallery/doc/src/examples-customchart.qdoc (renamed from src/charts/doc/src/examples-customchart.qdoc)23
-rw-r--r--examples/charts/chartsgallery/doc/src/examples-datetimeaxis.qdoc (renamed from src/charts/doc/src/examples-datetimeaxis.qdoc)29
-rw-r--r--examples/charts/chartsgallery/doc/src/examples-donutbreakdown.qdoc (renamed from src/charts/doc/src/examples-donutbreakdown.qdoc)29
-rw-r--r--examples/charts/chartsgallery/doc/src/examples-horizontalbarchart.qdoc (renamed from src/charts/doc/src/examples-horizontalbarchart.qdoc)30
-rw-r--r--examples/charts/chartsgallery/doc/src/examples-horizontalpercentbarchart.qdoc (renamed from src/charts/doc/src/examples-horizontalpercentbarchart.qdoc)35
-rw-r--r--examples/charts/chartsgallery/doc/src/examples-horizontalstackedbarchart.qdoc (renamed from src/charts/doc/src/examples-horizontalstackedbarchart.qdoc)33
-rw-r--r--examples/charts/chartsgallery/doc/src/examples-legend.qdoc (renamed from src/charts/doc/src/examples-legend.qdoc)26
-rw-r--r--examples/charts/chartsgallery/doc/src/examples-legendmarkers.qdoc (renamed from src/charts/doc/src/examples-legendmarkers.qdoc)25
-rw-r--r--examples/charts/chartsgallery/doc/src/examples-lineandbarchart.qdoc (renamed from src/charts/doc/src/examples-lineandbarchart.qdoc)30
-rw-r--r--examples/charts/chartsgallery/doc/src/examples-linechart.qdoc (renamed from src/charts/doc/src/examples-linechart.qdoc)26
-rw-r--r--examples/charts/chartsgallery/doc/src/examples-logvalueaxis.qdoc30
-rw-r--r--examples/charts/chartsgallery/doc/src/examples-modeldata.qdoc (renamed from src/charts/doc/src/examples-modeldata.qdoc)32
-rw-r--r--examples/charts/chartsgallery/doc/src/examples-multiaxis.qdoc (renamed from src/charts/doc/src/examples-multiaxis.qdoc)30
-rw-r--r--examples/charts/chartsgallery/doc/src/examples-nesteddonuts.qdoc (renamed from src/charts/doc/src/examples-nesteddonuts.qdoc)26
-rw-r--r--examples/charts/chartsgallery/doc/src/examples-openglseries.qdoc (renamed from src/charts/doc/src/examples-openglseries.qdoc)0
-rw-r--r--examples/charts/chartsgallery/doc/src/examples-percentbarchart.qdoc (renamed from src/charts/doc/src/examples-percentbarchart.qdoc)38
-rw-r--r--examples/charts/chartsgallery/doc/src/examples-pointconfiguration.qdoc (renamed from src/charts/doc/src/examples-pointconfiguration.qdoc)29
-rw-r--r--examples/charts/chartsgallery/doc/src/examples-pointsselectionandmarkers.qdoc (renamed from src/charts/doc/src/examples-pointsselectionandmarkers.qdoc)34
-rw-r--r--examples/charts/chartsgallery/doc/src/examples-polarchart.qdoc (renamed from src/charts/doc/src/examples-polarchart.qdoc)27
-rw-r--r--examples/charts/chartsgallery/doc/src/examples-scatterchart.qdoc (renamed from src/charts/doc/src/examples-scatterchart.qdoc)23
-rw-r--r--examples/charts/chartsgallery/doc/src/examples-selectedbar.qdoc (renamed from src/charts/doc/src/examples-selectedbar.qdoc)34
-rw-r--r--examples/charts/chartsgallery/doc/src/examples-splinechart.qdoc (renamed from src/charts/doc/src/examples-splinechart.qdoc)26
-rw-r--r--examples/charts/chartsgallery/doc/src/examples-stackedbarchart.qdoc (renamed from src/charts/doc/src/examples-stackedbarchart.qdoc)34
-rw-r--r--examples/charts/chartsgallery/doc/src/examples-stackedbarchartdrilldown.qdoc (renamed from src/charts/doc/src/examples-stackedbarchartdrilldown.qdoc)29
-rw-r--r--examples/charts/chartsgallery/doc/src/examples-temperaturerecords.qdoc (renamed from src/charts/doc/src/examples-temperaturerecords.qdoc)33
-rw-r--r--examples/charts/chartsgallery/doc/src/gallery.qdoc22
-rw-r--r--examples/charts/chartsgallery/doc/src/gallery.qdocinc2
-rw-r--r--src/charts/doc/src/examples-barchart.qdoc55
-rw-r--r--src/charts/doc/src/examples-donutchart.qdoc14
-rw-r--r--src/charts/doc/src/examples-dynamicspline.qdoc15
-rw-r--r--src/charts/doc/src/examples-logvalueaxis.qdoc37
-rw-r--r--src/charts/doc/src/examples-piechart.qdoc14
-rw-r--r--src/charts/doc/src/examples-piechartcustomization.qdoc13
-rw-r--r--src/charts/doc/src/examples-piechartdrilldown.qdoc14
-rw-r--r--src/charts/doc/src/examples-scatterinteractions.qdoc15
-rw-r--r--src/charts/doc/src/qtcharts-overview.qdoc39
-rw-r--r--src/charts/doc/src/qtcharts.qdoc3
45 files changed, 457 insertions, 725 deletions
diff --git a/examples/charts/chartsgallery/doc/images/ChartWidgetGallery.png b/examples/charts/chartsgallery/doc/images/ChartWidgetGallery.png
new file mode 100644
index 00000000..ed7217f9
--- /dev/null
+++ b/examples/charts/chartsgallery/doc/images/ChartWidgetGallery.png
Binary files differ
diff --git a/src/charts/doc/src/examples-areachart.qdoc b/examples/charts/chartsgallery/doc/src/examples-areachart.qdoc
index 5f3014e9..da122645 100644
--- a/src/charts/doc/src/examples-areachart.qdoc
+++ b/examples/charts/chartsgallery/doc/src/examples-areachart.qdoc
@@ -2,36 +2,32 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
- \example areachart
- \title AreaChart Example
- \ingroup qtcharts_examples
+ \page qtcharts-areachart-example.html
+ \title Creating Area Charts
+ \brief Shows how to create a simple area chart.
- \brief The example shows how to create a simple area chart.
+ \include gallery.qdocinc
\image examples_areachart.png
- \include examples-run.qdocinc
-
- \section1 Creating Area Charts
-
To create area charts, we need two QLineSeries instances. They are going to define the upper and lower boundary of the area.
- \snippet areachart/main.cpp 1
+ \snippet chartsgallery/areawidget.cpp 1
We add data to both series and use the stream operator.
- \snippet areachart/main.cpp 2
+ \snippet chartsgallery/areawidget.cpp 2
Now we create a QAreaSeries instance using two line series objects. We set the custom gradient fill and width of the outline.
- \snippet areachart/main.cpp 3
+ \snippet chartsgallery/areawidget.cpp 3
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.
- \snippet areachart/main.cpp 4
+ \snippet chartsgallery/areawidget.cpp 4
The chart is ready to be shown.
- \snippet areachart/main.cpp 5
+ \snippet chartsgallery/areawidget.cpp 5
*/
diff --git a/examples/charts/chartsgallery/doc/src/examples-barchart.qdoc b/examples/charts/chartsgallery/doc/src/examples-barchart.qdoc
new file mode 100644
index 00000000..de3fd7fe
--- /dev/null
+++ b/examples/charts/chartsgallery/doc/src/examples-barchart.qdoc
@@ -0,0 +1,40 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
+
+/*!
+ \page qtcharts-barchart-example.html
+ \title Creating Bar Charts
+ \brief BarChart shows the data in sets as separate bars within categories.
+
+ \include gallery.qdocinc
+
+ \image examples_barchart.png
+
+ The \c barsets are used in the same way in all barcharts.
+ To illustrate the difference between various barcharts, we use the same data in the examples.
+ Data that the barchart visualizes, is defined by the QBarSet instances. Here we create the sets and append data to them. The data is appended here with the << operator. Alternatively, the append method could be used.
+
+ \snippet chartsgallery/barwidget.cpp 1
+
+ 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.
+ First values of each set are grouped together at first category second value to second category and so on.
+
+ \snippet chartsgallery/barwidget.cpp 2
+
+ 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 setAnimationOptions(QChart::SeriesAnimations)
+
+ \snippet chartsgallery/barwidget.cpp 3
+
+ 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 set it to be aligned to the bottom, acting as the x-axis, and attach it to the series. The chart takes ownership of the axis. For y-axis we use a value axis, aligned to the left-hand side.
+
+ \snippet chartsgallery/barwidget.cpp 4
+
+ 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.
+
+ \snippet chartsgallery/barwidget.cpp 5
+
+ Finally we add the chart onto a view.
+
+ \snippet chartsgallery/barwidget.cpp 6
+
+*/
diff --git a/src/charts/doc/src/examples-barmodelmapper.qdoc b/examples/charts/chartsgallery/doc/src/examples-barmodelmapper.qdoc
index 28fdc420..dabaaa7e 100644
--- a/src/charts/doc/src/examples-barmodelmapper.qdoc
+++ b/examples/charts/chartsgallery/doc/src/examples-barmodelmapper.qdoc
@@ -2,34 +2,28 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
- \example barmodelmapper
- \title BarModelMapper Example
- \ingroup qtcharts_examples
-
- \brief This example shows how to use QAbstractItemModel derived model as the data for the bar
- series.
+ \page qtcharts-barmodelmapper-example.html
+ \title Using Data Models with Bar Charts
+ \brief Shows how to use QAbstractItemModel derived model as the data for a bar series.
+ \include gallery.qdocinc
\image examples_barmodelmapper.png
- \include examples-run.qdocinc
-
- \section1 Using Data Models with Bar Charts
-
Let's start by creating an instance of CustomTableModel class.
The CustomTableModel class is derived from QAbstractTableModel, and it was created for the purpose of this example.
The constructor of this class populates the model's internal data store with the data required for our chart example.
- \snippet barmodelmapper/tablewidget.cpp 1
+ \snippet chartsgallery/barmodelmapperwidget.cpp 1
We now have a model with data that we would like to display both on the chart and in a QTableView.
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.
- \snippet barmodelmapper/tablewidget.cpp 2
+ \snippet chartsgallery/barmodelmapperwidget.cpp 2
Now we need a QChart instance to display the same data on the chart.
We also enable animations. It makes it easier to see how a modification to the model's data affects the chart.
- \snippet barmodelmapper/tablewidget.cpp 3
+ \snippet chartsgallery/barmodelmapperwidget.cpp 3
The first line of the code below creates new bar series. Variables firstRow and rowCount are used to define a custom model mapping.
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.
@@ -38,28 +32,28 @@
Finally the series is added to the chart.
- \snippet barmodelmapper/tablewidget.cpp 4
+ \snippet chartsgallery/barmodelmapperwidget.cpp 4
To show in QTableView which data corresponds with which bar set, this example uses table coloring.
When series is added to the chart, it is assigned a color based on the currently selected theme.
Code below extracts that color from the series and uses it to create colored QTableView.
Coloring of the view is not a part of the QChart functionality.
- \snippet barmodelmapper/tablewidget.cpp 5
+ \snippet chartsgallery/barmodelmapperwidget.cpp 5
We would like to have categories placed on the chart's axis that describe what the data means.
Next snippet shows how to do that.
- \snippet barmodelmapper/tablewidget.cpp 6
+ \snippet chartsgallery/barmodelmapperwidget.cpp 6
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.
To make the render look nicer Antialiasing is turned on and the minimum size of the chartView widget is set.
- \snippet barmodelmapper/tablewidget.cpp 7
+ \snippet chartsgallery/barmodelmapperwidget.cpp 7
Finally, we place both widgets in a layout and use the layout as the application layout.
- \snippet barmodelmapper/tablewidget.cpp 8
+ \snippet chartsgallery/barmodelmapperwidget.cpp 8
The application is ready. Try modifying the data in the table view and see how it affects the chart.
*/
diff --git a/src/charts/doc/src/examples-boxplotchart.qdoc b/examples/charts/chartsgallery/doc/src/examples-boxplotchart.qdoc
index f05e678d..8d6b73a7 100644
--- a/src/charts/doc/src/examples-boxplotchart.qdoc
+++ b/examples/charts/chartsgallery/doc/src/examples-boxplotchart.qdoc
@@ -2,84 +2,78 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
- \example boxplotchart
- \title Box and Whiskers Example
- \ingroup qtcharts_examples
-
- \brief The example shows how to create a box-and-whiskers chart.
+ \page qtcharts-boxplotchart-example.html
+ \title Creating Box-and-Whiskers Charts
+ \brief Shows how to create a box-and-whiskers chart.
+ \include gallery.qdocinc
The example also shows how to read the non-continuous data from a file,
arrange it and find medians needed for box-and-whiskers plotting.
\image examples_boxplotchart.png
- \include examples-run.qdocinc
-
- \section1 Creating Box-and-Whiskers Charts
-
To show the share deviation of two companies we start by creating two QBoxPlotSeries to handle monthly data.
- \snippet boxplotchart/main.cpp 1
+ \snippet chartsgallery/boxplotwidget.cpp 1
QFile class is used to open a text file where the non-continuous data is kept. The BoxDataReader is an auxiliary class for
reading the text file and finding the extreme and median values from the data. The BoxDataReader is explained in more detail later.
The method readBox reads the values and sets them to the QBoxSet item which the method returns for the caller. The returned QBoxSet
item is added to the series.
- \snippet boxplotchart/main.cpp 2
+ \snippet chartsgallery/boxplotwidget.cpp 2
In this section a second file is opened for reading the data for the second company.
- \snippet boxplotchart/main.cpp 3
+ \snippet chartsgallery/boxplotwidget.cpp 3
In this code snippet a new QChart instance is created and previously created series are added to it. The title is also defined and
animation is set to be SeriesAnimation.
- \snippet boxplotchart/main.cpp 4
+ \snippet chartsgallery/boxplotwidget.cpp 4
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
for the axis from the chart, and then setting the min and max for that axis.
- \snippet boxplotchart/main.cpp 5
+ \snippet chartsgallery/boxplotwidget.cpp 5
In this section we set the legends to be visible and place them at the bottom of the chart.
- \snippet boxplotchart/main.cpp 6
+ \snippet chartsgallery/boxplotwidget.cpp 6
Finally, we add the chart onto a view. We also turn on the antialiasing for the chartView.
- \snippet boxplotchart/main.cpp 7
+ \snippet chartsgallery/boxplotwidget.cpp 7
- The chart is ready to be shown. We set the chart to be the central widget of the window.
- We also set the size for the chart window and show it.
+ The chart is ready to be shown.
- \snippet boxplotchart/main.cpp 8
+ Here the method readBox is explained in detail.
- Here the method readBox is explained in detail. Firstly, a line is read from the file and lines starting with # are rejected
+ First, a line is read from the file and lines starting with # are rejected
since they are considered as comment lines.
- \snippet boxplotchart/boxdatareader.cpp 1
+ \snippet chartsgallery/boxplotdatareader.cpp 1
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
are stored on QStringList.
- \snippet boxplotchart/boxdatareader.cpp 2
+ \snippet chartsgallery/boxplotdatareader.cpp 2
The sortedList will hold the numbers in continuous order and in this code segment we show how to do it. First the sortedList is cleared and numbers
are read from the strList and stored into sortedList in double format. The qSort method arranges the sortedList into continuous order
starting from the smallest.
- \snippet boxplotchart/boxdatareader.cpp 3
+ \snippet chartsgallery/boxplotdatareader.cpp 3
Below you will find a code sample showing how to select extremes and medians from the continuous data. Firstly a new QBoxSet is created.
Lower and upper extremes are simple to select; they are just first and last items on the sortedList. For medians we use a helper
method findMedian which is explained later. For the median from the upper half we need to adjust the begin number if the
amount of the numbers is even or uneven. The end number for lower half comes naturally from int rounding.
- \snippet boxplotchart/boxdatareader.cpp 4
+ \snippet chartsgallery/boxplotdatareader.cpp 4
Below you will find the code sample for the method findMedian. If the amount of numbers is uneven we select the number from
the middle. For even amount numbers we take two numbers from the middle and calculate the mean value.
- \snippet boxplotchart/boxdatareader.cpp 5
+ \snippet chartsgallery/boxplotdatareader.cpp 5
*/
diff --git a/src/charts/doc/src/examples-callout.qdoc b/examples/charts/chartsgallery/doc/src/examples-callout.qdoc
index 56b2a8c2..75439c92 100644
--- a/src/charts/doc/src/examples-callout.qdoc
+++ b/examples/charts/chartsgallery/doc/src/examples-callout.qdoc
@@ -2,19 +2,17 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
- \example callout
- \title Callout Example
- \ingroup qtcharts_examples
-
- \brief This example shows how to draw an additional element (a callout) on top of the chart.
+ \page qtcharts-callout-example.html
+ \title Drawing a Callout on Top of a Chart
+ \brief Shows how to draw an additional element (a callout) on top of a chart.
+ \include gallery.qdocinc
\image examples_callout.png
- QChart class provides two methods that map between the scene coordinates and the series domain
+ The QChart class provides two methods that map between the scene coordinates and the series domain
(defined by the axes ranges).
QPointF QChart::mapToPosition(const QPointF &value, QAbstractSeries *series)
QPointF QChart::mapToValue(const QPointF &position, QAbstractSeries *series)
- \include examples-run.qdocinc
*/
diff --git a/src/charts/doc/src/examples-candlestickchart.qdoc b/examples/charts/chartsgallery/doc/src/examples-candlestickchart.qdoc
index 265c66eb..91c4f462 100644
--- a/src/charts/doc/src/examples-candlestickchart.qdoc
+++ b/examples/charts/chartsgallery/doc/src/examples-candlestickchart.qdoc
@@ -2,22 +2,16 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
- \example candlestickchart
- \title Candlestick Chart Example
- \ingroup qtcharts_examples
-
+ \page qtcharts-candlestickchart-example.html
+ \title Creating Candlestick Charts
\brief Shows how to create a candlestick chart.
-
+ \include gallery.qdocinc
\image examples_candlestickchart.png
- \include examples-run.qdocinc
-
- \section1 Creating Candlestick Charts
-
To display a candlestick chart, we start by creating QCandlestickSeries to handle daily data. We
are also specifying custom increasing and decreasing body colors.
- \snippet candlestickchart/main.cpp 1
+ \snippet chartsgallery/candlestickwidget.cpp 1
QFile is used for accessing a text file where the non-continuous data is kept. The
\c CandlestickDataReader is an auxiliary class for reading the text file and finding the open,
@@ -26,13 +20,13 @@
QCandlestickSet item which the method returns for the caller. The returned QCandlestickSet item
is added to the series. We are also saving custom categories list for later use.
- \snippet candlestickchart/main.cpp 2
+ \snippet chartsgallery/candlestickwidget.cpp 2
Below, a new QChart instance is created and the previously created series object is added to it.
We also define a title, and set an animation as
\l {QChart::AnimationOption} {QChart::SeriesAnimation}.
- \snippet candlestickchart/main.cpp 3
+ \snippet chartsgallery/candlestickwidget.cpp 3
Here, we ask the chart to create default axes for our presentation. Then, we set custom
categories for the horizontal axis by querying the pointer for the axis from the chart, and then
@@ -40,38 +34,35 @@
the vertical axis by querying the pointer for the axis from the chart, and then setting the min
and max values for that axis.
- \snippet candlestickchart/main.cpp 4
+ \snippet chartsgallery/candlestickwidget.cpp 4
Below, we set the legend to be visible and place it at the bottom of the chart.
- \snippet candlestickchart/main.cpp 5
-
- Finally, we add the chart onto a view. We also turn on the antialiasing for the chartView.
+ \snippet chartsgallery/candlestickwidget.cpp 5
- \snippet candlestickchart/main.cpp 6
+ Finally, we add the chart onto a view.
- The chart is ready to be shown. We set the chart to be the central widget of the window. We also
- set the size for the chart window and show it.
+ \snippet chartsgallery/candlestickwidget.cpp 6
- \snippet candlestickchart/main.cpp 7
+ The chart is ready to be shown.
Here, the method \c readCandlestickSet() is explained in detail. First, a line is read from
the file, rejecting any lines starting with # as they are considered comment lines.
- \snippet candlestickchart/candlestickdatareader.cpp 1
+ \snippet chartsgallery/candlestickdatareader.cpp 1
In the file, the data is arranged as a space-delimited sequence of numbers. On this snippet the
line is split into single number strings which are stored in a QStringList.
- \snippet candlestickchart/candlestickdatareader.cpp 2
+ \snippet chartsgallery/candlestickdatareader.cpp 2
To select values from the continuous data, following code is used. The values in a \c strList
are stored in the following order: timestamp, open, high, low, close.
- \snippet candlestickchart/candlestickdatareader.cpp 3
+ \snippet chartsgallery/candlestickdatareader.cpp 3
Finally, the following snippet shows how to create a new QCandlestickSet and provide it with all
the necessary values.
- \snippet candlestickchart/candlestickdatareader.cpp 4
+ \snippet chartsgallery/candlestickdatareader.cpp 4
*/
diff --git a/src/charts/doc/src/examples-chartthemes.qdoc b/examples/charts/chartsgallery/doc/src/examples-chartthemes.qdoc
index 5ac4a7b6..a458c17a 100644
--- a/src/charts/doc/src/examples-chartthemes.qdoc
+++ b/examples/charts/chartsgallery/doc/src/examples-chartthemes.qdoc
@@ -2,21 +2,18 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
- \example chartthemes
- \title Chart Themes Example
- \ingroup qtcharts_examples
+ \page qtcharts-chartthemes-example.html
+ \title Creating Charts With Themes
+ \brief Shows the look and feel of the different built-in themes.
+ \include gallery.qdocinc
- \brief The example shows the look and feel of the different built-in themes.
-
- This example shows the look and feel of the different built-in themes for some of the supported
+ Here change the look and feel of the different built-in themes for some of the supported
chart types.
\image examples_chartthemes_light.png
\image examples_chartthemes_brown_sand.png
\image examples_chartthemes_blue_cerulean.png
- \include examples-run.qdocinc
-
\section1 Creating Charts
The charts of different types are generated and added to the layout separately. For example, the
@@ -24,42 +21,36 @@
First a chart is created.
- \snippet chartthemes/themewidget.cpp 1
+ \snippet chartsgallery/themewidget.cpp 1
A common set of random data is generated and placed in a list. This list is used in each chart
type to add data to the series of the chart. For the line series, QLineSeries instances are
created and added to the chart.
- \snippet chartthemes/themewidget.cpp 2
+ \snippet chartsgallery/themewidget.cpp 2
Default axes are created for the line series. We also specify ranges for the axes based on the
range of the data used for the series.
- \snippet chartthemes/themewidget.cpp 3
+ \snippet chartsgallery/themewidget.cpp 3
We also want to add more space between the labels and the y-axes. For this we specify a label
format that adds space characters to the labels.
- \snippet chartthemes/themewidget.cpp 4
+ \snippet chartsgallery/themewidget.cpp 4
Finally the line chart is added to the grid layout.
- \snippet chartthemes/themewidget.cpp 5
+ \snippet chartsgallery/themewidget.cpp 5
\section1 Changing Theme
The user can select a built-in theme to be used in the example. This theme is then applied to
all charts in the layout.
- \snippet chartthemes/themewidget.cpp 6
-
- \snippet chartthemes/themewidget.cpp 7
-
- In order to give the result a more harmonious look, the background palette of the application is
- customized to match the selected theme. The QPalette::Window and QPalette::WindowText roles are
- set based on the selected theme.
-
- \snippet chartthemes/themewidget.cpp 8
+ \snippet chartsgallery/themewidget.cpp 6
+ \dots
+ \snippet chartsgallery/themewidget.cpp 7
\section1 Changing Animation, Legend and Anti-Aliasing
@@ -69,15 +60,15 @@
Based on the user's selection, the used animation type is set on each chart. It is possible to have
no animations in the chart, or have animations for grid axis or series, or both.
- \snippet chartthemes/themewidget.cpp 9
+ \snippet chartsgallery/themewidget.cpp 9
The chart can be shown with a legend. The legend can be aligned to different sides of the chart.
- \snippet chartthemes/themewidget.cpp 10
+ \snippet chartsgallery/themewidget.cpp 10
The user can also see how changing anti-aliasing option changes the appearance of the chart.
Anti-aliasing is updated based on the user's selection.
- \snippet chartthemes/themewidget.cpp 11
+ \snippet chartsgallery/themewidget.cpp 11
*/
diff --git a/src/charts/doc/src/examples-customchart.qdoc b/examples/charts/chartsgallery/doc/src/examples-customchart.qdoc
index d576b0e9..1d494461 100644
--- a/src/charts/doc/src/examples-customchart.qdoc
+++ b/examples/charts/chartsgallery/doc/src/examples-customchart.qdoc
@@ -2,32 +2,27 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
- \example customchart
- \title Custom Chart Example
- \ingroup qtcharts_examples
+ \page qtcharts-customchart-example.html
+ \title Customizing Charts
+ \brief Shows how to customize the appearance of chart elements.
- \brief This example shows how to customize the appearance of the different elements on a chart.
+ \include gallery.qdocinc
\image examples_customchart.png
- \include examples-run.qdocinc
-
- \section1 Customizing Charts
-
We begin by creating a simple line series and a chart object.
- \snippet customchart/main.cpp 1
+ \snippet chartsgallery/customchartwidget.cpp 1
First we customize the series and the chart's title and background.
- \snippet customchart/main.cpp 2
+ \snippet chartsgallery/customchartwidget.cpp 2
Then we customize the axes.
- \snippet customchart/main.cpp 3
+ \snippet chartsgallery/customchartwidget.cpp 3
Then the axis label values and ranges. Once the axes are ready, we set them to be used by the chart.
- \snippet customchart/main.cpp 4
+ \snippet chartsgallery/customchartwidget.cpp 4
Finally, we create a view containing the chart.
- \snippet customchart/main.cpp 5
+ \snippet chartsgallery/customchartwidget.cpp 5
Now we are ready to show the chart on a main window.
- \snippet customchart/main.cpp 6
*/
diff --git a/src/charts/doc/src/examples-datetimeaxis.qdoc b/examples/charts/chartsgallery/doc/src/examples-datetimeaxis.qdoc
index a73a130a..15c9eb31 100644
--- a/src/charts/doc/src/examples-datetimeaxis.qdoc
+++ b/examples/charts/chartsgallery/doc/src/examples-datetimeaxis.qdoc
@@ -2,12 +2,10 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
- \example datetimeaxis
- \title DateTimeAxis Example
- \ingroup qtcharts_examples
-
- \brief The example shows how to use QLineChart with QDateTimeAxis.
-
+ \page qtcharts-datetimeaxis-example.html
+ \title Line Charts with Date and Time Axes
+ \brief Shows how to use QLineChart with QDateTimeAxis.
+ \include gallery.qdocinc
\image examples_datetimeaxis.png
\include examples-run.qdocinc
@@ -16,30 +14,31 @@
To create line chart, QLineSeries instance is needed. Let's create one.
- \snippet datetimeaxis/main.cpp 1
+ \snippet chartsgallery/datetimeaxiswidget.cpp 1
- 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.
- 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.
+ 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.
- \snippet datetimeaxis/main.cpp 2
+ 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.
+
+ \snippet chartsgallery/datetimeaxiswidget.cpp 2
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.
- \snippet datetimeaxis/main.cpp 3
+ \snippet chartsgallery/datetimeaxiswidget.cpp 3
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.
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.
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.
Please refer to the QDateTime::toString() method documentation to learn about the available format options.
- \snippet datetimeaxis/main.cpp 4
+ \snippet chartsgallery/datetimeaxiswidget.cpp 4
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.
- \snippet datetimeaxis/main.cpp 5
+ \snippet chartsgallery/datetimeaxiswidget.cpp 5
The chart is ready to be shown.
- \snippet datetimeaxis/main.cpp 6
-
*/
diff --git a/src/charts/doc/src/examples-donutbreakdown.qdoc b/examples/charts/chartsgallery/doc/src/examples-donutbreakdown.qdoc
index 444a2a3e..36e221bf 100644
--- a/src/charts/doc/src/examples-donutbreakdown.qdoc
+++ b/examples/charts/chartsgallery/doc/src/examples-donutbreakdown.qdoc
@@ -2,51 +2,50 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
- \example donutbreakdown
- \title Donut Chart Breakdown Example
- \ingroup qtcharts_examples
-
- \brief This example shows how to use create a donut breakdown chart using QPieSeries API.
+ \page qtcharts-donutbreakdown-example.html
+ \title Creating a Donut Breakdown Chart
+ \brief Shows how to create a donut breakdown chart.
+ \include gallery.qdocinc
\image examples_donutbreakdown.png
- \include examples-run.qdocinc
\section1 Creating Donut Breakdown Charts
Let's start by defining some data for the chart.
- \snippet donutbreakdown/main.cpp 1
+ \snippet chartsgallery/donutbreakdownwidget.cpp 1
Then we create a chart where we add the data. Note that this is our own chart derived from QChart.
- \snippet donutbreakdown/main.cpp 2
+ \snippet chartsgallery/donutbreakdownwidget.cpp 2
Our own chart works in such a way that we create a main series in the constructor we create a main series,
which aggregates the data provided by the breakdown series. This is the piechart in the center.
- \snippet donutbreakdown/donutbreakdownchart.cpp 1
+ \snippet chartsgallery/donutbreakdownchart.cpp 1
When a breakdown series is added the data is used to create a slice in the main series and the
breakdown series itself is used to create a segment of a donut positioned so that it is aligned
with the corresponding slice in the main series.
- \snippet donutbreakdown/donutbreakdownchart.cpp 2
+ \snippet chartsgallery/donutbreakdownchart.cpp 2
Here's how the start and end angles for the donut segments are calculated.
- \snippet donutbreakdown/donutbreakdownchart.cpp 3
+ \snippet chartsgallery/donutbreakdownchart.cpp 3
The legend markers are customized to show the breakdown percentage. The markers for the main level slices are hidden.
- \snippet donutbreakdown/donutbreakdownchart.cpp 4
+ \snippet chartsgallery/donutbreakdownchart.cpp 4
Instead the main level slices show the percentage on the label.
- \snippet donutbreakdown/mainslice.cpp 1
- \snippet donutbreakdown/mainslice.cpp 2
+ \snippet chartsgallery/donutbreakdownmainslice.cpp 1
+ \dots
+ \snippet chartsgallery/donutbreakdownmainslice.cpp 2
Now that we have our chart defined, we can finally create a QChartView and show the chart.
- \snippet donutbreakdown/main.cpp 3
+ \snippet chartsgallery/donutbreakdownwidget.cpp 3
*/
diff --git a/src/charts/doc/src/examples-horizontalbarchart.qdoc b/examples/charts/chartsgallery/doc/src/examples-horizontalbarchart.qdoc
index 122ff30a..535d3a79 100644
--- a/src/charts/doc/src/examples-horizontalbarchart.qdoc
+++ b/examples/charts/chartsgallery/doc/src/examples-horizontalbarchart.qdoc
@@ -2,37 +2,32 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
- \example horizontalbarchart
- \title HorizontalBarChart Example
- \ingroup qtcharts_examples
-
- \brief The example shows how to create a horizontal bar chart.
+ \page qtcharts-horizontalbarchart-example.html
+ \title Creating Horizontal Bar Charts
+ \brief Shows how to create a horizontal bar chart.
+ \include gallery.qdocinc
QHorizontalBarChart shows the data in sets as separate bars, which are grouped in categories. QHorizontalBarChart works just like
QBarChart, except that the bars are drawn horizontally on the chart.
\image examples_horizontalbarchart.png
- \include examples-run.qdocinc
-
- \section1 Creating Horizontal Bar Charts
-
The bar sets are used in the same way in all bar charts.
To illustrate the difference between various bar charts, we use the same data in all examples.
Data that bar chart visualizes, is defined by QBarSet instances. Here we create the sets and append data
to them. The data is appended here with << operator. Alternatively, the append method could also be used.
- \snippet horizontalbarchart/main.cpp 1
+ \snippet chartsgallery/horizontalbarwidget.cpp 1
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.
The first values of each set are grouped together in the first category; the second values in the second category, and so on.
- \snippet horizontalbarchart/main.cpp 2
+ \snippet chartsgallery/horizontalbarwidget.cpp 2
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
setAnimationOptions(QChart::SeriesAnimations).
- \snippet horizontalbarchart/main.cpp 3
+ \snippet chartsgallery/horizontalbarwidget.cpp 3
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
@@ -40,19 +35,16 @@
attach it to the series. The chart takes ownership of the axis. For x-axis
we use a value axis, aligned to the bottom.
- \snippet horizontalbarchart/main.cpp 4
+ \snippet chartsgallery/horizontalbarwidget.cpp 4
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
to Qt::AlignBottom.
- \snippet horizontalbarchart/main.cpp 5
+ \snippet chartsgallery/horizontalbarwidget.cpp 5
Finally we add the chart onto a view. We also turn on the antialiasing for the chartView.
- \snippet horizontalbarchart/main.cpp 6
-
- The chart is ready to be shown. We set the chart to be the central widget of the window.
- We also set the size for the chart window and show it.
+ \snippet chartsgallery/horizontalbarwidget.cpp 6
- \snippet horizontalbarchart/main.cpp 7
+ The chart is ready to be shown.
*/
diff --git a/src/charts/doc/src/examples-horizontalpercentbarchart.qdoc b/examples/charts/chartsgallery/doc/src/examples-horizontalpercentbarchart.qdoc
index e17c468d..5bec2210 100644
--- a/src/charts/doc/src/examples-horizontalpercentbarchart.qdoc
+++ b/examples/charts/chartsgallery/doc/src/examples-horizontalpercentbarchart.qdoc
@@ -2,42 +2,37 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
- \example horizontalpercentbarchart
- \title HorizontalPercentBarChart Example
- \ingroup qtcharts_examples
-
- \brief The example shows how to create a simple horizontal percent bar chart.
+ \page qtcharts-horizontalpercentbarchart-example.html
+ \title Creating Horizontal Percent Bar Charts
+ \brief Shows how to create a simple horizontal percent bar chart.
+ \include gallery.qdocinc
The horizontal percent bar chart shows the data in a set as a percentage of
all sets per category.
- Creating a horizontal percent bar chart is just like creating a regular \l {BarChart Example} {bar chart}, except that for a
+ Creating a horizontal percent bar chart is just like creating a regular \l {Creating Bar Charts} {bar chart}, except that for a
horizontal percent bar chart, we use the QHorizontalPercentBarSeries api instead of QBarSeries. Also, in the
- \l {BarChart Example} {bar chart}, we used a nice numbers algorithm to make the y-axis numbering look better. With
+ \l {Creating Bar Charts} {bar chart}, we used a nice numbers algorithm to make the y-axis numbering look better. With
the percent bar chart there is no need for that, because the maximum y-axis value is always 100.
\image examples_horizontalpercentbarchart.png
- \include examples-run.qdocinc
-
- \section1 Creating Horizontal Percent Bar Charts
-
The barsets are used in same way in all barcharts.
To illustrate the difference between various barcharts, we use same data in examples.
The data which the bar chart visualizes is defined by QBarSet instances. Here we create the sets and append data
to them. The data is appended here with << operator. Alternatively the append method could be used.
- \snippet horizontalpercentbarchart/main.cpp 1
+ \snippet chartsgallery/horizontalpercentbarwidget.cpp 1
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.
The first values of each set are grouped together in the first category, the second value in the second category etc.
- \snippet horizontalpercentbarchart/main.cpp 2
+ \snippet chartsgallery/horizontalpercentbarwidget.cpp 2
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
setAnimationOptions(QChart::SeriesAnimations)
- \snippet horizontalpercentbarchart/main.cpp 3
+ \snippet chartsgallery/horizontalpercentbarwidget.cpp 3
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
@@ -45,20 +40,16 @@
y-axis. The chart takes ownership of the axis. For x-axis we use a value
axis, aligned to the bottom.
- \snippet horizontalpercentbarchart/main.cpp 4
+ \snippet chartsgallery/horizontalpercentbarwidget.cpp 4
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 bottom of the chart by setting its
alignment to Qt::AlignBottom.
- \snippet horizontalpercentbarchart/main.cpp 5
-
- Finally, we add the chart onto a view. We also turn on the antialiasing for the chartView.
+ \snippet chartsgallery/horizontalpercentbarwidget.cpp 5
- \snippet horizontalpercentbarchart/main.cpp 6
+ Finally, we add the chart onto a view.
- The chart is ready to be shown. We set the chart to be the central widget of the window.
- We also set the size for the chart window and show it.
+ \snippet chartsgallery/horizontalpercentbarwidget.cpp 6
- \snippet horizontalpercentbarchart/main.cpp 7
*/
diff --git a/src/charts/doc/src/examples-horizontalstackedbarchart.qdoc b/examples/charts/chartsgallery/doc/src/examples-horizontalstackedbarchart.qdoc
index 4f5bd3ec..9089aa3a 100644
--- a/src/charts/doc/src/examples-horizontalstackedbarchart.qdoc
+++ b/examples/charts/chartsgallery/doc/src/examples-horizontalstackedbarchart.qdoc
@@ -2,39 +2,34 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
- \example horizontalstackedbarchart
- \title HorizontalStackedBarChart Example
- \ingroup qtcharts_examples
-
- \brief The example shows how to create a simple stacked horizontal bar chart.
+ \page qtcharts-horizontalstackedbarchart-example.html
+ \title Creating Horizontal Stacked Bar Charts
+ \brief Shows how to create a simple stacked horizontal bar chart.
+ \include gallery.qdocinc
The stacked bar chart shows the data in sets as bars that are
stacked on top of each other. The stacking is done per category.
- Creating a stacked horizontal bar chart is just like creating a regular \l {BarChart Example} {bar chart}, except that for a
+ Creating a stacked horizontal bar chart is just like creating a regular \l {Creating Bar Charts} {bar chart}, except that for a
stacked horizontal bar chart, we use the QHorizontalStackedBarSeries api instead of QBarSeries.
\image examples_horizontalstackedbarchart.png
- \include examples-run.qdocinc
-
- \section1 Creating Horizontal Stacked Bar Charts
-
The bar sets are used in same way in all bar charts.
To illustrate the difference between various barcharts, we use the same data in all examples.
The data that barchart visualizes, is defined by the QBarSet instances. Here we create the sets and append data
to them. The data is appended here with the << operator. Alternatively, the append method could also be used.
- \snippet horizontalstackedbarchart/main.cpp 1
+ \snippet chartsgallery/horizontalstackedbarwidget.cpp 1
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.
The first values of each set are grouped together in the first category, the second values in the second category and so on.
- \snippet horizontalstackedbarchart/main.cpp 2
+ \snippet chartsgallery/horizontalstackedbarwidget.cpp 2
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
setAnimationOptions(QChart::SeriesAnimations).
- \snippet horizontalstackedbarchart/main.cpp 3
+ \snippet chartsgallery/horizontalstackedbarwidget.cpp 3
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
@@ -42,20 +37,16 @@
y-axis. The chart takes ownership of the axis. For x-axis we use a value
axis, aligned to the bottom.
- \snippet horizontalstackedbarchart/main.cpp 4
+ \snippet chartsgallery/horizontalstackedbarwidget.cpp 4
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.
- \snippet horizontalstackedbarchart/main.cpp 5
-
- Finally we add the chart onto a view. We also turn on the antialiasing for the chartView.
+ \snippet chartsgallery/horizontalstackedbarwidget.cpp 5
- \snippet horizontalstackedbarchart/main.cpp 6
+ Finally we add the chart onto a view.
- The chart is ready to be shown. We set the chart to be the central widget of the window.
- We also set the size for the chart window and show it.
+ \snippet chartsgallery/horizontalstackedbarwidget.cpp 6
- \snippet horizontalstackedbarchart/main.cpp 7
*/
diff --git a/src/charts/doc/src/examples-legend.qdoc b/examples/charts/chartsgallery/doc/src/examples-legend.qdoc
index 5b028973..f84b5a2d 100644
--- a/src/charts/doc/src/examples-legend.qdoc
+++ b/examples/charts/chartsgallery/doc/src/examples-legend.qdoc
@@ -2,11 +2,10 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
- \example legend
- \title Legend Example
- \ingroup qtcharts_examples
-
- \brief This example shows how to detach the legend from the chart and how to attach it back.
+ \page qtcharts-legend-example.html
+ \title Detaching and Attaching Legends
+ \brief Shows how to detach the legend from the chart and attach it back.
+ \include gallery.qdocinc
By default, the chart draws the legend inside the same graphics view the chart is contained
within. In some cases, the user may want to draw the legend somewhere else. To make this
@@ -26,39 +25,34 @@
If the user drags the legend off of any side of the chart, it will automatically re-attach to
that side of the chart.
-
\image examples_legend_detach.png
\image examples_legend_detach2.png
- \include examples-run.qdocinc
-
- \section1 Detaching and Attaching Legends
-
Here we turn the legend visible and set its alignment to the bottom of the chart.
- \snippet legend/mainwidget.cpp 1
+ \snippet chartsgallery/legendwidget.cpp 1
This snippet shows how to detach the legend from the chart.
- \snippet legend/mainwidget.cpp 2
+ \snippet chartsgallery/legendwidget.cpp 2
Here we reattach the legend to the chart. The background is turned invisible.
- \snippet legend/mainwidget.cpp 3
+ \snippet chartsgallery/legendwidget.cpp 3
Here we connect to the signal emitted when the legend is detached or attached, turning its
background on when detached and off when attached. This makes it easier to see how the
items inside the legend are arranged when it is detached.
- \snippet legend/mainwidget.cpp 4
+ \snippet chartsgallery/legendwidget.cpp 4
This shows how to make the legend interactive to the user using a pointing device such as a
mouse.
- \snippet legend/mainwidget.cpp 5
+ \snippet chartsgallery/legendwidget.cpp 5
This shows how we set the detached legend dimensions if the legend is not interactive. After
setting the new values, we call update to show changes on screen.
- \snippet legend/mainwidget.cpp 6
+ \snippet chartsgallery/legendwidget.cpp 6
*/
diff --git a/src/charts/doc/src/examples-legendmarkers.qdoc b/examples/charts/chartsgallery/doc/src/examples-legendmarkers.qdoc
index aea0aa3d..d9cfa6a4 100644
--- a/src/charts/doc/src/examples-legendmarkers.qdoc
+++ b/examples/charts/chartsgallery/doc/src/examples-legendmarkers.qdoc
@@ -2,48 +2,43 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
- \example legendmarkers
- \title LegendMarkers Example
- \ingroup qtcharts_examples
-
- \brief The example shows how to make use of legend markers.
+ \page qtcharts-legendmarkers-example.html
+ \title Using Legend Markers
+ \brief Shows how to make use of legend markers.
+ \include gallery.qdocinc
In this example we create an application which uses the QLegendMarker clicked signal to show/hide the corresponding series
in a chart. The connect marker button connects a clicked signal from all markers in a legend to the handleMarkerClicked slot.
\image examples_legendmarkers.png
- \include examples-run.qdocinc
-
- \section1 Using Legend Markers
-
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.
In the image above we have connected the markers and clicked on one of them.
- \snippet legendmarkers/mainwidget.cpp 1
+ \snippet chartsgallery/legendmarkerswidget.cpp 1
Here we connect the markers in the legend to our handler. To avoid connecting the same marker more than once, we first disconnect it.
- \snippet legendmarkers/mainwidget.cpp 2
+ \snippet chartsgallery/legendmarkerswidget.cpp 2
Here we disconnect all markers from our handler.
- \snippet legendmarkers/mainwidget.cpp 3
+ \snippet chartsgallery/legendmarkerswidget.cpp 3
In our handler we first cast the sender of the event to the QLegendMarker.
- \snippet legendmarkers/mainwidget.cpp 4
+ \snippet chartsgallery/legendmarkerswidget.cpp 4
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.
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.
- \snippet legendmarkers/mainwidget.cpp 5
+ \snippet chartsgallery/legendmarkerswidget.cpp 5
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.
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
invisible in the legend and we can't click on it anymore.
- \snippet legendmarkers/mainwidget.cpp 6
+ \snippet chartsgallery/legendmarkerswidget.cpp 6
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.
diff --git a/src/charts/doc/src/examples-lineandbarchart.qdoc b/examples/charts/chartsgallery/doc/src/examples-lineandbarchart.qdoc
index 778f43e8..3f1befc7 100644
--- a/src/charts/doc/src/examples-lineandbarchart.qdoc
+++ b/examples/charts/chartsgallery/doc/src/examples-lineandbarchart.qdoc
@@ -2,54 +2,46 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
- \example lineandbar
- \title Line and BarChart Example
- \ingroup qtcharts_examples
-
- \brief The example shows how to combine different charts and set the axes.
+ \page qtcharts-lineandbar-example.html
+ \title Combining Line and BarChart
+ \brief Shows how to combine different charts and set the axes.
+ \include gallery.qdocinc
In the example we combine a linechart with
a barchart and use the category axis as a common axis for both.
\image examples_lineandbar.png
- \include examples-run.qdocinc
-
- \section1 Combining Charts
-
Here we create data for our bar series.
- \snippet lineandbar/main.cpp 1
+ \snippet chartsgallery/lineandbarwidget.cpp 1
We create a bar series and append sets to it.
The first values of each set are grouped together in the first category, the second values in the second category and so on.
- \snippet lineandbar/main.cpp 2
+ \snippet chartsgallery/lineandbarwidget.cpp 2
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
first point is at (0,value) second at (1,value) and so on.
- \snippet lineandbar/main.cpp 8
+ \snippet chartsgallery/lineandbarwidget.cpp 8
Here we create the chart and add both series to it.
- \snippet lineandbar/main.cpp 3
+ \snippet chartsgallery/lineandbarwidget.cpp 3
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
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
same axis. For the x-axis we use the QBarCategoryAxis and for the y-axis we use QValuesAxis.
- \snippet lineandbar/main.cpp 4
+ \snippet chartsgallery/lineandbarwidget.cpp 4
And we also want to show the legend.
- \snippet lineandbar/main.cpp 5
+ \snippet chartsgallery/lineandbarwidget.cpp 5
Finally we add the chart onto a view.
- \snippet lineandbar/main.cpp 6
-
- Now it is ready to be shown in a window.
+ \snippet chartsgallery/lineandbarwidget.cpp 6
- \snippet lineandbar/main.cpp 7
*/
diff --git a/src/charts/doc/src/examples-linechart.qdoc b/examples/charts/chartsgallery/doc/src/examples-linechart.qdoc
index eef586b1..e4433066 100644
--- a/src/charts/doc/src/examples-linechart.qdoc
+++ b/examples/charts/chartsgallery/doc/src/examples-linechart.qdoc
@@ -2,36 +2,28 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
- \example linechart
- \title LineChart Example
- \ingroup qtcharts_examples
-
- \brief The example shows how to create a simple line chart.
+ \page qtcharts-linechart-example.html
+ \title Creating Line Charts
+ \brief Shows how to create a simple line chart.
+ \include gallery.qdocinc
\image examples_linechart.png
- \include examples-run.qdocinc
-
- \section1 Creating Line Charts
-
To create a line chart, a QLineSeries instance is needed. Let's create one.
- \snippet linechart/main.cpp 1
+ \snippet chartsgallery/linewidget.cpp 1
Then we add data to the series. We can use the append() member function or use the stream operator.
- \snippet linechart/main.cpp 2
+ \snippet chartsgallery/linewidget.cpp 2
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.
- \snippet linechart/main.cpp 3
+ \snippet chartsgallery/linewidget.cpp 3
- 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.
+ Then we create a QChartView object with QChart as a parameter. This way we don't need to create a QGraphicsView scene ourselves.
- \snippet linechart/main.cpp 4
+ \snippet chartsgallery/linewidget.cpp 4
The chart is ready to be shown.
-
- \snippet linechart/main.cpp 5
-
*/
diff --git a/examples/charts/chartsgallery/doc/src/examples-logvalueaxis.qdoc b/examples/charts/chartsgallery/doc/src/examples-logvalueaxis.qdoc
new file mode 100644
index 00000000..69d32fd6
--- /dev/null
+++ b/examples/charts/chartsgallery/doc/src/examples-logvalueaxis.qdoc
@@ -0,0 +1,30 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
+
+/*!
+ \page qtcharts-logvalueaxis-example.html
+ \title Using Logarithmic Value Axes
+ \brief Shows how to use QLogValueAxis.
+ \include gallery.qdocinc
+
+ \image examples_logvalueaxis.png
+
+ Create a QLineSeries instance and add some data to it.
+
+ \snippet chartsgallery/logaxiswidget.cpp 1
+
+ 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.
+
+ \snippet chartsgallery/logaxiswidget.cpp 2
+
+ Create the axes. Add them to the chart and attach to the series.
+
+ \snippet chartsgallery/logaxiswidget.cpp 3
+
+ Then create a QChartView object with QChart as a parameter.
+
+ \snippet chartsgallery/logaxiswidget.cpp 4
+
+ The chart is ready to be shown.
+
+*/
diff --git a/src/charts/doc/src/examples-modeldata.qdoc b/examples/charts/chartsgallery/doc/src/examples-modeldata.qdoc
index 75d5357c..c13a7083 100644
--- a/src/charts/doc/src/examples-modeldata.qdoc
+++ b/examples/charts/chartsgallery/doc/src/examples-modeldata.qdoc
@@ -2,34 +2,28 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
- \example modeldata
- \title Model Data Example
- \ingroup qtcharts_examples
-
- \brief This example shows how to use the QAbstractItemModel derived model as the data for the
- series.
+ \page qtcharts-modeldata-example.html
+ \title Using Model Data
+ \brief Shows how to use the QAbstractItemModel derived model as series data.
+ \include gallery.qdocinc
\image examples_modeldata.png
- \include examples-run.qdocinc
-
- \section1 Using Model Data
-
Let's start by creating an instance of the CustomTableModel class.
The CustomTableModel class is derived from QAbstractTableModel and it was created for the purpose of this example.
The constructor of this class populates the internal data store of the model with the data that is suitable for our chart example.
- \snippet modeldata/tablewidget.cpp 1
+ \snippet chartsgallery/modeldatawidget.cpp 1
We now have a model with data that we would like to display both on the chart and in a QTableView.
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.
- \snippet modeldata/tablewidget.cpp 2
+ \snippet chartsgallery/modeldatawidget.cpp 2
Now we need the QChart instance to display the same data on the chart.
We also enable animations. It makes it easier to see how modifying the model's data affect the chart.
- \snippet modeldata/tablewidget.cpp 3
+ \snippet chartsgallery/modeldatawidget.cpp 3
The code below creates new line series and gives it a name. The following line creates an instance of QVXYModelMapper class.
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.
@@ -37,30 +31,30 @@
Finally, the series is added to the chart.
- \snippet modeldata/tablewidget.cpp 4
+ \snippet chartsgallery/modeldatawidget.cpp 4
To show in QTableView which data corresponds with which series this example uses table coloring.
When a series is added to the chart it is assigned a color based on the currently selected theme.
The code below extracts that color from the series and uses it to create a colored QTableView.
The coloring of the view is not a part of the QChart functionality.
- \snippet modeldata/tablewidget.cpp 5
+ \snippet chartsgallery/modeldatawidget.cpp 5
The same operations are done with a second series. Notice that for this series different columns of the same model are mapped.
- \snippet modeldata/tablewidget.cpp 6
+ \snippet chartsgallery/modeldatawidget.cpp 6
- \snippet modeldata/tablewidget.cpp 7
+ \snippet chartsgallery/modeldatawidget.cpp 7
To avoid setting up the QGraphicsScene we use the QChartView class that does it for us.
QChart object pointer is used as a parameter of the QChartView constructor.
To make the chart look nicer, Antialiasing is turned on and the minimum size of the chartView widget is set.
- \snippet modeldata/tablewidget.cpp 8
+ \snippet chartsgallery/modeldatawidget.cpp 8
Finally we place both widgets in a layout and use the layout as the application layout.
- \snippet modeldata/tablewidget.cpp 9
+ \snippet chartsgallery/modeldatawidget.cpp 9
The application is ready. Try modifying the data in the table view and see how it affects the chart.
*/
diff --git a/src/charts/doc/src/examples-multiaxis.qdoc b/examples/charts/chartsgallery/doc/src/examples-multiaxis.qdoc
index 62233da0..ce1e06f9 100644
--- a/src/charts/doc/src/examples-multiaxis.qdoc
+++ b/examples/charts/chartsgallery/doc/src/examples-multiaxis.qdoc
@@ -2,43 +2,33 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
- \example multiaxis
- \title Multiple Axes Example
- \ingroup qtcharts_examples
-
- \brief The example shows how to create a simple chart with two vertical axes. One for each
- series.
+ \page qtcharts-multiaxis-example.html
+ \title Using Multiple Axes
+ \brief Shows how to create a chart with a vertical axis for each series.
+ \include gallery.qdocinc
\image examples_multiaxis.png
- \include examples-run.qdocinc
-
- \section1 Using Multiple Axes
-
Create the QChart instance, hide the legend of the chart, and set its title.
- \snippet multiaxis/main.cpp 1
+ \snippet chartsgallery/multiaxiswidget.cpp 1
Create a QValueAxis instance that will be used as a horizontal axis by both series and add it the bottom of the chart.
The axis can be shared between many series, but each series can have only one vertical and horizontal axis.
- \snippet multiaxis/main.cpp 2
+ \snippet chartsgallery/multiaxiswidget.cpp 2
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.
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.
- \snippet multiaxis/main.cpp 3
+ \snippet chartsgallery/multiaxiswidget.cpp 3
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.
- \snippet multiaxis/main.cpp 4
-
- Create a QChartView object with QChart as a parameter. Enable Antialiasing to have the rendered splines look nicer.
-
- \snippet multiaxis/main.cpp 5
+ \snippet chartsgallery/multiaxiswidget.cpp 4
- The chart is ready to be shown.
+ Create a QChartView object with QChart as a parameter.
- \snippet multiaxis/main.cpp 6
+ \snippet chartsgallery/multiaxiswidget.cpp 5
*/
diff --git a/src/charts/doc/src/examples-nesteddonuts.qdoc b/examples/charts/chartsgallery/doc/src/examples-nesteddonuts.qdoc
index 061c45b2..ee8c2b66 100644
--- a/src/charts/doc/src/examples-nesteddonuts.qdoc
+++ b/examples/charts/chartsgallery/doc/src/examples-nesteddonuts.qdoc
@@ -2,26 +2,22 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
- \example nesteddonuts
- \title Nested Donuts Example
- \ingroup qtcharts_examples
+ \page qtcharts-nesteddonuts-example.html
+ \title Creating Nested Donut Charts
+ \brief Shows how to create a nested donut chart using the QPieSeries API.
+ \include gallery.qdocinc
- \brief This example shows how to create a nested donuts chart using the QPieSeries API.
\image examples_nesteddonuts.png
- \include examples-run.qdocinc
-
- \section1 Creating Nested Donut Charts
-
Let's start by creating a QChartView instance and enabling the Antialiasing on it. A QChart object is then obtained from the QChartView instance.
The legend is disabled and the title of the chart is set. Last line enables the animations of the chart.
- \snippet nesteddonuts/widget.cpp 1
+ \snippet chartsgallery/nesteddonutswidget.cpp 1
Three variables are defined that will be used to define the donut chart. Min and max size define the relative size of the whole donut.
minSize is the relative inner size of the smallest donut. maxSize is the relative outer size of the biggest donut.
- \snippet nesteddonuts/widget.cpp 2
+ \snippet chartsgallery/nesteddonutswidget.cpp 2
The following block of code defines the individual donuts and their slices. First a new QPieSeries object is created.
The number of slices in each donut is randomized.
@@ -31,20 +27,20 @@
Finally the slice is added to the donut. The donut's size is adjusted to achieve the nesting of the donuts.
Then the donut is added to the widget's list of donuts and to the chart.
- \snippet nesteddonuts/widget.cpp 3
+ \snippet chartsgallery/nesteddonutswidget.cpp 3
Finally the widget is placed in a layout used by the application.
- \snippet nesteddonuts/widget.cpp 4
+ \snippet chartsgallery/nesteddonutswidget.cpp 4
To make the example more interesting the donuts are rotated randomly every 1.25 sec.
- \snippet nesteddonuts/widget.cpp 5
+ \snippet chartsgallery/nesteddonutswidget.cpp 5
The widget's updatedRotation slot is defined below.
It goes through all of the donuts and modifies their current rotation by a random value.
- \snippet nesteddonuts/widget.cpp 6
+ \snippet chartsgallery/nesteddonutswidget.cpp 6
The earlier mentioned explodeSlice slot code is provided below.
If the slice is set to exploded, then stop the timer that controls the donuts rotation.
@@ -53,5 +49,5 @@
have their start and end angles modified so that they wouldn't "block" the way for the hightlighted slice.
If the slice is no longer selected return to the original state.
- \snippet nesteddonuts/widget.cpp 7
+ \snippet chartsgallery/nesteddonutswidget.cpp 7
*/
diff --git a/src/charts/doc/src/examples-openglseries.qdoc b/examples/charts/chartsgallery/doc/src/examples-openglseries.qdoc
index 20e465f0..20e465f0 100644
--- a/src/charts/doc/src/examples-openglseries.qdoc
+++ b/examples/charts/chartsgallery/doc/src/examples-openglseries.qdoc
diff --git a/src/charts/doc/src/examples-percentbarchart.qdoc b/examples/charts/chartsgallery/doc/src/examples-percentbarchart.qdoc
index eec81960..d00e0cc0 100644
--- a/src/charts/doc/src/examples-percentbarchart.qdoc
+++ b/examples/charts/chartsgallery/doc/src/examples-percentbarchart.qdoc
@@ -2,42 +2,37 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
- \example percentbarchart
- \title PercentBarChart Example
- \ingroup qtcharts_examples
-
- \brief The example shows how to create a simple percent bar chart.
+ \page qtcharts-percentbarchart-example.html
+ \title Creating Percent Bar Charts
+ \brief Shows how to create a simple percent bar chart.
+ \include gallery.qdocinc
A percent bar chart shows the data in sets as a percentage of
all sets per category.
- Creating percent bar charts is just like creating a regular \l {BarChart Example} {bar chart}, except that for a
- percent bar charts, we use the QPercentBarSeries api instead of QBarSeries. Also, in the
- \l {BarChart Example} {bar chart} we used the nice numbers algorithm to make the y-axis numbering look better. With
+ Creating percent bar charts is just like creating a regular \l {Creating Bar Charts} {bar chart}, except that for a
+ percent bar charts, we use the QPercentBarSeries API instead of QBarSeries. Also, in the
+ \l {Creating Bar Charts} {bar chart} we used the nice numbers algorithm to make the y-axis numbering look better. With
the percent bar chart there is no need for that, because the maximum y-axis value is always 100.
\image examples_percentbarchart.png
- \include examples-run.qdocinc
-
- \section1 Creating Percent Bar Charts
-
The barsets are used in same way in all barcharts.
To illustrate the difference between various barcharts, we use the same data in all examples.
The data visualized by the bar chart is defined by QBarSet instances. Here we create the sets and append data
to them. The data is appended here with the << operator. Alternatively the append method could be used.
- \snippet percentbarchart/main.cpp 1
+ \snippet chartsgallery/barpercentwidget.cpp 1
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.
The first values of each set are grouped together in the first category, the second values in the second category etc.
- \snippet percentbarchart/main.cpp 2
+ \snippet chartsgallery/barpercentwidget.cpp 2
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
setAnimationOptions(QChart::SeriesAnimations)
- \snippet percentbarchart/main.cpp 3
+ \snippet chartsgallery/barpercentwidget.cpp 3
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
@@ -45,19 +40,16 @@
x-axis. The chart takes ownership of the axis. For y-axis we use a value
axis, aligned to the left-hand side.
- \snippet percentbarchart/main.cpp 4
+ \snippet chartsgallery/barpercentwidget.cpp 4
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
the chart by setting its alignment to Qt::AlignBottom.
- \snippet percentbarchart/main.cpp 5
-
- Finally we add the chart onto a view. We also turn on the antialiasing for the chartView.
+ \snippet chartsgallery/barpercentwidget.cpp 5
- \snippet percentbarchart/main.cpp 6
+ Finally we add the chart onto a view.
- 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.
+ \snippet chartsgallery/barpercentwidget.cpp 6
- \snippet percentbarchart/main.cpp 7
+ The chart is ready to be shown.
*/
diff --git a/src/charts/doc/src/examples-pointconfiguration.qdoc b/examples/charts/chartsgallery/doc/src/examples-pointconfiguration.qdoc
index a061b948..217ba0dd 100644
--- a/src/charts/doc/src/examples-pointconfiguration.qdoc
+++ b/examples/charts/chartsgallery/doc/src/examples-pointconfiguration.qdoc
@@ -2,16 +2,15 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
- \example pointconfiguration
- \title Selected Point Configuration Example
- \ingroup qtcharts_examples
-
- \brief This example shows how to modify the configuration of individual points.
+ \page qtcharts-pointconfiguration-example.html
+ \title Selected Point Configuration
+ \brief Shows how to modify the configuration of individual points.
+ \include gallery.qdocinc
\image examples_pointconfiguration.png
\section1 Features Demonstrated
- In this application you will learn how to:
+ Here you will learn how to:
\list
\li Provide click-selection of points in a series.
\li Override the individual configuration of specific points, configuring:
@@ -28,16 +27,14 @@
\section1 Subclass QMainWindow
We start by creating a subclass of QMainWindow that will contain the chart and controls.
- \snippet pointconfiguration/chartwindow.h 1
And we provide the boilerplate for the constructor implementation:
- \snippet pointconfiguration/chartwindow.cpp 1
- \snippet pointconfiguration/chartwindow.cpp 7
+ \snippet chartsgallery/pointconfigurationwidget.cpp 1
\section1 Create a Line Series
Then we create a QLineSeries, giving it a name, making the points visible, and giving it some
points to plot.
- \snippet pointconfiguration/chartwindow.cpp 2
+ \snippet chartsgallery/pointconfigurationwidget.cpp 2
\section1 Create the Point Configuration Controls
@@ -53,7 +50,7 @@
Note that we do not set initial values for any of the controls, as a point will always be
selected showing its current settings.
- \snippet pointconfiguration/chartwindow.cpp 3
+ \snippet chartsgallery/pointconfigurationwidget.cpp 3
\section1 Populate the Controls upon Selecting a Point
@@ -72,7 +69,7 @@
Then the current indices of the comboboxes are set accordingly. Similarly for the checkbox and
line edit, the values are looked up from the \c PointConfigurations, and the controls are set
to match them.
- \snippet pointconfiguration/chartwindow.cpp 4
+ \snippet chartsgallery/pointconfigurationwidget.cpp 4
\section1 Provide the Logic to Configure the Selected Point
@@ -81,7 +78,7 @@
selected point with the setting chosen. It is a simple matter of setting the
QXYSeries::PointConfiguration value associated with the control to the \c m_selectedPointConfig
\c PointConfigurations member variable, and calling QXYSeries::setPointConfiguration.
- \snippet pointconfiguration/chartwindow.cpp 5
+ \snippet chartsgallery/pointconfigurationwidget.cpp 5
\section1 Create the Chart and Lay out the Controls
@@ -92,11 +89,7 @@
first painted. This is so that we can get correct values for the initially selected point. If
we do this earlier, the point values are incorrect. This connection is disconnected after the
first time that it is fired.
- \snippet pointconfiguration/chartwindow.cpp 6
-
- In \c main.cpp we simply instantiate the \c ChartWindow, resize it, show it, and start the event
- loop.
- \snippet pointconfiguration/main.cpp 1
+ \snippet chartsgallery/pointconfigurationwidget.cpp 6
Now we have a fully functioning application that demonstrates how to customize individual chart
points.
diff --git a/src/charts/doc/src/examples-pointsselectionandmarkers.qdoc b/examples/charts/chartsgallery/doc/src/examples-pointsselectionandmarkers.qdoc
index c46dd7aa..a58b83e5 100644
--- a/src/charts/doc/src/examples-pointsselectionandmarkers.qdoc
+++ b/examples/charts/chartsgallery/doc/src/examples-pointsselectionandmarkers.qdoc
@@ -2,30 +2,24 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
- \example pointsselectionandmarkers
- \title Light Markers Points Selection Example
- \ingroup qtcharts_examples
-
- \brief The example shows a usage of light markers
- and points selection for the series.
+ \page qtcharts-pointsselectionandmarkers-example.html
+ \title Using Light Markers and Points Selection
+ \brief Shows how to use light markers and points selection for a series.
+ \include gallery.qdocinc
\image examples_pointsselectionandmarkers1.png
\image examples_pointsselectionandmarkers2.png
- \include examples-run.qdocinc
-
- \section1 Light Markers Feature
-
- We start with creating a series, filling it with the data, and setting up selection funcionality.
+ We start with creating a series, filling it with the data, and setting up selection functionality.
It's important not to set points visibility to \c true, because light markers functionality is
an independent feature and setting both would result in undesired behavior.
- \snippet pointsselectionandmarkers/main.cpp 1
+ \snippet chartsgallery/lightmarkerswidget.cpp 1
Then we create the \c {QChart}, the \c {QChartview} and the control widget with its layout to arrange customization elements.
- \snippet pointsselectionandmarkers/main.cpp 2
+ \snippet chartsgallery/lightmarkerswidget.cpp 2
The next step is creating elements of customization.
- \snippet pointsselectionandmarkers/main.cpp 3
+ \snippet chartsgallery/lightmarkerswidget.cpp 3
We create the label for the marker selection combobox and add fill the combobox with the items.
Also, we provide functionality to the combobox. Considering the implementation of the light markers
@@ -35,18 +29,22 @@
have to remain invisible.
If checking isn't performed, new \c {QImage} will be set for light marker
and unselected points will be visible even though it has been switched off.
- \snippet pointsselectionandmarkers/main.cpp 4
+
+ \snippet chartsgallery/lightmarkerswidget.cpp 4
Almost the same procedure applies to the selected point light marker and line color. The only difference is
that there's no need to check visibility of unselected points as it doesn't affect the functionality.
- \snippet pointsselectionandmarkers/main.cpp 5
+
+ \snippet chartsgallery/lightmarkerswidget.cpp 5
A small difference comes with changing visibility of unselected points. As it was mentioned before,
making light markers invisible is achieved by setting them to "empty" \c {QImage}.
That is why, depending on checkbox state, selected point light marker is set to "empty" \c {QImage} or
to the light marker extracted from the current index of the corresponding combobox.
- \snippet pointsselectionandmarkers/main.cpp 6
+
+ \snippet chartsgallery/lightmarkerswidget.cpp 6
The final part is to arrange the elements, add all the widgets to the main widget, and set the main window size.
- \snippet pointsselectionandmarkers/main.cpp 7
+
+ \snippet chartsgallery/lightmarkerswidget.cpp 7
*/
diff --git a/src/charts/doc/src/examples-polarchart.qdoc b/examples/charts/chartsgallery/doc/src/examples-polarchart.qdoc
index 3912e871..fcc0ceec 100644
--- a/src/charts/doc/src/examples-polarchart.qdoc
+++ b/examples/charts/chartsgallery/doc/src/examples-polarchart.qdoc
@@ -2,40 +2,35 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
- \example polarchart
- \title Polar Chart Example
- \ingroup qtcharts_examples
-
- \brief The example shows how to create a simple polar chart with multiple different series.
+ \page qtcharts-polarchart-example.html
+ \title Creating Polar Charts
+ \brief Shows how to create a simple polar chart with multiple different series.
+ \include gallery.qdocinc
It also shows how to implement scrolling and zooming of the polar chart as well as
- visually demonstrate how polar charts and cartesian charts relate to each other.
+ visually demonstrate how polar charts and Cartesian charts relate to each other.
\image examples_polarchart.png
- \include examples-run.qdocinc
-
- \section1 Creating Polar Charts
-
Creating a polar chart is done with a QPolarChart instance instead of a QChart instance.
- \snippet polarchart/main.cpp 1
+ \snippet chartsgallery/polarchartwidget.cpp 1
- Axes are created similarly to cartesian charts, but when axes are added to the chart,
+ Axes are created similarly to Cartesian charts, but when axes are added to the chart,
you can use polar orientations instead of alignments.
- \snippet polarchart/main.cpp 2
+ \snippet chartsgallery/polarchartwidget.cpp 2
- Zooming and scrolling of a polar chart is logically nearly identical to zooming and scrolling of a cartesian chart.
+ Zooming and scrolling of a polar chart is logically nearly identical to zooming and scrolling of a Cartesian chart.
The main difference is that when scrolling along the X-axis (angular axis), the angle is used instead of the number of pixels.
Another difference is that zooming to a rectangle cannot be done.
- \snippet polarchart/chartview.cpp 1
+ \snippet chartsgallery/polarchartview.cpp 1
The same axes and series can be used in both cartesian and polar charts, though not simultaneously.
To switch between chart types, you first need to remove the series and axes from the old chart, and then add
them to the new chart. If you want to preserve the axis ranges, those need to be copied, too.
- \snippet polarchart/chartview.cpp 2
+ \snippet chartsgallery/polarchartview.cpp 2
*/
diff --git a/src/charts/doc/src/examples-scatterchart.qdoc b/examples/charts/chartsgallery/doc/src/examples-scatterchart.qdoc
index 0acf0eef..8048a67c 100644
--- a/src/charts/doc/src/examples-scatterchart.qdoc
+++ b/examples/charts/chartsgallery/doc/src/examples-scatterchart.qdoc
@@ -2,44 +2,37 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
- \example scatterchart
- \title ScatterChart Example
- \ingroup qtcharts_examples
-
+ \page qtcharts-scatterchart-example.html
+ \title Creating Scatter Charts
\brief The example shows how to create a simple scatter chart.
+ \include gallery.qdocinc
\image examples_scatterchart.png
- \include examples-run.qdocinc
-
- \section1 Creating Scatter Charts
-
To create scatter charts, a QScatterSeries instance is needed. Here we create a scatter series
instance, and set the type and width of outline for the scatter points.
- \snippet scatterchart/chartview.cpp 1
+ \snippet chartsgallery/scatterwidget.cpp 1
We add the data to be shown. We can use the append() member function or use the stream operator.
- \snippet scatterchart/chartview.cpp 2
+ \snippet chartsgallery/scatterwidget.cpp 2
We can define the brush of the scatter series to be an image. Here the image is a star created
using QPainterPath.
- \snippet scatterchart/chartview.cpp 3
+ \snippet chartsgallery/scatterwidget.cpp 3
In the end we enable anti-aliasing, set the chart title, and add the scatter series onto the
chart. We also disable drop shadow, because it would not look good on an application with only
chart view shown.
- \snippet scatterchart/chartview.cpp 4
+ \snippet chartsgallery/scatterwidget.cpp 4
We can also use the scatter points as legend markers.
- \snippet scatterchart/chartview.cpp 5
+ \snippet chartsgallery/scatterwidget.cpp 5
The chart is ready to be shown.
- \snippet scatterchart/main.cpp 4
-
*/
diff --git a/src/charts/doc/src/examples-selectedbar.qdoc b/examples/charts/chartsgallery/doc/src/examples-selectedbar.qdoc
index 67d1e7df..689ee430 100644
--- a/src/charts/doc/src/examples-selectedbar.qdoc
+++ b/examples/charts/chartsgallery/doc/src/examples-selectedbar.qdoc
@@ -2,44 +2,40 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
- \example selectedbar
- \title SelectedBar Example
- \ingroup qtcharts_examples
+ \page qtcharts-selectedbar-example.html
+ \title Changing the Color and State of Bars
+ \brief Shows how to use a selection feature for the bar chart.
+ \include gallery.qdocinc
- \brief The example shows how to use a selection feature for the bar chart.
-
- The example shows changing the color and state of bars using the selection feature.
+ The example shows how to change the color and state of bars using
+ setBarSelected().
\image examples_selectedbar.png
- \include examples-run.qdocinc
-
- \section1 Using setBarSelected()
-
We create the sets and fill them with the data. Then we create a series and append data to it.
- \snippet selectedbar/main.cpp 1
+ \snippet chartsgallery/selectedbarwidget.cpp 1
We create the chart and add series to it.
Also, we add a title to the chart, set animation for the chart, and align the legend.
- \snippet selectedbar/main.cpp 2
+ \snippet chartsgallery/selectedbarwidget.cpp 2
Here we set the color for the selected bars.
- \snippet selectedbar/main.cpp 3
+ \snippet chartsgallery/selectedbarwidget.cpp 3
Next step is adding axes:
QBarCategoryAxis for years of measurements and QValueAxis for values range.
- \snippet selectedbar/main.cpp 4
+ \snippet chartsgallery/selectedbarwidget.cpp 4
Then we add the chart view to put the chart in.
- \snippet selectedbar/main.cpp 5
+ \snippet chartsgallery/selectedbarwidget.cpp 5
Here we create a widget for labels of values of selected and unselected bars.
- \snippet selectedbar/main.cpp 6
+ \snippet chartsgallery/selectedbarwidget.cpp 6
We connect selecting of a specific bar with labels of values using a lambda.
\c {set->toggleSelection({index})} sets the bar selected.
- \snippet selectedbar/main.cpp 7
+ \snippet chartsgallery/selectedbarwidget.cpp 7
- Finally, we create the main widget and add other layouts to it and run the application.
- \snippet selectedbar/main.cpp 8
+ Finally, we create the main layout.
+ \snippet chartsgallery/selectedbarwidget.cpp 8
*/
diff --git a/src/charts/doc/src/examples-splinechart.qdoc b/examples/charts/chartsgallery/doc/src/examples-splinechart.qdoc
index 5765bc42..d1c4d637 100644
--- a/src/charts/doc/src/examples-splinechart.qdoc
+++ b/examples/charts/chartsgallery/doc/src/examples-splinechart.qdoc
@@ -2,40 +2,30 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
- \example splinechart
- \title SplineChart Example
- \ingroup qtcharts_examples
-
- \brief The example shows how to create a simple spline chart.
+ \page qtcharts-splinechart-example.html
+ \title Creating Spline Charts
+ \brief Shows how to create a simple spline chart.
\image examples_splinechart.png
- \include examples-run.qdocinc
-
- \section1 Creating Spline Charts
-
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.
- \snippet splinechart/main.cpp 1
+ \snippet chartsgallery/splinewidget.cpp 1
Now let's add some data points to the series.
- \snippet splinechart/main.cpp 2
+ \snippet chartsgallery/splinewidget.cpp 2
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.
- \snippet splinechart/main.cpp 3
+ \snippet chartsgallery/splinewidget.cpp 3
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.
-
- \snippet splinechart/main.cpp 4
+ a QGraphicsView scene ourselves.
- Finally, we set the QChartView as the windows's central widget.
+ \snippet chartsgallery/splinewidget.cpp 4
- \snippet splinechart/main.cpp 5
*/
diff --git a/src/charts/doc/src/examples-stackedbarchart.qdoc b/examples/charts/chartsgallery/doc/src/examples-stackedbarchart.qdoc
index 63110159..1b6820d3 100644
--- a/src/charts/doc/src/examples-stackedbarchart.qdoc
+++ b/examples/charts/chartsgallery/doc/src/examples-stackedbarchart.qdoc
@@ -2,41 +2,36 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
- \example stackedbarchart
- \title StackedBarChart Example
- \ingroup qtcharts_examples
-
- \brief The example shows how to create a simple stacked bar chart.
+ \page qtcharts-stackedbarchart-example.html
+ \title Creating Stacked Bar Charts
+ \brief Shows how to create a simple stacked bar chart.
+ \include gallery.qdocinc
The stacked bar chart shows the data in sets as bars stacked on top of each other. The stacking
is done per category. The example shows how to create a simple stacked bar chart. Stacked bar
chart shows the data in sets as bars that are stacked on top of each other. The stacking is done
- per category. Creating a stacked bar chart is just like creating a regular \l {BarChart Example}
+ per category. Creating a stacked bar chart is just like creating a regular \l {Creating Bar Charts}
{bar chart}, except that for a stacked bar chart, we use the QStackedBarSeries API instead of
QBarSeries.
\image examples_stackedbarchart.png
- \include examples-run.qdocinc
-
- \section1 Creating Stacked Bar Charts
-
The barsets are used in same way in all barcharts.
To illustrate the difference between various barcharts, we use same data in all examples.
Data, which the barchart visualizes, is defined by the QBarSet instances. Here we create the sets and append data
to them. The data is appended here with << operator. Alternatively the append method could be used.
- \snippet stackedbarchart/main.cpp 1
+ \snippet chartsgallery/barstackedwidget.cpp 1
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.
The first values of each set are grouped together in the first category, the second values in the second category etc.
- \snippet stackedbarchart/main.cpp 2
+ \snippet chartsgallery/barstackedwidget.cpp 2
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
setAnimationOptions(QChart::SeriesAnimations).
- \snippet stackedbarchart/main.cpp 3
+ \snippet chartsgallery/barstackedwidget.cpp 3
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
@@ -44,18 +39,15 @@
x-axis. The chart takes ownership of the axis. For the y-axis we use a
value axis, aligned to the left-hand side.
- \snippet stackedbarchart/main.cpp 4
+ \snippet chartsgallery/barstackedwidget.cpp 4
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.
- \snippet stackedbarchart/main.cpp 5
-
- Finally, we add the chart onto a view. We also turn on the antialiasing for the chartView.
+ \snippet chartsgallery/barstackedwidget.cpp 5
- \snippet stackedbarchart/main.cpp 6
+ Finally, we add the chart onto a view.
- The chart is ready to be shown. We set the chart to be the central widget of the window.
- We also set the size for the chart window and show it.
+ \snippet chartsgallery/barstackedwidget.cpp 6
- \snippet stackedbarchart/main.cpp 7
+ The chart is ready to be shown.
*/
diff --git a/src/charts/doc/src/examples-stackedbarchartdrilldown.qdoc b/examples/charts/chartsgallery/doc/src/examples-stackedbarchartdrilldown.qdoc
index ca10d44c..148884af 100644
--- a/src/charts/doc/src/examples-stackedbarchartdrilldown.qdoc
+++ b/examples/charts/chartsgallery/doc/src/examples-stackedbarchartdrilldown.qdoc
@@ -2,13 +2,12 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
- \example stackedbarchartdrilldown
- \title StackedBarChart Drilldown Example
- \ingroup qtcharts_examples
+ \page stackedbarchartdrilldown
+ \title Implementing Drilldown
+ \brief Shows how to implement drilldown using a stacked barchart.
+ \include gallery.qdocinc
- \brief The example shows how to implement drilldown using a stacked barchart.
-
- In the drilldown example we create a stacked bar chart, which shows the harvest of various chili
+ Here 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.
@@ -19,39 +18,35 @@
Clicking on a month shows that month's harvest:
\image examples_stackedbarchartdrilldown2.png
- \include examples-run.qdocinc
-
- \section1 Implementing Drilldown
-
First we define a drilldown series class, which adds categories to the stacked bar series and mapping for categories to other drilldown series.
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.
- \snippet stackedbarchartdrilldown/drilldownseries.h 1
+ \snippet chartsgallery/stackeddrilldownseries.h 1
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.
- \snippet stackedbarchartdrilldown/drilldownchart.h 1
+ \snippet chartsgallery/stackeddrilldownchart.h 1
Now we have our drilldown classes and we can start using them.
First create the chart.
- \snippet stackedbarchartdrilldown/main.cpp 1
+ \snippet chartsgallery/stackeddrilldownwidget.cpp 1
We define the categories from which the drilldown series will be constructed.
- \snippet stackedbarchartdrilldown/main.cpp 2
+ \snippet chartsgallery/stackeddrilldownwidget.cpp 2
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.
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.
To make mapping work, we connect the clicked signals from our series to the drilldownChart.
- \snippet stackedbarchartdrilldown/main.cpp 3
+ \snippet chartsgallery/stackeddrilldownwidget.cpp 3
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.
- \snippet stackedbarchartdrilldown/main.cpp 4
+ \snippet chartsgallery/stackeddrilldownwidget.cpp 4
Here we set the chart to show the top level series initially.
- \snippet stackedbarchartdrilldown/main.cpp 5
+ \snippet chartsgallery/stackeddrilldownwidget.cpp 5
*/
diff --git a/src/charts/doc/src/examples-temperaturerecords.qdoc b/examples/charts/chartsgallery/doc/src/examples-temperaturerecords.qdoc
index 2423b30f..19f9f679 100644
--- a/src/charts/doc/src/examples-temperaturerecords.qdoc
+++ b/examples/charts/chartsgallery/doc/src/examples-temperaturerecords.qdoc
@@ -2,32 +2,26 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
- \example temperaturerecords
- \title Temperature Records Example
- \ingroup qtcharts_examples
-
- \brief The example shows how to create a bar chart with negative bars.
-
+ \page qtcharts-temperaturerecords-example.html
+ \title Displaying Temperature Records with Negative Bars
+ \brief Shows how to create a bar chart with negative bars.
+ \include gallery.qdocinc
For our example we use temperature data.
\image examples_temperaturerecords.png
- \include examples-run.qdocinc
-
- \section1 Crating Negative Bars
-
First we create two barsets and append the data to them. One set represents the minimum temperatures and another the maximum temperatures.
- \snippet temperaturerecords/main.cpp 1
+ \snippet chartsgallery/temperaturerecordswidget.cpp 1
We create the series and append the barsets to it. The series takes ownership of the barsets.
- \snippet temperaturerecords/main.cpp 2
+ \snippet chartsgallery/temperaturerecordswidget.cpp 2
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
setAnimationOptions(QChart::SeriesAnimations)
- \snippet temperaturerecords/main.cpp 3
+ \snippet chartsgallery/temperaturerecordswidget.cpp 3
To have the categories displayed on an axis, we need to create a
QBarCategoryAxis. Here we create a category axis with a list of
@@ -36,19 +30,16 @@
axis, aligned to the left-hand side. We change the range for the y-axis,
as this gives nicer results than with autoscaling.
- \snippet temperaturerecords/main.cpp 4
+ \snippet chartsgallery/temperaturerecordswidget.cpp 4
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.
- \snippet temperaturerecords/main.cpp 5
-
- Finally we add the chart onto a view. We also turn on the antialiasing for the chartView.
+ \snippet chartsgallery/temperaturerecordswidget.cpp 5
- \snippet temperaturerecords/main.cpp 6
+ Finally we add the chart onto a view.
- Chart is ready to be shown. We set the chart to be the central widget of the window.
- We also set the size for the chart window and show it.
+ \snippet chartsgallery/temperaturerecordswidget.cpp 6
- \snippet temperaturerecords/main.cpp 7
+ The chart is ready to be shown.
*/
diff --git a/examples/charts/chartsgallery/doc/src/gallery.qdoc b/examples/charts/chartsgallery/doc/src/gallery.qdoc
new file mode 100644
index 00000000..e8f2dcbf
--- /dev/null
+++ b/examples/charts/chartsgallery/doc/src/gallery.qdoc
@@ -0,0 +1,22 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
+
+/*!
+\example chartsgallery
+\title Charts with Widgets Gallery
+\ingroup qtcharts_examples
+
+\brief An application that demonstrates the Qt Charts Widgets API.
+
+\image ChartWidgetGallery.png
+
+This example demonstrates the Qt Charts API for widgets by using included sample
+data to populate a number of chart types and interactions for a user.
+
+\annotatedlist charts_widget_gallery_example
+
+\include examples-run.qdocinc
+
+If you want to implement charts with QML see the \l{QML Charts Example}.
+
+*/
diff --git a/examples/charts/chartsgallery/doc/src/gallery.qdocinc b/examples/charts/chartsgallery/doc/src/gallery.qdocinc
new file mode 100644
index 00000000..fed4b273
--- /dev/null
+++ b/examples/charts/chartsgallery/doc/src/gallery.qdocinc
@@ -0,0 +1,2 @@
+ \ingroup charts_widget_gallery_example
+ \note This is part of the \l{Charts with Widgets Gallery} example.
diff --git a/src/charts/doc/src/examples-barchart.qdoc b/src/charts/doc/src/examples-barchart.qdoc
deleted file mode 100644
index 15d13a7b..00000000
--- a/src/charts/doc/src/examples-barchart.qdoc
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
-
-/*!
- \example barchart
- \title BarChart Example
- \ingroup qtcharts_examples
-
- \brief The example shows how to create a bar chart.
-
- BarChart shows the data in sets as separate bars, which are in categories.
-
- \image examples_barchart.png
-
- \include examples-run.qdocinc
-
- \section1 Creating Bar Charts
-
- The barsets are used in the same way in all barcharts.
- To illustrate the difference between various barcharts, we use the same data in the examples.
- Data that the barchart visualizes, is defined by the QBarSet instances. Here we create the sets and append data
- to them. The data is appended here with the << operator. Alternatively, the append method could be used.
-
- \snippet barchart/main.cpp 1
-
- 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.
- First values of each set are grouped together at first category second value to second category and so on.
-
- \snippet barchart/main.cpp 2
-
- 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
- setAnimationOptions(QChart::SeriesAnimations)
-
- \snippet barchart/main.cpp 3
-
- 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
- set it to be aligned to the bottom, acting as the x-axis, and attach it to
- the series. The chart takes ownership of the axis. For y-axis we use a
- value axis, aligned to the left-hand side.
-
- \snippet barchart/main.cpp 4
-
- 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.
-
- \snippet barchart/main.cpp 5
-
- Finally we add the chart onto a view. We also turn on the antialiasing for the chartView.
-
- \snippet barchart/main.cpp 6
-
- 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.
-
- \snippet barchart/main.cpp 7
-*/
diff --git a/src/charts/doc/src/examples-donutchart.qdoc b/src/charts/doc/src/examples-donutchart.qdoc
deleted file mode 100644
index 48bc9b4f..00000000
--- a/src/charts/doc/src/examples-donutchart.qdoc
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
-
-/*!
- \example donutchart
- \title Donutchart Example
- \ingroup qtcharts_examples
-
- \brief This example shows how to create a simple donut chart, and do some customizations to
- a slice.
- \image examples_donutchart.png
-
- \include examples-run.qdocinc
-*/
diff --git a/src/charts/doc/src/examples-dynamicspline.qdoc b/src/charts/doc/src/examples-dynamicspline.qdoc
deleted file mode 100644
index b13013d2..00000000
--- a/src/charts/doc/src/examples-dynamicspline.qdoc
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
-
-/*!
- \example dynamicspline
- \title Dynamic Spline Example
- \ingroup qtcharts_examples
-
- \brief This example shows how to draw dynamic data.
-
- \image examples_dynamicspline1.png
- \image examples_dynamicspline2.png
-
- \include examples-run.qdocinc
-*/
diff --git a/src/charts/doc/src/examples-logvalueaxis.qdoc b/src/charts/doc/src/examples-logvalueaxis.qdoc
deleted file mode 100644
index f8ece1c8..00000000
--- a/src/charts/doc/src/examples-logvalueaxis.qdoc
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
-
-/*!
- \example logvalueaxis
- \title Logarithmic Axis Example
- \ingroup qtcharts_examples
-
- \brief The example shows how to use QLogValueAxis.
-
- \image examples_logvalueaxis.png
-
- \include examples-run.qdocinc
-
- \section1 Using Logarithmic Value Axes
-
- Create a QLineSeries instance and add some data to it.
-
- \snippet logvalueaxis/main.cpp 1
-
- 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.
-
- \snippet logvalueaxis/main.cpp 2
-
- Create the axes. Add them to the chart and attach to the series.
-
- \snippet logvalueaxis/main.cpp 3
-
- Then create a QChartView object with QChart as a parameter. Enable antialiasing to have the rendered line look nicer.
-
- \snippet logvalueaxis/main.cpp 4
-
- The chart is ready to be shown.
-
- \snippet logvalueaxis/main.cpp 5
-
-*/
diff --git a/src/charts/doc/src/examples-piechart.qdoc b/src/charts/doc/src/examples-piechart.qdoc
deleted file mode 100644
index 54f81d8d..00000000
--- a/src/charts/doc/src/examples-piechart.qdoc
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
-
-/*!
- \example piechart
- \title Piechart Example
- \ingroup qtcharts_examples
-
- \brief The example shows how to create a simple pie chart and do some customizations to
- a pie slice.
- \image examples_piechart.png
-
- \include examples-run.qdocinc
-*/
diff --git a/src/charts/doc/src/examples-piechartcustomization.qdoc b/src/charts/doc/src/examples-piechartcustomization.qdoc
deleted file mode 100644
index bd9e75cc..00000000
--- a/src/charts/doc/src/examples-piechartcustomization.qdoc
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
-
-/*!
- \example piechartcustomization
- \title Pie Chart Customization Example
- \ingroup qtcharts_examples
-
- \brief This example shows how the look and feel of a pie chart can be customized.
- \image piechart_customization.png
-
- \include examples-run.qdocinc
-*/
diff --git a/src/charts/doc/src/examples-piechartdrilldown.qdoc b/src/charts/doc/src/examples-piechartdrilldown.qdoc
deleted file mode 100644
index 915117aa..00000000
--- a/src/charts/doc/src/examples-piechartdrilldown.qdoc
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
-
-/*!
- \example piechartdrilldown
- \title Piechart Drilldown Example
- \ingroup qtcharts_examples
-
- \brief The example shows how to implement a piechart with drilldown effect.
- \image examples_piechartdrill1.png
- \image examples_piechartdrill2.png
-
- \include examples-run.qdocinc
-*/
diff --git a/src/charts/doc/src/examples-scatterinteractions.qdoc b/src/charts/doc/src/examples-scatterinteractions.qdoc
deleted file mode 100644
index 59e6f203..00000000
--- a/src/charts/doc/src/examples-scatterinteractions.qdoc
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
-
-/*!
- \example scatterinteractions
- \title Scatter Interactions Example
- \ingroup qtcharts_examples
-
- \brief This example shows how to create a simple scatter chart and how to interact with the
- chart.
-
- \image examples_scatterinteractions.png
-
- \include examples-run.qdocinc
-*/
diff --git a/src/charts/doc/src/qtcharts-overview.qdoc b/src/charts/doc/src/qtcharts-overview.qdoc
index 462c7d6a..94c533d1 100644
--- a/src/charts/doc/src/qtcharts-overview.qdoc
+++ b/src/charts/doc/src/qtcharts-overview.qdoc
@@ -84,10 +84,9 @@
A spline chart is implemented by using the QSplineSeries class
that inherits QLineSeries or the SplineSeries type that inherits LineSeries.
- For more information, see \l{LineChart Example}, \l{SplineChart Example},
- and \l{Dynamic Spline Example}.
+ For more information, see \l{Creating Line Charts} and \l{Creating Spline Charts}.
For an example of combining a line chart with a bar chart and using a common
- axis for both, see \l{Line and BarChart Example}.
+ axis for both, see \l{Combining Line and BarChart}.
\section2 Area and Scatter Charts
@@ -106,8 +105,9 @@
A scatter chart is implemented by using the QScatterSeries class or the
ScatterSeries QML type.
- For more information, see \l{AreaChart Example}, \l{ScatterChart Example},
- and \l{Scatter Interactions Example}.
+ For more information, see \l{Creating Area Charts} and
+ \l{Creating Scatter Charts}.
+
\section2 Bar Charts
@@ -144,10 +144,9 @@
\inlineimage examples_horizontalpercentbarchart.png
- For more information, see \l{BarChart Example},
- \l{HorizontalBarChart Example}, \l{StackedBarChart Example},
- \l{HorizontalStackedBarChart Example}, \l{PercentBarChart Example}, and
- \l{HorizontalPercentBarChart Example}.
+ For more information, see \l{Creating Bar Charts},
+ \l{Creating Horizontal Stacked Bar Charts}, \l{Creating Horizontal Bar Charts},
+ and \l{Creating Horizontal Percent Bar Charts}.
\section2 Pie Charts
@@ -162,9 +161,8 @@
\inlineimage examples_donutchart.png
- For more information, see \l{PieChart Example},
- \l{Pie Chart Customization Example}, \l{DonutChart Example},
- \l{Donut Chart Breakdown Example}, and \l{Nested Donuts Example}.
+ For more information, see \l{Charts with Widgets Gallery},
+ \l{Creating a Donut Breakdown Chart}, and \l{Creating Nested Donut Charts}.
\section2 Box-and-Whiskers Charts
@@ -179,7 +177,7 @@
\image examples_boxplotchart.png
- For more information, see \l{Box and Whiskers Example}.
+ For more information, see \l{Creating Box-and-Whiskers Charts}.
\section2 Candlestick Charts
@@ -204,7 +202,7 @@
supported by them. The axis can be used either as a radial or an angular
axis. In QML, the corresponding type is PolarChartView.
- For more information, see \l{Polar Chart Example} and \l{Qml Polar Chart}.
+ For more information, see \l{Creating Polar Charts} and \l{Qml Polar Chart}.
\section1 Axes
@@ -248,8 +246,8 @@
supported, such as specifying QValueAxis and QLogValueAxis on the same
orientation.
- For more information, see \l{DateTimeAxis Example},
- \l{Logarithmic Axis Example}, \l{Multiple Axes Example}, and \l{Qml Axes}.
+ For more information, see \l{Line Charts with Date and Time Axes},
+ \l{Using Logarithmic Value Axes}, \l{Using Multiple Axes}, and \l{Qml Axes}.
\section1 Legend
@@ -283,7 +281,7 @@
It is possible to add data to charts dynamically and to make the chart view
scroll automatically to display the new data.
- For more information, see \l{Dynamic Spline Example}.
+ For more information, see \l{Creating Spline Charts}.
\section2 Drilling Down into Data
@@ -292,8 +290,7 @@
item is displayed. This is implemented by deleting the first series and
adding another one.
- For more information, see \l{StackedBarChart Drilldown Example} and
- \l{PieChart Drilldown Example}.
+ For more information, see \l{Implementing Drilldown}.
\section2 Zooming and Scrolling
@@ -312,7 +309,7 @@
charts or hover the mouse over them. This enables you to add elements, such
as callouts, to the charts.
- For more information, see \l{Callout Example}.
+ For more information, see \l{Drawing a Callout on Top of a Chart}.
\section1 Themes
@@ -341,5 +338,5 @@
\note Changing the theme will overwrite all customization previously applied
to the series.
- For more information, see the \l {Chart themes example}.
+ For more information, see the \l {Creating Charts With Themes}.
*/
diff --git a/src/charts/doc/src/qtcharts.qdoc b/src/charts/doc/src/qtcharts.qdoc
index 678c8473..782eb857 100644
--- a/src/charts/doc/src/qtcharts.qdoc
+++ b/src/charts/doc/src/qtcharts.qdoc
@@ -52,8 +52,7 @@
\note Since Qt Creator 3.0 the project created with Qt Quick Application wizard based on
Qt Quick 2 template uses QGuiApplication by default. As Qt Charts utilizes Qt Graphics View
- Framework for drawing, QApplication must be used. The project created with the wizard is
- usable with Qt Charts after the QGuiApplication is replaced with QApplication.
+ Framework for drawing, QApplication must be used. The project created with the wizard is usable with Qt Charts after the QGuiApplication is replaced with QApplication.
\section1 QML Types
*/