##// END OF EJS Templates
Fix default axis for DeclarativeChart...
Fix default axis for DeclarativeChart The range for the axis needs to be set if no axis has been defined for Chart. Change-Id: I036fd1264b53b150bc9aaf1c1571f4d1dbefbc81 Task-number: QTRD-3482 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@theqtcompany.com>

File last commit:

r2782:5fbd172ba15f
r2789:bcb78508ec67
Show More
qareaseries.cpp
697 lines | 19.9 KiB | text/x-c | CppLexer
Jani Honkonen
Add license headers
r794 /****************************************************************************
**
Titta Heikkala
Copyright header changes...
r2776 ** Copyright (C) 2015 The Qt Company Ltd
Jani Honkonen
Add license headers
r794 ** All rights reserved.
Titta Heikkala
Copyright header changes...
r2776 ** For any questions to The Qt Company, please use contact form at http://qt.io
Jani Honkonen
Add license headers
r794 **
Titta Heikkala
Updated license headers...
r2740 ** This file is part of the Qt Charts module.
Jani Honkonen
Add license headers
r794 **
Titta Heikkala
Updated license headers...
r2740 ** Licensees holding valid commercial license for Qt may use this file in
** accordance with the Qt License Agreement provided with the Software
** or, alternatively, in accordance with the terms contained in a written
Titta Heikkala
Copyright header changes...
r2776 ** agreement between you and The Qt Company.
Jani Honkonen
Add license headers
r794 **
** If you have questions regarding the use of this file, please use
Titta Heikkala
Updated license headers...
r2740 ** contact form at http://qt.io
Jani Honkonen
Add license headers
r794 **
****************************************************************************/
Titta Heikkala
Fix include syntax...
r2714 #include <QtCharts/QAreaSeries>
#include <private/qareaseries_p.h>
#include <QtCharts/QLineSeries>
#include <private/areachartitem_p.h>
#include <private/abstractdomain_p.h>
#include <private/chartdataset_p.h>
#include <private/charttheme_p.h>
#include <QtCharts/QValueAxis>
#include <QtCharts/QAreaLegendMarker>
#include <private/qchart_p.h>
sauimone
Areaseries uses new legendmarkers
r2177
Titta Heikkala
Qt Charts project file structure change...
r2712 QT_CHARTS_BEGIN_NAMESPACE
Michal Klocek
Adds area chart...
r421
/*!
\class QAreaSeries
Titta Heikkala
Fix Charts documentation...
r2639 \inmodule Qt Charts
Michal Klocek
Adds area chart...
r421 \brief The QAreaSeries class is used for making area charts.
Titta Heikkala
Clarified QAreaSeries documentation...
r2754 An area series is used to show quantitative data. It is based on line series, in the way that
the area between the boundary lines is emphasized with color. Since the area series is based on
line series, QAreaSeries constructor needs a QLineSeries instance, which defines "upper"
boundary of the area. The area chart is drawn using the bottom of the plot area as the "lower"
boundary by default. Instead of the bottom of the plot area, the "lower" boundary can be
specified by another line. In that case QAreaSeries should be initialized with two QLineSeries
instances. Please note that the terms "upper" and "lower" boundary can be misleading in cases
where the "lower" boundary has bigger values than the "upper" one. The main point is that the
area between these two boundary lines will be filled.
Michal Klocek
Adds area chart...
r421
Tero Ahola
Documentation fixes....
r995 See the \l {AreaChart Example} {area chart example} to learn how to create a simple area chart.
\image examples_areachart.png
Michal Klocek
Adds area chart...
r421 */
Titta Heikkala
Qt Charts project file structure change...
r2712
Titta Heikkala
Fix Charts documentation...
r2639 /*!
\qmltype AreaSeries
\instantiates QAreaSeries
Titta Heikkala
Qt Charts project file structure change...
r2712 \inqmlmodule QtCharts
Titta Heikkala
Fix Charts documentation...
r2639
Titta Heikkala
Qt Charts project file structure change...
r2712 \inherits AbstractSeries
\brief The AreaSeries type is used for making area charts.
Tero Ahola
Documenting xy-series
r1491
Titta Heikkala
Qt Charts project file structure change...
r2712 The following QML shows how to create a simple area chart:
\snippet qmlchart/qml/qmlchart/View4.qml 1
\beginfloatleft
\image examples_qmlchart4.png
\endfloat
\clearfloat
Tero Ahola
Documenting xy-series
r1491 */
Michal Klocek
Adds area chart...
r421
/*!
Tero Ahola
Minor modifications to properties of abstract, area and bar series
r1462 \property QAreaSeries::upperSeries
\brief The upper one of the two line series used to define area series boundaries.
Michal Klocek
Adds area chart...
r421 */
Tero Ahola
Documenting xy-series
r1491 /*!
\qmlproperty LineSeries AreaSeries::upperSeries
The upper one of the two line series used to define area series boundaries.
*/
Michal Klocek
Adds area chart...
r421
/*!
Tero Ahola
Minor modifications to properties of abstract, area and bar series
r1462 \property QAreaSeries::lowerSeries
The lower one of the two line series used to define are series boundaries. Note if
Miikka Heikkinen
Documentation updates...
r2494 QAreaSeries was constructed without a\ lowerSeries this is null.
Michal Klocek
Adds area chart...
r421 */
Tero Ahola
Documenting xy-series
r1491 /*!
\qmlproperty LineSeries AreaSeries::lowerSeries
The lower one of the two line series used to define are series boundaries. Note if
Miikka Heikkinen
Documentation updates...
r2494 AreaSeries was constructed without a\ lowerSeries this is null.
Tero Ahola
Documenting xy-series
r1491 */
Michal Klocek
Adds area chart...
r421
Tero Ahola
color and borderColor properties to XY charts; removed unnecessary signals
r1481 /*!
\property QAreaSeries::color
Fill (brush) color of the series. This is a convenience property for modifying the color of brush.
\sa QAreaSeries::brush()
*/
Tero Ahola
Documenting xy-series
r1491 /*!
\qmlproperty color AreaSeries::color
Fill (brush) color of the series.
*/
Tero Ahola
color and borderColor properties to XY charts; removed unnecessary signals
r1481
/*!
\property QAreaSeries::borderColor
Line (pen) color of the series. This is a convenience property for modifying the color of pen.
\sa QAreaSeries::pen()
*/
Tero Ahola
Documenting xy-series
r1491 /*!
\qmlproperty color AreaSeries::borderColor
Line (pen) color of the series.
*/
Tero Ahola
color and borderColor properties to XY charts; removed unnecessary signals
r1481
Tero Ahola
Added missing QML properties to AreaSeries
r1906 /*!
\qmlproperty real AreaSeries::borderWidth
The width of the border line. By default the width is 2.0.
*/
Michal Klocek
Adds area chart...
r421 /*!
\fn QPen QAreaSeries::pen() const
\brief Returns the pen used to draw line for this series.
\sa setPen()
*/
/*!
\fn QPen QAreaSeries::brush() const
\brief Returns the brush used to draw line for this series.
\sa setBrush()
*/
Titta Heikkala
Add possibility to set brush image via QML API...
r2681 /*!
\qmlproperty QString AreaSeries::brushFilename
The name of the file used as a brush image for the series.
*/
Tero Ahola
color and borderColor properties to XY charts; removed unnecessary signals
r1481 /*!
\fn void QAreaSeries::colorChanged(QColor color)
\brief Signal is emitted when the fill (brush) color has changed to \a color.
*/
Tero Ahola
Documenting xy-series
r1491 /*!
Tero Ahola
QML signals documentation
r1531 \qmlsignal AreaSeries::onColorChanged(color color)
Tero Ahola
Documenting xy-series
r1491 Signal is emitted when the fill (brush) color has changed to \a color.
*/
Tero Ahola
color and borderColor properties to XY charts; removed unnecessary signals
r1481
/*!
\fn void QAreaSeries::borderColorChanged(QColor color)
\brief Signal is emitted when the line (pen) color has changed to \a color.
*/
Michal Klocek
Adds area chart...
r421 /*!
Tero Ahola
QML signals documentation
r1531 \qmlsignal AreaSeries::onBorderColorChanged(color color)
Tero Ahola
Documenting xy-series
r1491 Signal is emitted when the line (pen) color has changed to \a color.
Michal Klocek
Adds area chart...
r421 */
Michal Klocek
Updates presenter example documentation
r574 /*!
\fn void QAreaSeries::clicked(const QPointF& point)
Titta Heikkala
Fix clicked, released and doubleClicked signal points...
r2746 \brief Signal is emitted when user clicks the \a point on area chart. The \a point is the point
where the press was triggered.
\sa pressed, released, doubleClicked
Michal Klocek
Updates presenter example documentation
r574 */
Tero Ahola
Documenting xy-series
r1491 /*!
Tero Ahola
QML signals documentation
r1531 \qmlsignal AreaSeries::onClicked(QPointF point)
Titta Heikkala
Fix clicked, released and doubleClicked signal points...
r2746 Signal is emitted when user clicks the \a point on area chart. The \a point is the point where
the press was triggered.
\sa onPressed, onReleased, onDoubleClicked
Tero Ahola
Documenting xy-series
r1491 */
Michal Klocek
Updates presenter example documentation
r574
Tero Ahola
Documented QXYSeries::hovered and QAreaSeries::hovered
r2362 /*!
\fn void QAreaSeries::hovered(const QPointF &point, bool state)
This signal is emitted when user has hovered over or away from the series. \a point shows the origin (coordinate)
of the hover event. \a state is true when user has hovered over the series and false when hover has moved away from
the series.
*/
/*!
\qmlsignal AreaSeries::onHovered(point point, bool state)
This signal is emitted when user has hovered over or away from the series. \a point shows the origin (coordinate)
of the hover event. \a state is true when user has hovered over the series and false when hover has moved away from
the series.
*/
Titta Heikkala
Add pressed, released and doubleClicked signals...
r2739 /*!
\fn void QAreaSeries::pressed(const QPointF& point)
\brief Signal is emitted when user presses the \a point on area chart.
Titta Heikkala
Fix clicked, released and doubleClicked signal points...
r2746 \sa clicked, released, doubleClicked
Titta Heikkala
Add pressed, released and doubleClicked signals...
r2739 */
/*!
\qmlsignal AreaSeries::onPressed(QPointF point)
Signal is emitted when user presses the \a point on area chart.
Titta Heikkala
Fix clicked, released and doubleClicked signal points...
r2746 \sa onClicked, onReleased, onDoubleClicked
Titta Heikkala
Add pressed, released and doubleClicked signals...
r2739 */
/*!
\fn void QAreaSeries::released(const QPointF& point)
Titta Heikkala
Fix clicked, released and doubleClicked signal points...
r2746 \brief Signal is emitted when user releases a press that was triggered on a \a point on area
chart.
\sa pressed, clicked, doubleClicked
Titta Heikkala
Add pressed, released and doubleClicked signals...
r2739 */
/*!
\qmlsignal AreaSeries::onReleased(QPointF point)
Titta Heikkala
Fix clicked, released and doubleClicked signal points...
r2746 Signal is emitted when user releases a press that was triggered on a \a point on area chart.
\sa onPressed, onClicked, onDoubleClicked
Titta Heikkala
Add pressed, released and doubleClicked signals...
r2739 */
/*!
\fn void QAreaSeries::doubleClicked(const QPointF& point)
Titta Heikkala
Fix clicked, released and doubleClicked signal points...
r2746 \brief Signal is emitted when user doubleclicks the \a point on area chart. The \a point is the
point where the first press was triggered.
\sa pressed, released, clicked
Titta Heikkala
Add pressed, released and doubleClicked signals...
r2739 */
/*!
\qmlsignal AreaSeries::onDoubleClicked(QPointF point)
Titta Heikkala
Fix clicked, released and doubleClicked signal points...
r2746 Signal is emitted when user doubleclicks the \a point on area chart. The \a point is the point
where the first press was triggered.
\sa onPressed, onReleased, onClicked
Titta Heikkala
Add pressed, released and doubleClicked signals...
r2739 */
Tero Ahola
Updated documentation, warnings from legend and area left
r973 /*!
\fn void QAreaSeries::selected()
The signal is emitted if the user selects/deselects the XY series. The logic for maintaining selections should be
implemented by the user of QAreaSeries API.
*/
Tero Ahola
Documenting xy-series
r1491 /*!
Tero Ahola
QML signals documentation
r1531 \qmlsignal AreaSeries::onSelected()
Tero Ahola
Documenting xy-series
r1491 The signal is emitted if the user selects/deselects the XY series. The logic for maintaining selections should be
implemented by the user of AreaSeries API.
*/
Tero Ahola
Updated documentation, warnings from legend and area left
r973
Michal Klocek
Adds area chart...
r421 /*!
Marek Rosa
gdpbarchart moved to test. Few small doc fixes
r940 \fn void QAreaSeriesPrivate::updated()
Michal Klocek
Adds area chart...
r421 \brief \internal
*/
Titta Heikkala
Added possibility to show series value...
r2689 /*!
\property QAreaSeries::pointLabelsFormat
The \a format used for showing labels with series points.
QAreaSeries supports the following format tags:
\table
\row
\li @xPoint \li The x value of the data point
\row
\li @yPoint \li The y value of the data point
\endtable
For example, the following usage of the format tags would produce labels that have the data
point (x, y) shown inside brackets separated by a comma:
\code
series->setPointLabelsFormat("(@xPoint, @yPoint)");
\endcode
By default, the labels format is set to '@xPoint, @yPoint'. The labels are shown on the plot
area, labels on the edge of the plot area are cut. If the points are close to each other the
labels may overlap.
\sa QAreaSeries::pointLabelsVisible, QAreaSeries::pointLabelsFont, QAreaSeries::pointLabelsColor
*/
/*!
\qmlproperty string AreaSeries::pointLabelsFormat
The \a format used for showing labels with series points.
\sa QAreaSeries::pointLabelsFormat, pointLabelsVisible, pointLabelsFont, pointLabelsColor
*/
/*!
\fn void QAreaSeries::pointLabelsFormatChanged(const QString &format)
Signal is emitted when the \a format of data point labels is changed.
*/
/*!
\qmlsignal AreaSeries::onPointLabelsFormatChanged(string format)
Signal is emitted when the \a format of data point labels is changed.
*/
/*!
\property QAreaSeries::pointLabelsVisible
Defines the visibility for data point labels. False by default.
\sa QAreaSeries::pointLabelsFormat
*/
/*!
\qmlproperty bool AreaSeries::pointLabelsVisible
Defines the visibility for data point labels.
\sa pointLabelsFormat
*/
/*!
\fn void QAreaSeries::pointLabelsVisibilityChanged(bool visible)
The visibility of the data point labels is changed to \a visible.
*/
/*!
\qmlsignal AreaSeries::onPointLabelsVisibilityChanged(bool visible)
The visibility of the data point labels is changed to \a visible.
*/
/*!
\property QAreaSeries::pointLabelsFont
Defines the font used for data point labels.
\sa QAreaSeries::pointLabelsFormat
*/
/*!
\qmlproperty font AreaSeries::pointLabelsFont
Defines the font used for data point labels.
\sa pointLabelsFormat
*/
/*!
\fn void QAreaSeries::pointLabelsFontChanged(const QFont &font);
The font used for data point labels is changed to \a font.
*/
/*!
\qmlsignal AreaSeries::onPointLabelsFontChanged(Font font)
The font used for data point labels is changed to \a font.
*/
/*!
\property QAreaSeries::pointLabelsColor
Defines the color used for data point labels. By default, the color is the color of the brush
defined in theme for labels.
\sa QAreaSeries::pointLabelsFormat
*/
/*!
\qmlproperty font AreaSeries::pointLabelsColor
Defines the color used for data point labels. By default, the color is the color of the brush
defined in theme for labels.
\sa pointLabelsFormat
*/
/*!
\fn void QAreaSeries::pointLabelsColorChanged(const QColor &color);
The color used for data point labels is changed to \a color.
*/
/*!
\qmlsignal AreaSeries::onPointLabelsColorChanged(Color color)
The color used for data point labels is changed to \a color.
*/
Michal Klocek
Adds area chart...
r421 /*!
Constructs area series object which is a child of \a upperSeries. Area will be spanned between \a
upperSeries line and \a lowerSeries line. If no \a lowerSeries is passed to constructor, area is specified by axis x (y=0) instead.
Michal Klocek
Krazy reported errors...
r974 When series object is added to QChartView or QChart instance ownerships is transferred.
Michal Klocek
Adds area chart...
r421 */
Tero Ahola
Internal review: fixed minor issues in Area and XySeries
r761 QAreaSeries::QAreaSeries(QLineSeries *upperSeries, QLineSeries *lowerSeries)
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 : QAbstractSeries(*new QAreaSeriesPrivate(upperSeries, lowerSeries, this), upperSeries)
Michal Klocek
Adds area chart...
r421 {
}
Tero Ahola
Internal review: fixed minor issues in Area and XySeries
r761
Tero Ahola
Separated series model stuff from data api in QML examples
r1202 /*!
Jani Honkonen
random doc updates
r1351 Constructs area series object without upper or lower series with \a parent object.
Tero Ahola
Separated series model stuff from data api in QML examples
r1202 */
QAreaSeries::QAreaSeries(QObject *parent)
: QAbstractSeries(*new QAreaSeriesPrivate(0, 0, this), parent)
{
}
Michal Klocek
Adds area chart...
r421 /*!
Marek Rosa
Few docs fixes to area series
r1515 Destroys the object.
Michal Klocek
Adds area chart...
r421 */
QAreaSeries::~QAreaSeries()
{
Michal Klocek
Fixes wrong bar destruction by adding destructor for bar*series , note this breaks ABI
r1727 Q_D(QAreaSeries);
Michal Klocek
Refactors internals...
r2273 if (d->m_chart)
d->m_chart->removeSeries(this);
Michal Klocek
Adds area chart...
r421 }
Jani Honkonen
Fix series type() docs
r1345 /*!
Miikka Heikkinen
Fix some documentation issues...
r2520 Returns QAbstractSeries::SeriesTypeArea.
Jani Honkonen
Fix series type() docs
r1345 */
Michal Klocek
Fixes to API , QSeriesType -> SeriesType , add missing getters
r1107 QAbstractSeries::SeriesType QAreaSeries::type() const
Michal Klocek
Adds big fat pimpl to series classes...
r938 {
Tero Ahola
Renamed QSeries to QAbstractSeries
r988 return QAbstractSeries::SeriesTypeArea;
Michal Klocek
Adds big fat pimpl to series classes...
r938 }
Marek Rosa
Added documentation for BarModelMapper example
r1369 /*!
Sets the \a series that is to be used as the area chart upper series.
*/
Jani Honkonen
more coding style fixes for src-folder...
r2104 void QAreaSeries::setUpperSeries(QLineSeries *series)
Tero Ahola
Separated series model stuff from data api in QML examples
r1202 {
Q_D(QAreaSeries);
Miikka Heikkinen
Remove cryptic/obsolete TODOs
r2439 if (d->m_upperSeries != series)
Titta Heikkala
Qt Charts project file structure change...
r2712 d->m_upperSeries = series;
Tero Ahola
Separated series model stuff from data api in QML examples
r1202 }
Jani Honkonen
more coding style fixes for src-folder...
r2104 QLineSeries *QAreaSeries::upperSeries() const
Michal Klocek
Adds big fat pimpl to series classes...
r938 {
Q_D(const QAreaSeries);
return d->m_upperSeries;
}
Marek Rosa
Added documentation for BarModelMapper example
r1369 /*!
Sets the \a series that is to be used as the area chart lower series.
*/
Jani Honkonen
more coding style fixes for src-folder...
r2104 void QAreaSeries::setLowerSeries(QLineSeries *series)
Tero Ahola
Separated series model stuff from data api in QML examples
r1202 {
Q_D(QAreaSeries);
d->m_lowerSeries = series;
}
Jani Honkonen
more coding style fixes for src-folder...
r2104 QLineSeries *QAreaSeries::lowerSeries() const
Michal Klocek
Adds big fat pimpl to series classes...
r938 {
Q_D(const QAreaSeries);
return d->m_lowerSeries;
}
Michal Klocek
Adds area chart...
r421 /*!
Sets \a pen used for drawing area outline.
*/
Tero Ahola
Internal review: fixed minor issues in Area and XySeries
r761 void QAreaSeries::setPen(const QPen &pen)
Michal Klocek
Adds area chart...
r421 {
Michal Klocek
Adds big fat pimpl to series classes...
r938 Q_D(QAreaSeries);
if (d->m_pen != pen) {
d->m_pen = pen;
emit d->updated();
Michal Klocek
Refactors click signal to line,area,spline,scatter charts
r571 }
Michal Klocek
Adds area chart...
r421 }
Miikka Heikkinen
Return empty brush/pen/font via API rather than the weird default one...
r2519 QPen QAreaSeries::pen() const
Michal Klocek
Adds big fat pimpl to series classes...
r938 {
Q_D(const QAreaSeries);
Miikka Heikkinen
Return empty brush/pen/font via API rather than the weird default one...
r2519 if (d->m_pen == QChartPrivate::defaultPen())
return QPen();
else
return d->m_pen;
Michal Klocek
Adds big fat pimpl to series classes...
r938 }
Michal Klocek
Adds area chart...
r421 /*!
Sets \a brush used for filling the area.
*/
sauimone
minor code review issues. indent, spaces, brackets etc.
r743 void QAreaSeries::setBrush(const QBrush &brush)
Michal Klocek
Adds area chart...
r421 {
Michal Klocek
Adds big fat pimpl to series classes...
r938 Q_D(QAreaSeries);
if (d->m_brush != brush) {
Tero Ahola
Fixed a bug in setting scatter/area series brush color
r1933 bool emitColorChanged = brush.color() != d->m_brush.color();
Michal Klocek
Adds big fat pimpl to series classes...
r938 d->m_brush = brush;
emit d->updated();
Tero Ahola
Fixed a bug in setting scatter/area series brush color
r1933 if (emitColorChanged)
emit colorChanged(brush.color());
Michal Klocek
Refactors click signal to line,area,spline,scatter charts
r571 }
Michal Klocek
Adds area chart...
r421 }
Michal Klocek
Adds big fat pimpl to series classes...
r938
QBrush QAreaSeries::brush() const
{
Q_D(const QAreaSeries);
Miikka Heikkinen
Return empty brush/pen/font via API rather than the weird default one...
r2519 if (d->m_brush == QChartPrivate::defaultBrush())
return QBrush();
else
return d->m_brush;
Michal Klocek
Adds big fat pimpl to series classes...
r938 }
Tero Ahola
color and borderColor properties to XY charts; removed unnecessary signals
r1481
void QAreaSeries::setColor(const QColor &color)
{
QBrush b = brush();
Tero Ahola
Fixed a bug in setting scatter/area series brush color
r1933 if (b == QBrush())
b.setStyle(Qt::SolidPattern);
b.setColor(color);
setBrush(b);
Tero Ahola
color and borderColor properties to XY charts; removed unnecessary signals
r1481 }
QColor QAreaSeries::color() const
{
return brush().color();
}
void QAreaSeries::setBorderColor(const QColor &color)
{
QPen p = pen();
if (p.color() != color) {
p.setColor(color);
setPen(p);
emit borderColorChanged(color);
}
}
QColor QAreaSeries::borderColor() const
{
return pen().color();
}
Michal Klocek
Adds area chart...
r421 /*!
Sets if data points are \a visible and should be drawn on line.
*/
void QAreaSeries::setPointsVisible(bool visible)
{
Michal Klocek
Adds big fat pimpl to series classes...
r938 Q_D(QAreaSeries);
if (d->m_pointsVisible != visible) {
d->m_pointsVisible = visible;
emit d->updated();
Michal Klocek
Refactors click signal to line,area,spline,scatter charts
r571 }
Michal Klocek
Adds area chart...
r421 }
Tero Ahola
Documenting xy-series
r1491 /*!
Returns if the points are drawn for this series.
\sa setPointsVisible()
*/
Michal Klocek
Adds big fat pimpl to series classes...
r938 bool QAreaSeries::pointsVisible() const
{
Q_D(const QAreaSeries);
return d->m_pointsVisible;
}
Titta Heikkala
Added possibility to show series value...
r2689 void QAreaSeries::setPointLabelsFormat(const QString &format)
{
Q_D(QAreaSeries);
if (d->m_pointLabelsFormat != format) {
d->m_pointLabelsFormat = format;
emit pointLabelsFormatChanged(format);
}
}
QString QAreaSeries::pointLabelsFormat() const
{
Q_D(const QAreaSeries);
return d->m_pointLabelsFormat;
}
void QAreaSeries::setPointLabelsVisible(bool visible)
{
Q_D(QAreaSeries);
if (d->m_pointLabelsVisible != visible) {
d->m_pointLabelsVisible = visible;
emit pointLabelsVisibilityChanged(visible);
}
}
bool QAreaSeries::pointLabelsVisible() const
{
Q_D(const QAreaSeries);
return d->m_pointLabelsVisible;
}
void QAreaSeries::setPointLabelsFont(const QFont &font)
{
Q_D(QAreaSeries);
if (d->m_pointLabelsFont != font) {
d->m_pointLabelsFont = font;
emit pointLabelsFontChanged(font);
}
}
QFont QAreaSeries::pointLabelsFont() const
{
Q_D(const QAreaSeries);
return d->m_pointLabelsFont;
}
void QAreaSeries::setPointLabelsColor(const QColor &color)
{
Q_D(QAreaSeries);
if (d->m_pointLabelsColor != color) {
d->m_pointLabelsColor = color;
emit pointLabelsColorChanged(color);
}
}
QColor QAreaSeries::pointLabelsColor() const
{
Q_D(const QAreaSeries);
if (d->m_pointLabelsColor == QChartPrivate::defaultPen().color())
return QPen().color();
else
return d->m_pointLabelsColor;
}
Michal Klocek
Adds big fat pimpl to series classes...
r938 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Jani Honkonen
more coding style fixes for src-folder...
r2104 QAreaSeriesPrivate::QAreaSeriesPrivate(QLineSeries *upperSeries, QLineSeries *lowerSeries, QAreaSeries *q)
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 : QAbstractSeriesPrivate(q),
Miikka Heikkinen
Fix explicitly set default pen/brush/font getting overridden by theme...
r2516 m_brush(QChartPrivate::defaultBrush()),
m_pen(QChartPrivate::defaultPen()),
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 m_upperSeries(upperSeries),
m_lowerSeries(lowerSeries),
Titta Heikkala
Added possibility to show series value...
r2689 m_pointsVisible(false),
m_pointLabelsFormat(QLatin1String("@xPoint, @yPoint")),
m_pointLabelsVisible(false),
m_pointLabelsFont(QChartPrivate::defaultFont()),
m_pointLabelsColor(QChartPrivate::defaultPen().color())
Michal Klocek
Adds big fat pimpl to series classes...
r938 {
Tero Ahola
Updated documentation, warnings from legend and area left
r973 }
Michal Klocek
Adds big fat pimpl to series classes...
r938
Michal Klocek
Refactors internals...
r2273 void QAreaSeriesPrivate::initializeDomain()
Michal Klocek
Refactor to use qseries private for implmentation interface...
r943 {
Q_Q(QAreaSeries);
Michal Klocek
Refactors internals...
r2273 qreal minX(domain()->minX());
qreal minY(domain()->minY());
qreal maxX(domain()->maxX());
qreal maxY(domain()->maxY());
Michal Klocek
Refactor to use qseries private for implmentation interface...
r943
Jani Honkonen
more coding style fixes for src-folder...
r2104 QLineSeries *upperSeries = q->upperSeries();
QLineSeries *lowerSeries = q->lowerSeries();
Michal Klocek
Refactor to use qseries private for implmentation interface...
r943
Titta Heikkala
Fix empty QAreaSeries crash...
r2601 if (upperSeries) {
const QList<QPointF>& points = upperSeries->points();
for (int i = 0; i < points.count(); i++) {
qreal x = points[i].x();
qreal y = points[i].y();
minX = qMin(minX, x);
minY = qMin(minY, y);
maxX = qMax(maxX, x);
maxY = qMax(maxY, y);
}
Michal Klocek
Refactor to use qseries private for implmentation interface...
r943 }
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 if (lowerSeries) {
Michal Klocek
Fixes and improvments to series API...
r1057
Michal Klocek
Fix xy series model issues due to API changes
r1059 const QList<QPointF>& points = lowerSeries->points();
Michal Klocek
Fixes and improvments to series API...
r1057
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 for (int i = 0; i < points.count(); i++) {
Michal Klocek
Fixes and improvments to series API...
r1057 qreal x = points[i].x();
qreal y = points[i].y();
Michal Klocek
Refactor to use qseries private for implmentation interface...
r943 minX = qMin(minX, x);
minY = qMin(minY, y);
maxX = qMax(maxX, x);
maxY = qMax(maxY, y);
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 }
}
Michal Klocek
Refactor to use qseries private for implmentation interface...
r943
Michal Klocek
Refactors internals...
r2273 domain()->setRange(minX, maxX, minY, maxY);
Michal Klocek
Refactor to use qseries private for implmentation interface...
r943 }
Michal Klocek
Refactors internals...
r2273 void QAreaSeriesPrivate::initializeGraphics(QGraphicsItem* parent)
Michal Klocek
Refactor to use qseries private for implmentation interface...
r943 {
Q_Q(QAreaSeries);
Michal Klocek
Refactors internals...
r2273 AreaChartItem *area = new AreaChartItem(q,parent);
m_item.reset(area);
QAbstractSeriesPrivate::initializeGraphics(parent);
}
void QAreaSeriesPrivate::initializeAnimations(QChart::AnimationOptions options)
{
Q_Q(QAreaSeries);
AreaChartItem *area = static_cast<AreaChartItem *>(m_item.data());
Miikka Heikkinen
Fix resetting animation options mid-animation....
r2555
Titta Heikkala
Fix empty QAreaSeries crash...
r2601 if (q->upperSeries() && area->upperLineItem()->animation())
Miikka Heikkinen
Fix resetting animation options mid-animation....
r2555 area->upperLineItem()->animation()->stopAndDestroyLater();
if (q->lowerSeries() && area->lowerLineItem()->animation())
area->lowerLineItem()->animation()->stopAndDestroyLater();
Michal Klocek
Refactors internals...
r2273 if (options.testFlag(QChart::SeriesAnimations)) {
Michal Klocek
Refactors animation handling for xyseries
r1217 area->upperLineItem()->setAnimation(new XYAnimation(area->upperLineItem()));
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 if (q->lowerSeries())
Miikka Heikkinen
Fix resetting animation options mid-animation....
r2555 area->lowerLineItem()->setAnimation(new XYAnimation(area->lowerLineItem()));
} else {
Titta Heikkala
Fix empty QAreaSeries crash...
r2601 if (q->upperSeries())
area->upperLineItem()->setAnimation(0);
Michal Klocek
Refactors internals...
r2273 if (q->lowerSeries())
area->lowerLineItem()->setAnimation(0);
Michal Klocek
Refactor to use qseries private for implmentation interface...
r943 }
Michal Klocek
Refactors internals...
r2273 QAbstractSeriesPrivate::initializeAnimations(options);
Michal Klocek
Refactor to use qseries private for implmentation interface...
r943 }
sauimone
Added createLegendMarkers to private series. This will replace old createLegendMarker method. Notice the s in new method name. PIMPL for QLegendMarker. Newlegend example updated a bit
r2163 QList<QLegendMarker*> QAreaSeriesPrivate::createLegendMarkers(QLegend* legend)
{
sauimone
Areaseries uses new legendmarkers
r2177 Q_Q(QAreaSeries);
sauimone
Added createLegendMarkers to private series. This will replace old createLegendMarker method. Notice the s in new method name. PIMPL for QLegendMarker. Newlegend example updated a bit
r2163 QList<QLegendMarker*> list;
sauimone
Areaseries uses new legendmarkers
r2177 return list << new QAreaLegendMarker(q,legend);
sauimone
Added createLegendMarkers to private series. This will replace old createLegendMarker method. Notice the s in new method name. PIMPL for QLegendMarker. Newlegend example updated a bit
r2163 }
sauimone
added createAxis methods to private series
r1545
Michal Klocek
Refactors internals...
r2273
void QAreaSeriesPrivate::initializeAxes()
sauimone
added createAxis methods to private series
r1545 {
Michal Klocek
Refactors internals...
r2273
sauimone
added createAxis methods to private series
r1545 }
Michal Klocek
Adds axis domain intialization
r1695 QAbstractAxis::AxisType QAreaSeriesPrivate::defaultAxisType(Qt::Orientation orientation) const
Michal Klocek
Adds createDefaultAxes logic
r1588 {
Michal Klocek
Adds axis domain intialization
r1695 Q_UNUSED(orientation);
Marek Rosa
updated AxisType names
r1818 return QAbstractAxis::AxisTypeValue;
sauimone
added createAxis methods to private series
r1545 }
Michal Klocek
Refactors internals...
r2273 QAbstractAxis* QAreaSeriesPrivate::createDefaultAxis(Qt::Orientation orientation) const
{
Q_UNUSED(orientation);
Titta Heikkala
Fix default axes creation...
r2614 return new QValueAxis;
Michal Klocek
Refactors internals...
r2273 }
void QAreaSeriesPrivate::initializeTheme(int index, ChartTheme* theme, bool forced)
{
Q_Q(QAreaSeries);
const QList<QGradient> gradients = theme->seriesGradients();
const QList<QColor> colors = theme->seriesColors();
Miikka Heikkinen
Fix explicitly set default pen/brush/font getting overridden by theme...
r2516 if (forced || QChartPrivate::defaultPen() == m_pen) {
QPen pen;
Michal Klocek
Refactors internals...
r2273 pen.setColor(ChartThemeManager::colorAt(gradients.at(index % gradients.size()), 0.0));
pen.setWidthF(2);
q->setPen(pen);
}
Miikka Heikkinen
Fix explicitly set default pen/brush/font getting overridden by theme...
r2516 if (forced || QChartPrivate::defaultBrush() == m_brush) {
Michal Klocek
Refactors internals...
r2273 QBrush brush(colors.at(index % colors.size()));
q->setBrush(brush);
}
Titta Heikkala
Added possibility to show series value...
r2689
if (forced || QChartPrivate::defaultPen().color() == m_pointLabelsColor) {
QColor color = theme->labelBrush().color();
q->setPointLabelsColor(color);
}
Michal Klocek
Refactors internals...
r2273 }
Michal Klocek
Adds area chart...
r421 #include "moc_qareaseries.cpp"
Michal Klocek
Adds big fat pimpl to series classes...
r938 #include "moc_qareaseries_p.cpp"
Michal Klocek
Adds area chart...
r421
Titta Heikkala
Qt Charts project file structure change...
r2712 QT_CHARTS_END_NAMESPACE