From 203508d4aff39cfb7d8a7f3192884a190f203020 Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Thu, 28 Feb 2019 14:42:03 +0100 Subject: Doc: Set QChart functions as deprecated axisX,Y and setAxisX,Y functions are now deprecated - mark them as such in the documentation. Example code was also fixed to not use deprecated functions, but example documentation was not updated to reflect that change. Task-number: QTBUG-74097 Change-Id: I2d4f283f1d0c62a02b33c373885e75bce34a1114 Reviewed-by: Miikka Heikkinen --- src/charts/doc/src/examples-barchart.qdoc | 9 +++++---- src/charts/doc/src/examples-horizontalbarchart.qdoc | 9 +++++---- .../doc/src/examples-horizontalpercentbarchart.qdoc | 9 +++++---- .../doc/src/examples-horizontalstackedbarchart.qdoc | 9 +++++---- src/charts/doc/src/examples-percentbarchart.qdoc | 9 +++++---- src/charts/doc/src/examples-stackedbarchart.qdoc | 9 +++++---- src/charts/doc/src/examples-temperaturerecords.qdoc | 11 ++++++----- src/charts/qchart.cpp | 19 ++++++++++++++++--- 8 files changed, 52 insertions(+), 32 deletions(-) diff --git a/src/charts/doc/src/examples-barchart.qdoc b/src/charts/doc/src/examples-barchart.qdoc index 412cdca6..818adcd1 100644 --- a/src/charts/doc/src/examples-barchart.qdoc +++ b/src/charts/doc/src/examples-barchart.qdoc @@ -57,10 +57,11 @@ \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 the x-axis of the chart. The chart takes ownership of axis. For y-axis we use default axis, which is created and scaled to series data - by calling createDefaultAxes of the chart. Note that the call for createDefaultAxes must be before we set the category axis. Otherwise the default axis will - override the category axis. + 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 diff --git a/src/charts/doc/src/examples-horizontalbarchart.qdoc b/src/charts/doc/src/examples-horizontalbarchart.qdoc index 84b0f678..9b66cc5d 100644 --- a/src/charts/doc/src/examples-horizontalbarchart.qdoc +++ b/src/charts/doc/src/examples-horizontalbarchart.qdoc @@ -58,10 +58,11 @@ \snippet horizontalbarchart/main.cpp 3 - To have the categories displayed on axis, we need to create a QBarCategoryAxis. Here we create a category axis with a list of categories and - set it to be the y-axis of the chart. The chart takes ownership of axis. For the x-axis we use the default axis, which is created and scaled to series data - by calling createDefaultAxes of the chart. Note that the call for createDefaultAxes must be done before we set the category axis. Otherwise the default axis will - override the category axis. + 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 left-hand side, acting as the y-axis, and + 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 diff --git a/src/charts/doc/src/examples-horizontalpercentbarchart.qdoc b/src/charts/doc/src/examples-horizontalpercentbarchart.qdoc index 59fba601..4ab67e99 100644 --- a/src/charts/doc/src/examples-horizontalpercentbarchart.qdoc +++ b/src/charts/doc/src/examples-horizontalpercentbarchart.qdoc @@ -63,10 +63,11 @@ \snippet horizontalpercentbarchart/main.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 categories and - set it to be the y-axis of the chart. The chart takes ownership of the axis. For the x-axis we use the default axis, which is created and scaled to series data - by calling createDefaultAxes of the chart. Note that createDefaultAxes must be called before we set the category axis. Otherwise the default axis will - override the category axis. + To have the categories displayed on an axis, we need to create a + QBarCategoryAxis first. Here we create a category axis with a list of + categories and add it to the chart on the left-hand side, acting as the + 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 diff --git a/src/charts/doc/src/examples-horizontalstackedbarchart.qdoc b/src/charts/doc/src/examples-horizontalstackedbarchart.qdoc index 4adf8ae2..de46004a 100644 --- a/src/charts/doc/src/examples-horizontalstackedbarchart.qdoc +++ b/src/charts/doc/src/examples-horizontalstackedbarchart.qdoc @@ -60,10 +60,11 @@ \snippet horizontalstackedbarchart/main.cpp 3 - To have categories displayed on an axis, we need to create a QBarCategoryAxis. Here we create a category axis with a list of categories and - set it to be the y-axis of the chart. The chart takes ownership of the axis. For the x-axis we use the default axis, which is created and scaled to series data - by calling createDefaultAxes of the chart. Note that the call for createDefaultAxes must be before we set the category axis. Otherwise the default axis will - override the category axis. + To have the categories displayed on an axis, we need to create a + QBarCategoryAxis first. Here we create a category axis with a list of + categories and add it to the chart on the left-hand side, acting as the + 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 diff --git a/src/charts/doc/src/examples-percentbarchart.qdoc b/src/charts/doc/src/examples-percentbarchart.qdoc index 2c0d2a5e..813fde1b 100644 --- a/src/charts/doc/src/examples-percentbarchart.qdoc +++ b/src/charts/doc/src/examples-percentbarchart.qdoc @@ -63,10 +63,11 @@ \snippet percentbarchart/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 the x-axis of the chart. The chart takes ownership of the axis. For the y-axis we use the default axis, which is created and scaled - to series data by calling createDefaultAxes of the chart. Note that createDefaultAxes must be called before we set the category axis. - Otherwise the default axis will override the category axis. + To have the categories displayed on an axis, we need to create a + QBarCategoryAxis first. Here we create a category axis with a list of + categories and add it to the chart aligned to the bottom, acting as the + 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 diff --git a/src/charts/doc/src/examples-stackedbarchart.qdoc b/src/charts/doc/src/examples-stackedbarchart.qdoc index 1744a68a..367a11ab 100644 --- a/src/charts/doc/src/examples-stackedbarchart.qdoc +++ b/src/charts/doc/src/examples-stackedbarchart.qdoc @@ -62,10 +62,11 @@ \snippet stackedbarchart/main.cpp 3 - To have categories displayed on the axis, we need to create a QBarCategoryAxis. Here we create a category axis with list of categories and - set it to be the x-axis of the chart. The chart takes ownership of the axis. For the y-axis we use default axis, which is created and scaled to series data - by calling createDefaultAxes of the chart. Note that the call for createDefaultAxes must be before we set the category axis. Otherwise the default axis will - override the category axis. + To have the categories displayed on an axis, we need to create a + QBarCategoryAxis first. Here we create a category axis with a list of + categories and add it to the chart aligned to bottom, acting as the + 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 diff --git a/src/charts/doc/src/examples-temperaturerecords.qdoc b/src/charts/doc/src/examples-temperaturerecords.qdoc index bf8a0b8c..8ac9d9a1 100644 --- a/src/charts/doc/src/examples-temperaturerecords.qdoc +++ b/src/charts/doc/src/examples-temperaturerecords.qdoc @@ -53,11 +53,12 @@ \snippet temperaturerecords/main.cpp 3 - To have categories displayed on an axis, we need to create a QBarCategoryAxis. Here we create a category axis with a list of categories and - set it to be the x-axis of the chart. The chart takes ownership of the axis. For y-axis we use the default axis, which is created and scaled to the series data - by calling createDefaultAxes of the chart. We change the range for the y-axis, since this gives nicer result than with autoscaling. - - Note that the call for createDefaultAxes must be before we set the category axis. Otherwise the default axis will override the category axis. + To have the categories displayed on an axis, we need to create a + QBarCategoryAxis. Here we create a category axis with a list of + categories and add it to the chart aligned to bottom, acting as the + x-axis. The chart takes ownership of the axis. For y-axis we use a value + 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 diff --git a/src/charts/qchart.cpp b/src/charts/qchart.cpp index 4fad4baf..703e6625 100644 --- a/src/charts/qchart.cpp +++ b/src/charts/qchart.cpp @@ -465,6 +465,9 @@ bool QChart::isZoomed() } /*! + \deprecated + Use axes() instead. + Returns a pointer to the horizontal axis attached to the specified \a series. If no series is specified, the first horizontal axis added to the chart is returned. @@ -479,6 +482,9 @@ QAbstractAxis *QChart::axisX(QAbstractSeries *series) const } /*! + \deprecated + Use axes() instead. + Returns a pointer to the vertical axis attached to the specified \a series. If no series is specified, the first vertical axis added to the chart is returned. @@ -496,6 +502,7 @@ QAbstractAxis *QChart::axisY(QAbstractSeries *series) const Returns the axes attached to the series \a series with the orientation specified by \a orientation. If no series is specified, all axes added to the chart with the specified orientation are returned. + \sa addAxis(), createDefaultAxes() */ QList QChart::axes(Qt::Orientations orientation, QAbstractSeries *series) const @@ -529,8 +536,8 @@ QList QChart::axes(Qt::Orientations orientation, QAbstractSerie \table \header \li Series type - \li X-axis - \li Y-axis + \li Horizontal axis (X) + \li Vertical axis (Y) \row \li QXYSeries \li QValueAxis @@ -552,7 +559,7 @@ QList QChart::axes(Qt::Orientations orientation, QAbstractSerie as the parameter for the axes() function call. QPieSeries does not create any axes. - \sa axisX(), axisY(), axes(), setAxisX(), setAxisY(), QAbstractSeries::attachAxis() + \sa axes(), QAbstractSeries::attachAxis() */ void QChart::createDefaultAxes() { @@ -743,6 +750,9 @@ QList QChart::series() const } /*! + \deprecated + Use addAxis() instead. + Adds the axis \a axis to the chart and attaches it to the series \a series as a bottom-aligned horizontal axis. The chart takes ownership of both the axis and the series. @@ -765,6 +775,9 @@ void QChart::setAxisX(QAbstractAxis *axis ,QAbstractSeries *series) } /*! + \deprecated + Use addAxis() instead. + Adds the axis \a axis to the chart and attaches it to the series \a series as a left-aligned vertical axis. The chart takes ownership of both the axis and the series. -- cgit v1.2.3