QBar3DSeries Class
QBar3DSeries 类在三维条形图中表示数据序列。更多
Header: | #include <QBar3DSeries> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS DataVisualization) target_link_libraries(mytarget PRIVATE Qt6::DataVisualization) |
qmake: | QT += datavisualization |
自 | QtDataVisualization 1.0 |
在 QML 中: | Bar3DSeries |
继承: | QAbstract3DSeries |
属性
- dataProxy : QBarDataProxy*
- meshAngle : float
(since 6.3)
rowColors : QList<QColor>- selectedBar : QPoint
公共功能
QBar3DSeries(QObject *parent = nullptr) | |
QBar3DSeries(QBarDataProxy *dataProxy, QObject *parent = nullptr) | |
virtual | ~QBar3DSeries() |
QBarDataProxy * | dataProxy() const |
float | meshAngle() const |
QList<QColor> | rowColors() const |
QPoint | selectedBar() const |
void | setDataProxy(QBarDataProxy *proxy) |
void | setMeshAngle(float angle) |
void | setRowColors(const QList<QColor> &colors) |
void | setSelectedBar(const QPoint &position) |
信号
void | dataProxyChanged(QBarDataProxy *proxy) |
void | meshAngleChanged(float angle) |
void | rowColorsChanged(const QList<QColor> &rowcolors) |
void | selectedBarChanged(const QPoint &position) |
静态公共成员
QPoint | invalidSelectionPosition() |
详细说明
该类管理系列的特定可视化元素以及系列数据(通过数据代理)。
如果没有为系列明确设置数据代理,则系列会创建一个默认代理。设置另一个代理将破坏现有代理和添加到其中的所有数据。
QBar3DSeries 支持以下用于QAbstract3DSeries::setItemLabelFormat() 的格式标记:
@rowTitle | 行轴的标题 |
@colTitle | 列轴标题 |
@valueTitle | 来自值轴的标题 |
@rowIdx | 可见行索引。使用图形本地化。 |
@colIdx | 可见列索引。使用图形本地化。 |
@rowLabel | 行轴标签 |
@colLabel | 列轴标签 |
@valueLabel | 使用附加到图表的值坐标轴格式的项目值。更多信息,请参阅QValue3DAxis::labelFormat 。 |
@seriesName | 系列名称 |
%< 格式说明 | 以指定格式显示的项目值。格式使用与QValue3DAxis::labelFormat 相同的规则。 |
例如
proxy->setItemLabelFormat(QStringLiteral("@valueTitle for (@rowLabel, @colLabel): %.1f"));
另请参阅 Qt Data Visualization 数据处理和QAbstract3DGraph::locale 。
属性文档
dataProxy : QBarDataProxy*
此属性保存活动数据代理。
该系列拥有任何设置给它的代理的所有权,并在添加新代理时删除任何以前设置的代理。代理不能为空或设置为其他系列。
访问功能:
QBarDataProxy * | dataProxy() const |
void | setDataProxy(QBarDataProxy *proxy) |
通知信号:
void | dataProxyChanged(QBarDataProxy *proxy) |
meshAngle : float
该属性表示系列旋转角度(度)。
设置该属性相当于下面的调用:
setMeshRotation(QQuaternion::fromAxisAndAngle(0.0f, 1.0f, 0.0f, angle))
注意: 读取该属性时,将使用浮点精度从QAbstract3DSeries::meshRotation 值计算,并始终返回 0 至 360 度的值。
访问功能:
float | meshAngle() const |
void | setMeshAngle(float angle) |
Notifier 信号:
void | meshAngleChanged(float angle) |
另请参见 QAbstract3DSeries::meshRotation 。
[since 6.3]
rowColors : QList<QColor>
该属性包含系列中的行颜色列表。
该属性可用于为系列中的行添加不同颜色。Q3DTheme::ColorStyle 必须设置为Q3DTheme::ColorStyleUniform 才能使用此属性。
此属性在 Qt 6.3 中引入。
访问功能:
QList<QColor> | rowColors() const |
void | setRowColors(const QList<QColor> &colors) |
Notifier 信号:
void | rowColorsChanged(const QList<QColor> &rowcolors) |
另请参阅 Q3DTheme::ColorStyleUniform 。
selectedBar : QPoint
该属性用于保存所选系列中的条形图。
访问功能:
QPoint | selectedBar() const |
void | setSelectedBar(const QPoint &position) |
Notifier 信号:
void | selectedBarChanged(const QPoint &position) |
成员函数 文档
[explicit]
QBar3DSeries::QBar3DSeries(QObject *parent = nullptr)
使用父parent 构建条形 3D 系列。
[explicit]
QBar3DSeries::QBar3DSeries(QBarDataProxy *dataProxy, QObject *parent = nullptr)
用数据代理dataProxy 和父数据parent 构建条形三维序列。
[virtual noexcept]
QBar3DSeries::~QBar3DSeries()
删除条形 3D 系列。
[static]
QPoint QBar3DSeries::invalidSelectionPosition()
返回选择的无效位置。将此位置设置为selectedBar 属性,可清除此系列中的选择。
另请参阅 QAbstract3DGraph::clearSelection().
void QBar3DSeries::setSelectedBar(const QPoint &position)
选择position 位置的条形图,该位置在系列数据数组中指定为行和列。
一次只能选择一个条形图。
要清除该系列的选择,invalidSelectionPosition() 设置为position 。
如果将此系列添加到图表中,图表会根据用户交互或选择无效的情况调整选择。选择另一个已添加系列上的条形图也会清除选择。
从选定条形图行之前的系列中移除行或插入行将调整选择,使同一条形图保持被选中。
注: 属性selectedBar 的设置函数。
另请参阅 selectedBar() 和QAbstract3DGraph::clearSelection()。
© 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.