summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2017-04-21 11:08:07 +0200
committerLiang Qi <liang.qi@qt.io>2017-04-21 11:08:07 +0200
commit826aa4dbfb31353d41fa7a6cdba28961c413b214 (patch)
tree9392e16adf622d68ce389afba5561a8bec026ca7
parent9310c07aac07efcdeafe83ada1e235b0b99e19e4 (diff)
parentcc4e79d6200b0495a5c4d1a7faa773906b1ac99e (diff)
Merge remote-tracking branch 'origin/5.9' into dev
-rw-r--r--qtcharts.pro5
-rw-r--r--src/charts/animations/pieanimation.cpp1
-rw-r--r--src/charts/axis/barcategoryaxis/qbarcategoryaxis.cpp8
-rw-r--r--src/charts/axis/datetimeaxis/qdatetimeaxis.cpp8
-rw-r--r--src/charts/axis/logvalueaxis/qlogvalueaxis.cpp2
-rw-r--r--src/charts/axis/qabstractaxis.cpp21
-rw-r--r--src/charts/axis/valueaxis/qvalueaxis.cpp2
-rw-r--r--src/charts/barchart/abstractbarchartitem.cpp2
-rw-r--r--src/charts/barchart/horizontal/stacked/horizontalstackedbarchartitem.cpp6
-rw-r--r--src/charts/barchart/qbarset.cpp36
-rw-r--r--src/charts/barchart/vertical/stacked/stackedbarchartitem.cpp6
-rw-r--r--src/charts/boxplotchart/boxplotchartitem.cpp13
-rw-r--r--src/charts/boxplotchart/boxplotchartitem_p.h2
-rw-r--r--src/charts/candlestickchart/candlestickchartitem.cpp1
-rw-r--r--src/charts/doc/src/index.qdoc5
-rw-r--r--src/charts/doc/src/qtcharts-overview.qdoc371
-rw-r--r--src/charts/layout/polarchartlayout.cpp2
-rw-r--r--src/charts/legend/legendmarkeritem.cpp5
-rw-r--r--src/charts/linechart/linechartitem.cpp2
-rw-r--r--src/charts/linechart/qlineseries.cpp5
-rw-r--r--src/charts/piechart/qvpiemodelmapper.cpp2
-rw-r--r--src/charts/scatterchart/qscatterseries.cpp6
-rw-r--r--src/charts/scatterchart/scatterchartitem.cpp1
-rw-r--r--src/charts/splinechart/qsplineseries.cpp5
-rw-r--r--src/charts/xychart/qxyseries.cpp2
-rw-r--r--tests/manual/chartviewer/charts/axis/categoryaxis.cpp2
-rw-r--r--tests/manual/chartviewer/charts/axis/valueaxis.cpp2
-rw-r--r--tests/manual/chartviewer/charts/font/font.cpp2
-rw-r--r--tests/manual/chartviewer/charts/pieseries/donutchart.cpp2
-rw-r--r--tests/manual/chartviewer/charts/pieseries/piechart.cpp2
-rw-r--r--tests/manual/chartviewer/charts/size/sizecharts.cpp2
-rw-r--r--tests/manual/chartviewer/charts/xyseries/areachart.cpp2
-rw-r--r--tests/manual/chartviewer/charts/xyseries/linechart.cpp2
-rw-r--r--tests/manual/chartviewer/charts/xyseries/scatterchart.cpp2
-rw-r--r--tests/manual/chartviewer/charts/xyseries/splinechart.cpp2
35 files changed, 505 insertions, 34 deletions
diff --git a/qtcharts.pro b/qtcharts.pro
index 122264e6..fc2928f8 100644
--- a/qtcharts.pro
+++ b/qtcharts.pro
@@ -1,5 +1,10 @@
requires(qtHaveModule(widgets))
+qtHaveModule(widgets) {
+ QT_FOR_CONFIG += widgets
+ requires(qtConfig(graphicsview))
+}
+
load(qt_parts)
OTHER_FILES += README dist/*
diff --git a/src/charts/animations/pieanimation.cpp b/src/charts/animations/pieanimation.cpp
index 03146745..76993792 100644
--- a/src/charts/animations/pieanimation.cpp
+++ b/src/charts/animations/pieanimation.cpp
@@ -39,6 +39,7 @@ PieAnimation::PieAnimation(PieChartItem *item, int duration, QEasingCurve &curve
m_animationDuration(duration),
m_animationCurve(curve)
{
+ Q_UNUSED(m_item);
}
PieAnimation::~PieAnimation()
diff --git a/src/charts/axis/barcategoryaxis/qbarcategoryaxis.cpp b/src/charts/axis/barcategoryaxis/qbarcategoryaxis.cpp
index efa02c15..2026359e 100644
--- a/src/charts/axis/barcategoryaxis/qbarcategoryaxis.cpp
+++ b/src/charts/axis/barcategoryaxis/qbarcategoryaxis.cpp
@@ -270,7 +270,7 @@ void QBarCategoryAxis::remove(const QString &category)
d->updateCategoryDomain();
}
} else {
- setRange(QString::null, QString::null);
+ setRange(QString(), QString());
}
emit categoriesChanged();
emit countChanged();
@@ -339,7 +339,7 @@ void QBarCategoryAxis::clear()
{
Q_D(QBarCategoryAxis);
d->m_categories.clear();
- setRange(QString::null, QString::null);
+ setRange(QString(), QString());
emit categoriesChanged();
emit countChanged();
}
@@ -354,8 +354,8 @@ void QBarCategoryAxis::setCategories(const QStringList &categories)
{
Q_D(QBarCategoryAxis);
d->m_categories.clear();
- d->m_minCategory = QString::null;
- d->m_maxCategory = QString::null;
+ d->m_minCategory = QString();
+ d->m_maxCategory = QString();
d->m_min = 0;
d->m_max = 0;
d->m_count = 0;
diff --git a/src/charts/axis/datetimeaxis/qdatetimeaxis.cpp b/src/charts/axis/datetimeaxis/qdatetimeaxis.cpp
index 03ffccb2..f01ed5fc 100644
--- a/src/charts/axis/datetimeaxis/qdatetimeaxis.cpp
+++ b/src/charts/axis/datetimeaxis/qdatetimeaxis.cpp
@@ -145,6 +145,14 @@ QT_CHARTS_BEGIN_NAMESPACE
*/
/*!
+ \qmlmethod DateTimeAxis::rangeChanged(datetime min, datetime max)
+ This signal is emitted when the minimum or maximum value of the axis, specified by \a min
+ and \a max, changes.
+
+ The corresponding signal handler is \c onRangeChanged().
+*/
+
+/*!
\property QDateTimeAxis::tickCount
\brief The number of tick marks on the axis.
*/
diff --git a/src/charts/axis/logvalueaxis/qlogvalueaxis.cpp b/src/charts/axis/logvalueaxis/qlogvalueaxis.cpp
index 8efe1139..47bed00f 100644
--- a/src/charts/axis/logvalueaxis/qlogvalueaxis.cpp
+++ b/src/charts/axis/logvalueaxis/qlogvalueaxis.cpp
@@ -380,7 +380,7 @@ QLogValueAxisPrivate::QLogValueAxisPrivate(QLogValueAxis *q)
m_base(10),
m_tickCount(0),
m_minorTickCount(0),
- m_labelFormat(QString::null)
+ m_labelFormat()
{
}
diff --git a/src/charts/axis/qabstractaxis.cpp b/src/charts/axis/qabstractaxis.cpp
index a4065570..cad5e9b9 100644
--- a/src/charts/axis/qabstractaxis.cpp
+++ b/src/charts/axis/qabstractaxis.cpp
@@ -130,11 +130,12 @@ QT_CHARTS_BEGIN_NAMESPACE
\property QAbstractAxis::minorGridVisible
\brief The visibility of the minor grid lines.
- Applies only to QValueAxis.
+ Applies only to axes that support minor grid lines.
*/
/*!
\qmlproperty bool AbstractAxis::minorGridVisible
- The visibility of the minor grid lines. Applies only to ValueAxis.
+ The visibility of the minor grid lines. Applies only to axes that support
+ minor grid lines.
*/
/*!
@@ -155,7 +156,7 @@ QT_CHARTS_BEGIN_NAMESPACE
\property QAbstractAxis::minorGridLinePen
\brief The pen used to draw the minor grid line.
- Applies only to QValueAxis.
+ Applies only to axes that support minor grid lines.
*/
/*!
@@ -164,10 +165,22 @@ QT_CHARTS_BEGIN_NAMESPACE
*/
/*!
+ \qmlproperty color AbstractAxis::gridLineColor
+ The color of the grid line.
+*/
+
+/*!
\property QAbstractAxis::minorGridLineColor
\brief The color of the minor grid line.
- Applies only to QValueAxis.
+ Applies only to axes that support minor grid lines.
+*/
+
+/*!
+ \qmlproperty color AbstractAxis::minorGridLineColor
+ The color of the minor grid line.
+
+ Applies only to axes that support minor grid lines.
*/
/*!
diff --git a/src/charts/axis/valueaxis/qvalueaxis.cpp b/src/charts/axis/valueaxis/qvalueaxis.cpp
index 2b775e2a..e8f9698f 100644
--- a/src/charts/axis/valueaxis/qvalueaxis.cpp
+++ b/src/charts/axis/valueaxis/qvalueaxis.cpp
@@ -354,7 +354,7 @@ QValueAxisPrivate::QValueAxisPrivate(QValueAxis *q)
m_max(0),
m_tickCount(5),
m_minorTickCount(0),
- m_format(QString::null),
+ m_format(),
m_applying(false)
{
diff --git a/src/charts/barchart/abstractbarchartitem.cpp b/src/charts/barchart/abstractbarchartitem.cpp
index 9395eef0..f62c0ef7 100644
--- a/src/charts/barchart/abstractbarchartitem.cpp
+++ b/src/charts/barchart/abstractbarchartitem.cpp
@@ -55,7 +55,7 @@ AbstractBarChartItem::AbstractBarChartItem(QAbstractBarSeries *series, QGraphics
m_orientation(Qt::Horizontal),
m_resetAnimation(true)
{
-
+ setAcceptedMouseButtons(0);
setFlag(ItemClipsChildrenToShape);
setFlag(QGraphicsItem::ItemIsSelectable);
connect(series->d_func(), SIGNAL(updatedLayout()), this, SLOT(handleLayoutChanged()));
diff --git a/src/charts/barchart/horizontal/stacked/horizontalstackedbarchartitem.cpp b/src/charts/barchart/horizontal/stacked/horizontalstackedbarchartitem.cpp
index 211aa4e5..1d38c9ab 100644
--- a/src/charts/barchart/horizontal/stacked/horizontalstackedbarchartitem.cpp
+++ b/src/charts/barchart/horizontal/stacked/horizontalstackedbarchartitem.cpp
@@ -57,7 +57,7 @@ void HorizontalStackedBarChartItem::initializeLayout(int set, int category,
checkIndex--;
QBarSet *checkSet = m_series->barSets().at(checkIndex);
const qreal checkValue = checkSet->at(category);
- if (value < 0.0 == checkValue < 0.0) {
+ if ((value < 0.0) == (checkValue < 0.0)) {
Bar *checkBar = m_indexForBarMap.value(checkSet).value(category);
rect = m_layout.at(checkBar->layoutIndex());
found = true;
@@ -165,8 +165,8 @@ QVector<QRectF> HorizontalStackedBarChartItem::calculateLayout()
if (m_animation && value != 0.0) {
const QRectF &checkRect = m_layout.at(bar->layoutIndex());
if (checkRect.isEmpty() &&
- (value < 0.0 && !qFuzzyCompare(checkRect.right(), rect.right())
- || value > 0.0 && !qFuzzyCompare(checkRect.left(), rect.left()))) {
+ ((value < 0.0 && !qFuzzyCompare(checkRect.right(), rect.right()))
+ || (value > 0.0 && !qFuzzyCompare(checkRect.left(), rect.left())))) {
initializeLayout(set, category, bar->layoutIndex(), true);
}
}
diff --git a/src/charts/barchart/qbarset.cpp b/src/charts/barchart/qbarset.cpp
index bba1cac7..c7927899 100644
--- a/src/charts/barchart/qbarset.cpp
+++ b/src/charts/barchart/qbarset.cpp
@@ -146,6 +146,15 @@ QT_CHARTS_BEGIN_NAMESPACE
*/
/*!
+ \qmlmethod BarSet::clicked(int index)
+
+ This signal is emitted when the user clicks the bar specified by \a index
+ in a bar set.
+
+ The corresponding signal handler is \c onClicked.
+*/
+
+/*!
\fn void QBarSet::pressed(int index)
This signal is emitted when the user clicks the bar specified by \a index in a bar set
@@ -153,6 +162,15 @@ QT_CHARTS_BEGIN_NAMESPACE
*/
/*!
+ \qmlmethod BarSet::pressed(int index)
+
+ This signal is emitted when the user clicks the bar specified by \a index in
+ a bar set and holds down the mouse button.
+
+ The corresponding signal handler is \c onPressed.
+*/
+
+/*!
\fn void QBarSet::released(int index)
This signal is emitted when the user releases the mouse press on the bar specified by
@@ -160,12 +178,30 @@ QT_CHARTS_BEGIN_NAMESPACE
*/
/*!
+ \qmlmethod BarSet::released(int index)
+
+ This signal is emitted when the user releases the mouse press on the bar
+ specified by \a index in a bar set.
+
+ The corresponding signal handler is \c onReleased.
+*/
+
+/*!
\fn void QBarSet::doubleClicked(int index)
This signal is emitted when the user double-clicks the bar specified by \a index in a bar set.
*/
/*!
+ \qmlmethod BarSet::doubleClicked(int index)
+
+ This signal is emitted when the user double-clicks the bar specified by
+ \a index in a bar set.
+
+ The corresponding signal handler is \c onDoubleClicked.
+*/
+
+/*!
\fn void QBarSet::hovered(bool status, int index)
This signal is emitted when a mouse is hovered over the bar specified by \a index in a bar set.
diff --git a/src/charts/barchart/vertical/stacked/stackedbarchartitem.cpp b/src/charts/barchart/vertical/stacked/stackedbarchartitem.cpp
index 51ab680d..42c02568 100644
--- a/src/charts/barchart/vertical/stacked/stackedbarchartitem.cpp
+++ b/src/charts/barchart/vertical/stacked/stackedbarchartitem.cpp
@@ -63,7 +63,7 @@ void StackedBarChartItem::initializeLayout(int set, int category,
checkIndex--;
QBarSet *checkSet = m_series->barSets().at(checkIndex);
const qreal checkValue = checkSet->at(category);
- if (value < 0.0 == checkValue < 0.0) {
+ if ((value < 0.0) == (checkValue < 0.0)) {
Bar *checkBar = m_indexForBarMap.value(checkSet).value(category);
rect = m_layout.at(checkBar->layoutIndex());
found = true;
@@ -169,8 +169,8 @@ QVector<QRectF> StackedBarChartItem::calculateLayout()
if (m_animation && value != 0.0) {
const QRectF &checkRect = m_layout.at(bar->layoutIndex());
if (checkRect.isEmpty() &&
- (value < 0.0 && !qFuzzyCompare(checkRect.top(), rect.top())
- || value > 0.0 && !qFuzzyCompare(checkRect.bottom(), rect.bottom()))) {
+ ((value < 0.0 && !qFuzzyCompare(checkRect.top(), rect.top()))
+ || (value > 0.0 && !qFuzzyCompare(checkRect.bottom(), rect.bottom())))) {
initializeLayout(set, category, bar->layoutIndex(), true);
}
}
diff --git a/src/charts/boxplotchart/boxplotchartitem.cpp b/src/charts/boxplotchart/boxplotchartitem.cpp
index 2fd2297b..c238ac5b 100644
--- a/src/charts/boxplotchart/boxplotchartitem.cpp
+++ b/src/charts/boxplotchart/boxplotchartitem.cpp
@@ -43,7 +43,10 @@ BoxPlotChartItem::BoxPlotChartItem(QBoxPlotSeries *series, QGraphicsItem *item)
m_series(series),
m_animation(0)
{
+ setAcceptedMouseButtons(0);
connect(series, SIGNAL(boxsetsRemoved(QList<QBoxSet *>)), this, SLOT(handleBoxsetRemove(QList<QBoxSet *>)));
+ connect(series, SIGNAL(visibleChanged()), this, SLOT(handleSeriesVisibleChanged()));
+ connect(series, SIGNAL(opacityChanged()), this, SLOT(handleOpacityChanged()));
connect(series->d_func(), SIGNAL(restructuredBoxes()), this, SLOT(handleDataStructureChanged()));
connect(series->d_func(), SIGNAL(updatedLayout()), this, SLOT(handleLayoutChanged()));
connect(series->d_func(), SIGNAL(updatedBoxes()), this, SLOT(handleUpdatedBars()));
@@ -73,6 +76,16 @@ void BoxPlotChartItem::setAnimation(BoxPlotAnimation *animation)
}
}
+void BoxPlotChartItem::handleSeriesVisibleChanged()
+{
+ setVisible(m_series->isVisible());
+}
+
+void BoxPlotChartItem::handleOpacityChanged()
+{
+ setOpacity(m_series->opacity());
+}
+
void BoxPlotChartItem::handleDataStructureChanged()
{
int setCount = m_series->count();
diff --git a/src/charts/boxplotchart/boxplotchartitem_p.h b/src/charts/boxplotchart/boxplotchartitem_p.h
index 0d9a4d29..4dbe6aa1 100644
--- a/src/charts/boxplotchart/boxplotchartitem_p.h
+++ b/src/charts/boxplotchart/boxplotchartitem_p.h
@@ -64,6 +64,8 @@ public:
QRectF boundingRect() const;
public Q_SLOTS:
+ void handleSeriesVisibleChanged();
+ void handleOpacityChanged();
void handleDataStructureChanged();
void handleDomainUpdated();
void handleLayoutChanged();
diff --git a/src/charts/candlestickchart/candlestickchartitem.cpp b/src/charts/candlestickchart/candlestickchartitem.cpp
index 4273a821..0c7c9c71 100644
--- a/src/charts/candlestickchart/candlestickchartitem.cpp
+++ b/src/charts/candlestickchart/candlestickchartitem.cpp
@@ -45,6 +45,7 @@ CandlestickChartItem::CandlestickChartItem(QCandlestickSeries *series, QGraphics
m_timePeriod(0.0),
m_animation(nullptr)
{
+ setAcceptedMouseButtons(0);
connect(series, SIGNAL(candlestickSetsAdded(QList<QCandlestickSet *>)),
this, SLOT(handleCandlestickSetsAdd(QList<QCandlestickSet *>)));
connect(series, SIGNAL(candlestickSetsRemoved(QList<QCandlestickSet *>)),
diff --git a/src/charts/doc/src/index.qdoc b/src/charts/doc/src/index.qdoc
index 1b736be4..18d5cb0b 100644
--- a/src/charts/doc/src/index.qdoc
+++ b/src/charts/doc/src/index.qdoc
@@ -57,6 +57,11 @@
\snippet doc_src_qtcharts.pro 0
+ \section1 Articles and Guides
+ \list
+ \li \l{Qt Charts Overview}
+ \endlist
+
\section1 Examples
\list
\li \l{Qt Charts Examples}
diff --git a/src/charts/doc/src/qtcharts-overview.qdoc b/src/charts/doc/src/qtcharts-overview.qdoc
new file mode 100644
index 00000000..dd042133
--- /dev/null
+++ b/src/charts/doc/src/qtcharts-overview.qdoc
@@ -0,0 +1,371 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt Charts module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \page qtcharts-overview.html overview
+ \title Qt Charts Overview
+ \brief Visualizing data as 2D charts.
+
+ Qt Charts enables creating stylish, interactive, data centric user
+ interfaces. Qt Charts uses the \l {Graphics View Framework} for ease of
+ integration. The chart components can be used as QWidget or QGraphicsWidget
+ objects or QML types.
+
+ \image examples_chartthemes_light.png
+
+ The QChart class manages the graphical representation of different types of
+ series and other chart related objects, such as legend and axes. QChart is a
+ QGraphicsWidget that can be shown in a QGraphicsScene.
+ A simpler solution is to display a chart in a layout by using the
+ convenience class QChartView instead of QChart. In QML, charts are displayed
+ using the ChartView type.
+
+ Some chart components can also be presented as polar charts by using the
+ the QPolarChart class that is a specialization of the QChart class or the
+ PolarChartView QML type that is a specialization of the ChartView type.
+
+ The look and feel of charts can be customized by using themes, modifying
+ colors and properties, hiding chart components, or animating charts.
+
+ Model mappers enable using a data model derived from the QAbstractItemModel
+ class as a data source for a chart. Model mappers can be either horizontal
+ or vertical.
+
+ \section1 Chart Types
+
+ The Qt Charts module provides the following chart types:
+
+ \list
+ \li \l{Line and spline charts}
+ \li \l{Area and scatter charts}
+ \li \l{Bar charts}
+ \li \l{Pie charts}
+ \li \l{Box-and-whiskers charts}
+ \li \l{Candlestick charts}
+ \li \l{Polar charts}
+ \endlist
+
+ Each chart type is represented by an QAbstractSeries derived class or
+ AbstractSeries derived type in QML. Charts are created by using an instance
+ of a series class and adding it to a QChart or ChartView instance.
+
+ For example:
+ \code
+ QLineSeries* series = new QLineSeries();
+ series->add(0, 6);
+ series->add(2, 4);
+ ...
+ chartView->chart()->addSeries(series);
+ chartView->chart()->createDefaultAxes();
+ \endcode
+
+ Or, in QML:
+
+ \snippet qmlpiechart/qml/qmlpiechart/main.qml 1
+ \snippet qmlpiechart/qml/qmlpiechart/main.qml 2
+ \snippet qmlpiechart/qml/qmlpiechart/main.qml 3
+
+ You can combine different types of series in one chart.
+
+ \section2 Line and Spline Charts
+
+ Line and spline charts present data as a series of data points connected by
+ lines. In a line chart, the data points are connected by straight lines,
+ whereas in a spline chart they are connected by a spline. The spline is
+ drawn by using QPainterPath.
+
+ \inlineimage examples_linechart.png
+ \inlineimage examples_splinechart.png
+
+
+ A line chart is implemented by using the QLineSeries class or the LineSeries
+ QML type.
+
+ 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 an example of combining a line chart with a bar chart and using a common
+ axis for both, see \l{Line and BarChart Example}.
+
+ \section2 Area and Scatter Charts
+
+ Area charts present data as an area bound by two lines, whereas scatter
+ charts present data as a collection of points.
+
+ \inlineimage examples_areachart.png
+ \inlineimage examples_scatterchart.png
+
+
+ An area chart is implemented by using the QAreaSeries class or the
+ AreaSeries QML type. By default, the x-axis is used as one boundary and
+ QLineSeries or LineSeries as the other. However, you can use QLineSeries
+ or LineSeries as both boundaries.
+
+ 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}.
+
+ \section2 Bar Charts
+
+ A bar chart presents data as horizontal or vertical bars that are grouped
+ by category. The QBarSet class and the BarSet QML type represent one set of
+ bars in a bar chart. The QAbstractBarSeries class is an abstract parent
+ class for all bar series classes, and the AbstractBarSeries type is the
+ parent type of bar series types. The series type determines how the data is
+ presented.
+
+ The QBarSeries class and the BarSeries QML type present data as vertical
+ bars grouped by category. Similarly, the QHorizontalBarSeries class and the
+ HorizontalBarSeries QML type present data as horizontal bars.
+
+ \inlineimage examples_barchart.png
+ \inlineimage examples_horizontalbarchart.png
+
+
+ The QStackedBarSeries class and the StackedBarSeries type present a series
+ of data as vertically stacked bars, with one bar per category. The
+ corresponding horizontal class and type are QHorizontalStackedBarSeries and
+ HorizontalStackedBarSeries, respectively.
+
+ \inlineimage examples_stackedbarchart.png
+ \inlineimage examples_horizontalstackedbarchart.png
+
+
+ The QPercentBarSeries class and PercentBarSeries QML type present a series
+ of categorized data as a percentage of each category. The corresponding
+ horizontal class and type are QHorizontalPercentBarSeries and
+ HorizontalPercentBarSeries, respectively.
+
+ \inlineimage examples_percentbarchart.png
+ \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}.
+
+ \section2 Pie Charts
+
+ Pie charts present data as a pie that consists of pie slices. The pie is
+ implemented using the QPieSeries class or the PieSeries QML type and the pie
+ slices are added using the QPieSlice class or the PieSlice QML type.
+
+ The pie can be turned into a donut by specifying a hole size between 0.0
+ and 1.0.
+
+ \inlineimage examples_piechart.png
+ \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}.
+
+ \section2 Box-and-Whiskers Charts
+
+ The box-and-whiskers charts present data as quartiles extended with whiskers
+ that show the variability of the values. The items in box plot series are
+ grouped by category, similarly to bar sets in bar series. For each
+ box-and-whiskers item, the lower extreme, lower quartile, median, upper
+ quartile, and upper extreme value are specified.
+
+ A box-and-whiskers chart is implemented by using the QBoxPlotSeries and
+ QBoxSet classes or the BoxPlotSeries and BoxSet QML types.
+
+ \image examples_boxplotchart.png
+
+ For more information, see \l{Box and Whiskers Example}.
+
+ \section2 Candlestick Charts
+
+ Candlestick charts presents a series of data shown as candlesticks.
+
+ \image examples_candlestickchart.png
+
+ A candlestick chart is implemented by using the QCandlestickSeries and
+ QCandlestickSet classes or the CandlestickSeries and CandlestickSet QML
+ types.
+
+ \section2 Polar Charts
+
+ Polar charts present data in a circular graph, where the placement of data
+ is based on the angle and distance from the center of the graph, the
+ \e pole.
+
+ \image examples_polarchart.png
+
+ The QPolarChart class is a specialization of the QChart class. It supports
+ line, spline, area, and scatter series, as well as all the axis types
+ 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}.
+
+ \section1 Axes
+
+ Qt Charts supports the following axis types:
+
+ \list
+ \li Value axis
+ \li Category axis
+ \li Bar category axis
+ \li Date-time axis
+ \li Logarithmic value axis
+ \endlist
+
+ An axis can be set up to show a line with tick marks, grid lines, and
+ shades. The values on the axis are drawn at the positions of tick marks.
+ All axis types are specializations of the QAbstractAxis class or the
+ AbstractAxis QML type.
+
+ A value axis adds real values to a chart's axis. It is implemented using the
+ QValueAxis class or the ValueAxis QML type.
+
+ A category axis is implemented using the QCategoryAxis class or the
+ CategoryAxis QML type. It has named ranges and adjustable range widths.
+
+ The bar category axis is similar to a category axis, but the range width is
+ the same for all ranges. A bar category axis is implemented using the
+ QBarCategoryAxis class or the BarCategoryAxis QML type.
+
+ A date-time axis adds dates and times to a chart's axis. It is implemented
+ using the QDateTimeAxis class or the DateTimeAxis QML type.
+
+ A logarithmic axis adds a logarithmic scale to a chart's axis. A logarithmic
+ scale is a nonlinear scale that is based on orders of magnitude, so that
+ each tick mark on the axis is the previous tick mark multiplied by a value.
+ A logarithmic axis is implemented using the QLogValueAxis class or the
+ LogValueAxis QML type.
+
+ Multiple axes can be defined for one chart. The axes can be placed down, up,
+ left, or right of the chart. Further, the axes can be of different types.
+ However, mixing axis types that would result in different domains is not
+ 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}.
+
+ \section1 Legend
+
+ A legend is a graphical object that displays the legend of a chart. Legend
+ objects cannot be created or deleted, but they can be referenced via the
+ QChart class or the ChartView QML type. The legend state is updated by
+ QChart or ChartView when series change.
+
+ A legend can be positioned below or above the chart, as well as to the left
+ or right of it. By default, the legend is attached to the chart view, but it
+ can be detached to a separate graphics item that can be moved around freely.
+
+ It is possible to hide either individual markers from the legend or the
+ whole legend.
+
+ Legend markers can be modified by using the QLegendMarker base class and the
+ subclasses for each series type: QAreaLegendMarker, QBarLegendMarker,
+ QBoxPlotLegendMarker, QCandlestickLegendMarker, and QXYLegendMarker.
+
+ In QML, legend markers can be modified by creating custom legends, as
+ illustrated by the \l{Qml Custom Legend} example.
+
+ \section1 Interacting with Charts
+
+ End users can interact with charts by dynamically adding values to them,
+ drilling down into data, zooming into and out of charts, scrolling charts,
+ and clicking items in charts or hovering the mouse over them.
+
+ \section2 Drawing Data Dynamically
+
+ 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}.
+
+ \section2 Drilling Down into Data
+
+ Drilldown effects can be implemented to bar or pie charts, for example.
+ When users select an item in the chart, a more detailed view of the
+ 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}.
+
+ \section2 Zooming and Scrolling
+
+ Users can use the keyboard for zooming and scrolling. They can scroll charts
+ by using the arrow keys and zoom into or out of charts by using the plus and
+ minus keys. In addition, QRubberBand can be used for selecting the area to
+ zoom into.
+
+ On touch devices, gestures can be used for panning and zooming.
+
+ For more information, see \l{Zoom Line Example}.
+
+ \section2 Clicking and Hovering
+
+ You can connect slots to signals emitted when end users click items in
+ 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}.
+
+ \section1 Themes
+
+ A theme is a built-in collection of UI style related settings applied to all
+ the visual elements of a chart, such as colors, pens, brushes, and fonts of
+ series, as well as axes, title, and legend.
+
+ \image examples_chartthemes_blue_cerulean.png
+
+ Qt Charts comes with the following predefined themes:
+
+ \list
+ \li Light theme, which is the default theme
+ \li Cerulean blue theme
+ \li Dark theme
+ \li Sand brown theme
+ \li Natural color system (NCS) blue theme
+ \li High contrast theme
+ \li Icy blue theme
+ \li Qt theme
+ \endlist
+
+ The themes can be customized by changing the colors, pens, brushes, and
+ fonts. New themes can be added by modifying the Qt Charts source code.
+
+ \note Changing the theme will overwrite all customization previously applied
+ to the series.
+
+ For more information, see the \l {Chart themes example}.
+*/
diff --git a/src/charts/layout/polarchartlayout.cpp b/src/charts/layout/polarchartlayout.cpp
index 1dd7d303..5ff223ea 100644
--- a/src/charts/layout/polarchartlayout.cpp
+++ b/src/charts/layout/polarchartlayout.cpp
@@ -34,8 +34,6 @@
QT_CHARTS_BEGIN_NAMESPACE
-static const qreal golden_ratio = 0.4;
-
PolarChartLayout::PolarChartLayout(ChartPresenter *presenter)
: AbstractChartLayout(presenter)
{
diff --git a/src/charts/legend/legendmarkeritem.cpp b/src/charts/legend/legendmarkeritem.cpp
index ec75659f..39ac8b6f 100644
--- a/src/charts/legend/legendmarkeritem.cpp
+++ b/src/charts/legend/legendmarkeritem.cpp
@@ -154,11 +154,12 @@ void LegendMarkerItem::setGeometry(const QRectF &rect)
const QString html = ChartPresenter::truncatedText(m_font, m_label, qreal(0.0),
width - x, rect.height(), truncatedRect);
m_textItem->setHtml(html);
+#if QT_CONFIG(tooltip)
if (m_marker->m_legend->showToolTips() && html != m_label)
m_textItem->setToolTip(m_label);
else
m_textItem->setToolTip(QString());
-
+#endif
m_textItem->setFont(m_font);
m_textItem->setTextWidth(truncatedRect.width());
@@ -243,7 +244,9 @@ QString LegendMarkerItem::displayedLabel() const
void LegendMarkerItem::setToolTip(const QString &tip)
{
+#if QT_CONFIG(tooltip)
m_textItem->setToolTip(tip);
+#endif
}
QLegend::MarkerShape LegendMarkerItem::markerShape() const
diff --git a/src/charts/linechart/linechartitem.cpp b/src/charts/linechart/linechartitem.cpp
index 04e00c35..f41e5bc2 100644
--- a/src/charts/linechart/linechartitem.cpp
+++ b/src/charts/linechart/linechartitem.cpp
@@ -39,8 +39,6 @@
QT_CHARTS_BEGIN_NAMESPACE
-const qreal mouseEventMinWidth(12);
-
LineChartItem::LineChartItem(QLineSeries *series, QGraphicsItem *item)
: XYChart(series,item),
m_series(series),
diff --git a/src/charts/linechart/qlineseries.cpp b/src/charts/linechart/qlineseries.cpp
index b055a896..f08dae17 100644
--- a/src/charts/linechart/qlineseries.cpp
+++ b/src/charts/linechart/qlineseries.cpp
@@ -75,6 +75,11 @@ QT_CHARTS_BEGIN_NAMESPACE
*/
/*!
+ \qmlproperty int LineSeries::count
+ The number of data points in the series.
+*/
+
+/*!
\qmlproperty real LineSeries::width
The width of the line. By default, the width is 2.0.
*/
diff --git a/src/charts/piechart/qvpiemodelmapper.cpp b/src/charts/piechart/qvpiemodelmapper.cpp
index 9c0d8443..9f876c48 100644
--- a/src/charts/piechart/qvpiemodelmapper.cpp
+++ b/src/charts/piechart/qvpiemodelmapper.cpp
@@ -143,7 +143,7 @@ QT_CHARTS_BEGIN_NAMESPACE
The minimum and default value is -1 (number limited by the number of rows in the model).
*/
/*!
- \qmlproperty int VPieModelMapper::columnCount
+ \qmlproperty int VPieModelMapper::rowCount
The number of rows of the model that are mapped as the data for a pie series.
The default value is -1 (number limited by the number of rows in the model).
*/
diff --git a/src/charts/scatterchart/qscatterseries.cpp b/src/charts/scatterchart/qscatterseries.cpp
index 52855ac5..c5a8a8ba 100644
--- a/src/charts/scatterchart/qscatterseries.cpp
+++ b/src/charts/scatterchart/qscatterseries.cpp
@@ -114,6 +114,12 @@
This is a convenience property for modifying the color of the pen.
\sa QScatterSeries::pen()
*/
+
+/*!
+ \qmlproperty int ScatterSeries::count
+ The number of data points in the series.
+*/
+
/*!
\qmlproperty color ScatterSeries::borderColor
The color used to draw the marker borders.
diff --git a/src/charts/scatterchart/scatterchartitem.cpp b/src/charts/scatterchart/scatterchartitem.cpp
index 2defadf5..9fb81909 100644
--- a/src/charts/scatterchart/scatterchartitem.cpp
+++ b/src/charts/scatterchart/scatterchartitem.cpp
@@ -267,6 +267,7 @@ void ScatterChartItem::handleUpdated()
m_visible = m_series->isVisible();
m_size = m_series->markerSize();
m_shape = m_series->markerShape();
+ setVisible(m_visible);
setOpacity(m_series->opacity());
m_pointLabelsFormat = m_series->pointLabelsFormat();
m_pointLabelsVisible = m_series->pointLabelsVisible();
diff --git a/src/charts/splinechart/qsplineseries.cpp b/src/charts/splinechart/qsplineseries.cpp
index 3c3e167b..78103111 100644
--- a/src/charts/splinechart/qsplineseries.cpp
+++ b/src/charts/splinechart/qsplineseries.cpp
@@ -101,6 +101,11 @@
\sa Qt::PenCapStyle
*/
+/*!
+ \qmlproperty int SplineSeries::count
+ The number of data points in the series.
+*/
+
QT_CHARTS_BEGIN_NAMESPACE
/*!
diff --git a/src/charts/xychart/qxyseries.cpp b/src/charts/xychart/qxyseries.cpp
index 9a6ea20c..40382d15 100644
--- a/src/charts/xychart/qxyseries.cpp
+++ b/src/charts/xychart/qxyseries.cpp
@@ -59,7 +59,7 @@ QT_CHARTS_BEGIN_NAMESPACE
\qmlproperty AbstractAxis XYSeries::axisX
The x-axis used for the series. If you leave both axisX and axisXTop
undefined, a value axis is created for the series.
- \sa axisXTop, QValueAxis
+ \sa axisXTop, ValueAxis
*/
/*!
diff --git a/tests/manual/chartviewer/charts/axis/categoryaxis.cpp b/tests/manual/chartviewer/charts/axis/categoryaxis.cpp
index 37a2535f..ee42bb34 100644
--- a/tests/manual/chartviewer/charts/axis/categoryaxis.cpp
+++ b/tests/manual/chartviewer/charts/axis/categoryaxis.cpp
@@ -37,7 +37,7 @@ class CategoryLineChart: public Chart
public:
QString name() { return QObject::tr("CategoryAxis"); }
QString category() { return QObject::tr("Axis"); }
- QString subCategory() { return QString::null; }
+ QString subCategory() { return QString(); }
QChart *createChart(const DataTable &table)
{
diff --git a/tests/manual/chartviewer/charts/axis/valueaxis.cpp b/tests/manual/chartviewer/charts/axis/valueaxis.cpp
index 996c28d6..00a6baef 100644
--- a/tests/manual/chartviewer/charts/axis/valueaxis.cpp
+++ b/tests/manual/chartviewer/charts/axis/valueaxis.cpp
@@ -38,7 +38,7 @@ class ValueAxis: public Chart
public:
QString name() { return "ValueAxis"; }
QString category() { return QObject::tr("Axis"); }
- QString subCategory() { return QString::null; }
+ QString subCategory() { return QString(); }
QChart *createChart(const DataTable &table)
{
diff --git a/tests/manual/chartviewer/charts/font/font.cpp b/tests/manual/chartviewer/charts/font/font.cpp
index f29db8fb..713b28c8 100644
--- a/tests/manual/chartviewer/charts/font/font.cpp
+++ b/tests/manual/chartviewer/charts/font/font.cpp
@@ -37,7 +37,7 @@ public:
FontChart(int fontSize): m_fontSize(fontSize) {};
QString name() { return QObject::tr("Font") + " " + QString::number(m_fontSize); }
QString category() { return QObject::tr("Font"); }
- QString subCategory() { return QString::null; }
+ QString subCategory() { return QString(); }
QChart *createChart(const DataTable &table)
{
diff --git a/tests/manual/chartviewer/charts/pieseries/donutchart.cpp b/tests/manual/chartviewer/charts/pieseries/donutchart.cpp
index 9bd4ef4a..8e297e6a 100644
--- a/tests/manual/chartviewer/charts/pieseries/donutchart.cpp
+++ b/tests/manual/chartviewer/charts/pieseries/donutchart.cpp
@@ -36,7 +36,7 @@ class DonutChart: public Chart
public:
QString name() { return QObject::tr("DonutChart"); }
QString category() { return QObject::tr("PieSeries"); }
- QString subCategory() { return QString::null; }
+ QString subCategory() { return QString(); }
QChart *createChart(const DataTable &table)
{
diff --git a/tests/manual/chartviewer/charts/pieseries/piechart.cpp b/tests/manual/chartviewer/charts/pieseries/piechart.cpp
index ba63ea42..32d0aa4b 100644
--- a/tests/manual/chartviewer/charts/pieseries/piechart.cpp
+++ b/tests/manual/chartviewer/charts/pieseries/piechart.cpp
@@ -36,7 +36,7 @@ class PieChart: public Chart
public:
QString name() { return QObject::tr("PieChart"); }
QString category() { return QObject::tr("PieSeries"); }
- QString subCategory() { return QString::null; }
+ QString subCategory() { return QString(); }
QChart *createChart(const DataTable &table)
{
diff --git a/tests/manual/chartviewer/charts/size/sizecharts.cpp b/tests/manual/chartviewer/charts/size/sizecharts.cpp
index 5112c902..22197d99 100644
--- a/tests/manual/chartviewer/charts/size/sizecharts.cpp
+++ b/tests/manual/chartviewer/charts/size/sizecharts.cpp
@@ -37,7 +37,7 @@ class SizeChart: public Chart
public:
QString name() { return QObject::tr("PlotArea"); }
QString category() { return QObject::tr("Size"); }
- QString subCategory() { return QString::null; }
+ QString subCategory() { return QString(); }
QChart *createChart(const DataTable &table)
{
diff --git a/tests/manual/chartviewer/charts/xyseries/areachart.cpp b/tests/manual/chartviewer/charts/xyseries/areachart.cpp
index aadd93ce..3faa7031 100644
--- a/tests/manual/chartviewer/charts/xyseries/areachart.cpp
+++ b/tests/manual/chartviewer/charts/xyseries/areachart.cpp
@@ -37,7 +37,7 @@ class AreaChart: public Chart
public:
QString name() { return QObject::tr("AreaChart"); }
QString category() { return QObject::tr("XYSeries"); }
- QString subCategory() { return QString::null; }
+ QString subCategory() { return QString(); }
QChart *createChart(const DataTable &table)
{
diff --git a/tests/manual/chartviewer/charts/xyseries/linechart.cpp b/tests/manual/chartviewer/charts/xyseries/linechart.cpp
index ca5e8407..2e23c2b6 100644
--- a/tests/manual/chartviewer/charts/xyseries/linechart.cpp
+++ b/tests/manual/chartviewer/charts/xyseries/linechart.cpp
@@ -36,7 +36,7 @@ class LineChart: public Chart
public:
QString name() { return QObject::tr("LineChart"); }
QString category() { return QObject::tr("XYSeries"); }
- QString subCategory() { return QString::null; }
+ QString subCategory() { return QString(); }
QChart *createChart(const DataTable &table)
{
diff --git a/tests/manual/chartviewer/charts/xyseries/scatterchart.cpp b/tests/manual/chartviewer/charts/xyseries/scatterchart.cpp
index 54f5a5cc..deb366f6 100644
--- a/tests/manual/chartviewer/charts/xyseries/scatterchart.cpp
+++ b/tests/manual/chartviewer/charts/xyseries/scatterchart.cpp
@@ -36,7 +36,7 @@ class ScatterChart: public Chart
public:
QString name() { return QObject::tr("ScatterChart"); }
QString category() { return QObject::tr("XYSeries"); }
- QString subCategory() { return QString::null; }
+ QString subCategory() { return QString(); }
QChart *createChart(const DataTable &table)
{
diff --git a/tests/manual/chartviewer/charts/xyseries/splinechart.cpp b/tests/manual/chartviewer/charts/xyseries/splinechart.cpp
index 699b2afa..3e9db5cd 100644
--- a/tests/manual/chartviewer/charts/xyseries/splinechart.cpp
+++ b/tests/manual/chartviewer/charts/xyseries/splinechart.cpp
@@ -36,7 +36,7 @@ class SplineChart: public Chart
public:
QString name() { return QObject::tr("SplineChart"); }
QString category() { return QObject::tr("XYSeries"); }
- QString subCategory() { return QString::null; }
+ QString subCategory() { return QString(); }
QChart *createChart(const DataTable &table)
{