QAreaSeries Class
QAreaSeries 类用于以面积图形式展示数据。更多内容...
| Header: | #include <QAreaSeries> |
| In QML: | AreaSeries |
| Inherits: | QAbstractSeries |
| Status: | Deprecated |
该类已弃用。我们强烈建议不要在新的代码中使用它。
属性
|
|
公共函数
| QAreaSeries(QObject *parent = nullptr) | |
| QAreaSeries(QLineSeries *upperSeries, QLineSeries *lowerSeries = nullptr) | |
| virtual | ~QAreaSeries() |
| QColor | borderColor() const |
| QBrush | brush() const |
| QColor | color() const |
| QLineSeries * | lowerSeries() const |
| QPen | pen() const |
| bool | pointLabelsClipping() const |
| QColor | pointLabelsColor() const |
| QFont | pointLabelsFont() const |
| QString | pointLabelsFormat() const |
| bool | pointLabelsVisible() const |
| bool | pointsVisible() const |
| void | setBorderColor(const QColor &color) |
| void | setBrush(const QBrush &brush) |
| void | setColor(const QColor &color) |
| void | setLowerSeries(QLineSeries *series) |
| void | setPen(const QPen &pen) |
| void | setPointLabelsClipping(bool enabled = true) |
| void | setPointLabelsColor(const QColor &color) |
| void | setPointLabelsFont(const QFont &font) |
| void | setPointLabelsFormat(const QString &format) |
| void | setPointLabelsVisible(bool visible = true) |
| void | setPointsVisible(bool visible = true) |
| void | setUpperSeries(QLineSeries *series) |
| QLineSeries * | upperSeries() const |
重新实现的公共函数
| virtual QAbstractSeries::SeriesType | type() const override |
信号
| void | borderColorChanged(QColor color) |
| void | clicked(const QPointF &point) |
| void | colorChanged(QColor color) |
| void | doubleClicked(const QPointF &point) |
| void | hovered(const QPointF &point, bool state) |
| void | pointLabelsClippingChanged(bool clipping) |
| void | pointLabelsColorChanged(const QColor &color) |
| void | pointLabelsFontChanged(const QFont &font) |
| void | pointLabelsFormatChanged(const QString &format) |
| void | pointLabelsVisibilityChanged(bool visible) |
| void | pressed(const QPointF &point) |
| void | released(const QPointF &point) |
详细说明
面积序列用于展示定量数据。它基于线序列,通过颜色突出显示边界线之间的区域。由于面积序列基于线序列,因此 QAreaSeries 构造函数需要一个QLineSeries 实例,该实例定义了该区域的上边界。 默认情况下,面积图以绘图区域的底部作为下边界进行绘制。下边界也可以由另一条线来指定,而不是使用绘图区域的底部。在这种情况下,应使用两个QLineSeries 实例来初始化QAreaSeries。
注意: 当下界值大于上界值时,“上界”和“下界”这两个 术语可能会造成误解。关键在于这两条边界线之间的区域会被填充。
请参阅“带小部件的图表”示例库,了解如何创建一个简单的面积图。

属性文档
borderColor : QColor
该属性存储序列的线条(笔)颜色。这是一个用于修改笔色的便捷属性。
访问函数:
| QColor | borderColor() const |
| void | setBorderColor(const QColor &color) |
通知信号:
| void | borderColorChanged(QColor color) |
另请参阅 QAreaSeries::pen()。
color : QColor
该属性保存系列填充(笔刷)的颜色。这是一个用于修改笔刷颜色的便捷属性。
访问函数:
| QColor | color() const |
| void | setColor(const QColor &color) |
通知信号:
| void | colorChanged(QColor color) |
另请参阅 QAreaSeries::brush()。
[read-only] lowerSeries : QLineSeries*
该属性存储用于定义面积序列边界的两个线序列中的较低那个。
注意:如果 QAreaSeries 在构建时未指定lowerSeries,则该属性为null。
访问函数:
| QLineSeries * | lowerSeries() const |
pointLabelsClipping : bool
该属性控制数据点标签的裁剪。默认值为 True。启用裁剪后,位于绘图区域边缘的标签将被裁剪。
访问函数:
| bool | pointLabelsClipping() const |
| void | setPointLabelsClipping(bool enabled = true) |
通知信号:
| void | pointLabelsClippingChanged(bool clipping) |
另请参阅 pointLabelsVisible 。
pointLabelsColor : QColor
此属性用于指定数据点标签的颜色。默认情况下,该颜色即为主题中为标签定义的画笔颜色。
访问函数:
| QColor | pointLabelsColor() const |
| void | setPointLabelsColor(const QColor &color) |
通知信号:
| void | pointLabelsColorChanged(const QColor &color) |
另请参阅 QAreaSeries::pointLabelsFormat 。
pointLabelsFont : QFont
此属性用于指定数据点标签所使用的字体。
访问函数:
| QFont | pointLabelsFont() const |
| void | setPointLabelsFont(const QFont &font) |
通知信号:
| void | pointLabelsFontChanged(const QFont &font) |
另请参阅 QAreaSeries::pointLabelsFormat 。
pointLabelsFormat : QString
此属性用于指定显示系列数据点标签时所采用的格式。
QAreaSeries 支持以下格式标签:
| @xPoint | 数据点的 x 值 |
| @yPoint | 数据点的 y 值 |
例如,以下格式标签的使用方式将生成标签,其中数据点 (x, y) 显示在括号内,并以逗号分隔:
series->setPointLabelsFormat("(@xPoint, @yPoint)");默认情况下,标签格式设置为@xPoint, @yPoint 。标签显示在绘图区域内,而位于绘图区域边缘的标签会被截断。如果数据点彼此靠近,标签可能会重叠。
访问函数:
| QString | pointLabelsFormat() const |
| void | setPointLabelsFormat(const QString &format) |
通知信号:
| void | pointLabelsFormatChanged(const QString &format) |
另请参阅 QAreaSeries::pointLabelsVisible 、QAreaSeries::pointLabelsFont 和QAreaSeries::pointLabelsColor 。
pointLabelsVisible : bool
该属性控制数据点标签的可见性。默认值为 False。
访问函数:
| bool | pointLabelsVisible() const |
| void | setPointLabelsVisible(bool visible = true) |
通知器信号:
| void | pointLabelsVisibilityChanged(bool visible) |
另请参阅 QAreaSeries::pointLabelsFormat 和QAreaSeries::pointLabelsClipping 。
[read-only] upperSeries : QLineSeries*
该属性存储用于定义面积序列边界的两个线序列中的上边界。
访问函数:
| QLineSeries * | upperSeries() const |
成员函数文档
[explicit] QAreaSeries::QAreaSeries(QObject *parent = nullptr)
使用parent 对象构建一个既没有上界系列也没有下界系列的面积序列对象。
[explicit] QAreaSeries::QAreaSeries(QLineSeries *upperSeries, QLineSeries *lowerSeries = nullptr)
构建一个面积系列对象,其范围介于upperSeries 和lowerSeries 两条线之间。如果未向构造函数传递lowerSeries ,则使用x轴作为下界。
QAreaSeries 不拥有上行或下行系列,所有权仍归调用方所有。当系列对象被添加到 QChartView 或 QChart 时,实例的所有权将被转移。
[virtual noexcept] QAreaSeries::~QAreaSeries()
销毁该对象。
[signal] void QAreaSeries::borderColorChanged(QColor color)
当线条(笔)颜色变为color 时,会发出此信号。
注意: 这是属性borderColor 的Notifier 信号。
QBrush QAreaSeries::brush() const
返回用于绘制该序列中线条的画笔。
另请参阅 setBrush()。
[signal] void QAreaSeries::clicked(const QPointF &point)
当用户在面积图中单击point 以触发按压操作时,会发出此信号。
另请参阅 pressed 、released 以及doubleClicked 。
[signal] void QAreaSeries::colorChanged(QColor color)
当填充(画笔)颜色变为color 时,会发出此信号。
注意: 这是属性color 的通知器 信号。
[signal] void QAreaSeries::doubleClicked(const QPointF &point)
当用户双击point ,在面积图中触发首次点击时,会发出此信号。
另请参阅 pressed 、released 以及clicked 。
[signal] void QAreaSeries::hovered(const QPointF &point, bool state)
当用户将鼠标光标悬停在数据系列上或将其移开时,会触发此信号。point 显示悬停事件的源点(坐标)。state 在光标悬停在数据系列上时为true ,当光标移开数据系列时则变为false。
QPen QAreaSeries::pen() const
返回用于绘制该数组中各条线的画笔。
另请参阅 setPen()。
[signal] void QAreaSeries::pointLabelsClippingChanged(bool clipping)
当数据点标签的裁剪状态变为clipping 时,将触发此信号。
注意: 这是属性pointLabelsClipping的通知器 信号。
[signal] void QAreaSeries::pointLabelsColorChanged(const QColor &color)
当数据点标签所用的颜色变为color 时,会发出此信号。
注意: 这是属性pointLabelsColor 的Notifier 信号。
[signal] void QAreaSeries::pointLabelsFontChanged(const QFont &font)
当数据点标签所用的字体更改为font 时,会发出此信号。
注意: 这是属性pointLabelsFont的通知 信号。
[signal] void QAreaSeries::pointLabelsFormatChanged(const QString &format)
当数据点标签的format 属性发生变化时,会触发此信号。
注意: 这是属性pointLabelsFormat 的Notifier 信号。
[signal] void QAreaSeries::pointLabelsVisibilityChanged(bool visible)
当数据点标签的可见性变为visible 时,将触发此信号。
注意: 这是属性pointLabelsVisible 的Notifier 信号。
bool QAreaSeries::pointsVisible() const
返回该系列是否绘制了点。
另请参阅 setPointsVisible()。
[signal] void QAreaSeries::pressed(const QPointF &point)
当用户在面积图中点击point 指定的点时,会触发此信号。
另请参阅 clicked 、released 和doubleClicked 。
[signal] void QAreaSeries::released(const QPointF &point)
当用户释放在point 上区域图中触发的点击时,会发出此信号。
另请参阅 pressed 、clicked 以及doubleClicked 。
void QAreaSeries::setBrush(const QBrush &brush)
设置用于填充该区域的brush 。
另请参阅 brush()。
void QAreaSeries::setLowerSeries(QLineSeries *series)
设置将用作面积图下方的序列的series 。
另请参阅 lowerSeries()。
void QAreaSeries::setPen(const QPen &pen)
设置用于绘制区域轮廓的pen 。
另请参阅 pen()。
void QAreaSeries::setPointsVisible(bool visible = true)
确定数据点是否为visible ,以及是否应绘制在折线上。
另请参阅 pointsVisible()。
void QAreaSeries::setUpperSeries(QLineSeries *series)
设置将用作面积图上层系列的series 。如果上层系列为空,则即使存在下层系列,面积图也不会绘制。
另请参阅 upperSeries()。
[override virtual] QAbstractSeries::SeriesType QAreaSeries::type() const
重新实现了属性QAbstractSeries::type 的访问函数。
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.