在本页

HBoxPlotModelMapper QML Type

方框图系列的水平模型映射器。更多

Import Statement: import QtCharts 2.11
In C++: QHBoxPlotModelMapper

属性

详细说明

HBoxPlotModelMapper 类型可将源自QAbstractItemModel 类的数据模型用作图表的数据源。水平模型映射器用于在数据模型和BoxPlotSeries 类型之间创建连接,这样数据模型中的每一行都定义了一个框-须项,而每一列都映射到框-须项的范围和三个中值。

模型和序列属性都可用于操作数据。模型映射器使系列和数据模型保持同步。

模型映射器可确保盒状图系列中的所有盒须项大小相等。因此,添加或删除方框-须项中的值会导致方框图系列中的所有方框-须项发生相同的变化。

下面的 QML 代码片段创建了一个有三个箱沪项的箱图序列(假设模型至少有四行)。每个方框-须项包含从第 1 列开始的数据。项的名称由行标题定义。

BoxPlotSeries {
    HBoxPlotModelMapper {
        model: myCustomModel // QAbstractItemModel derived implementation
        firstBoxSetRow: 1
        lastBoxSetRow: 3
        firstColumn: 1
    }
}

另请参阅 VBoxPlotModelMapper

属性文档

columnCount : int

模型中被映射为方框图系列数据的列数。最小值和默认值均为-1(数量限制为模型中的列数)。

firstBoxSetRow : int

模型中的行被用作第一个框须项的数据源。默认值为-1(无效映射)。

firstColumn : int

模型中包含盒状图序列中盒须项首值的列。默认值为 0。

lastBoxSetRow : int

模型中的行被用作最后一个框须项的数据源。默认值为-1(无效映射)。

model : SomeModel

映射器使用的数据模型。您需要实现该模型,并将其公开给 QML。

注意: 模型必须支持添加和删除行或列,以及修改单元格中的数据。

series : AbstractBarSeries

映射器使用的盒状图系列。在映射器中设置该系列时,该系列中的所有数据都会被丢弃。指定新系列后,旧系列将被断开(但保留其数据)。

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