CandlestickSeries QML Type
用蜡烛图表示一系列数据。更多
| Import Statement: | import QtCharts 2.11 |
| Since: | QtCharts 2.2 |
| In C++: | QCandlestickSeries |
| Inherits: |
属性
- axisX : AbstractAxis
- axisXTop : AbstractAxis
- axisY : AbstractAxis
- axisYRight : AbstractAxis
- bodyOutlineVisible : bool
- bodyWidth : real
- brushFilename : string
- capsVisible : bool
- capsWidth : real
- count : int
- decreasingColor : color
- increasingColor : color
- maximumColumnWidth : real
- minimumColumnWidth : real
信号
- candlestickSetsAdded(list<CandlestickSet> sets)
- candlestickSetsRemoved(list<CandlestickSet> sets)
- clicked(CandlestickSet set)
- doubleClicked(CandlestickSet set)
- hovered(bool status, CandlestickSet set)
- pressed(CandlestickSet set)
- released(CandlestickSet set)
方法
- bool append(CandlestickSet set)
- CandlestickSet at(int index)
- void clear()
- bool insert(int index, CandlestickSet set)
- bool remove(CandlestickSet set)
详细说明
CandlestickSeries 类型是单个蜡烛图项目的容器。使用BarCategoryAxis 时,每个项目都绘制在自己的类别中。DateTimeAxis 和ValueAxis 可替代BarCategoryAxis 。在这种情况下,每个烛台项目都根据其时间戳值绘制。
注意: 烛台系列中的时间戳必须是唯一的。使用BarCategoryAxis 时,只绘制共享时间戳的第一个烛台项。如果图表包含多个 CandlestickSeries 实例,则会将共享时间戳的不同系列的项目绘制到同一类别中。当使用ValueAxis 或DateTimeAxis 时,共享时间戳的烛台项目会相互重叠。
下面的 QML 演示了如何创建一个简单的蜡烛图:
import QtQuick 2.5 import QtCharts 2.2 ChartView { title: "Candlestick Series" width: 400 height: 300 CandlestickSeries { name: "Acme Ltd." increasingColor: "green" decreasingColor: "red" CandlestickSet { timestamp: 1435708800000; open: 690; high: 694; low: 599; close: 660 } CandlestickSet { timestamp: 1435795200000; open: 669; high: 669; low: 669; close: 669 } CandlestickSet { timestamp: 1436140800000; open: 485; high: 623; low: 485; close: 600 } CandlestickSet { timestamp: 1436227200000; open: 589; high: 615; low: 377; close: 569 } CandlestickSet { timestamp: 1436313600000; open: 464; high: 464; low: 254; close: 254 } } }

另请参阅 CandlestickSet,BarCategoryAxis,DateTimeAxis, 和ValueAxis 。
属性文档
axisX : AbstractAxis
用于系列的 X 轴。如果不定义 axisX 和axisXTop ,则会为序列创建一个值轴。
axisXTop : AbstractAxis
用于系列的 x 轴,绘制在图表视图的顶部。
注意: 只能提供axisX 或 axisXTop,不能同时提供。
另请参阅 axisX 。
axisY : AbstractAxis
用于序列的 Y 轴。如果不定义 axisY 和axisYRight ,则会为序列创建一个值轴。
另请参阅 axisYRight 和ValueAxis 。
axisYRight : AbstractAxis
用于系列的 Y 轴,在图表视图中画在右边。
注意: 只能提供axisY 或 axisYRight,不能同时提供。
另请参阅 axisY 。
bodyOutlineVisible : bool
烛台主体轮廓的可见度。
bodyWidth : real
烛台项目在其槽内的相对宽度,范围为 0.0 至 1.0。超出此范围的值将被箝位为 0.0 或 1.0。
brushFilename : string
用作系列画笔图像的文件名。
capsVisible : bool
帽子的能见度。
capsWidth : real
蜡烛图中盖帽的相对宽度,范围从 0.0 到 1.0。超出此范围的值将被箝位为 0.0 或 1.0。
count : int [read-only]
系列中烛台项目的数量。
decreasingColor : color
递减蜡烛图项目主体的颜色。当烛台的开盘值高于收盘值时,烛台就是递减的。默认情况下,该属性设置为画笔颜色,alpha 通道设置为 128。当属性设置为无效颜色值时,也会使用默认颜色。
increasingColor : color
递增蜡烛图项目主体的颜色。当烛台的收盘值高于开盘值时,该烛台就是递增的。默认情况下,该属性设置为笔刷颜色。当属性设置为无效颜色值时,也会使用默认颜色。
maximumColumnWidth : real
烛台项目的最大宽度(像素)。设置负值表示没有最大宽度。所有负值都会转换为-1.0。
minimumColumnWidth : real
烛台项目的最小宽度(像素)。设置负值表示没有最小宽度。所有负值都会转换为-1.0。
信号文档
candlestickSetsAdded(list<CandlestickSet> sets)
当sets 指定的烛台项目添加到系列时,将发出该信号。
相应的信号处理程序是onCandlestickSetsAdded 。
注: 相应的处理程序是onCandlestickSetsAdded 。
candlestickSetsRemoved(list<CandlestickSet> sets)
当sets 指定的烛台项目从系列中移除时,将发出该信号。
相应的信号处理程序是onCandlestickSetsRemoved 。
注: 相应的处理程序是onCandlestickSetsRemoved 。
clicked(CandlestickSet set)
在图表上点击set 指定的烛台项目时会发出该信号。
相应的信号处理程序是onClicked 。
注: 相应的处理程序是onClicked 。
doubleClicked(CandlestickSet set)
在图表上双击set 指定的烛台项目时,会发出该信号。
相应的信号处理程序是onDoubleClicked 。
注: 相应的处理程序是onDoubleClicked 。
hovered(bool status, CandlestickSet set)
当鼠标悬停在图表中set 指定的蜡烛图项目上时,就会发出该信号。
当鼠标移到该项目上时,status 会变成true ,当鼠标再次移开时,会变成false 。
相应的信号处理程序是onHovered 。
注: 相应的处理程序是onHovered 。
pressed(CandlestickSet set)
当用户点击set 指定的烛台项目并按住鼠标键时,将发出该信号。
相应的信号处理程序是onPressed 。
注: 相应的处理程序是onPressed 。
released(CandlestickSet set)
当用户在set 指定的蜡烛图项目上松开鼠标时,会发出该信号。
相应的信号处理程序是onReleased 。
注: 相应的处理程序是onReleased 。
方法文档
bool append(CandlestickSet set)
将set 指定的单个蜡烛图项目添加到系列中,并获得其所有权。如果项目为空或已在系列中,则不会添加。
如果追加成功,则返回true ,否则返回false 。
CandlestickSet at(int index)
返回index 指定位置上的蜡烛图项目。如果指数无效,则返回空值。
void clear()
删除系列中的所有烛台项目,并将其永久删除。
bool insert(int index, CandlestickSet set)
将set 指定的烛台项目插入index 指定位置的系列中。获取项目的所有权。如果项目为空或已属于系列,则不会插入。
如果插入成功,则返回true ,否则返回false 。
bool remove(CandlestickSet set)
从系列中删除set 指定的单个蜡烛图项目。
如果项目删除成功,则返回true ,否则返回false 。
© 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.