QAreaSeries Class

QAreaSeries 类以区域图的形式显示数据。更多

Header: #include <QAreaSeries>
In QML: AreaSeries
Inherits: QAbstractSeries

属性

公共函数

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)

Notifier 信号:

void borderColorChanged(QColor color)

另请参阅 QAreaSeries::pen().

color : QColor

该属性用于保存系列的填充(画笔)颜色。这是一个方便的属性,用于修改笔刷的颜色。

访问功能:

QColor color() const
void setColor(const QColor &color)

Notifier 信号:

void colorChanged(QColor color)

另请参见 QAreaSeries::brush().

[read-only] lowerSeries : QLineSeries* const

该属性保存用于定义区域系列边界的两条线系列中较低的一条。

注: 如果QAreaSeries 在构建时没有 lowerSeries,则该属性为空。

访问功能:

QLineSeries *lowerSeries() const

pointLabelsClipping : bool

该属性用于控制数据点标签的剪切。默认为 True。启用剪切后,绘图区域边缘的标签将被剪切。

访问功能:

bool pointLabelsClipping() const
void setPointLabelsClipping(bool enabled = true)

Notifier 信号:

void pointLabelsClippingChanged(bool clipping)

另请参见 pointLabelsVisible

pointLabelsColor : QColor

该属性用于保存数据点标签的颜色。默认情况下,颜色是主题中为标签定义的笔刷颜色。

访问功能:

QColor pointLabelsColor() const
void setPointLabelsColor(const QColor &color)

Notifier 信号:

void pointLabelsColorChanged(const QColor &color)

另请参见 QAreaSeries::pointLabelsFormat

pointLabelsFont : QFont

该属性用于保存数据点标签的字体。

访问功能:

QFont pointLabelsFont() const
void setPointLabelsFont(const QFont &font)

Notifier 信号:

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

该属性用于设置数据点标签的可见性。默认为假。

访问功能:

bool pointLabelsVisible() const
void setPointLabelsVisible(bool visible = true)

Notifier 信号:

void pointLabelsVisibilityChanged(bool visible)

另请参见 QAreaSeries::pointLabelsFormatQAreaSeries::pointLabelsClipping

[read-only] upperSeries : QLineSeries* const

该属性保存用于定义区域系列边界的两条线系列中的上一条。

访问函数:

QLineSeries *upperSeries() const

成员函数文档

[explicit] QAreaSeries::QAreaSeries(QObject *parent = nullptr)

使用parent 对象构建一个不带上序列或下序列的面积序列对象。

[explicit] QAreaSeries::QAreaSeries(QLineSeries *upperSeries, QLineSeries *lowerSeries = nullptr)

构造一个面积序列对象,其跨度介于upperSeries 线和lowerSeries 线之间。如果没有向构造函数传递lowerSeries ,则使用 x 轴作为下限。

QAreaSeries 不拥有上层或下层序列,其所有权属于调用者。当系列对象被添加到QChartViewQChart 时,实例所有权将被转移。

[virtual noexcept] QAreaSeries::~QAreaSeries()

销毁对象。

[signal] void QAreaSeries::borderColorChanged(QColor color)

当线条(笔)颜色变为color 时,将发出该信号。

注: 属性borderColor 的通知信号。

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 显示悬停事件的原点(坐标)。当光标悬停在系列上时,true ;当光标从系列上移开时,state 变为false

QPen QAreaSeries::pen() const

返回为该系列绘制线条所用的笔。

另请参阅 setPen()。

[signal] void QAreaSeries::pointLabelsClippingChanged(bool clipping)

当数据点标签的剪切更改为clipping 时,将发出该信号。

注: 属性pointLabelsClipping 的通知信号。

[signal] void QAreaSeries::pointLabelsColorChanged(const QColor &color)

当数据点标签使用的颜色更改为color 时,将发出该信号。

注: 属性pointLabelsColor 的通知信号。

[signal] void QAreaSeries::pointLabelsFontChanged(const QFont &font)

当数据点标签使用的字体更改为font 时,将发出该信号。

注: 属性pointLabelsFont 的通知信号。

[signal] void QAreaSeries::pointLabelsFormatChanged(const QString &format)

format 数据点标签发生变化时会发出该信号。

注: 属性pointLabelsFormat 的通知信号。

[signal] void QAreaSeries::pointLabelsVisibilityChanged(bool visible)

当数据点标签的可见性更改为visible 时,将发出该信号。

注: 属性pointLabelsVisible 的通知信号。

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

返回QAbstractSeries::SeriesTypeArea

© 2025 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.