AreaSeries QML Type
以面积图形式呈现数据。更多...
| Import Statement: | import QtCharts 2.12 |
| In C++: | QAreaSeries |
| Inherits: | |
| Status: | Deprecated |
此类型已弃用。我们强烈建议不要在新代码中使用它。
属性
- axisAngular : AbstractAxis
- axisRadial : AbstractAxis
- axisX : AbstractAxis
- axisXTop : AbstractAxis
- axisY : AbstractAxis
- axisYRight : AbstractAxis
- borderColor : color
- borderWidth : real
- brush : brush
- brushFilename : string
- color : color
- lowerSeries : LineSeries
- pointLabelsClipping : bool
- pointLabelsColor : font
- pointLabelsFont : font
- pointLabelsFormat : string
- pointLabelsVisible : bool
- upperSeries : LineSeries
信号
- clicked(point point)
- doubleClicked(point point)
- hovered(point point, bool state)
- pressed(point point)
- released(point point)
详细说明
面积系列用于展示定量数据。它基于折线系列,通过颜色突出显示边界线之间的区域。LineSeries 类型定义了该区域的上边界。 面积图默认以绘图区域的底部作为下边界进行绘制。下边界也可以由另一条线来指定,而非绘图区域的底部。在这种情况下,AreaSeries 应使用两个LineSeries 类型。
注意: 当下边界值大于上边界值时,“上边界”和“下边界”这两个术语 可能会造成误解。关键在于这两条边界线之间的区域将被填充。

以下 QML 代码演示了如何创建一个简单的面积图:
ChartView {
title: "NHL All-Star Team Players"
anchors.fill: parent
antialiasing: true
// Define x-axis to be used with the series instead of default one
ValueAxis {
id: valueAxis
min: 2000
max: 2011
tickCount: 12
labelFormat: "%.0f"
}
AreaSeries {
name: "Russian"
axisX: valueAxis
upperSeries: LineSeries {
XYPoint { x: 2000; y: 1 }
XYPoint { x: 2001; y: 1 }
XYPoint { x: 2002; y: 1 }
XYPoint { x: 2003; y: 1 }
XYPoint { x: 2004; y: 1 }
XYPoint { x: 2005; y: 0 }
XYPoint { x: 2006; y: 1 }
XYPoint { x: 2007; y: 1 }
XYPoint { x: 2008; y: 4 }
XYPoint { x: 2009; y: 3 }
XYPoint { x: 2010; y: 2 }
XYPoint { x: 2011; y: 1 }
}
}注意: 不支持将 同一条线系列同时添加到 图表和面积系列中。用作边界线的系列应仅在面积系列中定义。
属性文档
axisAngular : AbstractAxis
该系列所使用的角度轴,围绕极坐标图视图绘制。
另请参阅 axisX 和PolarChartView 。
axisRadial : AbstractAxis
该系列所使用的径向轴,绘制在极坐标图视图内部。
另请参阅 axisY 和PolarChartView 。
axisX : AbstractAxis
该系列使用的x轴。如果同时未定义axisX和axisXTop ,则会为该系列创建一个数值轴。
axisXTop : AbstractAxis
绘制在图表视图顶部的、用于该数据系列的x轴。
注意:您 只能指定axisX 或 axisXTop 其中之一,不能同时指定两者。
另请参阅 axisX 。
axisY : AbstractAxis
该数据系列使用的 y 轴。如果既未定义 axisY 也未定义axisYRight ,则会为该数据系列创建一个数值轴。
另请参阅 axisYRight 和ValueAxis 。
axisYRight : AbstractAxis
该数据系列所使用的 y 轴,在图表视图中向右绘制。
注意:您 只能指定axisY 或axisYRight其中一个,不能同时指定两者。
另请参阅 axisY 。
borderColor : color
该系列的线条(笔)颜色。
borderWidth : real
边框线的宽度。默认宽度为 2.0。
brush : brush
本系列中用于绘制线条的画笔。
brushFilename : string
该系列中用作画笔图像的文件名。
color : color
该系列的填充(笔刷)颜色。
lowerSeries : LineSeries [read-only]
用于定义面积序列边界的两个线序列中的较低那个。
注意:如果 AreaSeries 在构建时未指定lowerSeries,则该值默认为null。
pointLabelsClipping : bool
定义数据点标签的裁剪行为。默认值为 True。启用裁剪后,绘图区域边缘的标签将被裁剪。
另请参阅 pointLabelsVisible 。
pointLabelsColor : font
定义数据点标签所用的颜色。默认情况下,该颜色即主题中为标签定义的画笔颜色。
另请参阅 pointLabelsFormat 。
pointLabelsFont : font
定义数据点标签所使用的字体。
另请参阅 pointLabelsFormat 。
pointLabelsFormat : string
用于显示带系列点的标签的格式。
另请参阅 QAreaSeries::pointLabelsFormat 、pointLabelsVisible 、pointLabelsFont 以及pointLabelsColor 。
pointLabelsVisible : bool
定义数据点标签的可见性。
另请参阅 pointLabelsFormat 和pointLabelsClipping 。
upperSeries : LineSeries [read-only]
用于定义面积序列边界的两条线序列中较上的一条。
信号文档
clicked(point point)
当用户在面积图中单击point 以触发按压操作时,会发出此信号。
相应的信号处理程序是onClicked 。
注意: 相应的处理程序 是onClicked 。
另请参阅 pressed 、released 和doubleClicked 。
doubleClicked(point point)
当用户双击point ,在面积图中触发首次点击时,会发出此信号。
相应的信号处理程序是onDoubleClicked 。
注意: 相应的处理程序 是onDoubleClicked 。
另请参阅 pressed 、released 和clicked 。
hovered(point point, bool state)
当用户将鼠标光标悬停在一系列数据上或将光标移离该系列时,会触发此信号。point 表示悬停事件的源点(坐标)。state 在光标悬停在一系列数据上时为true ,当光标移离该系列时则变为false。
相应的信号处理程序是onHovered 。
注意: 相应的处理程序 是onHovered 。
pressed(point point)
当用户在面积图中点击由point 指定的点时,会触发此信号。
相应的信号处理程序为onPressed 。
注意: 相应的处理程序 是onPressed 。
另请参阅 clicked 、released 和doubleClicked 。
released(point point)
当用户释放区域图中在point 上触发的点击操作时,会发出此信号。
相应的信号处理程序为onReleased 。
注意: 对应的处理程序 是onReleased 。
另请参阅 pressed 、clicked 和doubleClicked 。
© 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.