带 Widgets 图库的图表

演示Qt Charts Widgets API 的应用程序。

该示例通过使用附带的示例数据为用户填充多种图表类型和交互,演示了Qt Charts API 的部件功能。

Changing the Color and State of Bars

演示如何使用条形图的选择功能。

Combining Line and BarChart

演示如何组合不同的图表并设置坐标轴。

Creating Area Charts

展示如何创建一个简单的区域图。

Creating Bar Charts

条形图(BarChart)在类别中以单独的条形显示数据集。

Creating Box-and-Whiskers Charts

显示如何创建盒状和须状图表。

Creating Candlestick Charts

显示如何创建蜡烛图

Creating Charts With Themes

展示不同内置主题的外观和感觉。

Creating Horizontal Bar Charts

演示如何创建水平条形图。

Creating Horizontal Percent Bar Charts

展示如何创建简单的水平百分比柱形图。

Creating Horizontal Stacked Bar Charts

演示如何创建简单的堆叠水平柱形图。

Creating Line Charts

演示如何创建简单的折线图。

Creating Nested Donut Charts

演示如何使用 QPieSeries API 创建嵌套甜甜圈图表。

Creating Percent Bar Charts

演示如何创建简单的百分比柱形图

Creating Polar Charts

演示如何创建具有多个不同序列的简单极坐标图

Creating Scatter Charts

该示例显示了如何创建简单的散点图。

Creating Stacked Bar Charts

演示如何创建简单的堆叠条形图。

Creating a Donut Breakdown Chart

演示如何创建甜甜圈分解图。

Customizing Charts

演示如何自定义图表元素的外观。

Detaching and Attaching Legends

演示如何从图表中分离图例并将其连接回来。

Displaying Temperature Records with Negative Bars

演示如何创建带负柱形的柱形图。

Drawing a Callout on Top of a Chart

演示如何在图表顶部绘制附加元素(呼出)。

Implementing Drilldown

演示如何使用堆叠柱状图实现向下钻取。

Line Charts with Date and Time Axes

演示如何将 QLineChart 与 QDateTimeAxis 结合使用。

Selected Point Configuration

演示如何修改单个点的配置。

Using Data Models with Bar Charts

演示如何使用 QAbstractItemModel 派生模型作为条形图系列的数据。

Using Legend Markers

演示如何使用图例标记。

Using Light Markers and Points Selection

演示如何为系列使用光标记和点选择。

Using Logarithmic Value Axes

演示如何使用 QLogValueAxis。

Using Model Data

演示如何使用 QAbstractItemModel 派生模型作为系列数据。

Using Multiple Axes

演示如何为每个系列创建一个带有垂直轴的图表。

运行示例

要从 Qt Creator,打开Welcome 模式,然后从Examples 中选择示例。有关详细信息,请参阅Qt Creator: 教程:构建并运行

如果你想用 QML 实现图表,请参阅Charts with QML Gallery

示例项目 @ code.qt.io

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