Qt Graphs

The Qt Graphs module enables you to visualize data in 2D and 3D graphs.

In the 3D realm there is support for bar, scatter, and surface graphs. It's especially useful for visualizing depth maps and large quantities of rapidly changing data, such as data received from multiple sensors. The look and feel of graphs can be customized by using themes or by adding custom items and labels.

In the 2D realm, there is support for area, bar, donut, line, pie, scatter, and spline graphs, and they are easily combinable with any other QML content.

Qt Graphs 構建於 Qt 6 並基於 Qt Quick 3D 的 3D 圖形,以利用硬件加速和 Qt Quick。

使用模塊

QtGraphs QML API

模塊的 QML 類型是可用的透過 QtGraphs 導入。要使用類型,添加以下 import 語句到 .qml 文件:

import QtGraphs
					

C++ API

使用 Qt 模塊的 C++ API 要求直接 (或透過其它依賴) 鏈接到模塊庫。幾個構建工具對此有專用支持,包括 CMake and qmake .

構建采用 CMake

使用 find_package() 命令定位所需模塊組件在 Qt6 包:

find_package(Qt6 REQUIRED COMPONENTS Graphs)
target_link_libraries(mytarget PRIVATE Qt6::Graphs)
					

更多細節,見 構建采用 CMake 概述。

采用 qmake 構建

要配置采用 qmake 構建模塊,添加模塊作為值為 QT 變量在工程的 .pro 文件:

QT += graphs
					

構建 Widget 應用程序

文章和指南

限製特徵

若應用程序的目標是具有有限規格的一些嵌入式硬件,在模塊中構建僅 2D (或 3D) 支持是可能的。

更多信息,見 配置 Qt Graphs .

Qt Graphs for 2D

Qt Graphs for 3D

Qt Graphs Common

範例

API 參考

許可和歸屬

Qt 在商業許可下是可用的來自 Qt 公司 。此外,它是可用的根據 GNU GPL (一般公共許可) 第 3 版 。見 Qt 許可 進一步瞭解細節。